Gems3k
3.1
GEMS3K standalone solver for geochemical equilibria
|
Implements an advanced (level 2) C/C++ interface with GEMS3K for the development of coupled reactive transport codes. More...
#include <nodearray.h>
Public Member Functions | |
TNodeArray (long int nNod) | |
Constructors for 1D arrangement of nodes. | |
TNodeArray (long int asizeN, long int asizeM, long int asizeK) | |
Constructor that uses 3D node arrangement. | |
long int | iNode (long int indN, long int indM, long int indK) const |
Makes one absolute node index from three spatial coordinate indexes. | |
long int | indN (long int ndx) const |
Get i index along N (x axis) from the absolute index ndx. | |
long int | indM (long int ndx) const |
Get j index along M (y axis) from the absolute index ndx. | |
long int | indK (long int ndx) const |
Get k index along K (z axis) from the absolute index ndx. | |
long int | nNodes () const |
Destructor. | |
long int | SizeN () const |
Get number of nodes in N direction (along x coordinate) | |
long int | SizeM () const |
Get number of nodes in M direction (along y coordinate) | |
long int | SizeK () const |
Get number of nodes in K direction (along z coordinate) | |
DATABRPTR * | pNodT0 () const |
Get pointer to array of nodes for the previous time point. | |
DATABRPTR * | pNodT1 () const |
Get pointer to array of nodes for the current time point. | |
bool * | piaNode () const |
Get pointer to IA switches for nodes. | |
char * | ptcNode () const |
Get pointer to boundary condition codes for nodes. | |
long int | RunGEM (long int ndx, long int Mode) |
Calls GEM IPM calculation for a node with absolute index ndx. | |
long int | RunGEM (long int indN, long int indM, long int indK, long int Mode) |
Calls GEM IPM for one node with three indexes (along x,y,z) | |
void | InitNodeArray (const char *dbrfiles_lst_name, long int *nodeTypes, bool getNodT1, bool binary_f) |
Initialization of TNodeArray data structures. | |
void | setNodeArray (long int ndx, long int *nodeTypes) |
Copies data from the work DATABR structure into the node ndx in the node arrays NodT0 and NodT1 (as specified in nodeTypes array) | |
void | checkNodeArray (long int i, long int *nodeTypes, const char *datachbr_file) |
Test setup of the boundary condition for all nodes in the task. | |
double | get_mPH (long int ia, long int nodex, long int PHx) |
Calculate phase (carrier) mass, kg of single component phase. | |
double | get_vPH (long int ia, long int nodex, long int PHx) |
Calculate phase volume, cm3 of single component phase. | |
double | get_bPH (long int ia, long int nodex, long int PHx, long int IC) |
Calculate bulk compositions of single component phase. | |
void | CopyWorkNodeFromArray (long int ndx, long int nNodes, DATABRPTR *anyNodeArray) |
Copies data for a node ndx from the array of nodes anyNodeArray that contains nNodes into the work node data bridge structure. | |
void | MoveWorkNodeToArray (long int ndx, long int nNodes, DATABRPTR *anyNodeArray) |
Moves work node data to the ndx element of the node array anyNodeArray that has nNodes. | |
void | CopyNodeFromTo (long int ndx, long int nNodes, DATABRPTR *arr_From, DATABRPTR *arr_To) |
Copies a node from the node array arr_From to the same place in the node array arr_To. | |
void | logDiffsIC (FILE *diffile, long int t, double at, long int nx, long int every_t) |
Prints difference increments in all nodes (cells) for step t (time point at) | |
void | logProfileAqIC (FILE *logfile, long int t, double at, long int nx, long int every_t) |
Prints dissolved elemental molarities in all cells for time point t / at. | |
void | logProfileTotIC (FILE *logfile, long int t, double at, long int nx, long int every_t) |
Prints total elemental amounts in all cells for time point t / at. | |
void | logProfilePhMol (FILE *logfile, long int t, double at, long int nx, long int every_t) |
Prints amounts of phases in all cells for time point t / at. | |
void | logProfilePhVol (FILE *logfile, long int t, double at, long int nx, long int every_t) |
Prints volumes of phases in all cells for time point t / at. | |
void | logProfileAqDC (FILE *logfile, long int t, double at, long int nx, long int every_t) |
Prints dissolved species molarities in all cells for time point t / at. | |
void | SetGrid (double aSize[3], double(*aGrid)[3]=0) |
Set grid coordinate array use predefined array aGrid or set up regular scale. | |
long int | FindNodeFromLocation (LOCATION cxyz, long int old_node=-1) const |
Finds a node absolute index for the current point location. | |
void | GetNodeSizes (long int ndx, LOCATION cxyz[2]) |
Get 3D sizes for node ( from cxyz[0] - to cxyz[1] ) | |
LOCATION & | GetNodeLocation (long int ndx) |
Get 3D location for node ( from cxyz[0] - to cxyz[1] ) | |
LOCATION & | GetSize () |
Get 3D size of the whole region. | |
double | GetNodeMass (long int ndx, char type, char tcode, unsigned char ips) |
Get full mass particle type in the node ndx. | |
void | MoveParticleMass (long int ndx_from, long int ind_to, char type, char ComponentMode, char tcode, unsigned char ips, double m_v) |
Move a mass m_v from node ndx_from to node ind_to, for particle type. | |
void | databr_to_vtk (fstream &ff, const char *name, double time, long cycle, long int nFields=0, long int(*Flds)[2]=0) |
Writes work node (DATABR structure) to a text VTK file. | |
Static Public Attributes | |
static TNodeArray * | na |
static pointer to this class | |
Protected Member Functions | |
void | allocMemory () |
void | freeMemory () |
LOCATION | getGrid (long int iN, long int jN, long int kN) const |
Prototypes of functions to manage location of particles within nodes relative to the whole grid of the node walls. | |
bool | isLocationInNode (long int ii, long int jj, long int kk, LOCATION cxyz) const |
Test if the location cxyz resides in the node ( ii,jj,kk ) | |
bool | isLocationInNode (long int iNode, LOCATION cxyz) const |
Test if the location cxyz resides in the node with absolute index iNode. | |
Protected Attributes | |
DATABR ** | NodT0 |
array of nodes for previous time point | |
DATABR ** | NodT1 |
array of nodes for current time point | |
long int | anNodes |
Number of allocated nodes. | |
long int | sizeN |
Number of nodes along x direction. | |
long int | sizeM |
Number of nodes along y direction. | |
long int | sizeK |
Number of nodes along z direction. | |
LOCATION | size |
spatial dimensions of the medium ( x, 0, 0 - 1D; x,y,0 - 2D; x,0,z - 2D; x,y,z - 3D ) defines topology of nodes (N of grid points per node): 1D- 2; 2D- 4; 3D- 8 ) relative to coordinate origin (0,0,0) units | |
LOCATION * | grid |
Array of grid point locations, size is anNodes. | |
char * | tcNode |
Node type codes (see databr.h), size anNodes. | |
bool * | iaNode |
GEM IA status for all nodes (true: NEED_GEM_AIA, false: NEED_GEM_SIA) |
Implements an advanced (level 2) C/C++ interface with GEMS3K for the development of coupled reactive transport codes.
Works with DATACH and an array of DATABR structures; uses TNode class
void TNodeArray::CopyNodeFromTo | ( | long int | ndx, |
long int | nNodes, | ||
DATABRPTR * | arr_From, | ||
DATABRPTR * | arr_To | ||
) |
Copies a node from the node array arr_From to the same place in the node array arr_To.
Previous contents of the ndx element in arr_To will be lost. Uses the work node structure which will be newly allocated and contain no data afterwards
long int TNodeArray::FindNodeFromLocation | ( | LOCATION | cxyz, |
long int | old_node = -1 |
||
) | const |
Finds a node absolute index for the current point location.
Uses grid coordinate array grid[]. Performance-important functions to be used e.g. in particle tracking methods
void TNodeArray::InitNodeArray | ( | const char * | dbrfiles_lst_name, |
long int * | nodeTypes, | ||
bool | getNodT1, | ||
bool | binary_f | ||
) | [virtual] |
Initialization of TNodeArray data structures.
Reads in the DBR text input files and copying data from work DATABR structure into the node array
dbrfiles_lst_name | pointer to a null-terminated C string with a path to a text file containing the list of names of DBR input files. Example: file "test-dbr.lst" with a content: "dbr-0.dat" , "dbr-1.dat" , "dbr-2.dat" |
nodeTypes | the initial node contents from DATABR files will be distributed among nodes in array according to the distribution list nodeTypes |
getNodT1 | optional parameter used only when reading multiple DBR files after modeling task interruption in GEM-Selektor |
Reimplemented from TNode.
void TNodeArray::MoveWorkNodeToArray | ( | long int | ndx, |
long int | nNodes, | ||
DATABRPTR * | anyNodeArray | ||
) |
Moves work node data to the ndx element of the node array anyNodeArray that has nNodes.
Previous contents of the ndx element will be lost, work node will be allocated new and will contain no data
long int TNodeArray::nNodes | ( | ) | const [inline, virtual] |