27 #ifndef OPM_SOMERTON_THERMAL_CONDUCTION_LAW_HPP
28 #define OPM_SOMERTON_THERMAL_CONDUCTION_LAW_HPP
60 template <
class FluidSystem,
62 class ParamsT = SomertonThermalConductionLawParams<FluidSystem::numPhases, ScalarT> >
65 enum { numPhases = FluidSystem::numPhases };
68 typedef ParamsT Params;
69 typedef typename Params::Scalar Scalar;
89 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
91 const FluidState& fluidState)
93 Valgrind::CheckDefined(params.vacuumLambda());
95 Evaluation lambda = 0;
96 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
97 Valgrind::CheckDefined(params.fullySaturatedLambda(phaseIdx));
99 if (FluidSystem::isLiquid(phaseIdx)) {
100 const auto& sat = decay<Evaluation>(fluidState.saturation(phaseIdx));
102 regularizedSqrt_(max(0.0, min(1.0, sat)))
103 * (params.fullySaturatedLambda(phaseIdx) - params.vacuumLambda());
106 lambda += params.fullySaturatedLambda(phaseIdx) - params.vacuumLambda();
110 lambda += params.vacuumLambda();
116 template <
class Evaluation>
117 static Evaluation regularizedSqrt_(
const Evaluation& x)
121 static const Scalar xMin = 1e-2;
122 static const Scalar sqrtXMin = std::sqrt(xMin);
123 static const Scalar fPrimeXMin = 1.0/(2*std::sqrt(xMin));
124 static const Scalar fPrime0 = 2*fPrimeXMin;
125 static const Spline sqrtRegSpline(0, xMin,
127 fPrime0, fPrimeXMin);
134 return sqrtRegSpline.eval(x);
The default implementation of a parameter object for the Somerton thermal conduction law.
Class implementing cubic splines.
Some templates to wrap the valgrind client request macros.
Implements the Somerton law of thermal conductivity in a porous medium.
Definition: SomertonThermalConductionLaw.hpp:64
static Evaluation thermalConductivity(const Params ¶ms, const FluidState &fluidState)
Given a fluid state, return the effective thermal conductivity [W/m^2 / (K/m)] of the porous medium.
Definition: SomertonThermalConductionLaw.hpp:90
Class implementing cubic splines.
Definition: Spline.hpp:91