gridripper::odesolver::ODE Class Reference

Ordinary differential equation interface. More...

List of all members.

Public Member Functions

boolean isNumericalConstraintSettingPassedToPDE ()
 Tests whether the constrained components should be set numerically later by PDE.initConstraints.
boolean isConstrainedInInit ()
 Tests whether the initial state is already constrained.
void constrain (double[] mesh)
 Constrain the field to the hypersurface of constraint conditions.
abstract void eval (double[] f, int offset, double x, double[] df)
 Evaluates the ODE.
int getMatrixFieldOrder (int i)
boolean hasExactSolution ()
void getExactSolution (double[] F, double x)
abstract double getMinX ()
 Gets the minimum x coordinate.
abstract double getMaxX ()
 Gets the maximum x coordinate.
boolean isValid (double[] F, double x)
 Tests whether the differential equation is still valid for describing the system.
boolean dRHS (double[] f, int offset, double x, double[] drhs)
 Calculates the derivative matrix of the RHS of the field equation vector.
double[] getInitialValuesForRelaxation (int nx)
 Gets the initial field values for the relaxation method.
double[] getInitialX ()
 Gets the initial x coordinate(s) for a shooting method.
FieldWrapper[] getInitialValuesForShooting ()
 Gets the initial field values for a shooting method.
double averageShootingResults (int np, int ip, double x, int ic, double f0, double f1)
 Averages solutions from two shooting method results.
void getPhysicalField (double x, double[] f)
 Gets the physical field components.
final PDE getPDE ()
 Gets the PDE.
final InitCond getPDEInitCond ()
 Gets the initial condition for the PDE.
final void setPDE (PDE pde, InitCond init)
 Sets the PDE and its initial condition.
void initPDE (double x, double[] fode, FieldWrapper fw)
 Sets boundary conditions for a PDE to be the solution of this ODE.
void initPDE (double x, double[] fode, FieldWrapper fpde, double[] data)
 Sets boundary conditions for a PDE to be the solution of this ODE.
final int getNumComponents ()
 Gets the number of field components.
final String getComponentName (int k)
 Gets the name of a component.

Static Public Member Functions

static ODE create (String str, Parameters p) throws IllegalArgumentException
 Creates an ODE.

Protected Member Functions

 ODE (String[] compnames)
 Constructs the ODE.
void log (String s)
 Print logging info on stderr.


Detailed Description

Ordinary differential equation interface.

Version:
0.5, 01/27/2009
Since:
GridRipper 0.4, 08/02/2006
Author:
Peter Csizmadia

Constructor & Destructor Documentation

gridripper::odesolver::ODE::ODE ( String[]  compnames  )  [inline, protected]

Constructs the ODE.

Parameters:
compnames array of component names


Member Function Documentation

boolean gridripper::odesolver::ODE::isNumericalConstraintSettingPassedToPDE (  )  [inline]

Tests whether the constrained components should be set numerically later by PDE.initConstraints.

Returns:
true in the default implementation

boolean gridripper::odesolver::ODE::isConstrainedInInit (  )  [inline]

Tests whether the initial state is already constrained.

Returns:
true if the initial state is constrained, false if constrain must be called

void gridripper::odesolver::ODE::constrain ( double[]  mesh  )  [inline]

Constrain the field to the hypersurface of constraint conditions.

The default implementation does not perform any operation.

Parameters:
mesh the mesh containing the field values

abstract void gridripper::odesolver::ODE::eval ( double[]  f,
int  offset,
double  x,
double[]  df 
) [pure virtual]

Evaluates the ODE.

Parameters:
f vector of field values
offset offset in field vector
x the x coordinate
df output vector for the derivatives

abstract double gridripper::odesolver::ODE::getMinX (  )  [pure virtual]

Gets the minimum x coordinate.

Returns:
the minimum x coordinate

abstract double gridripper::odesolver::ODE::getMaxX (  )  [pure virtual]

Gets the maximum x coordinate.

Returns:
the maximum x coordinate

boolean gridripper::odesolver::ODE::isValid ( double[]  F,
double  x 
) [inline]

Tests whether the differential equation is still valid for describing the system.

Shooting method stops immediately when the ODE becomes invalid.

Parameters:
F the field values
x the space coordinate

boolean gridripper::odesolver::ODE::dRHS ( double[]  f,
int  offset,
double  x,
double[]  drhs 
) [inline]

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.

Parameters:
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
Returns:
true if the derivatives were calculated, false if they are not available (default)

double [] gridripper::odesolver::ODE::getInitialValuesForRelaxation ( int  nx  )  [inline]

Gets the initial field values for the relaxation method.

Parameters:
nx the grid size (number of subdivisions)
Returns:
the array of field values

double [] gridripper::odesolver::ODE::getInitialX (  )  [inline]

Gets the initial x coordinate(s) for a shooting method.

Returns:
a 1- or 2-element array containing the initial x coordinate(s)

FieldWrapper [] gridripper::odesolver::ODE::getInitialValuesForShooting (  )  [inline]

Gets the initial field values for a shooting method.

Returns:
a 1- or 2-element array containing the initial field values

double gridripper::odesolver::ODE::averageShootingResults ( int  np,
int  ip,
double  x,
int  ic,
double  f0,
double  f1 
) [inline]

Averages solutions from two shooting method results.

The default implementation returns the arithmetic mean (f0+f1)/2.

Parameters:
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
Returns:
the average field value

void gridripper::odesolver::ODE::getPhysicalField ( double  x,
double[]  f 
) [inline]

Gets the physical field components.

Parameters:
x the coordinate
f the field components (input: values on the grid, output: physical values)

final PDE gridripper::odesolver::ODE::getPDE (  )  [inline]

Gets the PDE.

Returns:
the PDE or null if there is no PDE

final InitCond gridripper::odesolver::ODE::getPDEInitCond (  )  [inline]

Gets the initial condition for the PDE.

Returns:
the initial condition or null if there is no PDE

final void gridripper::odesolver::ODE::setPDE ( PDE  pde,
InitCond  init 
) [inline]

Sets the PDE and its initial condition.

Useful to avoid code duplication; common methods should be implemented in the PDE.

Parameters:
pde the PDE
init the initial condition object

void gridripper::odesolver::ODE::initPDE ( double  x,
double[]  fode,
FieldWrapper  fw 
) [inline]

Sets boundary conditions for a PDE to be the solution of this ODE.

Parameters:
x the x coordinate
fode the solution vector of the ODE
fw output array for the fields appearing in the PDE

void gridripper::odesolver::ODE::initPDE ( double  x,
double[]  fode,
FieldWrapper  fpde,
double[]  data 
) [inline]

Sets boundary conditions for a PDE to be the solution of this ODE.

Parameters:
x the x coordinate
fode the solution vector of the ODE
fpde output array for the fields appearing in the PDE
data array containing the field values for all grid points

final int gridripper::odesolver::ODE::getNumComponents (  )  [inline]

Gets the number of field components.

Returns:
the number of components

final String gridripper::odesolver::ODE::getComponentName ( int  k  )  [inline]

Gets the name of a component.

Parameters:
k the component index
Returns:
the component name

static ODE gridripper::odesolver::ODE::create ( String  str,
Parameters  p 
) throws IllegalArgumentException [inline, static]

Creates an ODE.

Parameters:
str the ODE name and parameter string (separated by space)
p additional parameters
Returns:
the component name


The documentation for this class was generated from the following file:

Generated on Wed Jun 17 18:47:30 2009 for GridRipper by  doxygen 1.5.6