public class PoissonGrid extends Grid implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
PT_DIRICHLET
Grid point is a boundary point with Dirichlet boundary conditions
|
static int |
PT_NEUMANN1
Grid point with Neumann boundary conditions, gradient in the first direction
|
static int |
PT_NEUMANN2
Grid point with Neumann boundary conditions, gradient in the second direction
|
static int |
PT_NEUMANN3
Grid point with Neumann boundary conditions, gradient in the third direction
|
static int |
PT_OPEN
Grid point is in an open region
|
static int |
PT_UNDEFINED
Grid point type is undefined
|
Constructor and Description |
---|
PoissonGrid(int n1,
int n2,
int n3)
Allocate a new PotentialGrid
|
Modifier and Type | Method and Description |
---|---|
protected xal.tools.math.r3.Grid.GridCell[][][] |
allocateCells(int n1,
int n2,
int n3)
Override base class allocator in order to allocate modified grid cell objects.
|
protected xal.tools.math.r3.Grid.GridPt[][][] |
allocatePts(int n1,
int n2,
int n3)
Override base class allocator in order to allocate modified grid point objects.
|
R3 |
fieldCartesian(R3 pt)
Compute and return the field in cartesian coordinates at point pt as generated
by the potential values on the grid.
|
R3 |
fieldCylindrical(R3 pt)
Compute and return the field in cylindrical coordinates at point pt as generated
by the potential values on the grid.
|
R3 |
fieldSpherical(R3 pt)
Compute and return the field in spherical coordinates at point pt as generated
by the potential values on the grid.
|
protected xal.tools.math.r3.PoissonGrid.Point |
getPt(int i,
int j,
int k)
Return grid point object located with index (i,j,k)
|
double |
potential(R3 pt)
Compute and return interpolated potential at a point pt within grid definition.
|
protected double[] |
relaxWeightsCartesian()
Compute the weighting coefficients of this grid for a Gauss-Seidel relaxation
solution technique for Poisson's equation.
|
protected double[] |
relaxWeightsCylindrical(double r)
Compute the weighting coefficients of this grid for a Gauss-Seidel relaxation
solution technique for Poisson's equation.
|
void |
setPtPotential(int i,
int j,
int k,
double dblPot)
Set the potential value at grid point given by index
|
void |
setPtSource(int i,
int j,
int k,
double dblSrc)
Set the source value at grid point given by index
|
void |
setPtType(int i,
int j,
int k,
int enmType)
Set the type of the grid point given by index
|
double |
solveCartesian(int intIterMax,
double dblErrMax)
Solve for the potential on the grid using a gauss-seidel relaxation technique.
|
double |
solveCylindrical(int intIterMax,
double dblErrMax)
Solve for the potential on the grid using a gauss-seidel relaxation technique.
|
compCellContaining, compCellIndex, compPtCoords, compPtCoords, getGridCell, getGridCell, getGridDomain, getGridOrigin, getGridPt, getGridPt, getGridResolution, getGridSize, getPtValue, interpolateGradient, interpolateValue, main, membershipGrid, print, setGridDomain, setPtValue
public static final int PT_UNDEFINED
public static final int PT_OPEN
public static final int PT_DIRICHLET
public static final int PT_NEUMANN1
public static final int PT_NEUMANN2
public static final int PT_NEUMANN3
public PoissonGrid(int n1, int n2, int n3) throws GridException
n1
- number of grid points in first dimensionn2
- number of grid points in second dimensionn3
- number of grid points in third dimensionGridException
- invalid size vector encounteredpublic void setPtPotential(int i, int j, int k, double dblPot)
i
- x dimension index of grid pointj
- y dimension index of grid pointk
- z dimension index of grid pointdblPot
- value of the potential at grid point (i,j,k)public void setPtType(int i, int j, int k, int enmType)
i
- x dimension index of grid pointj
- y dimension index of grid pointk
- z dimension index of grid pointenmType
- type enumeration of grid point (i,j,k)public void setPtSource(int i, int j, int k, double dblSrc)
i
- x dimension index of grid pointj
- y dimension index of grid pointk
- z dimension index of grid pointdblSrc
- value of the driving source at grid point (i,j,k)public double solveCartesian(int intIterMax, double dblErrMax) throws GridException
intIterMax
- maximum number of iterationsdblErrMax
- maximum residual errorGridException
- procedure did not converge to prescribed residual errorpublic double solveCylindrical(int intIterMax, double dblErrMax) throws GridException
intIterMax
- maximum number of iterationsdblErrMax
- maximum residual errorGridException
- procedure did not converge to prescribed residual errorpublic double potential(R3 pt) throws GridException
pt
- coordinates of field point within gridGridException
- point pt is outside grid domainpublic R3 fieldCartesian(R3 pt) throws GridException
pt
- field point to compute fieldGridException
- field undefined or pt is outside gridpublic R3 fieldCylindrical(R3 pt) throws GridException
pt
- field point to compute fieldGridException
- field undefined or pt is outside gridpublic R3 fieldSpherical(R3 pt) throws GridException
pt
- field point to compute fieldGridException
- field undefined or pt is outside gridprotected xal.tools.math.r3.PoissonGrid.Point getPt(int i, int j, int k)
protected xal.tools.math.r3.Grid.GridPt[][][] allocatePts(int n1, int n2, int n3) throws GridException
allocatePts
in class Grid
n1
- size of the first dimensionn2
- size of the second dimensionn3
- size of the third dimensionGridException
- unable to allocate arrayprotected xal.tools.math.r3.Grid.GridCell[][][] allocateCells(int n1, int n2, int n3) throws GridException
allocateCells
in class Grid
n1
- size of the first dimensionn2
- size of the second dimensionn3
- size of the third dimensionGridException
- unable to allocate arrayprotected double[] relaxWeightsCartesian()
protected double[] relaxWeightsCylindrical(double r)
r
- the radius at which the weights are determined