spis.Solver.Poisson
Class PoissonInit

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

public class PoissonInit
extends java.lang.Object

Class Name : PoissonInit (initialise Poisson Solver)
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 intialise the conjugate gradient Poisson solver (see class ConjGrad3DUnstructPoissonSolver).
It contains:
Cuthil Mac Kee renumbering the mesh
Compute two pointers for the compressed storage of non diagonal non null element of the matrix
Assembling the Poisson and Mass matrix with the compressed storage
Assembling and building the preconditionner for the Linear Poisson Solver
Implementing Fourier Boundary conditions
Implementing Dirichlet Boundary Conditions
Compute the electric field on each particle

Versions and anomalies correction :

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


Version:
0.1
Author:
D. Volpert and F.Rogier

Constructor Summary
PoissonInit()
           
 
Method Summary
static void assembPoissonMass(int nodeNb, int cellNb, int[][] cellNode, int[][] surfCell, float[] cellVol, float[][] surfNormal, float[] surfArea, int[][] cellSurf, int[] pointMat, int[] nonZeroMat, double[] matPoisson, double[] diagPoisson, double[] matMass, double[] diagMass)
          Assembles the Poisson and Mass matrix with compressed storage.
static void assembPoissonMassWires(int nodeNb, int cellNb, int[][] cellNode, int[][] surfCell, float[] cellVol, float[][] surfNormal, float[] surfArea, int[] cellWire, int[][] cellSurf, int[] pointMat, int[] nonZeroMat, double[] matPoisson, double[] diagPoisson, double[] matMass, double[] diagMass)
          Assembles the Poisson and Mass matrix with compressed storage.
static void assembPrecondLinear(int nodeNb, int bandw, int[] nonZeroMat, int[] pointMat, double[] diag, double[] mat, double[] precond, org.netlib.util.intW info)
          Preconditionning : assembling and building of the preconditionner for the Linear Poisson Solver.
static void calLenWire(float[][] xyz, float[][] minusDrDn, float[][] surfNormale, float[] lenNodeWire, int[][] surfNode, int[][] cellSurf, int[][] edgeNode, int[] cellWire, int[] edgeFlag, int[] wireEdge, int cellNb, int edgeNb)
           
static int calPointeur(int[][] cellNode, int[][] edgeNode, int[] pointMat, int[] nonZeroMat, int nodeNb, int edgeNb)
          Compute the index of the column number of j > i for each row i of the matrix
static void computeGradient(float[][] xyz, float[][] surfNormal, float[][] partGrad, float[][] partCoord, double[] secmembre, float[] cellVol, float[] surfArea, float[] nodePot, float[] edgeRadius, int[] edgeIndex, double[] dirValue, int[][] cellNode, int[][] surfCell, int[][] cellSurf, int[][] cellEdge, int[][] surfNode, int[][] edgeNode, int[] cellIndex, int[] cellWire, int[] wireEdge, int[] edgeFlag, int[] nodeFlag, int partNb, ThreeDUnstructVolMesh vm)
          Computes the electric field at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to the other computeGradient(...) routine).
static void computeGradient(int partNb, int[] cellIndex, float[] nodePot, int nodeNb, int cellNb, int[][] cellNode, int[][] surfCell, float[] cellVol, float[][] surfNormal, float[] surfArea, int[][] cellSurf, float[][] partGrad)
          Computes the electric field at each particle position (depending only on cell index indeed, since electric field is constant over a cell).
static void cuthilMackee(int[][] cellNode, int[][] edgeNode, int[] newNum, int[] nonZeroMat, int[] bandTab, int nodeNb, int cellNb, int edgeNb)
          Cuthil-Mac Kee Renumbering of the mesh and building of the indexes of the matrices.
static void faceOppos(int[][] cellNode, int[][] surfNode, int[][] cellSurf, int cellNb)
          renumbering local number cellSurf: this must be the local number of the opposit node in tetrahedra Input:
nodes of a cell int[][] cellNode[cellNb][4]
nodes of a surface int[][] surfNode[surfNb][3]
surfaces of a cell int[][] cellSurf[cellNb][4]
number of cell int cellNb
Output : modified surface of a cell int[][] cellSurf[cellNb][4]
static void fourierWireLump(float[][] minusDrDn, double[] diagpoisson, double[] secMembre, float[] surfArea, float[] lenNodeWire, double[] dirValue, float[] edgeRadius, int[] edgeIndex, int[][] cellNode, int[][] surfNode, int[][] cellSurf, int[] cellWire, int[] wireEdge, int cellNb)
           
static void initDirichletBC(double[] diagPoisson, double[] matPoisson, double[] diagMass, double[] matMass, double[] bcPoisson, double[] dirValue, int[] flagDir, int[] pointMat, int[] nonZeroMat, int nodeNb, int[] bandTab)
          Implements Dirichlet Boundary Conditions.
static void initFourierBC(double[] diagPoisson, double[] matPoisson, double[] bcPoisson, double[] fourValue, float[] surfArea, double[] alphaSurf, int[][] surfNode, int[] flagFour, int[] pointMat, int[] nonZeroMat, int surfNb)
          Implements Fourier boundary conditions. .
static void interpolatePotential(float[][] xyz, float[][] partCoord, float[] partPot, double[] secmembre, float[] cellVol, float[] nodePot, float[] edgeRadius, int[] edgeIndex, int[][] cellNode, int[][] surfCell, int[][] cellSurf, int[][] cellEdge, int[][] surfNode, int[][] edgeNode, int[] cellIndex, int[] cellWire, int[] wireEdge, int[] edgeFlag, int[] nodeFlag, int partNb, ThreeDUnstructVolMesh vm)
          Computes the potential at each particle position by interpolation: linear in regular tetrahedra, specific in tetrahedra next to a wire
static void quicksort(int[] tablo, int[] index, int n)
          quick sort of integer number tablo.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoissonInit

public PoissonInit()
Method Detail

cuthilMackee

public static void cuthilMackee(int[][] cellNode,
                                int[][] edgeNode,
                                int[] newNum,
                                int[] nonZeroMat,
                                int[] bandTab,
                                int nodeNb,
                                int cellNb,
                                int edgeNb)
Cuthil-Mac Kee Renumbering of the mesh and building of the indexes of the matrices.
It does not actually renumber, but its output newNum allows the user to do it.
Passed variables are:
nodes of a cell int[][] cellNode[cellNb][4]
nodes of an edge int[][] edgeNode[edgeNb][4]
new numbering of a the nodes (output) int[] newNun[nodeNb]
index of non diagonal non null matrix elements int pointMat[edgeNb]
pointer of row for pointMat int nonZeroMat[nodeNb+1]
a[i][j] = mat[k] where: nonZeroMat[i] < k <= nonZeroMat[i+1], and j = pointMat[k]
bandwidth int[] bandTab[2]
bandTab[0] = bandwith for preconditioning
bandTab[1] = bandwith of the matrix
node (points) number int nodeNb
cell (tetrahedra) number int cellNb
edge number int edgeNb

Status: tested independently of the framework

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 D. Volpert, Dominique.Volpert@cert.frImplementation



calPointeur

public static int calPointeur(int[][] cellNode,
                              int[][] edgeNode,
                              int[] pointMat,
                              int[] nonZeroMat,
                              int nodeNb,
                              int edgeNb)
Compute the index of the column number of j > i for each row i of the matrix


quicksort

public static void quicksort(int[] tablo,
                             int[] index,
                             int n)
quick sort of integer number tablo. Index(i) is the old position of new tablo(i): old tablo(index(i)) = new tablo(i)


assembPoissonMass

public static void assembPoissonMass(int nodeNb,
                                     int cellNb,
                                     int[][] cellNode,
                                     int[][] surfCell,
                                     float[] cellVol,
                                     float[][] surfNormal,
                                     float[] surfArea,
                                     int[][] cellSurf,
                                     int[] pointMat,
                                     int[] nonZeroMat,
                                     double[] matPoisson,
                                     double[] diagPoisson,
                                     double[] matMass,
                                     double[] diagMass)
Assembles the Poisson and Mass matrix with compressed storage.

INPUT = nodeNb,cellNb,cellNode,cellVol,surfNormal, surfArea,cellSurf, pointMat,nonZeroMat:
nonZeroMat[nodeNb+1] = index of non null matrix element
pointMat[ndimMat] = index of non null matrix element

OUPUT = matPoisson,diagPoisson,matMass, diagMass:
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)

Status: tested independently of the framework

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



assembPoissonMassWires

public static void assembPoissonMassWires(int nodeNb,
                                          int cellNb,
                                          int[][] cellNode,
                                          int[][] surfCell,
                                          float[] cellVol,
                                          float[][] surfNormal,
                                          float[] surfArea,
                                          int[] cellWire,
                                          int[][] cellSurf,
                                          int[] pointMat,
                                          int[] nonZeroMat,
                                          double[] matPoisson,
                                          double[] diagPoisson,
                                          double[] matMass,
                                          double[] diagMass)
Assembles the Poisson and Mass matrix with compressed storage.

INPUT = nodeNb,cellNb,cellNode,cellVol,surfNormal, surfArea,cellSurf, pointMat,nonZeroMat:
nonZeroMat[nodeNb+1] = index of non null matrix element
pointMat[ndimMat] = index of non null matrix element

OUPUT = matPoisson,diagPoisson,matMass, diagMass:
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)

Status: tested independently of the framework

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



assembPrecondLinear

public static void assembPrecondLinear(int nodeNb,
                                       int bandw,
                                       int[] nonZeroMat,
                                       int[] pointMat,
                                       double[] diag,
                                       double[] mat,
                                       double[] precond,
                                       org.netlib.util.intW info)
Preconditionning : assembling and building of the preconditionner for the Linear Poisson Solver.
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)

Status: tested independently of the framework

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



initFourierBC

public static void initFourierBC(double[] diagPoisson,
                                 double[] matPoisson,
                                 double[] bcPoisson,
                                 double[] fourValue,
                                 float[] surfArea,
                                 double[] alphaSurf,
                                 int[][] surfNode,
                                 int[] flagFour,
                                 int[] pointMat,
                                 int[] nonZeroMat,
                                 int surfNb)
Implements Fourier boundary conditions. .
dphi/dn + alpha*phi = fourValue
weakly :
integraleonface(psi*dphi/dn) = integraleonsface(-alpha*phi*psi+psi*fourValue)
first term in the Poisson matrices, second term in bcPoisson
Input variables:
- fourValue[nodeNb] given on the nodes
- surfArea[surfNb]
- alphaSurf[surfNb] given on the surfaces
- surfNode[surfNb][3]
- flagFour[surfNb]: 1 if Fourier conditions to be implemented on that surface (0 if not).
- pointMat[]: index of non diagonal non null poisson matrix elements
- nonZeroMat[]: pointer of row for pointMat (cf. cuthilMackee for more on the structure of the sparse poisson matrix)
- surfNb: number of surface elements
Output variables:
- diagPoisson[nodeNb]
- matPoisson[ndimMat]
- bcPoisson[nodeNb]

Status: tested independently of the framework

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 D. Volpert, Dominique.Volpert@cert.frImplementation



initDirichletBC

public static void initDirichletBC(double[] diagPoisson,
                                   double[] matPoisson,
                                   double[] diagMass,
                                   double[] matMass,
                                   double[] bcPoisson,
                                   double[] dirValue,
                                   int[] flagDir,
                                   int[] pointMat,
                                   int[] nonZeroMat,
                                   int nodeNb,
                                   int[] bandTab)
Implements Dirichlet Boundary Conditions.
phi[i] = dirValue[i] on node i if flagDir[i] = 1
non null Dirichlet conditions for Poisson matrices (diagPoisson and matPoisson
null Dirichlet conditions for Mass matrices (diagMass and matMass) in Newton iterations
What the method do:
1) for each i flagdir[i] == 1; bcPoisson = bcPoisson -dirValue[i]*colmn[i] of Poisson matrix
2) row[i] and column[i] = 0 in matrices Poisson and Mass; diagPoisson[i]=diagMass[i] = 1
3) bcPoisson[i] = dirValue[i]
So in non linear iterations, the unknown "pot" MUST be initialized at bcPoisson
Input variables:
- dirValue[nodeNb]
- flagDir[nodeNb]: 1 if Dirichlet conditions to be implemented on that node (0 if not).
- pointMat[ndimm] - bandTab[2]: bandTab[1] is the bandwith of matrices
- nonZeroMat[nodeNb+1] = index of non null matrix element
- pointMat[ndimMat] = index of non null matrix element
- nodeNb
Output variables:
- diagPoisson[nodeNb]
- matPoisson[ndimMat]
- diagMass[nodeNb]
- matMass[ndimMat]
- bcPoisson[nodeNb]

Status: tested independently of the framework

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 D. Volpert, Dominique.Volpert@cert.frImplementation



computeGradient

public static void computeGradient(int partNb,
                                   int[] cellIndex,
                                   float[] nodePot,
                                   int nodeNb,
                                   int cellNb,
                                   int[][] cellNode,
                                   int[][] surfCell,
                                   float[] cellVol,
                                   float[][] surfNormal,
                                   float[] surfArea,
                                   int[][] cellSurf,
                                   float[][] partGrad)
Computes the electric field at each particle position (depending only on cell index indeed, since electric field is constant over a cell).
NB: no specific interpolation is done in tetrahedra next to a wire (contrarily to the other computeGradient(...) routine).
INPUT = partNb, cellIndex, nodePot, nodeNb, cellNb, cellNode, cellVol,surfNormal,surfArea,cellSurf
potNode = potential on each node
OUTPUT = partGrad = electric field on each particle

See Also:
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)

computeGradient

public static void computeGradient(float[][] xyz,
                                   float[][] surfNormal,
                                   float[][] partGrad,
                                   float[][] partCoord,
                                   double[] secmembre,
                                   float[] cellVol,
                                   float[] surfArea,
                                   float[] nodePot,
                                   float[] edgeRadius,
                                   int[] edgeIndex,
                                   double[] dirValue,
                                   int[][] cellNode,
                                   int[][] surfCell,
                                   int[][] cellSurf,
                                   int[][] cellEdge,
                                   int[][] surfNode,
                                   int[][] edgeNode,
                                   int[] cellIndex,
                                   int[] cellWire,
                                   int[] wireEdge,
                                   int[] edgeFlag,
                                   int[] nodeFlag,
                                   int partNb,
                                   ThreeDUnstructVolMesh vm)
Computes the electric field at each particle position: linear in regular tetrahedra, specific in tetrahedra next to a wire (contrarily to the other computeGradient(...) routine).
NB: dirValue looks to be redundant with nodePot (TBC): dirValue is used on wires only, and should be equal to nodePot there => dirValue might be removed (TBD)

Parameters:
xyz -
surfNormal -
partGrad - electric field on each particle (output, others are input)
partCoord -
secmembre -
cellVol -
surfArea -
nodePot -
edgeRadius -
edgeIndex -
dirValue -
cellNode -
surfCell -
cellSurf -
cellEdge -
surfNode -
edgeNode -
cellIndex -
cellWire -
wireEdge -
edgeFlag -
nodeFlag -
partNb -
vm -
See Also:
computeGradient(int, int[], float[], int, int, int[][], int[][], float[], float[][], float[], int[][], float[][])

interpolatePotential

public static void interpolatePotential(float[][] xyz,
                                        float[][] partCoord,
                                        float[] partPot,
                                        double[] secmembre,
                                        float[] cellVol,
                                        float[] nodePot,
                                        float[] edgeRadius,
                                        int[] edgeIndex,
                                        int[][] cellNode,
                                        int[][] surfCell,
                                        int[][] cellSurf,
                                        int[][] cellEdge,
                                        int[][] surfNode,
                                        int[][] edgeNode,
                                        int[] cellIndex,
                                        int[] cellWire,
                                        int[] wireEdge,
                                        int[] edgeFlag,
                                        int[] nodeFlag,
                                        int partNb,
                                        ThreeDUnstructVolMesh vm)
Computes the potential at each particle position by interpolation: linear in regular tetrahedra, specific in tetrahedra next to a wire

Parameters:
xyz -
partCoord -
partPot - potential on each particle (output, others are input)
secmembre -
cellVol -
nodePot -
edgeRadius -
edgeIndex -
cellNode -
surfCell -
cellSurf -
cellEdge -
surfNode -
edgeNode -
cellIndex -
cellWire -
wireEdge -
edgeFlag -
nodeFlag -
partNb -
vm -
See Also:
PoissonInit#computeGradient(float[][],float[][],float[][],float[][],double[],float[],float[],[],float[],int[], double[],int[][],int[][],int[][],int[][],int[][],int[][],int[],int[],int[],int[],int[],int,ThreeDUnstructVolMesh vm)

faceOppos

public static void faceOppos(int[][] cellNode,
                             int[][] surfNode,
                             int[][] cellSurf,
                             int cellNb)
renumbering local number cellSurf: this must be the local number of the opposit node in tetrahedra Input:
nodes of a cell int[][] cellNode[cellNb][4]
nodes of a surface int[][] surfNode[surfNb][3]
surfaces of a cell int[][] cellSurf[cellNb][4]
number of cell int cellNb
Output : modified surface of a cell int[][] cellSurf[cellNb][4]


calLenWire

public static void calLenWire(float[][] xyz,
                              float[][] minusDrDn,
                              float[][] surfNormale,
                              float[] lenNodeWire,
                              int[][] surfNode,
                              int[][] cellSurf,
                              int[][] edgeNode,
                              int[] cellWire,
                              int[] edgeFlag,
                              int[] wireEdge,
                              int cellNb,
                              int edgeNb)

fourierWireLump

public static void fourierWireLump(float[][] minusDrDn,
                                   double[] diagpoisson,
                                   double[] secMembre,
                                   float[] surfArea,
                                   float[] lenNodeWire,
                                   double[] dirValue,
                                   float[] edgeRadius,
                                   int[] edgeIndex,
                                   int[][] cellNode,
                                   int[][] surfNode,
                                   int[][] cellSurf,
                                   int[] cellWire,
                                   int[] wireEdge,
                                   int cellNb)