#include <ODE.h>
Public Member Functions | |
virtual bool | isNumericalConstraintSettingPassedToPDE () const |
Tests whether the constraint condition should be set numerically later by PDE.initConstraints. | |
virtual bool | isConstrainedInInit () const |
Tests whether the initial state is already constrained. | |
virtual void | constrain (tvalarray< GReal_t > &mesh) |
Constrain the field to the hypersurface of constraint conditions. | |
virtual void | eval (const GReal_t *f, int offset, GReal_t x, GReal_t *df)=0 |
Evaluates the ODE. | |
virtual int | getMatrixFieldOrder (int i) const |
virtual bool | hasExactSolution () const |
virtual void | getExactSolution (tvalarray< GReal_t > &F, GReal_t x) const |
virtual GReal_t | getMinX () const =0 |
Gets the minimum x coordinate. | |
virtual GReal_t | getMaxX () const =0 |
Gets the maximum x coordinate. | |
virtual bool | isValid (const GReal_t *F, int nc, GReal_t x) const |
Tests whether the differential equation is still valid for describing the system. | |
virtual bool | dRHS (const GReal_t *f, int offset, GReal_t x, GReal_t *drhs) |
Calculates the derivative matrix of the RHS of the field equation vector. | |
virtual tvalarray< GReal_t > | getInitialValuesForRelaxation (int nx) const |
Gets the initial field values for the relaxation method. | |
virtual tvalarray< GReal_t > | getInitialX () const |
Gets the initial x coordinate(s) for a shooting method. | |
virtual FieldArray | getInitialValuesForShooting () const |
Gets the initial field values for a shooting method. | |
virtual GReal_t | averageShootingResults (int np, int ip, GReal_t x, int ic, GReal_t f0, GReal_t f1) const |
Averages solutions from two shooting method results. | |
virtual void | getPhysicalField (GReal_t x, GReal_t *f) const |
Gets the physical field components. | |
const PDE & | getPDE () const |
Gets the PDE. | |
const InitCond & | getPDEInitCond () const |
Gets the initial condition for the PDE. | |
void | setPDE (const PDE *pde, const InitCond *init) |
Sets the PDE and its initial condition. | |
virtual void | initPDE (GReal_t x, const GReal_t *fode, FieldWrapper &fpde) |
Sets boundary conditions for a PDE to be the solution of this ODE. | |
virtual void | initPDE (GReal_t x, const GReal_t *fode, FieldWrapper &fpde, const GReal_t *data, int ndata) |
Sets boundary conditions for a PDE to be the solution of this ODE. | |
int | getNumComponents () const |
Gets the number of field components. | |
string | getComponentName (int k) const |
Gets the name of a component. | |
Protected Member Functions | |
ODE (int nc, const string *compnames) | |
Constructs the ODE. |
gridripper::odesolver::ODE::ODE | ( | int | nc, | |
const string * | compnames | |||
) | [inline, protected] |
virtual bool gridripper::odesolver::ODE::isNumericalConstraintSettingPassedToPDE | ( | ) | const [inline, virtual] |
Tests whether the constraint condition should be set numerically later by PDE.initConstraints.
virtual bool gridripper::odesolver::ODE::isConstrainedInInit | ( | ) | const [inline, virtual] |
Tests whether the initial state is already constrained.
true
if the initial state is constrained, false
if constrain must be called virtual void gridripper::odesolver::ODE::constrain | ( | tvalarray< GReal_t > & | mesh | ) | [inline, virtual] |
Constrain the field to the hypersurface of constraint conditions.
The default implementation does not perform any operation.
mesh | the mesh containing the field values |
virtual void gridripper::odesolver::ODE::eval | ( | const GReal_t * | f, | |
int | offset, | |||
GReal_t | x, | |||
GReal_t * | df | |||
) | [pure virtual] |
Evaluates the ODE.
f | vector of field values | |
offset | offset in field vector | |
x | the x coordinate | |
df | output vector for the derivatives |
virtual GReal_t gridripper::odesolver::ODE::getMinX | ( | ) | const [pure virtual] |
Gets the minimum x coordinate.
virtual GReal_t gridripper::odesolver::ODE::getMaxX | ( | ) | const [pure virtual] |
Gets the maximum x coordinate.
virtual bool gridripper::odesolver::ODE::isValid | ( | const GReal_t * | F, | |
int | nc, | |||
GReal_t | x | |||
) | const [inline, virtual] |
Tests whether the differential equation is still valid for describing the system.
Shooting method stops immediately when the ODE becomes invalid.
F | the field values | |
nc | the number of components | |
x | the space coordinate |
virtual bool gridripper::odesolver::ODE::dRHS | ( | const GReal_t * | f, | |
int | offset, | |||
GReal_t | x, | |||
GReal_t * | drhs | |||
) | [virtual] |
Calculates the derivative matrix of the RHS of the field equation vector.
This method is used by the relaxation method. However, its implementation is not obligatory: if exact derivates are not available, then finite differences are calculated numerically by the relaxation algorithm.
f | n*nc element vector containing the field components | |
offset | index of the first field component in the vector | |
x | the space coordinate | |
drhs | nc*nc output array, it will contain the derivative matrix |
true
if the derivatives were calculated, false
if they are not available (default) virtual tvalarray<GReal_t> gridripper::odesolver::ODE::getInitialValuesForRelaxation | ( | int | nx | ) | const [virtual] |
Gets the initial field values for the relaxation method.
nx | the grid size (number of subdivisions) |
Gets the initial x coordinate(s) for a shooting method.
virtual FieldArray gridripper::odesolver::ODE::getInitialValuesForShooting | ( | ) | const [virtual] |
Gets the initial field values for a shooting method.
virtual GReal_t gridripper::odesolver::ODE::averageShootingResults | ( | int | np, | |
int | ip, | |||
GReal_t | x, | |||
int | ic, | |||
GReal_t | f0, | |||
GReal_t | f1 | |||
) | const [inline, virtual] |
Averages solutions from two shooting method results.
The default implementation returns the arithmetic mean (f0+f1)/2.
np | the grid size (number of subdivisions) | |
ip | grid point index | |
x | grid point x coordinate | |
ic | field component index | |
f0 | field value from the first shooting result | |
f1 | field value from the second shooting result |
virtual void gridripper::odesolver::ODE::getPhysicalField | ( | GReal_t | x, | |
GReal_t * | f | |||
) | const [inline, virtual] |
Gets the physical field components.
x | the coordinate | |
f | the field components (input: values on the grid, output: physical values) |
const PDE& gridripper::odesolver::ODE::getPDE | ( | ) | const [inline] |
Gets the PDE.
null
if there is no PDE const InitCond& gridripper::odesolver::ODE::getPDEInitCond | ( | ) | const [inline] |
Gets the initial condition for the PDE.
null
if there is no PDE Sets the PDE and its initial condition.
Useful to avoid code duplication; common methods should be implemented in the PDE.
pde | the PDE | |
init | the initial condition object |
virtual void gridripper::odesolver::ODE::initPDE | ( | GReal_t | x, | |
const GReal_t * | fode, | |||
FieldWrapper & | fpde | |||
) | [virtual] |
virtual void gridripper::odesolver::ODE::initPDE | ( | GReal_t | x, | |
const GReal_t * | fode, | |||
FieldWrapper & | fpde, | |||
const GReal_t * | data, | |||
int | ndata | |||
) | [inline, virtual] |
int gridripper::odesolver::ODE::getNumComponents | ( | ) | const [inline] |
Gets the number of field components.
string gridripper::odesolver::ODE::getComponentName | ( | int | k | ) | const [inline] |
Gets the name of a component.
k | the component index |