#include <SnowDrift.h>
Public Member Functions | |
SnowDriftA3D (const mio::DEMObject &dem, const mio::Config &cfg) | |
virtual | ~SnowDriftA3D () |
virtual void | setSnowSurfaceData (const mio::Grid2DObject &cH_in, const mio::Grid2DObject &sp_in, const mio::Grid2DObject &rg_in, const mio::Grid2DObject &N3_in, const mio::Grid2DObject &rb_in) |
void | setSnowPack (SnowpackInterface &mysnowpack) |
virtual void | Compute (const mio::Date &calcDate) |
Main: Calls the essential routines. More... | |
bool | isNewWindField (const unsigned int current_step) |
void | setMeteo (const unsigned int &steps, const mio::Grid2DObject &new_psum, const mio::Grid2DObject &new_psum_ph, const mio::Grid2DObject &new_p, mio::Grid2DObject &vw, mio::Grid2DObject &dw, const mio::Grid2DObject &new_rh, const mio::Grid2DObject &new_ta, const std::vector< mio::MeteoData > &vecMeteo) |
Sets the required meteo fields. More... | |
void | GetTResults (double outtime_v[15], double outtime_tau[15], double outtime_salt[15], double outtime_diff[15]) |
double | getTiming () const |
void | Destroy () |
std::string | getGridsRequirements () const |
Protected Member Functions | |
void | Initialize () |
Initialize for snowdrift Allocate saltation variable, snow height and new snow mass per bottom element. More... | |
void | ConstructElements () |
void | InitializeNodes (const mio::Grid3DObject &z_readMatr) |
Initialize nodes Each (3D) node receives its (x,y,z), slope, aspect, normals. More... | |
void | CompleteNodes () |
Initialize concentration according to the rain rate (uniform) Now calculate the missing parameters Slope in direction of the wind. More... | |
virtual void | compSaltation (bool setbound) |
Calculate Saltation Fluxes for all Bottom Elements. More... | |
virtual void | SnowMassChange (bool setbound, const mio::Date &calcDate) |
virtual void | Suspension () |
virtual void | Diffusion (double deltaT, double &diff_max, double t) |
virtual void | Sublimation () |
Sublimation Calculates drifting snow sublimation at every node of the concentration field. More... | |
double | terminalFallVelocity (const double Radius, const double Temperature, const double RH, const double altitude) |
Terminal fall velocity NB assumed to be 0.5. More... | |
double | calcS (const double concentration, const double sublradius, const double dmdt) |
Calculate sublimation The mass change of a single particle is now extended to all particles. More... | |
double | calcSubldM (const double Radius, const double AirTemperature, const double RH, const double WindSpeed, const double altitude) |
Calculate sublimation mass change This function calculates the mass change of a single ice particle for the given conditions. More... | |
double | reynoldsNumberforFallingParticles (const double Radius, const double Windspeed, const double AirTemperature, const double RH, const double altitude) |
Reynolds number Calculate the Reynolds number for a falling particle. More... | |
double | ventilationVelocity (const double Radius, const double Windspeed, const double AirTemperature, const double RH, const double altitude) |
Ventilation velocity. More... | |
double | waterVaporDensity (const double Temperature, const double VaporPressure) |
double | RH_from_q (const double AirTemp, const double q, const double altitude) |
Relative humidity Gives the relative humidity for a given air temperature and specific humidity. More... | |
void | initializeTRH () |
Initialize RH, T and q Initialize fields of humidity and temperature, necessary for sublimation calculations. More... | |
virtual void | Jacobian (double *DETERMINANTJ, double J[][3], const int element, const double *P, int k, const int ix, const int iy, const int iz) |
Compute Jacobian This function calculates the Jacobian at the given point P and and stores the value of its determinant at point P in the global variable DETERMINANTJ[k] the input value is the respective element, the position where to store the DETERMINANTJ[k], and the function is of type void, the Jacobian matrix J and the integration point P and the DETERMINANTJ array. More... | |
virtual void | J0fun (double J0[3][3], const double J[3][3]) |
J0 function computes the matrix of cofactors of the input matrix J and stores it in J0. More... | |
virtual double | GQIntB (double *DETERMINANTJ, const int i, const int j) |
GQIntB returns the integral of the product of basis functions i and j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners. More... | |
virtual double | GQIntC (double *DETERMINANTJ, const double J0M[3][3][8], const int i, const int j, const double b[3], const double K[3][3]) |
GQIntC returns the integral of the product of the gradients of basis functions i and j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners. More... | |
virtual double | GQIntApdx (double DETERMINANTJ[], const double J0M[3][3][8], const int i, const int j, double b[], const double deltak) |
GQIntApdx returns the integral of the product of a basis function i and the gradient of basis function j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners. More... | |
virtual double | GQIntAdxdx (double *DETERMINANTJ, double J0M[3][3][8], const int i, const int j, double *b, const double deltak) |
GQIntAdxdx ... More... | |
virtual void | TTfun (double TT[3][8], const double P[]) |
TT function TTfun is a function calculating the values of the partial derivative of phi at the point P and putting them in a (3,8) array. More... | |
virtual void | phi (double *PHI, double *P) |
Phi - shape functions Calculates the value of the 8 shape functions at point P. More... | |
virtual void | setQuadraturePoints () |
virtual void | matmult (CDoubleArray &res, const CDoubleArray &x, double *sm, int *ijm) |
matmult computes a matrix vector product for a sparse matrix More... | |
virtual void | matmult (CDoubleArray &res, const CDoubleArray &x, const CDoubleArray &sA, const CIntArray &colA, CIntArray &rowA) |
matmult computes a matrix vector product for a sparse matrix of CSR format More... | |
virtual void | transmult (CDoubleArray &res, const CDoubleArray &x, double *sm, int *ijm) |
transmult this is the transmult function that multiplies the vector x by the transpose of the matrix M in its sparse form sm, ijm More... | |
virtual void | SolveEquation (int timeStep, int maxTimeStep, const param_type param) |
Solve the advection diffusion equation. More... | |
virtual void | bicgStab (CDoubleArray &result, CDoubleArray &rhs, const CDoubleArray &sA, const CIntArray &colA, CIntArray &rowA, const int nmax, const double tol, double &testres) |
bicgStab iterative equation solver iterative equation solver Tests : Tested by the followin procedure: given a sparse matrix A (CRS-format) characterized by colA and rowA and an arbitrary, or rather: a few nontrivial examples of a vector x. For each x matmult(y,x,sA,rowA,colA) and bicgStab(result,y,sA,colA,rowA,...) have been computed and then verified that result=x More... | |
virtual void | assembleSystem (CIntArray &colA, CIntArray &rowA, CDoubleArray &sA, CDoubleArray &sB, CDoubleArray &Psi, CDoubleArray &f, const double dt) |
Assemble System loop over all elements, updates the system matrices A, B and the 'bare' right hand side (rhs) of the system, in other words: prepares the system prior to the inclusion of dirichlet boundary conditions. More... | |
virtual void | applyBoundaryValues (CDoubleArray &c00, CDoubleArray &Psi) |
applyBoundaryValues Apply boundary values to all elements Author: Marc Ryser More... | |
virtual void | prepareSolve () |
prepareSolve Some preparations to solve a 3D-field. More... | |
virtual void | computeDiffusionTensor (double K[3][3], const unsigned int ix, const unsigned int iy, const unsigned int iz) |
Compute diffusion tensor Computes the diffusion tensor of an element, accesses the nodes array and the nodeMap array. More... | |
virtual void | computeDriftVector (double b[3], const unsigned int ix, const unsigned int iy, const unsigned int iz) |
Compute the drift vector of an element. More... | |
virtual void | computeElementParameters (const int &element, double DETERMINANTJ[8], double J0M[3][3][8], double J0[3][3], double J[3][3], double b[3], double K[3][3], double &deltak, double &qualla, const int ix, const int iy, const int iz) |
Compute parameters of the SUPG method Compute the parameters of the SUPG method for each element. More... | |
virtual void | computeElementSystem (int &element, int &nDofNodes, int *dofNode, double Ael[9][9], double Del[9][9], bool stationary, double DETERMINANTJ[8], double J0M[3][3][8], double b[3], double K[3][3], double &deltak, const double &dt, CDoubleArray &f, CDoubleArray &Psi) |
compute element system .... More... | |
virtual void | computeDirichletBoundaryValues (int element, double DETERMINANTJ[8], double J0M[3][3][8], double J0[3][3], double b[3], double K[3][3], double deltak, int spec[8], int length_spec, int length_complSpec, CDoubleArray &c00, CDoubleArray &Psi) |
virtual void | addElementMatrix (CDoubleArray &sA, const CIntArray &colInd, const CIntArray &rowPtr, const double Bel[9][9], const int element, const int *spec, const int length_spec) |
Add element matrix given a sparse matrix A in CSR format ( specified by sA, colInd, rowPtr) and the element matrix Bel, this function adds the element contributions to the global ones ; the first length_spec entries of the vector spec contains the indices of the matrix which are inserted Comments : Beware of the enumeration of the matrix sA (size is one bigger than required, zero index is unused => dangerous accesses nodeMap, nodeMap. More... | |
virtual void | computeDepositionFlux (const CDoubleArray &c, const double theta) |
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i.e. (b c + K grad c) at the artificial layer of nodes and write it to the flux_x,y,z variable Comments : Beware of the enumeration of elements and nodes, Must be consistent with SnowDriftA3D::SnowMassChange(...) Note: this solution has temporary character since flux_x has size (nx-1)*(ny-1) and therefore only internal fluxes are written More... | |
virtual void | computeDepositionFluxSublimation (const CDoubleArray &c, const double theta) |
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i.e. (b c + K grad c) at the artificial layer of nodes and write it to the flux_x,y,z variable Comments : Beware of the enumeration of elements and nodes, Must be consistent with SnowDriftA3D::SnowMassChange(...) Note: this solution has temporary character since flux_x has size (nx-1)*(ny-1) and therefore only internal fluxes are written More... | |
void | setBC_BottomLayer (CDoubleArray &var00, const param_type param) |
Set Bottom Boundary Condition Set the boundary condition of bottom layer +intialize concentration in rest of domain. More... | |
void | values_nodes_to_elements (const mio::Grid3DObject &nodesGrid, CDoubleArray &elementsArray) |
nodes_to_elements More... | |
void | values_elements_to_nodes (mio::Grid3DObject &nodesGrid, const CDoubleArray &elementsArray) |
elements_to_nodes Extract a 3D-grid of nodes from an array of elements More... | |
void | setRobinBoundaryCondition (const aspect_type aspect, const double gamma_val, const int ix, const int iy, const int iz, CDoubleArray &var00, const param_type param) |
Set Robin Boundary Condition. More... | |
virtual void | InitializeFEData () |
Initializes system size and all data members which are required for the finite element solution. More... | |
virtual void | prepareSparseMatrix (CIntArray &colA, CIntArray &rowA, CDoubleArray &adjA) |
prepare sparse matrix Description : generates the auxiliary arrays (i.e. the arrays row-pointer and column-index) for a sparse matrix of CSR format. The sparsity pattern is assumed to be given by a finite element problem on a nodal mesh which is topologically equivalent to a simple cubic lattice with N=nx*ny*nz number of nodes. For these hexahedral elements each node belongs to 8 elements. Hence, the support of the basis function of that given node overlaps with the support of 27 nodes' basis functions (including its own) which implies 27 nonzero entries per node in the interior of the domain. On the surface one has 18, 12 and 8 nonzero entries depending on the location (interior, edge, corner) From that the total number of nonzero elements can be computed. Usually, the dimensions of colA and rowA are nNZ and nDOF + 1,respectively where the last entry of rowA holds the number of nonzeros. Note: Here the sizes are nNZ + 1 for colA nDOF + 2 for rowA. This stems from the fact that originally Numerical recipes routines are used for the sparse matrix arrays in numerical recipes start with index one. In order to adopt them an the size was simply enlarged by one and the zero-index entry is unused. => fragile More... | |
virtual void | initializeSystem (CIntArray &colA, CIntArray &rowA, CDoubleArray &sA, CDoubleArray &sB, CDoubleArray &rhs, CDoubleArray &f, CDoubleArray &Psi, CDoubleArray &var, CDoubleArray &var00, const param_type param) |
Initialize system initializes vectors for the algorithm required for each time step. More... | |
virtual void | resetArray (CDoubleArray &sA) |
virtual void | resetArray (CIntArray &sA) |
virtual void | classifySubdomain () |
Description... this functions sets summation limits for the loops over boundary elements (faces,bars,corners), presently the assemble routines depend on these limits => fragile the values of the limits is also affected by the enumeration of the elements presently the the first element has the number 1 (instead of 0) => even more fragile. More... | |
virtual int | numberOfNonzeros () |
Number of nonzero elements of the finite element system matrix Description : computes the number of nonzero elements of the finite element system matrix, assumes a rectangular domain with simple cubic connectivity of size nx ny nz and linear elements. Then the support of the basis function at each of the (nx-2)*(ny-2)*(nz-2) degrees of freedom overlaps with the support of the basis functions of a certain number of nodes. The number of these nodes depends on the location of the degree of freedom. This defines four classes of dofs: interior (= adjacent to 0 boundary nodes) face (= adjacent to one boundary node) bar (= adjacent to two boundary nodes) and corner (= adjacent to three boundary nodes) where here adjacency refers to the simple cubic lattice graph. More... | |
void | iterativeSublimationCalculation (int timeStep, int maxTimeStep) |
Calculate the steady state sublimation in several steps. Single feedbacks can be switched on or off in SnowDrift.h. More... | |
void | zeroRow (int node) |
void | buildWindFieldsTable (const std::string &wind_field_string) |
void | debugOutputs (const mio::Date &calcDate, const std::string &fname, const DRIFT_OUTPUT &filetype) |
void | writeOutput (const std::string &fname) |
Write output Writes the values of several nodes-fields. More... | |
Protected Attributes | |
Saltation | saltation_obj |
double | time_v [15] |
double | time_tau [15] |
double | time_salt [15] |
double | time_diff [15] |
int | DOITERATION |
double | auxLayerHeight |
double | station_altitude |
mio::IOManager | io |
SnowpackInterface * | snowpack |
mio::Timer | timer |
mio::Grid2DObject | cH |
mio::Grid2DObject | sp |
mio::Grid2DObject | rg |
mio::Grid2DObject | N3 |
mio::Grid2DObject | rb |
unsigned int | nx |
unsigned int | ny |
unsigned int | nz |
unsigned int | nDOF |
unsigned int | nNodes |
unsigned int | nElements |
unsigned int | nNZ |
CDoubleArray | sA |
CDoubleArray | sB |
CIntArray | colA |
CIntArray | rowA |
CDoubleArray | Psi |
CDoubleArray | c |
CDoubleArray | q |
CDoubleArray | T |
CDoubleArray | rhs |
CDoubleArray | f |
CDoubleArray | c00 |
CDoubleArray | q00 |
CDoubleArray | T00 |
CDoubleArray | precond |
CDoubleArray | gNeumann |
CDoubleArray | gDirichlet |
CDoubleArray | gamma |
CIntArray | nnzA |
CDoubleArray | adjA |
double | qualla |
double | theta |
mio::Array2D< int > | nz_face |
mio::Array2D< int > | ny_face |
mio::Array2D< int > | nx_face |
mio::Array2D< int > | nz_bar |
mio::Array2D< int > | ny_bar |
mio::Array2D< int > | nx_bar |
mio::Array2D< int > | nz_interior |
mio::Array2D< int > | ny_interior |
mio::Array2D< int > | nx_interior |
CIntArray | n_corner |
mio::Array2D< double > | qPoint |
CElementArray | nodeMap |
CElementArray | dofMap |
CDoubleArray | flux_x |
CDoubleArray | flux_y |
CDoubleArray | flux_z |
CDoubleArray | flux_x_subl |
CDoubleArray | flux_y_subl |
CDoubleArray | flux_z_subl |
bool | new_wind_status |
CElementArray | elems |
mio::Array2D< double > | saltation |
mio::Array2D< double > | c_salt |
mio::Array2D< double > | mns_subl |
mio::Array2D< double > | mns_nosubl |
mio::Array2D< double > | dif_mns_subl |
mio::Grid2DObject | mns |
mio::Grid2DObject | vw |
mio::Grid2DObject | rh |
mio::Grid2DObject | ta |
mio::Grid2DObject | p |
mio::Grid2DObject | psum |
mio::Grid2DObject | psum_ph |
double | ta_1D |
mio::Date | skip_date |
mio::Grid3DObject | nodes_x |
mio::Grid3DObject | nodes_y |
mio::Grid3DObject | nodes_z |
mio::Grid3DObject | nodes_sy |
mio::Grid3DObject | nodes_sx |
mio::Grid3DObject | nodes_slope |
mio::Grid3DObject | nodes_wstar |
mio::Grid3DObject | nodes_u |
mio::Grid3DObject | nodes_v |
mio::Grid3DObject | nodes_w |
mio::Grid3DObject | nodes_K |
mio::Grid3DObject | nodes_e |
mio::Grid3DObject | nodes_c |
mio::Grid3DObject | nodes_Tair |
mio::Grid3DObject | nodes_Tair_ini |
mio::Grid3DObject | nodes_q |
mio::Grid3DObject | nodes_q_ini |
mio::Grid3DObject | nodes_RH |
mio::Grid3DObject | nodes_Subl |
mio::Grid3DObject | nodes_Subl_ini |
mio::Grid3DObject | nodes_WindVel |
mio::Grid3DObject | nodes_tmp_c |
bool | STATIONARY |
std::vector< struct WIND_FIELD > | wind_fields |
int | wind_field_index |
Static Protected Attributes | |
static const double | kinematicViscosityAir = 1.3E-5 |
static const double | USTAR =0.87 |
static const double | molecularWeightofWater = 18.015E-3 |
static const double | thermalConductivityofAtm = 0.024 |
static const double | c_red = 1.0 |
static const double | grain_size = 0.000680 |
static const double | tau_thresh = 0.094 |
static const double | z0 = 0.01 |
static const bool | thresh_snow = true |
SnowDriftA3D::SnowDriftA3D | ( | const mio::DEMObject & | dem, |
const mio::Config & | cfg | ||
) |
|
virtual |
|
protectedvirtual |
Add element matrix given a sparse matrix A in CSR format ( specified by sA, colInd, rowPtr) and the element matrix Bel, this function adds the element contributions to the global ones ; the first length_spec entries of the vector spec contains the indices of the matrix which are inserted Comments : Beware of the enumeration of the matrix sA (size is one bigger than required, zero index is unused => dangerous accesses nodeMap, nodeMap.
sA | |
colInd | |
rowPtr | |
Bel | |
element | |
spec | |
length_spec |
|
protectedvirtual |
applyBoundaryValues Apply boundary values to all elements Author: Marc Ryser
var00 | initial variable |
Psi | vector for incorporating inhomogeneous Dirichlet BC |
|
protectedvirtual |
Assemble System loop over all elements, updates the system matrices A, B and the 'bare' right hand side (rhs) of the system, in other words: prepares the system prior to the inclusion of dirichlet boundary conditions.
colA | column index to locate within sparse matrix |
rowA | row index |
sA | "system matrix" |
sB | "system matrix" |
Psi | vector for incorporating inhomogeneous Dirichlet BC |
f | source in diffusion equation |
dt |
|
protectedvirtual |
bicgStab iterative equation solver iterative equation solver Tests : Tested by the followin procedure: given a sparse matrix A (CRS-format) characterized by colA and rowA and an arbitrary, or rather: a few nontrivial examples of a vector x. For each x matmult(y,x,sA,rowA,colA) and bicgStab(result,y,sA,colA,rowA,...) have been computed and then verified that result=x
res | result |
rhs | |
sA | |
colA | |
rowA | |
nmax | max number of iterations |
tol | tolerance |
|
protected |
|
protected |
Calculate sublimation The mass change of a single particle is now extended to all particles.
concentration | snow concentration |
sublradius | radius of a single particle |
dmdt | mass change of a single particle due to sublimation |
|
protected |
Calculate sublimation mass change This function calculates the mass change of a single ice particle for the given conditions.
Radius | radius of the ice particle |
AirTemperature | |
RH | relative humidity |
WindSpeed | magnitude of the wind |
|
protectedvirtual |
Description... this functions sets summation limits for the loops over boundary elements (faces,bars,corners), presently the assemble routines depend on these limits => fragile the values of the limits is also affected by the enumeration of the elements presently the the first element has the number 1 (instead of 0) => even more fragile.
This setting will become important for the domain decomposition, since then an element on the domain boundary is not necessarily an element of the physical boundary, and these array account for that. Note: these summation limits are related to the number of nodes, the number of elements, the number of dofs and accordingly the number of nonzero matrix elemens in the system matrix. It would be better to have one class which holds all these information consistently.
|
protected |
Initialize concentration according to the rain rate (uniform) Now calculate the missing parameters Slope in direction of the wind.
CompleteNodes
|
protectedvirtual |
Calculate Saltation Fluxes for all Bottom Elements.
setbound | bool |
|
virtual |
Main: Calls the essential routines.
calcDate | date of current time step |
|
protectedvirtual |
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i.e. (b c + K grad c) at the artificial layer of nodes and write it to the flux_x,y,z variable Comments : Beware of the enumeration of elements and nodes, Must be consistent with SnowDriftA3D::SnowMassChange(...) Note: this solution has temporary character since flux_x has size (nx-1)*(ny-1) and therefore only internal fluxes are written
CDoubleArray&c | Concentration of snow |
theta | height above bottom of element |
|
protectedvirtual |
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i.e. (b c + K grad c) at the artificial layer of nodes and write it to the flux_x,y,z variable Comments : Beware of the enumeration of elements and nodes, Must be consistent with SnowDriftA3D::SnowMassChange(...) Note: this solution has temporary character since flux_x has size (nx-1)*(ny-1) and therefore only internal fluxes are written
CDoubleArray&c | Concentration of snow |
theta | height above bottom of element |
|
protectedvirtual |
Compute diffusion tensor Computes the diffusion tensor of an element, accesses the nodes array and the nodeMap array.
element | element number |
K | diffusion coefficient |
layer | layer of the element |
|
protectedvirtual |
|
protectedvirtual |
Compute the drift vector of an element.
element | element number |
b | drift vector |
|
protectedvirtual |
Compute parameters of the SUPG method Compute the parameters of the SUPG method for each element.
element | Element number |
DETERMINANTJ | Determinant of Jacobian matrix |
J0M | |
J0 | JO matrix |
J | Jacobian matrix |
b | drift vector |
K | Diffusion tensor |
&deltak | parameter SUPG method |
&qualla | parameter SUPG method (to vary delta_k) |
|
protectedvirtual |
compute element system ....
element | element number |
nDofNodes | degrees of freedom of element |
Ael | |
Del | |
stationary | |
DETERMINANTJ | |
J0M | |
b | wind field |
K | diffusion tensor |
deltak | parameter |
dt | |
f | source |
Psi |
|
protected |
|
protected |
void SnowDriftA3D::Destroy | ( | ) |
|
protectedvirtual |
std::string SnowDriftA3D::getGridsRequirements | ( | ) | const |
double SnowDriftA3D::getTiming | ( | ) | const |
void SnowDriftA3D::GetTResults | ( | double | outtime_v[15], |
double | outtime_tau[15], | ||
double | outtime_salt[15], | ||
double | outtime_diff[15] | ||
) |
|
protectedvirtual |
GQIntAdxdx ...
DETERMINANTJ | determinant of Jacobian |
J0M | |
i | pointer |
j | pointer |
*b | drift vector |
deltak | parameter SUPG method |
|
protectedvirtual |
GQIntApdx returns the integral of the product of a basis function i and the gradient of basis function j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners.
DETERMINANTJ | determinant of Jacobian |
J0M | |
i | nr basis function |
j | nr basis function |
b | drift vector |
deltak | parameter SUPG method |
|
protectedvirtual |
GQIntB returns the integral of the product of basis functions i and j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners.
DETERMINANTJ | determinant of Jacobian |
i | nr shape function |
j | nr shape function |
|
protectedvirtual |
GQIntC returns the integral of the product of the gradients of basis functions i and j over a hexahedral element using gaussian quadrature, DETERMINANTK[0],...DETERMINANTK[7] contains the determinant of the jacobian of the mapping onto the unit cube evaluated at the corners.
DETERMINANTJ | determinant of Jacobian |
J0M | |
i | pointer/index |
j | pointer/index |
b | drift vector |
K | Diffusion tensor |
|
protected |
Initialize for snowdrift Allocate saltation variable, snow height and new snow mass per bottom element.
|
protectedvirtual |
Initializes system size and all data members which are required for the finite element solution.
|
protected |
Initialize nodes Each (3D) node receives its (x,y,z), slope, aspect, normals.
|
protectedvirtual |
Initialize system initializes vectors for the algorithm required for each time step.
colA | array determining the sparsity pattern |
rowA | array determining the sparsity pattern |
sA | system matrix in compressed sparse row (CSR) storage format |
sB | system matrix in compressed sparse row (CSR) storage format |
rhs | vector which contains the right hand side of the linear system |
f | source term in the advection/diffusion equation (sublimation amount) |
Psi | auxiliary vector for incorporating inhomogeneous Dirichlet boundary conditions |
var | variable for which equation has to be solved (Humidity, Concentration or Temperature) |
var00 | boundary condition at bottom + initial condition interior domain of variable var |
|
protected |
Initialize RH, T and q Initialize fields of humidity and temperature, necessary for sublimation calculations.
bool SnowDriftA3D::isNewWindField | ( | const unsigned int | current_step | ) |
|
protected |
Calculate the steady state sublimation in several steps. Single feedbacks can be switched on or off in SnowDrift.h.
|
protectedvirtual |
J0 function computes the matrix of cofactors of the input matrix J and stores it in J0.
J0 | matrix of cofactors (transpose of the adjoint of J) |
J | Jacobian matrix |
|
protectedvirtual |
Compute Jacobian This function calculates the Jacobian at the given point P and and stores the value of its determinant at point P in the global variable DETERMINANTJ[k] the input value is the respective element, the position where to store the DETERMINANTJ[k], and the function is of type void, the Jacobian matrix J and the integration point P and the DETERMINANTJ array.
DETERMINANTJ | Determinant of Jacobian matrix |
J | Jacobian matrix |
element | element number |
P | point where Jacobian has to be calculated |
k | for storing Jacobian at DETERMINANTJ(k) |
|
protectedvirtual |
matmult computes a matrix vector product for a sparse matrix of CSR format
y | result (matrix vector product) |
x | |
sA | |
colind | column index |
rowPtr | row index |
|
protectedvirtual |
matmult computes a matrix vector product for a sparse matrix
res | result (matrix vector product) |
x | |
sm | sparse matrix |
ijm |
|
protectedvirtual |
Number of nonzero elements of the finite element system matrix Description : computes the number of nonzero elements of the finite element system matrix, assumes a rectangular domain with simple cubic connectivity of size nx ny nz and linear elements. Then the support of the basis function at each of the (nx-2)*(ny-2)*(nz-2) degrees of freedom overlaps with the support of the basis functions of a certain number of nodes. The number of these nodes depends on the location of the degree of freedom. This defines four classes of dofs: interior (= adjacent to 0 boundary nodes) face (= adjacent to one boundary node) bar (= adjacent to two boundary nodes) and corner (= adjacent to three boundary nodes) where here adjacency refers to the simple cubic lattice graph.
accesses the SnowDrift variable nNZ Comments : For parallelization issues this must be in accordance with the summation limits set in SnowDriftA3D::classifySubdomain()
|
protectedvirtual |
Phi - shape functions Calculates the value of the 8 shape functions at point P.
*PHI | ...................shape functions |
*P | pointer |
|
protectedvirtual |
prepareSolve Some preparations to solve a 3D-field.
|
protectedvirtual |
prepare sparse matrix Description : generates the auxiliary arrays (i.e. the arrays row-pointer and column-index) for a sparse matrix of CSR format. The sparsity pattern is assumed to be given by a finite element problem on a nodal mesh which is topologically equivalent to a simple cubic lattice with N=nx*ny*nz number of nodes. For these hexahedral elements each node belongs to 8 elements. Hence, the support of the basis function of that given node overlaps with the support of 27 nodes' basis functions (including its own) which implies 27 nonzero entries per node in the interior of the domain. On the surface one has 18, 12 and 8 nonzero entries depending on the location (interior, edge, corner) From that the total number of nonzero elements can be computed. Usually, the dimensions of colA and rowA are nNZ and nDOF + 1,respectively where the last entry of rowA holds the number of nonzeros. Note: Here the sizes are nNZ + 1 for colA nDOF + 2 for rowA. This stems from the fact that originally Numerical recipes routines are used for the sparse matrix arrays in numerical recipes start with index one. In order to adopt them an the size was simply enlarged by one and the zero-index entry is unused. => fragile
|
protectedvirtual |
|
protectedvirtual |
|
protected |
Reynolds number Calculate the Reynolds number for a falling particle.
Radius | radius of the particle |
Windspeed | magnitude of the wind |
AirTemperature | |
RH | relative humidity of the air |
|
protected |
Relative humidity Gives the relative humidity for a given air temperature and specific humidity.
AirTemp | Air temperature |
qi | specific humidity |
altitude | Altitude above sea level |
|
protected |
Set Bottom Boundary Condition Set the boundary condition of bottom layer +intialize concentration in rest of domain.
c00 | initial concentration/humidity at bottom |
void SnowDriftA3D::setMeteo | ( | const unsigned int & | steps, |
const mio::Grid2DObject & | new_psum, | ||
const mio::Grid2DObject & | new_psum_ph, | ||
const mio::Grid2DObject & | new_p, | ||
mio::Grid2DObject & | vw, | ||
mio::Grid2DObject & | dw, | ||
const mio::Grid2DObject & | new_rh, | ||
const mio::Grid2DObject & | new_ta, | ||
const std::vector< mio::MeteoData > & | vecMeteo | ||
) |
Sets the required meteo fields.
|
protectedvirtual |
|
protected |
Set Robin Boundary Condition.
aspect | Location of boundary (NSWE or top/bottom) |
gamma_val | (double) constant to approach Dirichlet or Neumann condition |
ix,iy,iz | location |
var00 | Initial 3D field (T, q or c) that needs to be set |
param | Type of field (T, q or c) |
void SnowDriftA3D::setSnowPack | ( | SnowpackInterface & | mysnowpack | ) |
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
Solve the advection diffusion equation.
timeStep | (parameter only for non stationary) |
maxTimeStep | (parameter only for non stationary) |
param | variable that should be solved |
|
protectedvirtual |
Sublimation Calculates drifting snow sublimation at every node of the concentration field.
|
protectedvirtual |
|
protected |
Terminal fall velocity NB assumed to be 0.5.
Radius | radius of the particle |
Temperature | air temperature (K) |
RH | relative humidity of the air (between 0 and 1) |
altitude | Altitude above sea level |
|
protectedvirtual |
transmult this is the transmult function that multiplies the vector x by the transpose of the matrix M in its sparse form sm, ijm
res | result |
x | |
sm | |
ijm | index |
|
protectedvirtual |
TT function TTfun is a function calculating the values of the partial derivative of phi at the point P and putting them in a (3,8) array.
TT | partial derivative of phi at point P (result of this function) |
P | pointer |
|
protected |
elements_to_nodes Extract a 3D-grid of nodes from an array of elements
nodesGrid | grid of nodes that should be filled |
elementsArray | array with elements |
|
protected |
nodes_to_elements
nodesGrid | 3Dgrid of nodes |
elementsArray | array with elements |
|
protected |
Ventilation velocity.
Radius | radius of the particle |
Windspeed | magnitude of the wind |
AirTemperature | |
RH | relative humidity of the air |
altitude | Altitude above sea level |
|
protected |
|
protected |
Write output Writes the values of several nodes-fields.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
staticprotected |