spis.Solver.Poisson
Class ConjGrad3DUnstructPoissonSolver

java.lang.Object
  extended byspis.Solver.Poisson.PoissonSolver
      extended byspis.Solver.Poisson.PotPoissonSolver
          extended byspis.Solver.Poisson.ConjGrad3DUnstructPoissonSolver

public class ConjGrad3DUnstructPoissonSolver
extends PotPoissonSolver

Class Name : ConjGrad3DUnstructPoissonSolver
Project ref : SPIS project
File name : ConjGrad3DUnstructPoissonSolver.java
File type : class
Copyright : ONERA, 2 Av. E. Belin, 31055 Toulouse cedex, France http://www.onecert.fr
Status : under development
Creation : 25/08/2003
Modification :

Description : Poisson solving through pre-conditioned conjugate gradient method.

Versions and anomalies correction :

Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 JF Roussel, roussel@onecert.fr and D Volpert, volpert@cert.fr Creation


Version:
0.1
Author:
JF Roussel

Constructor Summary
ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh)
          Constructor with really minimum data, default boundary conditions will be:
- Dirichlet on spacecraft (fixed potential)
- Fourier at external boundaries (potentiel goes asymptotically to zero, within 1 meter)
Default data for non-linear solving are: dens = 10^11 #/m3, Te = 0.1eV.
ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh, float ne, float Te, float ne2, float Te2, boolean linear)
          Constructor with little data, default boundary conditions will be:
- Dirichlet on spacecraft (fixed potential)
- Fourier at external boundaries (potentiel goes asymptotically to zero, within 1 meter with these pre-defined parameters)
ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh, SurfMesh boundarySurfMesh, SurfMesh scSurfMesh, PoissonBC boundaryBC, PoissonBC scBC, float ne, float Te, float ne2, float Te2, boolean linear)
          Default constructor
 
Method Summary
 void buildMatrices(int[] fourierFlag, double[] fourierAlpha, double[] fourierValue, int[] dirFlag, double[] dirichletPot)
          Builds all matrices (and second member vectors) needed to later
solve Poisson equation.
 int getIterGradient()
           
 int getIterGradientNl()
           
 int getIterNewton()
           
 double getTolGradient()
           
 double getTolGradientNl()
           
 double getTolNewton()
           
 void init()
          Initialises solver, which should be done only once at solver creation.
 void initFromBc()
          Builds all matrices (and second member vectors) needed to later
solve Poisson equation, needed each time BC are modified.
 void interpolatePotential(PointList pl, ScalVolField pot, FloatScalTable val)
          Interpolates the potential at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to VolMesh interpolatePotential routine).
 void interpolatePotGradient(PointList pl, ScalVolField pot, VectTable val)
          Computes the potential gradient (minus the electric field) at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to VolMesh computeGradient(...) routine.)
 void setIterGradient(int i)
           
 void setIterGradientNl(int i)
           
 void setIterNewton(int i)
           
 void setTolGradient(double d)
           
 void setTolGradientNl(double d)
           
 void setTolNewton(double d)
           
 void solveLinear(ScalVolField density, VectVolField E_)
          Solves Poisson equation.
 void solveNonLinear(ScalVolField density, VectVolField E_)
          Solves non-linearPoisson equation.
 
Methods inherited from class spis.Solver.Poisson.PotPoissonSolver
getAnalyticDens
 
Methods inherited from class spis.Solver.Poisson.PoissonSolver
getBbc, getBsm, getElecDens, getElecDens2, getElecTemp, getElecTemp2, getScbc, getScsm, getVm, isLinear, setElecDens, setElecDens2, setElecTemp, setElecTemp2, setLinear, setScPot, solve
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConjGrad3DUnstructPoissonSolver

public ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh,
                                       SurfMesh boundarySurfMesh,
                                       SurfMesh scSurfMesh,
                                       PoissonBC boundaryBC,
                                       PoissonBC scBC,
                                       float ne,
                                       float Te,
                                       float ne2,
                                       float Te2,
                                       boolean linear)
Default constructor

Parameters:
volMesh - volume mesh
boundarySurfMesh - external boundary surface mesh
scSurfMesh - spacecraft surface mesh
boundaryBC - boundary conditions on external boundary
scBC - boundary conditions on spacecraft
ne - reference electron density (for non linear Poisson solver)
Te - reference electron temperature (for non linear Poisson solver)
linear - if true, linear solver will be used by default

ConjGrad3DUnstructPoissonSolver

public ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh,
                                       float ne,
                                       float Te,
                                       float ne2,
                                       float Te2,
                                       boolean linear)
Constructor with little data, default boundary conditions will be:
- Dirichlet on spacecraft (fixed potential)
- Fourier at external boundaries (potentiel goes asymptotically to zero, within 1 meter with these pre-defined parameters)

Parameters:
volMesh - volume mesh (spacecraft and external boundary meshes are extracted from volMesh)
ne - reference electron density (for non linear Poisson solver)
Te - reference electron temperature (for non linear Poisson solver)
linear - linear solver selection by default?

ConjGrad3DUnstructPoissonSolver

public ConjGrad3DUnstructPoissonSolver(ThreeDUnstructVolMesh volMesh)
Constructor with really minimum data, default boundary conditions will be:
- Dirichlet on spacecraft (fixed potential)
- Fourier at external boundaries (potentiel goes asymptotically to zero, within 1 meter)
Default data for non-linear solving are: dens = 10^11 #/m3, Te = 0.1eV.
The default selectionned solver is linear Poisson

Parameters:
volMesh - volume mesh (spacecraft and external boundary meshes are extracted from volMesh)
Method Detail

init

public void init()
Initialises solver, which should be done only once at solver creation.
it mostly renumbers the nodes and determines Poisson matrix shape.
It also allocates arrays to store Poisson and Mass matrices, so that they do not need to be re-allocated at each matrix assembling,
which can be done repetitively, contrarily to this init.
These operations should certainly be done in the constructor, but it was preferred to separate for now (init() should be added in the
constructor later and init passed private, TBM).

Specified by:
init in class PoissonSolver

buildMatrices

public void buildMatrices(int[] fourierFlag,
                          double[] fourierAlpha,
                          double[] fourierValue,
                          int[] dirFlag,
                          double[] dirichletPot)
Builds all matrices (and second member vectors) needed to later
solve Poisson equation.
Inputs are:
- fourierFlag[surfNb]: 1 if Fourier conditions to be implemented on that surface.
- fourierAlpha[surfNb]: alpha parameter in Fourier BC df/dn + alpha n = value
- fourierValue[nodeNb]: value parameter in Fourier BC df/dn + alpha n = value (this is not an error, it centred on nodes, not on surfaces like other Fourier data)
- dirichletFlag[nodeNb]: 1 if Dirichlet conditions to be implemented on that node
- dirichletPot[nodeNb]: fixed potential on Dirichlet nodes
Outputs are internally stored matrices and vectors:
diagMass, matMass, diagPoisson, matPoisson, secMember


initFromBc

public void initFromBc()
Builds all matrices (and second member vectors) needed to later
solve Poisson equation, needed each time BC are modified.
In this version without parameters, boundary conditions data are extracted from internally stored BC data bbc and scbc.
Outputs are internally stored matrices and vectors:
diagMass, matMass, diagPoisson, matPoisson, secMember

Specified by:
initFromBc in class PoissonSolver

solveNonLinear

public void solveNonLinear(ScalVolField density,
                           VectVolField E_)
Solves non-linearPoisson equation.
NB: several different interfaces may be implemented to pass control parameters (precision, or iteration number, etc.), but implementin this one, with minimal parameter number, is enforced with this by the abstract method definition of the super class PoissonSlver, so that the user can be sure to have this default interface (automated definition of default control parameters).

Specified by:
solveNonLinear in class PoissonSolver

solveLinear

public void solveLinear(ScalVolField density,
                        VectVolField E_)
Solves Poisson equation.
Several different interfaces may be implemented to pass control parameters (precision, or iteration number, etc.), but implementin this one, with minimal parameter number, is enforced with this by the abstract method definition of the super class PoissonSlver, so that the user can be sure to have this default interface (automated definition of default control parameters). Still TBC.

Specified by:
solveLinear in class PoissonSolver

interpolatePotGradient

public void interpolatePotGradient(PointList pl,
                                   ScalVolField pot,
                                   VectTable val)
Computes the potential gradient (minus the electric field) at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to VolMesh computeGradient(...) routine.)
Basically calls the right PoissonInit.computeGradient(...) routine with the right extra parameters.

Specified by:
interpolatePotGradient in class PoissonSolver
Parameters:
pl - particle list (points are enough)
pot - potential (input)
val - gradient at particle locations
See Also:
PoissonInit.computeGradient(float[][], float[][], float[][], float[][], double[], float[], float[], float[], float[], int[], double[], int[][], int[][], int[][], int[][], int[][], int[][], int[], int[], int[], int[], int[], int, ThreeDUnstructVolMesh), ThreeDUnstructVolMesh.computeGradient(PointList, ScalVolField, VectTable)

interpolatePotential

public void interpolatePotential(PointList pl,
                                 ScalVolField pot,
                                 FloatScalTable val)
Interpolates the potential at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to VolMesh interpolatePotential routine).
Basically calls the right PoissonInit.interpolatePotential(...) routine with the right extra parameters.

Specified by:
interpolatePotential in class PoissonSolver
Parameters:
pl - particle list (points are enough)
pot - potential (input)
val - gradient at particle locations
See Also:
PoissonInit.interpolatePotential(float[][], float[][], float[], double[], float[], float[], float[], int[], int[][], int[][], int[][], int[][], int[][], int[][], int[], int[], int[], int[], int[], int, ThreeDUnstructVolMesh), ThreeDUnstructVolMesh.interpolate(PointList, VolField, Table)

getIterGradient

public int getIterGradient()
Returns:

getIterGradientNl

public int getIterGradientNl()
Returns:

getIterNewton

public int getIterNewton()
Returns:

getTolGradient

public double getTolGradient()
Returns:

getTolGradientNl

public double getTolGradientNl()
Returns:

getTolNewton

public double getTolNewton()
Returns:

setIterGradient

public void setIterGradient(int i)
Parameters:
i -

setIterGradientNl

public void setIterGradientNl(int i)
Parameters:
i -

setIterNewton

public void setIterNewton(int i)
Parameters:
i -

setTolGradient

public void setTolGradient(double d)
Parameters:
d -

setTolGradientNl

public void setTolGradientNl(double d)
Parameters:
d -

setTolNewton

public void setTolNewton(double d)
Parameters:
d -