|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjabble.Problem
public abstract class Problem
Defines an EquationSet with a set of initial conditions.
The equation set is defined by the prepareEquationSet() method, that one
would need to implement to provide the set of equations. The initial conditions
are set by implemention initialXxx methods. For example, a declared function
initialPhi(double x, double y, double t) would be used to initialize
the phi field for a 2D problem. If we need to initialize the field for phi at
t - 1, we can declare initialPreviousPhi(Point point).
In general, three signatures are valid for initialization:
initialXxx(double x, double y, double t)initialXxx(Point point)initialXxx(Point point, double x, double y, double t)
| Constructor Summary | |
|---|---|
Problem()
|
|
| Method Summary | |
|---|---|
protected double |
calculateDifferential(Grid grid,
int xIndex)
Calculates the space differential for the given coordinate. |
protected abstract double |
calculateTimeDifferential(Grid grid)
Calculates the time differential. |
double |
getCoordinateCenter(int xIndex)
The value at the center of the coordinate range. |
double |
getCoordinateRange(int xIndex)
The range of the given coordinate. |
double |
getCourantFactor()
Returns the Courant factor, which should be used in the expression to calculate the time differential. |
protected Evolver |
getDefaultEvolver()
Returns the default Evolver to be used to solve the problem. |
int |
getGridSize(int xIndex)
Returns the size for the given direction. |
abstract EquationSet |
prepareEquationSet()
Creates the equation set that needs to be solved. |
void |
setCoordinateCenter(int xIndex,
double center)
Changes the center for the given coordinate. |
void |
setCoordinateRange(int xIndex,
double range)
Changes the range for the coordinate. |
void |
setCourantFactor(double courantFactor)
Changes the Courant factor. |
void |
setGridSize(int... sizes)
Changes the size of the grid for this problem. |
void |
setInitialCondition(java.util.List<Slice> slices)
Initializes the set of slices according to the initial conditions. |
boolean |
verifyResult(java.util.List<Slice> slices,
double tolerance)
Compares the field value in the slices with the expected solution. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Problem()
| Method Detail |
|---|
public abstract EquationSet prepareEquationSet()
public void setInitialCondition(java.util.List<Slice> slices)
slices - a list of slices to initializepublic double getCoordinateRange(int xIndex)
xIndex - the index of the coordinate
public void setCoordinateRange(int xIndex,
double range)
xIndex - the coordinate indexrange - the range to assign to the coordinatepublic double getCoordinateCenter(int xIndex)
xIndex - the index of the coordinate
public void setCoordinateCenter(int xIndex,
double center)
xIndex - the coordinate indexcenter - the center value of the coordinatepublic double getCourantFactor()
public void setCourantFactor(double courantFactor)
courantFactor - the Courant factor
protected double calculateDifferential(Grid grid,
int xIndex)
grid - the Grid on which the computation will be performedxIndex - a coordinate index
protected abstract double calculateTimeDifferential(Grid grid)
For example, let's say our expression is given by dt = C * dx2, we'll have:
protected double calculateTimeDifferential(Grid grid) {
double value = getCourantFactor();
value *= calculateDifferential(grid, 0);
value *= calculateDifferential(grid, 0);
return value;
}
In case normalization constants are used, the differentials in the expression should be normalized.
For example:
protected double calculateTimeDifferential(Grid grid) {
double value = getCourantFactor();
value *= calculateDifferential(grid, 0) / normalizationDx;
return value;
}
grid - the Grid for which the time differential will be used
public boolean verifyResult(java.util.List<Slice> slices,
double tolerance)
slices - a list of slices with the solution to comparetolerance - the difference allowed between the given solution and the exact solution
protected Evolver getDefaultEvolver()
public int getGridSize(int xIndex)
xIndex - a direction index
public void setGridSize(int... sizes)
sizes - the sizes for the directions on the Grid
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||