org.jscience.physics.fluids.dynamics.solver
Class GCCholeskyImpl

java.lang.Object
  extended by org.jscience.physics.fluids.dynamics.solver.GCCholeskyImpl
All Implemented Interfaces:
ConjugatedGradient

public class GCCholeskyImpl
extends java.lang.Object
implements ConjugatedGradient

Solver for systems of lineal ecuations through the conjugated gradient. The used preconditioner is a incomplete Cholesky. For more information about conjugated gradient and sparse matrices consult the program documentation.

The most important changes are the following:
- More clarity in the methods. Style setter/getter.
- Main code is out of the constructor.
- Simetrical data storage.
- Possibility to reuse the coeficient matrix.
- NaN in the convergence criteria resturns a system null (needed for the NavierStokes)
- Preconditioning improved.
- Revised for ADFC v2.0.

See Also:
ConjugatedGradient

Field Summary
static java.lang.String VERSION
          Version of the class.
 
Constructor Summary
GCCholeskyImpl(KernelADFC kadfc)
          Default Constructor of the class.
 
Method Summary
 double[] getB()
          Returns the current column of independient terms.
 double getDeltaConvergence()
          Returns the current delta of convergence of the solver.
 void resolve(double[] xk)
          Solves the lineal system of ecuations by a preconditioning conjugated gradient.
 void setB(double[] v)
          Assigns a new column of independient terms.
 void setCoeficientMatrix(Matrix m)
          We use the current solver to resolve the defined system of ecuations by the indicated Matrix.
 void setDeltaConvergence(double delta)
          Assigns the delta of convergence of the current solver.
 void setDirichlet(int[] nodes, double[] values)
          Split in two calls: a setNodesDirichlet() and setValuesDirichlet().
 void setNodesDirichlet(int[] nodes)
          Indicates the indices of the new Dirichlet nodes.
 void setValuesDirichlet(double[] values)
          Adjust the values of the Dirichlet nodes specified by setNodesDirichlet().
 void setVerbose(boolean v)
          Activates flag VERBOSE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version of the class.

See Also:
Constant Field Values
Constructor Detail

GCCholeskyImpl

public GCCholeskyImpl(KernelADFC kadfc)
Default Constructor of the class.

Parameters:
kadfc - DOCUMENT ME!
Method Detail

resolve

public void resolve(double[] xk)
Solves the lineal system of ecuations by a preconditioning conjugated gradient.

Specified by:
resolve in interface ConjugatedGradient
Parameters:
xk - DOCUMENT ME!
Since:
org.jscience.fluids.solver v0.3

getB

public double[] getB()
Returns the current column of independient terms.

Specified by:
getB in interface ConjugatedGradient
Returns:
vector of independient terms.
Since:
org.jscience.fluids.solver v0.3

getDeltaConvergence

public double getDeltaConvergence()
Returns the current delta of convergence of the solver.

Specified by:
getDeltaConvergence in interface ConjugatedGradient
Returns:
delta of convergence.
Since:
org.jscience.fluids.solver v0.3

setB

public void setB(double[] v)
Assigns a new column of independient terms. The rest of the data is kept.

Specified by:
setB in interface ConjugatedGradient
Parameters:
v - column of independient terms.
Since:
org.jscience.fluids.solver v0.3

setDeltaConvergence

public void setDeltaConvergence(double delta)
Assigns the delta of convergence of the current solver. This value is used to decide if the solution is suficiently precise for our needs. The value by default is deltaConvergence, good for almost all purposes.

Lower values of delta increase precision, but increase the calculation time.

Specified by:
setDeltaConvergence in interface ConjugatedGradient
Parameters:
delta - nuevo delta of convergence.
Since:
org.jscience.fluids.solver v0.3

setCoeficientMatrix

public void setCoeficientMatrix(Matrix m)
We use the current solver to resolve the defined system of ecuations by the indicated Matrix.

Specified by:
setCoeficientMatrix in interface ConjugatedGradient
Parameters:
m - matrix of coeficientes of the system.
Since:
org.jscience.fluids.solver v0.3

setNodesDirichlet

public void setNodesDirichlet(int[] nodes)
Indicates the indices of the new Dirichlet nodes. Must be used in conjunction with setValuesDirichlet(). To change the Dirichlet nodes implies generate a new Cholesky matrix associated with the system.

Parameters:
nodes - vector of indexes.
Since:
org.jscience.fluids.solver v0.3

setValuesDirichlet

public void setValuesDirichlet(double[] values)
Adjust the values of the Dirichlet nodes specified by setNodesDirichlet().

Parameters:
values - values of the Dirichlet nodes.
Since:
org.jscience.fluids.solver v0.3

setDirichlet

public void setDirichlet(int[] nodes,
                         double[] values)
Split in two calls: a setNodesDirichlet() and setValuesDirichlet().

Specified by:
setDirichlet in interface ConjugatedGradient
Parameters:
nodes - indexes of Dirichlet nodes.
values - values of Dirichlet nodes.
Since:
org.jscience.fluids.solver v0.3

setVerbose

public void setVerbose(boolean v)
Activates flag VERBOSE.

Parameters:
v - DOCUMENT ME!