SNOWPACK 20241221.26c8720
SalinityTransport.h
Go to the documentation of this file.
1/*
2 * SNOWPACK stand-alone
3 *
4 * Copyright WSL Institute for Snow and Avalanche Research SLF, DAVOS, SWITZERLAND
5*/
6/* This file is part of Snowpack.
7 Snowpack is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 Snowpack is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Snowpack. If not, see <http://www.gnu.org/licenses/>.
19*/
24#ifndef SALINITYTRANSPORT_H
25#define SALINITYTRANSPORT_H
26
27#include <meteoio/MeteoIO.h>
28
35
36 public:
37 SalinityTransport(size_t nE); // Class constructor
38
39 bool VerifyCFL(const double dt);
40 bool VerifyImplicitDt(const double dt);
41 bool SolveSalinityTransportEquationImplicit(const double dt, std::vector <double>& DeltaSal, const double f, const bool DonorCell = true); // Donor cell or central differences?
42 bool SolveSalinityTransportEquationExplicit(const double dt, std::vector <double>& DeltaSal);
44
45 std::vector<double> flux_up; //Flux with element above (negative=upward, positive=downward)
46 std::vector<double> flux_down; //Flux with element below (negative=upward, positive=downward)
47 std::vector<double> flux_up_2; //Flux with element above (negative=upward, positive=downward)
48 std::vector<double> flux_down_2; //Flux with element below (negative=upward, positive=downward)
49 std::vector<double> dz_; //Grid cell size
50 std::vector<double> dz_up; //Grid cell distance above
51 std::vector<double> dz_down; //Grid cell distance below
52 std::vector<double> theta1; //Vol. liquid water content (m^3/m^3), at t=n
53 std::vector<double> theta2; //Vol. liquid water content (m^3/m^3), at t=n+1
54 std::vector<double> BrineSal; //Salinity in brine, in g/(m^3_water)
55 std::vector<double> D; //Diffusivity
56 std::vector<double> sb; //Source/sink term for brine salinity
57
58 double BottomSalinity, TopSalinity; //The boundary conditions bottom and top salinities.
59
60 double BottomSalFlux, TopSalFlux; //Bottom and top salt flux
61
62 private:
63 void SetDomainSize(size_t nE);
64 size_t NumberOfElements;
65};
66#endif //End of SalinityTransport.h
This module contains the solver for the diffusion-advection equation for the transport of salinity.
Definition: SalinityTransport.h:34
std::vector< double > flux_up_2
Definition: SalinityTransport.h:47
bool SolveSalinityTransportEquationExplicit(const double dt, std::vector< double > &DeltaSal)
Solve diffusion-advection equation using the upwind explicit method .
Definition: SalinityTransport.cc:368
std::vector< double > dz_down
Definition: SalinityTransport.h:51
std::vector< double > D
Definition: SalinityTransport.h:55
std::vector< double > sb
Definition: SalinityTransport.h:56
double TopSalFlux
Definition: SalinityTransport.h:60
bool VerifyImplicitDt(const double dt)
Check for Implicit criterion .
Definition: SalinityTransport.cc:477
std::vector< double > theta2
Definition: SalinityTransport.h:53
std::vector< double > dz_up
Definition: SalinityTransport.h:50
SalinityTransport(size_t nE)
Class for solving diffusion-advection equation for salinity using the Crank-Nicolson implicit method ...
Definition: SalinityTransport.cc:68
double BottomSalinity
Definition: SalinityTransport.h:58
std::vector< double > theta1
Definition: SalinityTransport.h:52
std::vector< double > dz_
Definition: SalinityTransport.h:49
double BottomSalFlux
Definition: SalinityTransport.h:60
std::vector< double > BrineSal
Definition: SalinityTransport.h:54
double TopSalinity
Definition: SalinityTransport.h:58
std::vector< double > flux_down_2
Definition: SalinityTransport.h:48
SalinityTransportSolvers
Definition: SalinityTransport.h:43
@ IMPLICIT2
Definition: SalinityTransport.h:43
@ EXPLICIT
Definition: SalinityTransport.h:43
@ IMPLICIT
Definition: SalinityTransport.h:43
bool SolveSalinityTransportEquationImplicit(const double dt, std::vector< double > &DeltaSal, const double f, const bool DonorCell=true)
Solve diffusion-advection equation using the Crank-Nicolson implicit, or fully implicit method .
Definition: SalinityTransport.cc:119
std::vector< double > flux_down
Definition: SalinityTransport.h:46
bool VerifyCFL(const double dt)
Check for CFL criterion .
Definition: SalinityTransport.cc:453
std::vector< double > flux_up
Definition: SalinityTransport.h:45