|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjabble.Evolver
jabble.Multigrid
public abstract class Multigrid
Base class for Multigrid algorithms.
To write an Multigrid Evolver, use one of the subclasses, like FullMultigrid (for linear operators) and FAS (for non-linear operators). Here are some suggestions that are always valid:
This class implement the FullMultigrid algorithm, which is described as follows.
Given Lu=f, where L is an elliptic differential operator, u the unknown field and f a given field, the Full Multigrid algorithm is defined as:
FMG(h, N, f h, bh, v1, v2, n):
where:
In the Jabble framework, this class will take care of this algorithm and rely on the subclass to implement the V-Cycle. Therefore, usually you'll want to use one of the classes that inherit from this. The parameters of the algorithm can be found as bean properties:
To implement the V-Cycle, one needs to implement the vCycleResitrict and vCycleProlong methods. In those function one would decide how to transfer the fields from one level to the other during a V-Cycle. The rest is already in place. There are few things one is expected to honor:
We suggest one looks at the source of the subclasses already bundled with Jabble as examples and guidance.
Reference:
| Nested Class Summary | |
|---|---|
class |
Multigrid.VCycle
|
| Field Summary | |
|---|---|
protected java.lang.String |
f
|
protected java.lang.String |
u
|
protected MultigridOperation |
vCycleProlongOperator
|
protected MultigridOperation |
vCycleRestrictOperator
|
| Fields inherited from class jabble.Evolver |
|---|
constantsMap, dDirs, fieldArrayMap, fieldMap, grid, stopTrigger |
| Constructor Summary | |
|---|---|
Multigrid(Evolver evolver,
java.lang.String u,
java.lang.String f)
Creates a new MultiGrid evolver on top of the given evolver. |
|
| Method Summary | |
|---|---|
protected void |
calculateNewFields()
Implements the multi grid method. |
void |
evolve(java.util.List<Slice> slices)
Evolves the data in the list of slices of one time step. |
int |
evolve(java.util.List<Slice> slices,
int maxIterations,
Trigger stopTrigger)
Evolves the slices using multi grid methods and the evolver given through the constructor. |
Evolver |
getExactSolutionEvolver()
|
int |
getNIterationsExact()
|
int |
getNIterationsPostPrologation()
|
int |
getNIterationsPreRestriction()
|
int |
getNPreviousSlicesNeeded()
Returns the number of slices needed for the previous time steps. |
int |
getNVCycleIterations()
|
Evolver |
getRelaxationEvolver()
|
Evolver |
getVCycleEvolver()
|
protected void |
prolong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
protected void |
restrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
void |
setNIterationsExact(int nIterationsExact)
|
void |
setNIterationsPostPrologation(int nIterationsPostPrologation)
|
void |
setNIterationsPreRestriction(int nIterationsPreRestriction)
|
void |
setNVCycleIterations(int nVCycleIterations)
|
protected void |
setupRestrictSlices(java.util.List<Slice> fineSlices)
|
java.lang.String |
toString()
The String representation of the MultiGrid evolver, which include the toString() of the wrapped evolver. |
protected abstract void |
vCycleProlong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
protected abstract void |
vCycleRestrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
| Methods inherited from class jabble.Evolver |
|---|
evolve, initializeFieldArray, initializeFieldArray, skipBoundaryPoint |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String u
protected java.lang.String f
protected MultigridOperation vCycleRestrictOperator
protected MultigridOperation vCycleProlongOperator
| Constructor Detail |
|---|
public Multigrid(Evolver evolver,
java.lang.String u,
java.lang.String f)
evolver - this evolver will be used by MultiGrid to actually solve the equations| Method Detail |
|---|
public int getNPreviousSlicesNeeded()
EvolverThe value is calculated by looking at the fields declared within the evolver. So if a subclass will declare a previous2Phi, this method will return 2, provided no other older fields where declared.
getNPreviousSlicesNeeded in class Evolver
protected void restrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
protected void prolong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
public void evolve(java.util.List<Slice> slices)
EvolverAn EllipticSolver will work by continuing to refine the solution at each iteration over the Grid. At each iteration, the solver will determine what was the best improvement (that is F[n](P) - F[n-1](P)) and if it's less than the truncation error it will return. The solver will not go past the maxIterations limit.
The solver will return the solution by modifying the data contained in the Slice, or by removing and adding Fields accordingly.
evolve in class Evolverslices - The slices containing the data to work on; first slice is the most recent in time
of iterations performed by the solver.
public int evolve(java.util.List<Slice> slices,
int maxIterations,
Trigger stopTrigger)
evolve in class Evolverslices - the slices with the data to evolvemaxIterations - the maximum number of iterations (on any grid)stopTrigger - stop condition for the evolver
protected void calculateNewFields()
calculateNewFields in class Evolverpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getNIterationsExact()
public void setNIterationsExact(int nIterationsExact)
public int getNIterationsPostPrologation()
public void setNIterationsPostPrologation(int nIterationsPostPrologation)
public int getNIterationsPreRestriction()
public void setNIterationsPreRestriction(int nIterationsPreRestriction)
public void setNVCycleIterations(int nVCycleIterations)
public int getNVCycleIterations()
public Evolver getRelaxationEvolver()
public Evolver getExactSolutionEvolver()
public Evolver getVCycleEvolver()
protected void setupRestrictSlices(java.util.List<Slice> fineSlices)
protected abstract void vCycleRestrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
protected abstract void vCycleProlong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||