spis.Surf.SurfMesh
Class ThreeDUnstructSurfMesh

java.lang.Object
  extended byspis.Surf.SurfMesh.SurfMesh
      extended byspis.Surf.SurfMesh.UnstructSurfMesh
          extended byspis.Surf.SurfMesh.ThreeDUnstructSurfMesh
All Implemented Interfaces:
java.io.Serializable

public class ThreeDUnstructSurfMesh
extends UnstructSurfMesh
implements java.io.Serializable

Class Name : ThreeDUnstructSurfMesh (generic Surface Mesh class)
Project ref : SPIS project
File name : ThreeDUnstructSurfMesh.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 : 3-dimensional Unstructured Surface Mesh class (triangles only)
Specificities and constraints:
- thin surfaces, i.e. whose both sides are physical (e.g. a solar array) must be duplicated and tagged - the i-th surfNode of a surf must be "opposite" the i-th surfEdge (i-th node does not belong to the i-th edge)

Versions and anomalies correction :

Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 JF Roussel, roussel@onecert.frCreation


Version:
0.1
Author:
JF Roussel
See Also:
Serialized Form

Field Summary
private  int[] edgeFlag
          edge flag (int[edgeNb]) to tag thin
surface (2D) and thin wires (1D):
- bit 0: 0 = edge of a surface
1 = not a real edge but a wire
- bit 1: 0 = edge of a regular surface
1 = edge of a thin surface
hence: - edgeFlag=0 if edge of a regular surface
- edgeFlag=1 if this edge is indeed a wire
- edgeFlag=2 if edge of a thin surface
- nodeFlag=3 is forbidden (bits 0 and 1 are exclusive)
private  int[] edgeIndex
          index of the edge in the VolMesh numbering
private  int[] edgeIndexS2
          if a thin surface (edgeFlag = 2), index of the opposite duplicated edge (Side 2) in the same local surface numbering
private  float[] edgeLength
          Edge length
private  int edgeNb
          edge number
private  int[][] edgeNode
          nodes of an edge (int[EdgeNb][2])
private  float[] edgeRadius
          wire real physical radius in case this edge is indeed a wire (wire cylinder not meshed)
private  int[][] edgeSurf
          surfaces on both sides of an edge (int[edgeNb][2]) order is meaningless, negative value if out of mesh
private  Matrix mapNE
          Node to surface connectivity matrix, for nodes and edges belonging to 1D wires only!
private  Matrix mapNEC
          mapNE column-normalised (sum_j Mij = 1)
private  Matrix mapNECT
          transpose of mapNEC
private  Matrix mapNER
          mapNE row-normalised (sum_j Mij = 1)
private  Matrix mapNERT
          transpose of mapNER
private  Matrix mapNS
          Node to surface connectivity matrix
private  Matrix mapNSC
          mapNS column-normalised (sum_j Mij = 1)
private  Matrix mapNSCT
          transpose of mapNSC
private  Matrix mapNSR
          mapNS row-normalised (sum_j Mij = 1)
private  Matrix mapNSRT
          transpose of mapNSR
private  int[] nodeFlag
          node flag (int[nodeNb]) to tag thin
surface (2D) and thin wires (1D). :
- bit 0: 0 = node of a surface
1 = node of a wire-like edge
- bit 1: 0 = node of a regular surface
1 = node of a thin surface
hence:
- nodeFlag=0 if a node of a regular surface
- nodeFlag=1 if a node of a wire-like edge
- nodeFlag=2 if a node of a thin surface
- nodeFlag=3 is forbidden (bits 0 and 1 are exclusive)
private  int[] nodeIndex
          index of the node in the VolMesh numbering
private  int[] nodeIndexS2
          if a thin surface (nodeFlag = 2), index of the opposite duplicated node (Side 2) in the same local surface numbering
private  int nodeNb
          node (points) number
private  float[] surfArea
          Surface area volume
private  int[][] surfEdge
          edges of a surface (int[SurfNb][3])
private  int[] surfFlag
          surface flag (int[surfNb]) to tag thin surfaces. :
- lowest weight bit (bit 0): = 0
- next bit: 0 = regular surface
1 = thin surface
hence:
- surfFlag=0 if a regular surface
- surfFlag=2 if not
private  int[] surfIndex
          index of the surface in the numbering of the volume mesh this surface mesh is the boundary of
private  int[] surfIndexS2
          if a thin surface (surfFlag = 2), index of the opposite numbering surface (Side 2) in the same local surface numbering
private  int surfNb
          surface (triangle) number
private  int[][] surfNode
          nodes of a surface (int[SurfNb][3])
private  float[][] surfNormal
          Normal to a Surface (SurfNormal[i][j] = j-th coordinate of i-th surface normal), they point out of the volume, (hence into the spacecraft)
private  float[] surfThickness
          surface real physical thickness in case it is considered as thin from the mesh viewpoint (thickness not meshed, surfFlag = 2)
private  ThreeDUnstructVolMesh vm
          volume mesh
private  boolean volNodeRenumbered
          Has the volume node renumbering be performed ?
private  float[][] xyz
          nodes coordinates (xyz[i][j] = j-th coordinate of i-th node)
 
Fields inherited from class spis.Surf.SurfMesh.SurfMesh
 
Constructor Summary
ThreeDUnstructSurfMesh(Geom geometry, ThreeDUnstructVolMesh volMesh, int surfNbr, int edgeNbr, int nodeNbr, int[][] surfEdges, int[][] surfNodes, int[][] edgeNodes, int[] surfFlags, int[] surfIndices, int[] surfIndicesS2, float[] surfThicknesses, int[] edgeFlags, int[] edgeIndices, int[] edgeIndicesS2, float[] edgeRadiuses, int[] nodeFlags, int[] nodeIndices, int[] nodeIndicesS2, float[][] xyzCoord)
          Main constructor with basic sufficient data provided.
 
Method Summary
 void advance(PartList pl, VectTable dx)
          Advances the particles of particle list pl from their current position to their next position, defined by the shift vector dx.
 float[] applyScalFunction(Centring centring, ScalFunctionOfVect f)
          Applies a function of the position to the nodes (or surfaces/cells... depending on centring), and returns the result (f(xi,yi,zi)) as a float array.
 float[][] applyVectFunction(Centring centring, VectFunctionOfVect f)
          Applies a vectorial function of the position to the nodes (or surfaces/cells... depending on centring), and returns the result (f(xi,yi,zi)) as a float[i][] array.
 VectSurfField buildSurfCentre()
          Builds and returns the table of the surface centre coordinates as a surface-centred VectSurfField
private  void computeMaps()
          Computes mapping matrices:
- between nodes and surfaces (excluding nodes of 1D wires), mapNS*
- between nodes and edges of 1D wires, mapNE*
 ScalSurfField[][] computeNeighbouringData()
          Computes and returns data characterising neighbour cells of a cell (needed for surface conductivity).
 void currentDeposit(PartList pl, ScalSurfField cur)
          Performs the deposit of charges of the particle list pl in the current cur.
 void deposit(PartList pl, ScalSurfField current, int charge, int mass)
          Performs the deposit of charges of the particle list pl in the ScalSurfField current (current is incremented, reset it before if you want to start from 0).
 int[] getEdgeFlag()
           
 ScalSurfField getEdgeLength()
          Returns length of edges
 float[] getEdgeRadius()
          Returns real radius of thin wires
 int getElNb(Centring centring)
          Returns the number of elements of dimension dim of a given centring
 int getElNb(int relDim)
          Returns the number of elements of relative dimension relDim
 VectSurfField getNodeCoord()
          Returns the table of the nodes/points coordinates as node-centred VectSurfField
 int[] getNodeIndex()
          Returns nodeIndex, i.e. index of the nodes in the VolMesh numbering
 ScalSurfField getSurfArea()
          returns surface areas as a ScalSurfField
 int[] getSurfIndex()
          Returns surfIndex, i.e.index of the surface in the numbering of the volume mesh
 int[][] getSurfNode()
          Returns the table of the nodes/points of each surface as an int[][].
 VectSurfField getSurfNormal()
          returns normals to mesh surfaces as a VectSurfField
 float[] getSurfThickness()
          Returns real thickness of thin plates
 void initialise()
          Performs extra mesh initialisations.
 void interpolate(PointList pl, SurfField sf, Table val)
          Interpolates the surface field sf (defined on the mesh nodes/cells/...)
 boolean isVolNodeRenumbered()
           
 void mapField(ScalSurfField fin, ScalSurfField fout, int flag)
          Maps surface fields of different centering into one another (fin into fout).
 void rebuildIndexTables(int[] surfIndexV, int[] edgeIndexV, int[] nodeIndexV, int[] surfFlagV, int[] edgeFlagV, int[] nodeFlagV, int flagMask)
          Obsolete, no longer used.
 void samplePos(IntScalTable indexT, SpaceVectTable posT)
          Performs a random sampling of particle positions.
 void setSurfArea(float[] surfArea)
           
 void setVm(ThreeDUnstructVolMesh volMesh)
          sets volume mesh (pointer, no copy), and orients the surface normals of the surface mesh coming out out of the volume mesh (the order of the surface nodes is modified accordingly).
 void setVolInternNodeNumbering(int[] internNum)
          Updates pointers to volume nodes (nodeIndex and nodeIndex2) when volume nodes are renumbered (checks it is not done a second time).
 void setVolNodeRenumbered(boolean b)
           
 
Methods inherited from class spis.Surf.SurfMesh.SurfMesh
checkIsOnThisMesh, getGeom, getVm, setVm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vm

private ThreeDUnstructVolMesh vm
volume mesh


surfNb

private int surfNb
surface (triangle) number


edgeNb

private int edgeNb
edge number


nodeNb

private int nodeNb
node (points) number


surfEdge

private int[][] surfEdge
edges of a surface (int[SurfNb][3])


surfNode

private int[][] surfNode
nodes of a surface (int[SurfNb][3])


edgeNode

private int[][] edgeNode
nodes of an edge (int[EdgeNb][2])


edgeSurf

private int[][] edgeSurf
surfaces on both sides of an edge (int[edgeNb][2]) order is meaningless, negative value if out of mesh


surfFlag

private int[] surfFlag
surface flag (int[surfNb]) to tag thin surfaces. :
- lowest weight bit (bit 0): = 0
- next bit: 0 = regular surface
1 = thin surface
hence:
- surfFlag=0 if a regular surface
- surfFlag=2 if not


surfIndex

private int[] surfIndex
index of the surface in the numbering of the volume mesh this surface mesh is the boundary of


surfIndexS2

private int[] surfIndexS2
if a thin surface (surfFlag = 2), index of the opposite numbering surface (Side 2) in the same local surface numbering


surfThickness

private float[] surfThickness
surface real physical thickness in case it is considered as thin from the mesh viewpoint (thickness not meshed, surfFlag = 2)


edgeFlag

private int[] edgeFlag
edge flag (int[edgeNb]) to tag thin
surface (2D) and thin wires (1D):
- bit 0: 0 = edge of a surface
1 = not a real edge but a wire
- bit 1: 0 = edge of a regular surface
1 = edge of a thin surface
hence: - edgeFlag=0 if edge of a regular surface
- edgeFlag=1 if this edge is indeed a wire
- edgeFlag=2 if edge of a thin surface
- nodeFlag=3 is forbidden (bits 0 and 1 are exclusive)


edgeIndex

private int[] edgeIndex
index of the edge in the VolMesh numbering


edgeIndexS2

private int[] edgeIndexS2
if a thin surface (edgeFlag = 2), index of the opposite duplicated edge (Side 2) in the same local surface numbering


edgeRadius

private float[] edgeRadius
wire real physical radius in case this edge is indeed a wire (wire cylinder not meshed)


nodeFlag

private int[] nodeFlag
node flag (int[nodeNb]) to tag thin
surface (2D) and thin wires (1D). :
- bit 0: 0 = node of a surface
1 = node of a wire-like edge
- bit 1: 0 = node of a regular surface
1 = node of a thin surface
hence:
- nodeFlag=0 if a node of a regular surface
- nodeFlag=1 if a node of a wire-like edge
- nodeFlag=2 if a node of a thin surface
- nodeFlag=3 is forbidden (bits 0 and 1 are exclusive)


nodeIndex

private int[] nodeIndex
index of the node in the VolMesh numbering


nodeIndexS2

private int[] nodeIndexS2
if a thin surface (nodeFlag = 2), index of the opposite duplicated node (Side 2) in the same local surface numbering


xyz

private float[][] xyz
nodes coordinates (xyz[i][j] = j-th coordinate of i-th node)


surfArea

private float[] surfArea
Surface area volume


edgeLength

private float[] edgeLength
Edge length


surfNormal

private float[][] surfNormal
Normal to a Surface (SurfNormal[i][j] = j-th coordinate of i-th surface normal), they point out of the volume, (hence into the spacecraft)


volNodeRenumbered

private boolean volNodeRenumbered
Has the volume node renumbering be performed ? (to internal numbering)


mapNS

private Matrix mapNS
Node to surface connectivity matrix


mapNSR

private Matrix mapNSR
mapNS row-normalised (sum_j Mij = 1)


mapNSC

private Matrix mapNSC
mapNS column-normalised (sum_j Mij = 1)


mapNSRT

private Matrix mapNSRT
transpose of mapNSR


mapNSCT

private Matrix mapNSCT
transpose of mapNSC


mapNE

private Matrix mapNE
Node to surface connectivity matrix, for nodes and edges belonging to 1D wires only!


mapNER

private Matrix mapNER
mapNE row-normalised (sum_j Mij = 1)


mapNEC

private Matrix mapNEC
mapNE column-normalised (sum_j Mij = 1)


mapNERT

private Matrix mapNERT
transpose of mapNER


mapNECT

private Matrix mapNECT
transpose of mapNEC

Constructor Detail

ThreeDUnstructSurfMesh

public ThreeDUnstructSurfMesh(Geom geometry,
                              ThreeDUnstructVolMesh volMesh,
                              int surfNbr,
                              int edgeNbr,
                              int nodeNbr,
                              int[][] surfEdges,
                              int[][] surfNodes,
                              int[][] edgeNodes,
                              int[] surfFlags,
                              int[] surfIndices,
                              int[] surfIndicesS2,
                              float[] surfThicknesses,
                              int[] edgeFlags,
                              int[] edgeIndices,
                              int[] edgeIndicesS2,
                              float[] edgeRadiuses,
                              int[] nodeFlags,
                              int[] nodeIndices,
                              int[] nodeIndicesS2,
                              float[][] xyzCoord)
Main constructor with basic sufficient data provided.
the connectivity to edges is also needed to have the same numbering as in the external framework.
The tables are not copied, the new ThreeDUnstructSurfMesh instance simply points to the provided tables.

Method Detail

initialise

public void initialise()
Performs extra mesh initialisations.
Must be called at the end of the constructor after passed variables are stored.
Tasks performed are:
- initialisation of area/length/normals...
- computation of maps for mapping to/from circuit fields


rebuildIndexTables

public void rebuildIndexTables(int[] surfIndexV,
                               int[] edgeIndexV,
                               int[] nodeIndexV,
                               int[] surfFlagV,
                               int[] edgeFlagV,
                               int[] nodeFlagV,
                               int flagMask)
Obsolete, no longer used. Temporary method, to build tables which where not initialised in the framework, as they should. xxxFlag are assumed to be correctly filled, and xxxIndexYY are assumed allocated but not correctly filled (xxx = surf/edge/node, YY=''/SC/B) both for this surfMesh and the volMesh. The tables xxxIndexYY are built here (again, both for this surfMesh and the volMesh)


currentDeposit

public void currentDeposit(PartList pl,
                           ScalSurfField cur)
Performs the deposit of charges of the particle list pl in the current cur.
For now the deposit is zero order (NGP), hence a surface-centred current is needed.
Units are Coulombs (not Coulombs per surface unit).
In the particle list pl, only the particles arrived on surfaces are taken into account (determined by their flags)

Specified by:
currentDeposit in class SurfMesh

deposit

public void deposit(PartList pl,
                    ScalSurfField current,
                    int charge,
                    int mass)
Performs the deposit of charges of the particle list pl in the ScalSurfField current (current is incremented, reset it before if you want to start from 0).
The number of (phycical) particles is miltiplied by their charge if charge is 1 (not if 0) and by their mass if mass = 1.
In the particle list pl, only the particles arrived this surface are taken into account (determined by their flags)
Ex: deposit(pl, cur, 1, 0) returns the (charge) current onto the surface in cur.
Units-Normalisation: - if charge, charge in elementary charge units
- if mass, mass in amu
- Results are not divided by surface area, they are indeed particle numbers (or charge but not charge par area)
NB: for now, only surface-centred result fields are supported (0-th order method, NGP-like: counts particles on each surface element).

Specified by:
deposit in class SurfMesh

advance

public void advance(PartList pl,
                    VectTable dx)
Advances the particles of particle list pl from their current position to their next position, defined by the shift vector dx. The flags and indices of the particles in PartListare updated (each particle flag indicates the particle status (in_vol/on_surf/null/...) and the index is the index of particle cell or surface) It is basically an intersection computation, the dynamics itself is computed in PartList.move method. Depending on the specialisation of the Surface mesh, this Advance service is first requested from the volume mesh, not the present surface mesh. In case of an unstructured volume mesh, the advance, or interception, service is implemented at volume mesh level, but in case of structured mesh, this service is transferred to the spacecraft surface mesh as in PicUp3D (the surface mesh is of type 2.A. above: Interception/ Physical_spacecraft)

Specified by:
advance in class SurfMesh
Parameters:
pl - List of particles to be advanced
dx - Shift vectors for particles

interpolate

public void interpolate(PointList pl,
                        SurfField sf,
                        Table val)
Interpolates the surface field sf (defined on the mesh nodes/cells/...) at the points of the point list pl (particle positions). The field values are returned in val. The Table of values val must be of the same type as the field (vector/scalar/...) More than the point position may be used in PointList, as e.g. the index of the current surface cell of the particle (unstructured meshes).
NB: similar to homonym method of VolField, but here the need for this method is not so sure
Virtual method, to be implemented in derived classes.

Specified by:
interpolate in class SurfMesh
Parameters:
pl - Point list at which interpolation is requested (input)
sf - Surface Field to be interpolated
val - Table with interpolated values

mapField

public void mapField(ScalSurfField fin,
                     ScalSurfField fout,
                     int flag)
Maps surface fields of different centering into one another (fin into fout).
If flag = 1, the quantity is extensive (which results in sommations),
if flag = 0, it is intensive (which results in averages).
Supported mappings are:
- between nodes and surfaces (excluding nodes of 1D wires, considered as not linked to neighbour triangles),
- between nodes and edges of 1D wires

Specified by:
mapField in class SurfMesh

computeMaps

private void computeMaps()
Computes mapping matrices:
- between nodes and surfaces (excluding nodes of 1D wires), mapNS*
- between nodes and edges of 1D wires, mapNE*


computeNeighbouringData

public ScalSurfField[][] computeNeighbouringData()
Computes and returns data characterising neighbour cells of a cell (needed for surface conductivity). Returned data is a ScalSurfField[][], with:
- result[n][0]: the Ids of n-th neighbour cell (-1 if not existing)
- result[n][1]: length of the edge shared with the n-th neighbour cell
- result[n][2]: distance from the centre of this cell to the edge shared with the n-th neighbour cell
- result[n][3]: distance from the centre of the n-th neighbour to the common edge
In the generic routine, the range of n values is arbitrary (0-3 for quadrangle meshes), here it is 0-2.

Specified by:
computeNeighbouringData in class SurfMesh
Returns:

setVolInternNodeNumbering

public void setVolInternNodeNumbering(int[] internNum)
Updates pointers to volume nodes (nodeIndex and nodeIndex2) when volume nodes are renumbered (checks it is not done a second time).


applyScalFunction

public float[] applyScalFunction(Centring centring,
                                 ScalFunctionOfVect f)
Applies a function of the position to the nodes (or surfaces/cells... depending on centring), and returns the result (f(xi,yi,zi)) as a float array.

Specified by:
applyScalFunction in class SurfMesh

applyVectFunction

public float[][] applyVectFunction(Centring centring,
                                   VectFunctionOfVect f)
Applies a vectorial function of the position to the nodes (or surfaces/cells... depending on centring), and returns the result (f(xi,yi,zi)) as a float[i][] array.

Specified by:
applyVectFunction in class SurfMesh

samplePos

public void samplePos(IntScalTable indexT,
                      SpaceVectTable posT)
Performs a random sampling of particle positions. Particles of index n are generated on surface n.

Specified by:
samplePos in class SurfMesh
Parameters:
indexT - surface index of each particle (input)
posT - position of each particle (output)

getElNb

public int getElNb(Centring centring)
Returns the number of elements of dimension dim of a given centring

Specified by:
getElNb in class SurfMesh

getElNb

public int getElNb(int relDim)
Returns the number of elements of relative dimension relDim

Specified by:
getElNb in class SurfMesh

getSurfNormal

public VectSurfField getSurfNormal()
returns normals to mesh surfaces as a VectSurfField

Specified by:
getSurfNormal in class SurfMesh

getSurfArea

public ScalSurfField getSurfArea()
returns surface areas as a ScalSurfField

Specified by:
getSurfArea in class SurfMesh

getEdgeLength

public ScalSurfField getEdgeLength()
Description copied from class: SurfMesh
Returns length of edges

Specified by:
getEdgeLength in class SurfMesh
Returns:
Returns the edgeLength as a ScalSurfField.

getNodeCoord

public VectSurfField getNodeCoord()
Returns the table of the nodes/points coordinates as node-centred VectSurfField


buildSurfCentre

public VectSurfField buildSurfCentre()
Builds and returns the table of the surface centre coordinates as a surface-centred VectSurfField


getSurfNode

public int[][] getSurfNode()
Returns the table of the nodes/points of each surface as an int[][].


getSurfIndex

public int[] getSurfIndex()
Returns surfIndex, i.e.index of the surface in the numbering of the volume mesh


getNodeIndex

public int[] getNodeIndex()
Returns nodeIndex, i.e. index of the nodes in the VolMesh numbering


setVm

public void setVm(ThreeDUnstructVolMesh volMesh)
sets volume mesh (pointer, no copy), and orients the surface normals of the surface mesh coming out out of the volume mesh (the order of the surface nodes is modified accordingly).


isVolNodeRenumbered

public boolean isVolNodeRenumbered()
Returns:
true if node renumbering is on (defined by CutHill McKee renumbering)

setVolNodeRenumbered

public void setVolNodeRenumbered(boolean b)
Parameters:
b - declare if node renumbering is on (defined by CutHill McKee renumbering)

getEdgeRadius

public float[] getEdgeRadius()
Description copied from class: SurfMesh
Returns real radius of thin wires

Specified by:
getEdgeRadius in class SurfMesh
Returns:

getSurfThickness

public float[] getSurfThickness()
Description copied from class: SurfMesh
Returns real thickness of thin plates

Specified by:
getSurfThickness in class SurfMesh
Returns:

getEdgeFlag

public int[] getEdgeFlag()
Specified by:
getEdgeFlag in class SurfMesh
Returns:
Returns the edgeFlag.

setSurfArea

public void setSurfArea(float[] surfArea)
Parameters:
surfArea - The surfArea to set.