24#ifndef DUMUX_BRINE_FLUID_SYSTEM_HH
25#define DUMUX_BRINE_FLUID_SYSTEM_HH
27#include <dune/common/math.hh>
38namespace FluidSystems {
45template<
class Scalar,
class H2OType = Components::TabulatedComponent<Dumux::Components::H2O<Scalar>> >
46class Brine :
public Base< Scalar, Brine<Scalar, H2OType>>
128 return H2O::liquidIsCompressible();
156 case H2OIdx:
return H2O::name();
159 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << compIdx);
170 case H2OIdx:
return H2O::molarMass();
173 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << compIdx);
205 static void init(Scalar tempMin, Scalar tempMax,
unsigned nTemp,
206 Scalar pressMin, Scalar pressMax,
unsigned nPress)
209 if (H2O::isTabulated)
211 std::cout <<
"Initializing tables for the H2O fluid properties ("
215 H2O::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
224 template <
class Flu
idState>
228 const Scalar
temperature = fluidState.temperature(phaseIdx);
229 const Scalar
pressure = fluidState.pressure(phaseIdx);
230 const Scalar xNaCl = fluidState.massFraction(phaseIdx,
NaClIdx);
235 const Scalar salinity = max(0.0, xNaCl);
238 const Scalar
density = rhow + 1000*salinity*(0.668 +
259 template <
class Flu
idState>
264 assert(0 <= phaseIdx && phaseIdx <
numPhases);
267 if (phaseIdx == compIdx)
273 return std::numeric_limits<Scalar>::infinity();
280 template <
class Flu
idState>
284 const Scalar
temperature = fluidState.temperature(phaseIdx);
285 const Scalar xNaCl = fluidState.massFraction(phaseIdx,
NaClIdx);
292 const Scalar salinity = max(0.0, xNaCl);
294 const Scalar T_C = T - 273.15;
295 const Scalar A = ((0.42*power((pow(salinity, 0.8)-0.17), 2)) + 0.045)*pow(T_C, 0.8);
296 const Scalar mu_brine = 0.1 + (0.333*salinity) + (1.65+(91.9*salinity*salinity*salinity))*exp(-A);
297 assert(mu_brine > 0.0);
298 return mu_brine/1000.0;
307 template <
class Flu
idState>
317 DUNE_THROW(Dune::NotImplemented,
"NaCl::vaporPressure(t)");
319 DUNE_THROW(Dune::NotImplemented,
"Invalid component index " << compIdx);
336 template <
class Flu
idState>
337 static Scalar
enthalpy(
const FluidState& fluidState,
int phaseIdx)
340 static const Scalar f[] = { 2.63500E-1, 7.48368E-6, 1.44611E-6, -3.80860E-10 };
343 static const Scalar a[4][3] = { { +9633.6, -4080.0, +286.49 },
344 { +166.58, +68.577, -4.6856 },
345 { -0.90963, -0.36524, +0.249667E-1 },
346 { +0.17965E-2, +0.71924E-3, -0.4900E-4 } };
348 const Scalar p = fluidState.pressure(phaseIdx);
349 const Scalar T = fluidState.temperature(phaseIdx);
350 const Scalar theta = T - 273.15;
351 const Scalar salSat = f[0] + f[1]*theta + f[2]*theta*theta + f[3]*theta*theta*theta;
357 const Scalar salinity = min(max(xNaCl,0.0), salSat);
359 const Scalar hw = H2O::liquidEnthalpy(T, p)/1E3;
362 const Scalar h_NaCl = (3.6710E4*T + 0.5*(6.2770E1)*T*T - ((6.6670E-2)/3)*T*T*T
363 + ((2.8000E-5)/4)*(T*T*T*T))/(58.44E3)- 2.045698e+02;
365 const Scalar m = (1E3/58.44)*(salinity/(1-salinity));
369 for (
int i = 0; i<=3; i++)
370 for (
int j=0; j<=2; j++)
371 d_h = d_h + a[i][j] * power(theta, i) * power(m, j);
374 const Scalar delta_h = (4.184/(1E3 + (58.44 * m)))*d_h;
377 const Scalar h_ls1 =(1-salinity)*hw + salinity*h_NaCl + salinity*delta_h;
388 template <
class Flu
idState>
398 if (componentIdx ==
H2OIdx)
399 return H2O::liquidEnthalpy(T, p);
400 else if (componentIdx ==
NaClIdx)
401 DUNE_THROW(Dune::NotImplemented,
"The component enthalpy for NaCl is not implemented.");
402 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << componentIdx);
404 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
417 template <
class Flu
idState>
420 return density(fluidState, phaseIdx)/fluidState.averageMolarMass(phaseIdx);
428 template <
class Flu
idState>
431 DUNE_THROW(Dune::NotImplemented,
"FluidSystems::Brine::diffusionCoefficient()");
444 template <
class Flu
idState>
452 if (compIIdx > compJIdx)
455 swap(compIIdx, compJIdx);
463 DUNE_THROW(Dune::NotImplemented,
"Binary diffusion coefficient of components "
464 << compIIdx <<
" and " << compJIdx
465 <<
" in phase " << phaseIdx);
468 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index: " << phaseIdx);
481 template <
class Flu
idState>
485 return H2O::liquidThermalConductivity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
486 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index: " << phaseIdx);
499 template <
class Flu
idState>
503 return H2O::liquidHeatCapacity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
504 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
Some exceptions thrown in DuMux
A collection of input/output field names for common physical quantities.
Material properties of pure salt .
Tabulates all thermodynamic properties of a given untabulated chemical species.
Material properties of pure water .
A central place for various physical constants occuring in some equations.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:119
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
A class for the NaCl properties.
Definition: nacl.hh:47
static std::string name()
A human readable name for the NaCl.
Definition: nacl.hh:52
static constexpr Scalar molarMass()
The molar mass of NaCl in .
Definition: nacl.hh:60
Fluid system base class.
Definition: fluidsystems/base.hh:45
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:390
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:197
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:278
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: fluidsystems/base.hh:326
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:363
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:160
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:236
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:424
A compositional single phase fluid system consisting of two components, which are H2O and NaCl.
Definition: fluidsystems/brine.hh:47
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/brine.hh:482
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=liquidPhaseIdx)
Return the viscosity of the phase.
Definition: fluidsystems/brine.hh:281
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: fluidsystems/brine.hh:389
static bool isIdealGas(int phaseIdx=liquidPhaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: fluidsystems/brine.hh:138
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the diffusion coefficient of a component in a phase.
Definition: fluidsystems/brine.hh:429
static constexpr int phase0Idx
Index of the first (and only) phase.
Definition: fluidsystems/brine.hh:59
static constexpr bool isGas(int phaseIdx=liquidPhaseIdx)
Return whether a phase is gaseous.
Definition: fluidsystems/brine.hh:90
static constexpr int comp0Idx
index of the first component
Definition: fluidsystems/brine.hh:64
static const int numComponents
Number of components in the fluid system (H2O, NaCl)
Definition: fluidsystems/brine.hh:57
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the fluid system's static parameters using problem specific temperature and pressure range...
Definition: fluidsystems/brine.hh:205
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/brine.hh:260
static constexpr int comp1Idx
index of the second component
Definition: fluidsystems/brine.hh:65
static constexpr int H2OIdx
index of the water component
Definition: fluidsystems/brine.hh:62
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase. .
Definition: fluidsystems/brine.hh:500
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: fluidsystems/brine.hh:166
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature and pressure, return its specific enthalpy .
Definition: fluidsystems/brine.hh:337
static Scalar vaporPressure(const FluidState &fluidState, int compIdx)
Vapor pressure of a component .
Definition: fluidsystems/brine.hh:308
static const std::string phaseName(int phaseIdx=liquidPhaseIdx)
Return the human readable name of the phase.
Definition: fluidsystems/brine.hh:71
static constexpr int NaClIdx
index of the NaCl component
Definition: fluidsystems/brine.hh:63
H2OType H2O
export the involved components
Definition: fluidsystems/brine.hh:53
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: fluidsystems/brine.hh:81
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx=liquidPhaseIdx)
The molar density of the fluid phase in .
Definition: fluidsystems/brine.hh:418
static constexpr int liquidPhaseIdx
The one considered phase is liquid.
Definition: fluidsystems/brine.hh:60
static bool isCompressible(int phaseIdx=liquidPhaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: fluidsystems/brine.hh:125
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: fluidsystems/brine.hh:152
static Scalar density(const FluidState &fluidState, int phaseIdx=liquidPhaseIdx)
Return the phase density [kg/m^3].
Definition: fluidsystems/brine.hh:225
static bool isIdealMixture(int phaseIdx=liquidPhaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: fluidsystems/brine.hh:110
static const int numPhases
Number of phases in the fluid system.
Definition: fluidsystems/brine.hh:56
static void init()
Initialize the fluid system's static parameters generically.
Definition: fluidsystems/brine.hh:184
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: fluidsystems/brine.hh:445