GMAmode class

Generalized Modal Analysis (GMA) routines for solving 1-D generalized mode.  A Generalized 1-D Mode is constructed by starting with a curve in the ODE solution space where the points on the curve are taken as ODE initial conditions (t=0).  The evolution of the curve is found by solving each point on the curve, and using t as the evolution parameter.  So for example, the curve is carried by the vector field, and results in a new curve at t=1 (or any other number).

Copyright 2012, Lance Larsen
Licensed under the MIT license

Uses ODE.js

Summary
GMAmode classGeneralized Modal Analysis (GMA) routines for solving 1-D generalized mode.
GMAmodeCreates a new GMA model object.
Functions
GMAmodeCreates a new GMAmode object.
setnContoursSet the number of contours to retrieve from getContours.
solveCalculate the evolution of the modal curve.
tinitThis is called after the odes are solved to set up the t array, which is a complete array of timestep values.
getStep4tGet the step count associated with the time t.
getStepIteratorIterates through the solution points skipping values as indicated in ‘opt’.
getContourGet the generalized mode contour.
getContoursPush GMA contours onto an array.
getSolutionGets one of the ODE solutions used to calculate the generalized mode evolution.
getSolutionsPush a set of ODE solutions onto an array.
setLimitAdd a limit function that is used to bound the ODE solution points that are retained.
GlobalGlobally scoped functions
Functions
defaultFactoryThe default contour or solution factory just returns the object passed in.

GMAmode

Creates a new GMA model object.  Solve is called automatically to calculate the modal solution.

Summary
Functions
GMAmodeCreates a new GMAmode object.
setnContoursSet the number of contours to retrieve from getContours.
solveCalculate the evolution of the modal curve.
tinitThis is called after the odes are solved to set up the t array, which is a complete array of timestep values.
getStep4tGet the step count associated with the time t.
getStepIteratorIterates through the solution points skipping values as indicated in ‘opt’.
getContourGet the generalized mode contour.
getContoursPush GMA contours onto an array.
getSolutionGets one of the ODE solutions used to calculate the generalized mode evolution.
getSolutionsPush a set of ODE solutions onto an array.
setLimitAdd a limit function that is used to bound the ODE solution points that are retained.

Functions

GMAmode

Creates a new GMAmode object.

PARAMETERS

optAn object with the following properites
opt.VThe vector field or ODE
opt.stepsThe number of steps to solve for each point on initial modal curve
opt.dtThe timestep for each step
opt.tThe initial time value
opt.ptsThe initial mode curve
opt.ncontoursNumber of contours to return from getContours.  Initializes this.ncontours and this.last_index.  (Default: 6)
opt.contourOffsetThe ode index offset to the first contour.  Initializes this.ctrOffset and this.last_index.  (Default: 0)
opt.contourTotalStepsThe total number of ode steps over the contour range.  Initializes this.contourTotalSteps.  (Default: this.steps - opt.contourOffset)
opt.limit(Optional) A limit function used to indicate when to bound the solution.  The function should take a point and indicate true if the point is within the bounds, or false if it is not.
opt.contourFactory(Optional) factory used to process contour objects.  The function form is ‘contourFactory(gmaobj, stepn, contour)’ where gmaobj is this object, stepn is the stepn is index used to get the points, and contour is a object with ‘data’ holding the contour data.
opt.solutionFactory(Optional) factory used to process solutions that are returned from getSolution.  The function form is ‘solutionFactory(gmaobj, stepn, contour)’

setnContours

Set the number of contours to retrieve from getContours.

PARAMETERS

optObject to hold the parameters.  All are optional.
opt.ncontoursNumber of contours to return from getContours.  Initializes this.ncontours and this.last_index.
opt.contourOffsetThe ode index offset to the first contour.  Initializes this.ctrOffset and this.last_index.
opt.contourTotalStepsThe total number of ode steps over the contour range.  Initializes this.contourTotalSteps.

solve

Calculate the evolution of the modal curve.  The optional parameters are not needed if solve is called more than once.  Calling solve without the optional parameters extends the solution.

PARAMETERS

stepsThe number of steps to solve for each point on initial mode curve
dtThe timestep for each step
t(Optional) The initial time value
pts(Optional)The initial mode curve
limit(Optional)A limit function used to indicate when to bound the solution.  The function should take a point and indicate true if the point is within the bounds, or false if it is not.

tinit

This is called after the odes are solved to set up the t array, which is a complete array of timestep values.

getStep4t

Get the step count associated with the time t.

PARAMETERS

tThe time we want the timestep for.

getStepIterator

Iterates through the solution points skipping values as indicated in ‘opt’.

PARAMETERS

opt(Optional) Object with the following input fields
opt.nCurvesThe number of modal or solution curves to extract.  Default is 6.
opt.offsetThe offset to the first index to use.
opt.totalStepsThe last step to use as a modal curve.  The default is the number of solve steps.

getContour

Get the generalized mode contour.

PARAMETERS

stepnThe ODE step that is associated with the the contour.
rawReturns the result without passing it through the contourFactory.

RETURNS

A contour generated by the contourFactory function that was passed to the constructor.  The contourFactory function is called as ‘contourFactory(gmaobj, stepn, contour)’, where contour contain the fields ‘t’ and ‘pts’ where ‘t’ is a parameter array, and ‘pts’ are the contour points.

getContours

Push GMA contours onto an array.

PARAMETERS

arryAn array to push contours onto using ‘arry.push(value)’
optOptions used by GMAmode.getStepIterator.

getSolution

Gets one of the ODE solutions used to calculate the generalized mode evolution.

PARAMETERS

idxThe index of the ODE solution to get.
rawReturns the result without passing it through the solutionFactory.

RETURNS

A value as returned by the solutionFactory.  The solution factory is called as solutionFactory(gmaobj, stepn, contour) as defined in

getSolutions

Push a set of ODE solutions onto an array.

PARAMETERS

arryThe array to add solutions to using ‘arry.push(soln)’
optOptions used by GMAmode.getStepIterator for selecting the set of solutions.

setLimit

Add a limit function that is used to bound the ODE solution points that are retained.

PARAMETERS

limit_func: The limit function to use.  This is called as ‘limit_func(pt)’ and should return true if the point is retained, or false if the point is discarded.

Global

Globally scoped functions

Summary
Functions
defaultFactoryThe default contour or solution factory just returns the object passed in.

Functions

defaultFactory

The default contour or solution factory just returns the object passed in.

PARAMETERS

gmaobjThe GMAmode object that the contour is associated with.
stepnThe index used when getting the modal contour.
contourAn object with field ‘t’ and ‘pts’.  Both are arrays of the same size, with ‘t’ being the parameter value, and ‘pts’ the associated ODE solution points.

RETURNS

This simply returns the contour (or solution) value that is passed in without modification.

Iterates through the solution points skipping values as indicated in ‘opt’.
Close