spis.Solver.Poisson
Class PoissonSolve

java.lang.Object
  extended byspis.Solver.Poisson.PoissonSolve

public class PoissonSolve
extends java.lang.Object

Class Name : PoissonSolve
Project ref : SPIS project
File name : PoissonInit.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 : Contains the routines necessary to solve the Poisson equation through conjugate gradient method
It contains:
Solve the linear or nonlinear Poisson equation and compute the potential
Solve the linear system AX=b by a precondionned Conjuguate Gradient method
Solve Nonlinear by Newton method

Versions and anomalies correction :

Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation


Version:
0.1
Author:
F. Rogier

Constructor Summary
PoissonSolve()
           
 
Method Summary
static void assembPrecondNonLinear(int nodeNb, int bandw, int[] nonzeroMat, int[] pointMat, double[] diag, double[] mat, double[] precond, org.netlib.util.intW info)
          Assembles the preconditionner for the Nonlinear Poisson equation
INPUT = nodeNb,bandw,nonzeroMat, pointMat, mat, diag
- bandw = bandwidth of preconditionner
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- mat[ndimMat] = Mass matrix (without the diagonal)
- diag [nodeNb] = diagonal of the Mass matrix
OUTPUT= precond,info
- precond [(bandw+1)*nodeNb]] = Predonditionner of the Poisson matrix (after LDLt decomposition)
- info = Lapack test used for preconditionning (=0 succesfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications 0.1 F.
static void ConjugateGradientSolve(int nodeNb, Matrix mat, double[] xSol, double[] bSecond, double tolGradient, int iterGradient)
          Solves a linear system mat.xSol=bSecond, through conjugate gradient method.
static void jacobNewton(int nodeNb, int[] nonzeroMat, int[] pointMat, int[] flagDir, double[] diagMass, double[] matMass, double[] diagPoisson, double[] matPoisson, double[] pot, double elecTemp, double elecDens, double elecTemp2, double elecDens2, float[] nodeVol, double[] diagNewton, double[] matNewton)
          Computes the Newton jacobian
INPUT = nodeNb,nonzeroMat, pointMa,flagDir, diagMass,matMass, diagPoisson,matPoisson,pot, elecTemp,elecDens
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diagMass [nodeNb] = diagonal of the Mass matrix
- matMass[ndimMat] = Mass matrix (without the diagonal)
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- pot [nodeNb] = potential
- elecTemp = Electronic temperature (eV)
- elecDens = Electronic density (M-3)
- elecTemp2 = Electronic temperature 2nd population [eV]
- elecDens2 = Electronic density 2nd population [m-3]
OUTPUT = diagNewton, matNewton
- diagNewton [nodeNb] = diagonal of the jacobian
- matNewton[ndimMat] = Jacobian matrix (without the diagonal)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications 0.1 F.
static void poissonLinear(int nodeNb, int ndimMat, int[] nonzeroMat, int[] pointMat, double[] diagPoisson, double[] matPoisson, double[] precondPoisson, double[] dens, double[] bcPoisson, int bandw, double tolGradient, int iterGradient, double[] pot, org.netlib.util.intW info)
          Solves the linear Poisson equation and computes the potential.
static void poissonNonLinear(int nodeNb, int ndimMat, int[] nonzeroMat, int[] pointMat, int[] flagDir, double[] diagMass, double[] matMass, double[] diagPoisson, double[] matPoisson, double[] bcPoisson, double[] dens, double elecTemp, double elecDens, double elecTemp2, double elecDens2, float[] nodeVol, int bandw, double tolNewton, int iterNewton, double tolGradient, int iterGradient, double[] pot, org.netlib.util.intW info)
          Solves the nonlinear Poisson equation and computes the potential.
static void precondConjugateGradient(int nodeNb, int bandw, int[] nonzeroMat, int[] pointMat, double[] diag, double[] mat, double[] precond, double[] xSol, double[] bSecond, double tolGradient, int iterGradient, org.netlib.util.intW info)
          Solves the linear system AX=b by a precondionned Conjuguate gradient method
INPUT = nodeNb, bandw,nonzeroMat, pointMat, diag, mat,precond, bSecond,tolGradient, iterGradient
- bandw = bandwidth of preconditionner
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diag [nodeNb] = diagonal of the Mass matrix
- mat[ndimMat] = Mass matrix (without the diagonal) - precond [(bandw+1)*nodeNb]] = Predonditionner of the Poisson matrix (incomplete decomposition limited to bandw)
- bSecond [nodeNb] = left hand side of the linear system
- xSol[nodeNb] = initial guess of the CG
- tolGradient = stop test for the CG convergence
- iterGradient = maximum CG iteration number
OUTPUT =xSol, info - xSol[nodeNb] = solution
- info = Lapack test used for preconditionning (=0 succesfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications 0.1 F.
static void prodmatVect(int nodeNb, int[] nonzeroMat, int[] pointMat, double[] mat, double[] diag, double[] x, double[] y)
          Computes the vector matrix product Ax
- INPUT = nodeNb, nonzeroMat, pointMat, mat, diag,x
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- mat[ndimMat] = Mass matrix (without the diagonal)
- diag [nodeNb] = diagonal of the Mass matrix
- x[nodeNb] = vector input
OUTPUT = y
- y[nodeNb] = vector output = y=Ax

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications 0.1 F.
static void residualNewton(int nodeNb, int[] nonzeroMat, int[] pointMat, int[] flagDir, double[] diagMass, double[] matMass, double[] diagPoisson, double[] matPoisson, double elecTemp, double elecDens, double elecTemp2, double elecDens2, float[] nodeVol, double[] pot, double[] bNewton, double[] secm, double[] rloc1, double[] rloc2)
          Computes the residual of the Newton algorithm
INPUT = nodeNb, nonzeroMat, pointMat, flagDir, diagMass, matMass, diagPoisson, matPoisson, elecTemp,elecDens, pot, bNewton
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diagMass [nodeNb] = diagonal of the Mass matrix
- matMass[ndimMat] = Mass matrix (without the diagonal)
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- elecTemp = Electronic temperature (eV)
- elecDens = Electronic density (M-3)
- elecTemp2 = Electronic temperature 2nd population [eV]
- elecDens2 = Electronic density 2nd population [m-3]
- pot [nodeNb] = potential
- bNewton[nodeNb] = left hand side of Newton
OUTPUT = rloc1,rloc2,secm
- rloc1[nodeNb] = local vector
- rloc2[nodeNb] = local vector
- secm[nodeNb] = Newton residual

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications 0.1 F.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoissonSolve

public PoissonSolve()
Method Detail

poissonNonLinear

public static void poissonNonLinear(int nodeNb,
                                    int ndimMat,
                                    int[] nonzeroMat,
                                    int[] pointMat,
                                    int[] flagDir,
                                    double[] diagMass,
                                    double[] matMass,
                                    double[] diagPoisson,
                                    double[] matPoisson,
                                    double[] bcPoisson,
                                    double[] dens,
                                    double elecTemp,
                                    double elecDens,
                                    double elecTemp2,
                                    double elecDens2,
                                    float[] nodeVol,
                                    int bandw,
                                    double tolNewton,
                                    int iterNewton,
                                    double tolGradient,
                                    int iterGradient,
                                    double[] pot,
                                    org.netlib.util.intW info)
Solves the nonlinear Poisson equation and computes the potential.

INPUT: nodeNb, ndimMat, nonzeroMat, pointMat, flagDir, diagMass,matMass, diagPoisson,matPoisson, bcPoisson, dens, elecTemp,elecDens, bandw, tolNewton,iterNewton, tolGradient,iterGradient:
- ndimMat = memory requirement for matrix mat
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir [nodeNb] = Dirichlet boundary conditions flag
- diagMass [nodeNb] = diagonal of the Mass matrix
- matMass[ndimMat] = Mass matrix (without the diagonal)
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- bcPoisson [nodeNb] = contribution of boundary conditions
- dens [nodeNb] = charge density
- elecTemp = Electronic temperature [eV]
- elecDens = Electronic density [m-3]
- elecTemp2 = Electronic temperature 2nd population [eV]
- elecDens2 = Electronic density 2nd population [m-3]
- bandw = bandwidth of matrices
- tolNewton = stop test for the newton convergence
- iterNewton = maximum newton iteration number
- tolGradient = stop test for the CG convergence
- iterGradient = maximum CG iteration number

OUTPUT : pot,info
- pot = potential (also used as input at first iteration start)
- dens [nodeNb] = charge density in INPUT is modified
- info = Lapack test (=0 succesfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



poissonLinear

public static void poissonLinear(int nodeNb,
                                 int ndimMat,
                                 int[] nonzeroMat,
                                 int[] pointMat,
                                 double[] diagPoisson,
                                 double[] matPoisson,
                                 double[] precondPoisson,
                                 double[] dens,
                                 double[] bcPoisson,
                                 int bandw,
                                 double tolGradient,
                                 int iterGradient,
                                 double[] pot,
                                 org.netlib.util.intW info)
Solves the linear Poisson equation and computes the potential.

INPUT: nodeNb, ndimMat, nonzeroMat, pointMat, diagPoisson,matPoisson, precondPoisson,pot, dens, bcPoisson,bandW, tolGradient, iterGradient
- ndimMat = memory requirement for matrix mat
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- precondPoisson[nodeNb*(bandw+1)] = poisson matrix preconditionning
- pot = potential (also used as input at first iteration start)
- dens [nodeNb] = charge density
- bcPoisson [nodeNb] = contribution of boundary conditions
- bandw = bandwidth of matrices
- tolGradient = stop test for the CG convergence
- iterGradient = maximum CG iteration number

OUTPUT : pot,info
- pot = potential (also used as input at first iteration start)
- info = Lapack test (=0 successfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



residualNewton

public static void residualNewton(int nodeNb,
                                  int[] nonzeroMat,
                                  int[] pointMat,
                                  int[] flagDir,
                                  double[] diagMass,
                                  double[] matMass,
                                  double[] diagPoisson,
                                  double[] matPoisson,
                                  double elecTemp,
                                  double elecDens,
                                  double elecTemp2,
                                  double elecDens2,
                                  float[] nodeVol,
                                  double[] pot,
                                  double[] bNewton,
                                  double[] secm,
                                  double[] rloc1,
                                  double[] rloc2)
Computes the residual of the Newton algorithm
INPUT = nodeNb, nonzeroMat, pointMat, flagDir, diagMass, matMass, diagPoisson, matPoisson, elecTemp,elecDens, pot, bNewton
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diagMass [nodeNb] = diagonal of the Mass matrix
- matMass[ndimMat] = Mass matrix (without the diagonal)
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- elecTemp = Electronic temperature (eV)
- elecDens = Electronic density (M-3)
- elecTemp2 = Electronic temperature 2nd population [eV]
- elecDens2 = Electronic density 2nd population [m-3]
- pot [nodeNb] = potential
- bNewton[nodeNb] = left hand side of Newton
OUTPUT = rloc1,rloc2,secm
- rloc1[nodeNb] = local vector
- rloc2[nodeNb] = local vector
- secm[nodeNb] = Newton residual

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



jacobNewton

public static void jacobNewton(int nodeNb,
                               int[] nonzeroMat,
                               int[] pointMat,
                               int[] flagDir,
                               double[] diagMass,
                               double[] matMass,
                               double[] diagPoisson,
                               double[] matPoisson,
                               double[] pot,
                               double elecTemp,
                               double elecDens,
                               double elecTemp2,
                               double elecDens2,
                               float[] nodeVol,
                               double[] diagNewton,
                               double[] matNewton)
Computes the Newton jacobian
INPUT = nodeNb,nonzeroMat, pointMa,flagDir, diagMass,matMass, diagPoisson,matPoisson,pot, elecTemp,elecDens
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diagMass [nodeNb] = diagonal of the Mass matrix
- matMass[ndimMat] = Mass matrix (without the diagonal)
- diagPoisson [nodeNb] = diagonal of the poisson matrix
- matPoisson[ndimMat] = poisson matrix (without the diagonal)
- pot [nodeNb] = potential
- elecTemp = Electronic temperature (eV)
- elecDens = Electronic density (M-3)
- elecTemp2 = Electronic temperature 2nd population [eV]
- elecDens2 = Electronic density 2nd population [m-3]
OUTPUT = diagNewton, matNewton
- diagNewton [nodeNb] = diagonal of the jacobian
- matNewton[ndimMat] = Jacobian matrix (without the diagonal)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



precondConjugateGradient

public static void precondConjugateGradient(int nodeNb,
                                            int bandw,
                                            int[] nonzeroMat,
                                            int[] pointMat,
                                            double[] diag,
                                            double[] mat,
                                            double[] precond,
                                            double[] xSol,
                                            double[] bSecond,
                                            double tolGradient,
                                            int iterGradient,
                                            org.netlib.util.intW info)
Solves the linear system AX=b by a precondionned Conjuguate gradient method
INPUT = nodeNb, bandw,nonzeroMat, pointMat, diag, mat,precond, bSecond,tolGradient, iterGradient
- bandw = bandwidth of preconditionner
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- flagDir[nodeNb] = Dirichlet boundary conditions flag
- diag [nodeNb] = diagonal of the Mass matrix
- mat[ndimMat] = Mass matrix (without the diagonal) - precond [(bandw+1)*nodeNb]] = Predonditionner of the Poisson matrix (incomplete decomposition limited to bandw)
- bSecond [nodeNb] = left hand side of the linear system
- xSol[nodeNb] = initial guess of the CG
- tolGradient = stop test for the CG convergence
- iterGradient = maximum CG iteration number
OUTPUT =xSol, info - xSol[nodeNb] = solution
- info = Lapack test used for preconditionning (=0 succesfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



prodmatVect

public static void prodmatVect(int nodeNb,
                               int[] nonzeroMat,
                               int[] pointMat,
                               double[] mat,
                               double[] diag,
                               double[] x,
                               double[] y)
Computes the vector matrix product Ax
- INPUT = nodeNb, nonzeroMat, pointMat, mat, diag,x
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- mat[ndimMat] = Mass matrix (without the diagonal)
- diag [nodeNb] = diagonal of the Mass matrix
- x[nodeNb] = vector input
OUTPUT = y
- y[nodeNb] = vector output = y=Ax

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



assembPrecondNonLinear

public static void assembPrecondNonLinear(int nodeNb,
                                          int bandw,
                                          int[] nonzeroMat,
                                          int[] pointMat,
                                          double[] diag,
                                          double[] mat,
                                          double[] precond,
                                          org.netlib.util.intW info)
Assembles the preconditionner for the Nonlinear Poisson equation
INPUT = nodeNb,bandw,nonzeroMat, pointMat, mat, diag
- bandw = bandwidth of preconditionner
- nonzeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- mat[ndimMat] = Mass matrix (without the diagonal)
- diag [nodeNb] = diagonal of the Mass matrix
OUTPUT= precond,info
- precond [(bandw+1)*nodeNb]] = Predonditionner of the Poisson matrix (after LDLt decomposition)
- info = Lapack test used for preconditionning (=0 succesfull)

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation



ConjugateGradientSolve

public static void ConjugateGradientSolve(int nodeNb,
                                          Matrix mat,
                                          double[] xSol,
                                          double[] bSecond,
                                          double tolGradient,
                                          int iterGradient)
Solves a linear system mat.xSol=bSecond, through conjugate gradient method.
It was derived from the solver developed for Poissonb equation, this is why it is in PoissonSolve class.
INPUT : double xSol[] , int nodeNb, object: mat (+Matrix.product) ,double bSecond[], double tol, int itermax
- xSol : initial guess for the iteratibe CG method - mat : object Matrix containing the matrix and the methods derived OUTPUT : double xSol[] - xSol[] solution (also used as input at first iteration start)
Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 F. Rogier rogier@cert.frImplementation