25#ifndef DUMUX_TABULATED_CO2_HH
26#define DUMUX_TABULATED_CO2_HH
28#include <dune/common/float_cmp.hh>
30#warning "This header is deprecated and will be removed after release 3.5. Use generated tables (bin/util/make_co2_tables.py), see test/porousmediumflow/co2/"
38template <
class Traits>
41 using Scalar =
typename Traits::Scalar;
42 enum { numTempSteps = Traits::numTempSteps, numPressSteps = Traits::numPressSteps };
49 {
return Traits::minTemp; }
52 {
return Traits::maxTemp; }
55 {
return Traits::minPress; }
58 {
return Traits::maxPress; }
88 Scalar alpha = (
temperature - tempAtI)/(tempAtI1 - tempAtI);
89 Scalar beta = (
pressure - pressAtI)/(pressAtI1 - pressAtI);
93 (1-alpha)*(1-beta)*
val(i, j) +
94 (1-alpha)*( beta)*
val(i, j + 1) +
95 ( alpha)*(1-beta)*
val(i + 1, j) +
96 ( alpha)*( beta)*
val(i + 1, j + 1);
103 Scalar
val(
int i,
int j)
const
106 if (i < 0 || i >= Traits::numTempSteps ||
107 j < 0 || j >= Traits::numPressSteps) {
109 "Attempt to access element ("
111 <<
") on a " << Traits::name <<
" table of size ("
112 << Traits::numTempSteps <<
", " << Traits::numPressSteps
116 return Traits::vals[i][j];
123 return numTempSteps - 2;
128 return max(0, min(result, numTempSteps - 2));
134 return numPressSteps - 2;
139 return max(0, min(result, numPressSteps - 2));
Some exceptions thrown in DuMux
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:40
Scalar temperatureAt_(int i) const
Definition: co2tablereader.hh:142
int findTempIdx_(Scalar temperature) const
Definition: co2tablereader.hh:120
Scalar at(Scalar temperature, Scalar pressure) const
Definition: co2tablereader.hh:66
Scalar maxPress() const
Definition: co2tablereader.hh:57
bool applies(Scalar temperature, Scalar pressure) const
Definition: co2tablereader.hh:60
TabulatedCO2Properties()
Definition: co2tablereader.hh:46
Scalar minTemp() const
Definition: co2tablereader.hh:48
Scalar minPress() const
Definition: co2tablereader.hh:54
int findPressIdx_(Scalar pressure) const
Definition: co2tablereader.hh:131
Scalar maxTemp() const
Definition: co2tablereader.hh:51
Scalar pressureAt_(int j) const
Definition: co2tablereader.hh:144
Scalar val(int i, int j) const
Definition: co2tablereader.hh:103