24#ifndef DUMUX_ENERGY_COMBUSTION_LOCAL_RESIDUAL_HH
25#define DUMUX_ENERGY_COMBUSTION_LOCAL_RESIDUAL_HH
41template<
class TypeTag>
49 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
52 using Element =
typename GridView::template Codim<0>::Entity;
54 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
59 static constexpr auto numEnergyEqFluid = ModelTraits::numEnergyEqFluid();
60 static constexpr auto numEnergyEqSolid = ModelTraits::numEnergyEqSolid();
61 static constexpr auto energyEq0Idx = Indices::energyEq0Idx;
74 const Element& element,
75 const FVElementGeometry& fvGeometry,
76 const ElementVolumeVariables& elemVolVars,
77 const SubControlVolume &scv)
80 const auto& volVars = elemVolVars[scv];
81 const auto& fs = volVars.fluidState() ;
82 const Scalar characteristicLength = volVars.characteristicLength() ;
86 const Scalar as = volVars.fluidSolidInterfacialArea();
89 const Scalar TFluid = volVars.temperatureFluid(0);
90 const Scalar TSolid = volVars.temperatureSolid();
92 const Scalar satW = fs.saturation(0) ;
93 const Scalar satN = fs.saturation(1) ;
95 const Scalar
eps = 1e-6 ;
96 Scalar solidToFluidEnergyExchange ;
98 Scalar fluidConductivity ;
100 fluidConductivity = volVars.fluidThermalConductivity(1) ;
101 else if (satW >= 1.0 -
eps)
102 fluidConductivity = volVars.fluidThermalConductivity(0) ;
104 DUNE_THROW(Dune::NotImplemented,
"wrong range");
106 const Scalar factorEnergyTransfer = volVars.factorEnergyTransfer() ;
108 solidToFluidEnergyExchange = factorEnergyTransfer * (TSolid - TFluid) / characteristicLength * as * fluidConductivity ;
109 const Scalar epsRegul = 1e-3 ;
111 if (satW < (0 +
eps) )
113 solidToFluidEnergyExchange *= volVars.nusseltNumber(1) ;
115 else if ( (satW >= 0 +
eps) and (satW < 1.0-
eps) )
117 solidToFluidEnergyExchange *= (volVars.nusseltNumber(1) * satN );
126 qBoil = sp.
eval(satW);
129 else if (satW>= (1.0-epsRegul) )
132 Spline sp(1.0-epsRegul, 1.0,
136 qBoil = sp.
eval(satW) ;
143 solidToFluidEnergyExchange += qBoil;
145 else if (satW >= 1.0-
eps)
147 solidToFluidEnergyExchange *= volVars.nusseltNumber(0) ;
150 DUNE_THROW(Dune::NotImplemented,
"wrong range");
153 if (!isfinite(solidToFluidEnergyExchange))
154 DUNE_THROW(
NumericalProblem,
"Calculated non-finite source, " <<
"TFluid="<< TFluid <<
" TSolid="<< TSolid);
156 for(
int energyEqIdx =0; energyEqIdx<numEnergyEqFluid+numEnergyEqSolid; ++energyEqIdx)
161 source[energyEq0Idx + energyEqIdx] += solidToFluidEnergyExchange;
164 source[energyEq0Idx + energyEqIdx] -= solidToFluidEnergyExchange;
167 DUNE_THROW(Dune::NotImplemented,
179 static Scalar
QBoilFunc(
const VolumeVariables & volVars,
184 const auto& fs = volVars.fluidState();
185 const Scalar g( 9.81 );
186 const Scalar gamma(0.0589);
187 const Scalar TSolid = volVars.temperatureSolid();
189 const Scalar as = volVars.fluidSolidInterfacialArea();
190 const Scalar mul = fs.viscosity(0);
191 const Scalar deltahv = fs.enthalpy(1) - fs.enthalpy(0);
192 const Scalar deltaRho = fs.density(0) - fs.density(1);
193 const Scalar firstBracket = pow(g * deltaRho / gamma, 0.5);
194 const Scalar cp = FluidSystem::heatCapacity(fs, 0);
197 const Scalar Tsat = FluidSystem::vaporTemperature(fs, 1 ) ;
198 const Scalar deltaT = TSolid - Tsat;
199 const Scalar secondBracket = pow( (cp *deltaT / (0.006 * deltahv) ) , 3.0 );
200 const Scalar Prl = volVars.prandtlNumber(0);
201 const Scalar thirdBracket = pow( 1/Prl , (1.7/0.33));
202 const Scalar QBoil = satW * as * mul * deltahv * firstBracket * secondBracket * thirdBracket;
216 return (
QBoilFunc(volVars, satW) / satW ) ;
Some exceptions thrown in DuMux
Provides 3rd order polynomial splines.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
constexpr double eps
epsilon for checking direction of scvf normals
Definition: test_tpfafvgeometry_nonconforming.cc:44
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:39
A 3rd order polynomial spline.
Definition: spline.hh:55
Scalar eval(Scalar x, bool extrapolate=false) const
Evaluate the spline at a given position.
Definition: splinecommon_.hh:142
This file contains the parts of the local residual to calculate the heat conservation in the thermal ...
Definition: porousmediumflow/nonequilibrium/thermal/localresidual.hh:43
This file contains the parts of the local residual to calculate the heat conservation in the thermal ...
Definition: combustionlocalresidual.hh:44
static Scalar QBoilFunc(const VolumeVariables &volVars, const Scalar satW)
Calculates the energy transfer during boiling, i.e. latent heat.
Definition: combustionlocalresidual.hh:179
static Scalar dQBoil_dSw(const VolumeVariables &volVars, const Scalar satW)
Calculates the derivative of the energy transfer function during boiling. Needed for regularization.
Definition: combustionlocalresidual.hh:211
static void computeSourceEnergy(NumEqVector &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv)
Calculates the source term of the equation.
Definition: combustionlocalresidual.hh:73
Declares all properties used in Dumux.
This file contains the parts of the local residual to calculate the heat conservation in the thermal ...