25#ifndef DUMUX_TABULATED_CO2_HH
26#define DUMUX_TABULATED_CO2_HH
28#include <dune/common/float_cmp.hh>
37template <
class Traits>
40 using Scalar =
typename Traits::Scalar;
41 enum { numTempSteps = Traits::numTempSteps, numPressSteps = Traits::numPressSteps };
48 {
return Traits::minTemp; }
51 {
return Traits::maxTemp; }
54 {
return Traits::minPress; }
57 {
return Traits::maxPress; }
87 Scalar alpha = (
temperature - tempAtI)/(tempAtI1 - tempAtI);
88 Scalar beta = (
pressure - pressAtI)/(pressAtI1 - pressAtI);
92 (1-alpha)*(1-beta)*
val(i, j) +
93 (1-alpha)*( beta)*
val(i, j + 1) +
94 ( alpha)*(1-beta)*
val(i + 1, j) +
95 ( alpha)*( beta)*
val(i + 1, j + 1);
102 Scalar
val(
int i,
int j)
const
105 if (i < 0 || i >= Traits::numTempSteps ||
106 j < 0 || j >= Traits::numPressSteps) {
108 "Attempt to access element ("
110 <<
") on a " << Traits::name <<
" table of size ("
111 << Traits::numTempSteps <<
", " << Traits::numPressSteps
115 return Traits::vals[i][j];
122 return numTempSteps - 2;
127 return max(0, min(result, numTempSteps - 2));
133 return numPressSteps - 2;
138 return max(0, min(result, numPressSteps - 2));
Some exceptions thrown in DuMux
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:39
A generic template for tabulated material laws that depend on two parameters.
Definition: co2tablereader.hh:39
Scalar temperatureAt_(int i) const
Definition: co2tablereader.hh:141
int findTempIdx_(Scalar temperature) const
Definition: co2tablereader.hh:119
Scalar at(Scalar temperature, Scalar pressure) const
Definition: co2tablereader.hh:65
Scalar maxPress() const
Definition: co2tablereader.hh:56
bool applies(Scalar temperature, Scalar pressure) const
Definition: co2tablereader.hh:59
TabulatedCO2Properties()
Definition: co2tablereader.hh:45
Scalar minTemp() const
Definition: co2tablereader.hh:47
Scalar minPress() const
Definition: co2tablereader.hh:53
int findPressIdx_(Scalar pressure) const
Definition: co2tablereader.hh:130
Scalar maxTemp() const
Definition: co2tablereader.hh:50
Scalar pressureAt_(int j) const
Definition: co2tablereader.hh:143
Scalar val(int i, int j) const
Definition: co2tablereader.hh:102