Alpine3D 20241222.625fd38
SnowDrift.h
Go to the documentation of this file.
1/***********************************************************************************/
2/* Copyright 2009-2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3/***********************************************************************************/
4/* This file is part of Alpine3D.
5 Alpine3D is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Alpine3D is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef SNOWDRIFTA3D_H
19#define SNOWDRIFTA3D_H
20
21#define WS0 0.5
22#define TKE 0
23#define SALTATION 1
24#define SUBLIMATION 0
25#define FIELD3D_OUTPUT 0
26#define SUBLIMATION_OUTPUT 0
27#define T_FB 1
28#define Q_FB 1
29#define C_FB 1
30#define READK 0
31#define WRITE_DRIFT_FLUXES 0
32#define dt_diff 0.5
33
34#include <stdio.h>
35#include <math.h>
36#include <stdlib.h>
37#include <iostream>
38#include <meteoio/MeteoIO.h>
39#include <meteoio/plugins/ARPSIO.h>
40
41typedef mio::Array2D<int> CElementArray;
42typedef mio::Array1D<double> CDoubleArray;
43typedef mio::Array1D<int> CIntArray;
44
48
49#pragma GCC diagnostic push
50#pragma GCC diagnostic ignored "-Weffc++"
51
53class EnergyBalance;
54
55typedef enum DRIFT_OUTPUT_ENUM {OUT_CONC, OUT_SUBL} DRIFT_OUTPUT;
56typedef enum PARAM_TYPES {CON,HUM,SUB,TEM,SUB2} param_type;
57typedef enum ASPECT_TYPES {OTHER,BOTTOM} aspect_type;
58
59struct WIND_FIELD {unsigned int start_step;std::string wind;};
60
90 public:
91 SnowDriftA3D(const mio::DEMObject& dem, const mio::Config& cfg);
92
93 virtual ~SnowDriftA3D();
94
95 virtual void setSnowSurfaceData(const mio::Grid2DObject& cH_in, const mio::Grid2DObject& sp_in, const mio::Grid2DObject& rg_in,
96 const mio::Grid2DObject& N3_in, const mio::Grid2DObject& rb_in);
97
98 void setSnowPack(SnowpackInterface &mysnowpack);
99
100 virtual void Compute(const mio::Date& calcDate);
101 bool isNewWindField(const unsigned int current_step) /*const*/;
102 void setMeteo (const unsigned int& steps, const mio::Grid2DObject& new_psum, const mio::Grid2DObject& new_psum_ph,
103 const mio::Grid2DObject& new_p, mio::Grid2DObject& vw, mio::Grid2DObject& dw,
104 const mio::Grid2DObject& new_rh, const mio::Grid2DObject& new_ta,
105 const std::vector<mio::MeteoData>& vecMeteo);
106
107 void GetTResults(double outtime_v[15], double outtime_tau[15], double outtime_salt[15], double outtime_diff[15]);
108
109 double getTiming() const;
110
111 void Destroy();
112
113 std::string getGridsRequirements() const;
114
115 protected:
116 void Initialize();
117 void ConstructElements();
118 void InitializeNodes(const mio::Grid3DObject& z_readMatr);
119 void CompleteNodes();
120
121 virtual void compSaltation(bool setbound);
122 virtual void SnowMassChange(bool setbound, const mio::Date& calcDate);
123 virtual void Suspension();
124 virtual void Diffusion(double deltaT, double &diff_max, double t);
125
126
127 //sublimation functions begin
128 virtual void Sublimation();
129 double terminalFallVelocity(const double Radius, const double Temperature, const double RH, const double altitude);
130 double calcS(const double concentration, const double sublradius, const double dmdt);
131 double calcSubldM(const double Radius, const double AirTemperature, const double RH,const double WindSpeed, const double altitude);
132 double reynoldsNumberforFallingParticles(const double Radius, const double Windspeed, const double AirTemperature, const double RH, const double altitude);
133 double ventilationVelocity(const double Radius, const double Windspeed,const double AirTemperature, const double RH, const double altitude);
134 double waterVaporDensity(const double Temperature,const double VaporPressure);
135 double RH_from_q(const double AirTemp, const double q, const double altitude);
136 void initializeTRH();
137 //sublimation functions end
138
139 //---------------------------------------------------------------------
140 //functions which are required for the fe numerics
141 //defined in SnowDriftFENumerics.cc
142 //---------------------------------------------------------------------
143 //bare numerics for element computations, i.e. integrations, jacobian and auxiliary stuff
144 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);
145 virtual void J0fun(double J0[3][3], const double J[3][3]);
146 virtual double GQIntB(double *DETERMINANTJ,const int i, const int j);
147 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]);
148 virtual double GQIntApdx(double DETERMINANTJ[],const double J0M[3][3][8],const int i, const int j, double b[],const double deltak);
149 virtual double GQIntAdxdx(double *DETERMINANTJ, double J0M[3][3][8],const int i, const int j, double *b,const double deltak);
150 virtual void TTfun(double TT[3][8],const double P[]); // P is a pointer pointing at an adress containing a double
151 virtual void phi(double*PHI, double*P);
152 virtual void setQuadraturePoints();
153
154 //functions required for solving the linear system
155 virtual void matmult(CDoubleArray& res, const CDoubleArray& x, double* sm, int* ijm);
156 virtual void matmult(CDoubleArray& res, const CDoubleArray& x, const CDoubleArray& sA, const CIntArray& colA, CIntArray& rowA);
157 virtual void transmult(CDoubleArray& res, const CDoubleArray& x,double* sm, int* ijm);
158 virtual void SolveEquation(int timeStep, int maxTimeStep, const param_type param );
159 virtual void bicgStab(CDoubleArray& result, CDoubleArray& rhs, const CDoubleArray& sA, const CIntArray& colA, CIntArray& rowA, const int nmax, const double tol, double& testres);
160
161
162 //---------------------------------------------------------------------
163 // finite Element functions, basically wrappers for the bare
164 // numerics. Basically two different "classes" of functions, the
165 // first (assembleSystem, applyBoundaryValues, computeDepositionFlux)
166 // contain loops over all or a particular subset of elements and then
167 // invoke the other class of functions which wrap the numerics for
168 // each element (computeDiffusionTensor, computeDriftVector,
169 // computeElementParameter,
170 // computeElementSystem,computeDirichletBoundaryValues,
171 // addElementMatrix
172 //
173 // all these functions are defined in SnowDriftFEControl.cc
174 //---------------------------------------------------------------------
177 virtual void prepareSolve();
178
179
180 //functions which are required for building the element matrices,
181 virtual void computeDiffusionTensor(double K[3][3], const unsigned int ix, const unsigned int iy, const unsigned int iz);
182 virtual void computeDriftVector(double b[3], const unsigned int ix, const unsigned int iy, const unsigned int iz );
183 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);
184
185 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);
186
187 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);
188
189 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);
190
191 virtual void computeDepositionFlux(const CDoubleArray& c, const double theta);
192 virtual void computeDepositionFluxSublimation(const CDoubleArray& c, const double theta);
193
194
195 //---------------------------------------------------------------------
196 // Functions for initializing the finite element procedure
197 // defined in SnowDriftFEInit.cc
198 //---------------------------------------------------------------------
199 void setBC_BottomLayer(CDoubleArray& var00, const param_type param);
200 void values_nodes_to_elements(const mio::Grid3DObject& nodesGrid, CDoubleArray& elementsArray );
201 void values_elements_to_nodes(mio::Grid3DObject& nodesGrid, const CDoubleArray& elementsArray );
202 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);
203 virtual void InitializeFEData();
206 virtual void resetArray(CDoubleArray& sA);
207 virtual void resetArray(CIntArray& sA);
208 virtual void classifySubdomain();
209 virtual int numberOfNonzeros();
210 void iterativeSublimationCalculation(int timeStep, int maxTimeStep);
211
212 protected:
213 Saltation saltation_obj;
214
215 //Time dependent data output after each computation step (SnowDrift::Compute)
216 double time_v[15], time_tau[15], time_salt[15], time_diff[15];
220
221 mio::IOManager io;
223 mio::Timer timer;
224
225 mio::Grid2DObject cH;
226 mio::Grid2DObject sp;
227 mio::Grid2DObject rg;
228 mio::Grid2DObject N3;
229 mio::Grid2DObject rb;
230
231 //the dimensions of the rectangular domain
232 unsigned int nx, ny, nz;
233
234 // Variables for the finite element solution
235 unsigned int nDOF; //the total number of degrees of freedom
236 unsigned int nNodes; //the total number of nodes
237 unsigned int nElements; //the total number of elements
238 unsigned int nNZ; //the total number of nonzero elements of the system matrix
239
240 //create system matrix in compressed sparse row (CSR) storage format
245
246 //auxiliary vector for incorporating inhomogeneous Dirichlet
247 //boundary conditions
249
250 //vector of nodal concentrations, solution of the linear system
251 CDoubleArray c; //snow concentration in suspension
252 CDoubleArray q; //specific humidity
253 CDoubleArray T; //potential temperature
254
255 //vector which contains the right hand side of the linear system
257
258 //vector of sink/source terms
260
261 //vector which contains boundary and initial conditions
265
266 //vector which contains boundary and initial conditions
268 //mio::Grid3DObject newElements_precond;
269 //LH_BC
273 void zeroRow(int node);
274
275 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276 //LH_DEBUG: Algorithm test BEGIN
279 //LH_DEBUG: Algorithm test END
280 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281
282
283 double qualla;// paramater to vary the deltak coefficient of the SUPG approach
284
285 double theta; // here you can vary the heigth above the point used in
286
287 //the face,bar,corner interior arrays are used for the loops over
288 //all elements and are set in classifySubdomain, see there for details
289 mio::Array2D<int> nz_face;
290 mio::Array2D<int> ny_face;
291 mio::Array2D<int> nx_face;
292
293 mio::Array2D<int> nz_bar;
294 mio::Array2D<int> ny_bar;
295 mio::Array2D<int> nx_bar;
296
297 mio::Array2D<int> nz_interior;
298 mio::Array2D<int> ny_interior;
299 mio::Array2D<int> nx_interior;
300
302
303 //for the quadrature points of the numerical integration scheme
304 mio::Array2D<double> qPoint;
305
306 //array for mapping the local node indices onto the global nodes
307 //indices (actually this is the analog of the array elems of the old code)
309
310 //array for mapping the local node indices onto the global
311 //degree-of-freedom (dof) indices
313
315
317
320
321 //Meteo 2D data
322 mio::Grid2DObject mns, vw, rh, ta, p, psum, psum_ph/*, iswr, ea*/; // TODO ISWR activate, TODO EA activate
323
324 //Meteo 1D data
325 double ta_1D;
326
327 mio::Date skip_date; //time step to skip because there would be no drift
328
329 //3D
331 mio::Grid3DObject nodes_u, nodes_v, nodes_w, nodes_K;
332 mio::Grid3DObject nodes_e, nodes_c;
335
336 void buildWindFieldsTable(const std::string& wind_field_string);
337 std::vector<struct WIND_FIELD> wind_fields;
339
340 void debugOutputs(const mio::Date& calcDate, const std::string& fname, const DRIFT_OUTPUT& filetype);
341 void writeOutput(const std::string& fname); //HACK: this should be done by MeteoIO
342
343 //sublimation constants
345
346 // constants originally from Snowpack
347 static const double c_red, grain_size, tau_thresh, z0;
348 static const bool thresh_snow;
349};
350
351#pragma GCC diagnostic pop
352
353#endif
static int steps
Definition: AlpineMain.cc:48
mio::Array1D< double > CDoubleArray
Definition: SnowDrift.h:42
param_type
Definition: SnowDrift.h:56
@ SUB
Definition: SnowDrift.h:56
@ HUM
Definition: SnowDrift.h:56
@ SUB2
Definition: SnowDrift.h:56
@ TEM
Definition: SnowDrift.h:56
@ CON
Definition: SnowDrift.h:56
aspect_type
Definition: SnowDrift.h:57
@ BOTTOM
Definition: SnowDrift.h:57
@ OTHER
Definition: SnowDrift.h:57
mio::Array2D< int > CElementArray
Definition: SnowDrift.h:41
mio::Array1D< int > CIntArray
Definition: SnowDrift.h:43
DRIFT_OUTPUT
Definition: SnowDrift.h:55
@ OUT_SUBL
Definition: SnowDrift.h:55
@ OUT_CONC
Definition: SnowDrift.h:55
Definition: EnergyBalance.h:69
Definition: SnowDrift.h:89
mio::Grid3DObject nodes_v
Definition: SnowDrift.h:331
double getTiming() const
Definition: SnowDrift.cc:154
mio::Grid3DObject nodes_K
Definition: SnowDrift.h:331
std::string getGridsRequirements() const
Definition: SnowDrift.cc:76
mio::Grid3DObject nodes_u
Definition: SnowDrift.h:331
void debugOutputs(const mio::Date &calcDate, const std::string &fname, const DRIFT_OUTPUT &filetype)
Definition: SnowDrift.cc:724
mio::Array2D< double > qPoint
Definition: SnowDrift.h:304
SnowDriftA3D(const mio::DEMObject &dem, const mio::Config &cfg)
Definition: SnowDrift.cc:50
void iterativeSublimationCalculation(int timeStep, int maxTimeStep)
Calculate the steady state sublimation in several steps. Single feedbacks can be switched on or off i...
Definition: Suspension.cc:199
void Initialize()
Initialize for snowdrift Allocate saltation variable, snow height and new snow mass per bottom elemen...
Definition: SnowDrift.cc:121
double time_v[15]
Definition: SnowDrift.h:216
static const double grain_size
Definition: SnowDrift.h:347
virtual void classifySubdomain()
Description... this functions sets summation limits for the loops over boundary elements (faces,...
Definition: SnowDriftFEInit.cc:118
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 hexahed...
Definition: SnowDriftFENumerics.cc:204
mio::Array2D< int > nz_interior
Definition: SnowDrift.h:297
mio::Array2D< double > mns_nosubl
Definition: SnowDrift.h:319
CDoubleArray adjA
Definition: SnowDrift.h:278
mio::Grid2DObject sp
Definition: SnowDrift.h:226
unsigned int ny
Definition: SnowDrift.h:232
double terminalFallVelocity(const double Radius, const double Temperature, const double RH, const double altitude)
Terminal fall velocity NB assumed to be 0.5.
Definition: Sublimation.cc:146
unsigned int nx
Definition: SnowDrift.h:232
mio::Grid2DObject psum_ph
Definition: SnowDrift.h:322
mio::Array2D< int > nx_interior
Definition: SnowDrift.h:299
CDoubleArray flux_y
Definition: SnowDrift.h:314
CDoubleArray flux_x_subl
Definition: SnowDrift.h:314
CElementArray nodeMap
Definition: SnowDrift.h:308
CDoubleArray f
Definition: SnowDrift.h:259
double time_salt[15]
Definition: SnowDrift.h:216
virtual ~SnowDriftA3D()
Definition: SnowDrift.cc:159
mio::Grid3DObject nodes_Tair_ini
Definition: SnowDrift.h:333
void CompleteNodes()
Initialize concentration according to the rain rate (uniform) Now calculate the missing parameters Sl...
Definition: SnowDrift.cc:169
mio::Grid3DObject nodes_sx
Definition: SnowDrift.h:330
CDoubleArray sA
Definition: SnowDrift.h:241
mio::Array2D< double > mns_subl
Definition: SnowDrift.h:319
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.
Definition: SnowDriftFEControl.cc:453
virtual void Sublimation()
Sublimation Calculates drifting snow sublimation at every node of the concentration field.
Definition: Sublimation.cc:33
mio::Grid3DObject nodes_c
Definition: SnowDrift.h:332
mio::Grid2DObject rh
Definition: SnowDrift.h:322
unsigned int nDOF
Definition: SnowDrift.h:235
CDoubleArray Psi
Definition: SnowDrift.h:248
static const double kinematicViscosityAir
Definition: SnowDrift.h:344
virtual void SnowMassChange(bool setbound, const mio::Date &calcDate)
Definition: SnowDrift.cc:390
virtual void SolveEquation(int timeStep, int maxTimeStep, const param_type param)
Solve the advection diffusion equation.
Definition: Suspension.cc:123
CDoubleArray sB
Definition: SnowDrift.h:242
CDoubleArray rhs
Definition: SnowDrift.h:256
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.
Definition: SnowDriftFEInit.cc:390
mio::Array2D< int > nz_bar
Definition: SnowDrift.h:293
unsigned int nz
Definition: SnowDrift.h:232
void values_nodes_to_elements(const mio::Grid3DObject &nodesGrid, CDoubleArray &elementsArray)
nodes_to_elements
Definition: SnowDriftFEInit.cc:473
mio::Array2D< double > c_salt
Definition: SnowDrift.h:319
virtual void resetArray(CDoubleArray &sA)
Definition: SnowDriftFEInit.cc:461
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 th...
Definition: SnowDriftFEControl.cc:343
mio::Grid3DObject nodes_Tair
Definition: SnowDrift.h:333
double auxLayerHeight
Definition: SnowDrift.h:218
CDoubleArray flux_x
Definition: SnowDrift.h:314
mio::Array2D< int > nz_face
Definition: SnowDrift.h:289
int DOITERATION
Definition: SnowDrift.h:217
mio::Grid2DObject N3
Definition: SnowDrift.h:228
virtual void compSaltation(bool setbound)
Calculate Saltation Fluxes for all Bottom Elements.
Definition: Saltation.cc:51
mio::Grid3DObject nodes_sy
Definition: SnowDrift.h:330
unsigned int nNodes
Definition: SnowDrift.h:236
CIntArray nnzA
Definition: SnowDrift.h:277
mio::Array2D< int > nx_face
Definition: SnowDrift.h:291
void initializeTRH()
Initialize RH, T and q Initialize fields of humidity and temperature, necessary for sublimation calcu...
Definition: SnowDrift.cc:835
virtual void matmult(CDoubleArray &res, const CDoubleArray &x, double *sm, int *ijm)
matmult computes a matrix vector product for a sparse matrix
Definition: SnowDriftFENumerics.cc:485
CDoubleArray flux_y_subl
Definition: SnowDrift.h:314
mio::Grid3DObject nodes_z
Definition: SnowDrift.h:330
virtual void computeDepositionFlux(const CDoubleArray &c, const double theta)
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i....
Definition: SnowDriftFEControl.cc:839
mio::Grid2DObject rg
Definition: SnowDrift.h:227
void InitializeNodes(const mio::Grid3DObject &z_readMatr)
Initialize nodes Each (3D) node receives its (x,y,z), slope, aspect, normals.
Definition: SnowDrift.cc:230
static const double molecularWeightofWater
Definition: SnowDrift.h:344
mio::Grid3DObject nodes_tmp_c
Definition: SnowDrift.h:333
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 ...
Definition: SnowDriftFENumerics.cc:537
CDoubleArray precond
Definition: SnowDrift.h:267
void setBC_BottomLayer(CDoubleArray &var00, const param_type param)
Set Bottom Boundary Condition Set the boundary condition of bottom layer +intialize concentration in ...
Definition: SnowDriftFEInit.cc:320
virtual void prepareSparseMatrix(CIntArray &colA, CIntArray &rowA, CDoubleArray &adjA)
prepare sparse matrix Description : generates the auxiliary arrays (i.e. the arrays row-pointer and c...
Definition: SnowDriftFEInit.cc:248
mio::Grid2DObject psum
Definition: SnowDrift.h:322
virtual void setQuadraturePoints()
Definition: SnowDriftFENumerics.cc:51
CDoubleArray c
Definition: SnowDrift.h:251
mio::Grid3DObject nodes_Subl_ini
Definition: SnowDrift.h:333
virtual void computeDepositionFluxSublimation(const CDoubleArray &c, const double theta)
compute deposition flux Authors : Marc Ryser Description : calculates the deposition flux i....
Definition: SnowDriftFEControl.cc:940
static const bool thresh_snow
Definition: SnowDrift.h:348
CDoubleArray q00
Definition: SnowDrift.h:263
mio::Grid3DObject nodes_x
Definition: SnowDrift.h:330
bool STATIONARY
Definition: SnowDrift.h:334
mio::Grid2DObject cH
Definition: SnowDrift.h:225
CElementArray elems
Definition: SnowDrift.h:318
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,...
Definition: SnowDriftFEControl.cc:642
virtual void Diffusion(double deltaT, double &diff_max, double t)
Definition: Suspension.cc:31
mio::Array2D< double > saltation
Definition: SnowDrift.h:319
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)
Definition: SnowDrift.cc:714
static const double c_red
Definition: SnowDrift.h:347
double station_altitude
Definition: SnowDrift.h:219
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.
Definition: SnowDriftFEControl.cc:421
void buildWindFieldsTable(const std::string &wind_field_string)
Definition: SnowDrift.cc:81
mio::Grid3DObject nodes_w
Definition: SnowDrift.h:331
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.
Definition: Sublimation.cc:166
virtual void Suspension()
Definition: Suspension.cc:40
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 si...
Definition: SnowDriftFEControl.cc:43
CDoubleArray q
Definition: SnowDrift.h:252
mio::Grid2DObject p
Definition: SnowDrift.h:322
Saltation saltation_obj
Definition: SnowDrift.h:213
mio::Date skip_date
Definition: SnowDrift.h:327
CDoubleArray flux_z
Definition: SnowDrift.h:314
CDoubleArray T00
Definition: SnowDrift.h:264
CIntArray colA
Definition: SnowDrift.h:243
mio::Grid3DObject nodes_q
Definition: SnowDrift.h:333
mio::Grid3DObject nodes_y
Definition: SnowDrift.h:330
mio::Grid3DObject nodes_Subl
Definition: SnowDrift.h:333
mio::Array2D< int > ny_bar
Definition: SnowDrift.h:294
unsigned int nElements
Definition: SnowDrift.h:237
double waterVaporDensity(const double Temperature, const double VaporPressure)
CDoubleArray gDirichlet
Definition: SnowDrift.h:271
void writeOutput(const std::string &fname)
Write output Writes the values of several nodes-fields.
Definition: SnowDrift.cc:738
mio::Array2D< int > ny_interior
Definition: SnowDrift.h:298
mio::Grid3DObject nodes_q_ini
Definition: SnowDrift.h:333
mio::Array2D< double > dif_mns_subl
Definition: SnowDrift.h:319
mio::Grid3DObject nodes_e
Definition: SnowDrift.h:332
mio::Grid2DObject ta
Definition: SnowDrift.h:322
CDoubleArray T
Definition: SnowDrift.h:253
mio::Grid3DObject nodes_slope
Definition: SnowDrift.h:330
bool isNewWindField(const unsigned int current_step)
Definition: SnowDrift.cc:104
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 functio...
Definition: SnowDriftFENumerics.cc:298
int wind_field_index
Definition: SnowDrift.h:338
virtual double GQIntAdxdx(double *DETERMINANTJ, double J0M[3][3][8], const int i, const int j, double *b, const double deltak)
GQIntAdxdx ...
Definition: SnowDriftFENumerics.cc:352
double time_diff[15]
Definition: SnowDrift.h:216
SnowpackInterface * snowpack
Definition: SnowDrift.h:222
mio::Grid3DObject nodes_wstar
Definition: SnowDrift.h:330
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 ....
Definition: SnowDriftFEControl.cc:540
static const double thermalConductivityofAtm
Definition: SnowDrift.h:344
static const double USTAR
Definition: SnowDrift.h:344
mio::Grid2DObject mns
Definition: SnowDrift.h:322
virtual int numberOfNonzeros()
Number of nonzero elements of the finite element system matrix Description : computes the number of n...
Definition: SnowDriftFEInit.cc:216
CDoubleArray c00
Definition: SnowDrift.h:262
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)
Definition: SnowDriftFEControl.cc:721
static const double tau_thresh
Definition: SnowDrift.h:347
virtual void prepareSolve()
prepareSolve Some preparations to solve a 3D-field.
Definition: Suspension.cc:361
static const double z0
Definition: SnowDrift.h:347
mio::Array2D< int > nx_bar
Definition: SnowDrift.h:295
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.
Definition: SnowDrift.cc:777
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 f...
Definition: Sublimation.cc:60
mio::Grid2DObject vw
Definition: SnowDrift.h:322
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
Definition: SnowDriftFEInit.cc:511
CDoubleArray gamma
Definition: SnowDrift.h:272
double ta_1D
Definition: SnowDrift.h:325
virtual void phi(double *PHI, double *P)
Phi - shape functions Calculates the value of the 8 shape functions at point P.
Definition: SnowDriftFENumerics.cc:463
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.
Definition: Sublimation.cc:114
void setSnowPack(SnowpackInterface &mysnowpack)
Definition: SnowDrift.cc:709
void Destroy()
Definition: SnowDrift.cc:152
double time_tau[15]
Definition: SnowDrift.h:216
bool new_wind_status
Definition: SnowDrift.h:316
virtual void Compute(const mio::Date &calcDate)
Main: Calls the essential routines.
Definition: SnowDrift.cc:655
unsigned int nNZ
Definition: SnowDrift.h:238
void zeroRow(int node)
Definition: SnowDriftFEControl.cc:1029
CIntArray rowA
Definition: SnowDrift.h:244
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 ...
Definition: SnowDriftFENumerics.cc:422
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...
Definition: SnowDriftFENumerics.cc:171
void ConstructElements()
Definition: SnowDrift.cc:312
double theta
Definition: SnowDrift.h:285
CDoubleArray flux_z_subl
Definition: SnowDrift.h:314
virtual void applyBoundaryValues(CDoubleArray &c00, CDoubleArray &Psi)
applyBoundaryValues Apply boundary values to all elements Author: Marc Ryser
Definition: SnowDriftFEControl.cc:206
mio::Timer timer
Definition: SnowDrift.h:223
std::vector< struct WIND_FIELD > wind_fields
Definition: SnowDrift.h:337
mio::IOManager io
Definition: SnowDrift.h:221
CIntArray n_corner
Definition: SnowDrift.h:301
mio::Array2D< int > ny_face
Definition: SnowDrift.h:290
CElementArray dofMap
Definition: SnowDrift.h:312
CDoubleArray gNeumann
Definition: SnowDrift.h:270
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 ...
Definition: SnowDriftFENumerics.cc:79
mio::Grid3DObject nodes_RH
Definition: SnowDrift.h:333
mio::Grid2DObject rb
Definition: SnowDrift.h:229
mio::Grid3DObject nodes_WindVel
Definition: SnowDrift.h:333
double ventilationVelocity(const double Radius, const double Windspeed, const double AirTemperature, const double RH, const double altitude)
Ventilation velocity.
Definition: Sublimation.cc:129
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.
Definition: SnowDriftFENumerics.cc:145
virtual void InitializeFEData()
Initializes system size and all data members which are required for the finite element solution.
Definition: SnowDriftFEInit.cc:32
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.
Definition: Sublimation.cc:100
void GetTResults(double outtime_v[15], double outtime_tau[15], double outtime_salt[15], double outtime_diff[15])
Definition: SnowDrift.cc:700
double qualla
Definition: SnowDrift.h:283
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.
Definition: SnowDriftFEInit.cc:362
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...
Definition: SnowDriftFENumerics.cc:570
Definition: SnowpackInterface.h:126
Definition: SnowDrift.h:59
unsigned int start_step
Definition: SnowDrift.h:59
std::string wind
Definition: SnowDrift.h:59