jabble
Class FAS
java.lang.Object
jabble.Evolver
jabble.Multigrid
jabble.FAS
public abstract class FAS
- extends Multigrid
Implements FAS (Full Approximation Storage).
The FAS V-Cycle algorithm
Given Lu=f, where L is a non-linear differential operator, u
the unknown field and f a given field, the FAS V-Cycle algorithm is defined
as:
uh = FASVCycle(uh, h, N, f h, v1,
v2):
- If N == 2, solve Lh uh = f h
and return uh.
- uh = Relax(uh, h, N, f h, v1);
relax v1 times.
- u2h = I2hh uh;
compute u for the coarser grid.
- f 2h = I2hh f h;
+ Lh uh - I2hh
Lh uh;
compute f for the coarser grid.
- u2h = VCycle(u2h, 2h, N/2, f 2h,
v1, v2);
recursive call.
- uh = uh + I h2h (
u2h - I2hh uh
);
calculate and add correction.
- uh = Relax(uh, h, N, f h, v2);
relax v2 times.
- Return uh.
where:
- uh is the solution field with step h, and u2h
is the field quantized with step 2h (the coarser field, the field at
the next level of multigrid)
- N is the number of point along one direction of the grid
- f h is the source field
- v1 and v2 are the parameters for the
V-Cycle
- I2hh is the restriction operator, that transform
a fine field (with step h) to a coarse field (with step 2h).
- I h2h is the prolongation operator.
In the Jabble framework, this class will take care of this algorithm and rely
on a first Evolver to implement the Relax for steps 2 and 7, and a second Evolver
(possibly the same as the first) for the exact solution at step 1. Therefore, to
use an object of this class, one will need to specify:
- an exactSolutionEvolver, used for step 1. This is done through the constructor.
- a relaxationEvolver, used for steps 2 and 7. This is done through the constructor.
If only one evolver is given, the same is used as both relaxationEvolver and
exactSolutionEvolver.
- which fields need to be restricted and prolonged. This is done through the
constructor.
- the implementation of how to calculate the residual and calculate the correction.
This is done by implementing the l() method which should compute the L operator.
Other details:
- v1 and v2 correspond to the bean properties
nIterationsPreRestriction and nIterationsPostProlongation. The defaults are
2 and 1 respectively.
- The exact solution (step 1) is implemented through the exactSolutionEvolver,
which is run for nIterationsExact (default 3).
The following is a sample code for a FullMultigrid class that solves the non-linear
equation d2phi / dx2 + phi2 = rho :
public class NonlinearEllipticCartesianFAS extends FAS {
public NonlinearEllipticCartesianFAS() {
// Uses the Gauss-Seidel method for both relaxation and correct solution
// "phi" is the Field to solve for and "rho" is the source field
super(new NonlinearEllipticCartesianGS(), "phi", "rho");
}
// Fields used while computing residual and correction
private Field phi;
// Calculates the L operator from phi
public double l(Point point) {
return laplacianBulk(phi) +
phi.at(point) * phi.at(point);
}
}
Reference:
- Numerical Recipies in C, 19.6
|
Constructor Summary |
FAS(Evolver evolver,
java.lang.String u,
java.lang.String f)
|
|
Method Summary |
abstract double |
l(Point point)
|
java.lang.String |
toString()
The String representation of the MultiGrid evolver, which include the toString() of the
wrapped evolver. |
protected void |
vCycleProlong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
protected void |
vCycleRestrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
|
| Methods inherited from class jabble.Multigrid |
calculateNewFields, evolve, evolve, getExactSolutionEvolver, getNIterationsExact, getNIterationsPostPrologation, getNIterationsPreRestriction, getNPreviousSlicesNeeded, getNVCycleIterations, getRelaxationEvolver, getVCycleEvolver, prolong, restrict, setNIterationsExact, setNIterationsPostPrologation, setNIterationsPreRestriction, setNVCycleIterations, setupRestrictSlices |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FAS
public FAS(Evolver evolver,
java.lang.String u,
java.lang.String f)
vCycleRestrict
protected void vCycleRestrict(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
- Specified by:
vCycleRestrict in class Multigrid
l
public abstract double l(Point point)
vCycleProlong
protected void vCycleProlong(java.util.List<Slice> coarseSlices,
java.util.List<Slice> fineSlices)
- Specified by:
vCycleProlong in class Multigrid
toString
public java.lang.String toString()
- Description copied from class:
Multigrid
- The String representation of the MultiGrid evolver, which include the toString() of the
wrapped evolver.
- Overrides:
toString in class Multigrid
- Returns:
- String representation of the evolver