opm-simulators
energymodule.hh
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
29 #ifndef EWOMS_ENERGY_MODULE_HH
30 #define EWOMS_ENERGY_MODULE_HH
31 
32 #include <dune/common/fvector.hh>
33 
34 #include <opm/material/common/Valgrind.hpp>
35 
38 
40 
41 #include <cassert>
42 #include <cmath>
43 #include <stdexcept>
44 #include <string>
45 #include <type_traits>
46 
47 namespace Opm {
53 template <class TypeTag, bool enableEnergy>
55 
59 template <class TypeTag>
60 class EnergyModule<TypeTag, /*enableEnergy=*/false>
61 {
69 
70  enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
71 
72 public:
76  static void registerParameters()
77  {}
78 
84  static std::string primaryVarName(unsigned)
85  { return ""; }
86 
92  static std::string eqName(unsigned)
93  { return ""; }
94 
99  static Scalar primaryVarWeight(const Model&,
100  unsigned,
101  unsigned)
102  { return -1; }
103 
107  static Scalar eqWeight(const Model&,
108  unsigned,
109  unsigned)
110  { return -1; }
111 
115  template <class FluidState>
116  static void setPriVarTemperatures(PrimaryVariables&,
117  const FluidState&)
118  {}
119 
124  template <class RateVector, class FluidState>
125  static void setEnthalpyRate(RateVector&,
126  const FluidState&,
127  unsigned,
128  const Evaluation&)
129  {}
130 
134  static void setEnthalpyRate(RateVector&,
135  const Evaluation&)
136  {}
137 
141  static void addToEnthalpyRate(RateVector&,
142  const Evaluation&)
143  {}
144 
148  static Scalar thermalConductionRate(const ExtensiveQuantities&)
149  { return 0.0; }
150 
155  template <class LhsEval>
156  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq>&,
157  const IntensiveQuantities&,
158  unsigned)
159  {}
160 
165  template <class LhsEval, class Scv>
166  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq>&,
167  const IntensiveQuantities&,
168  const Scv&,
169  unsigned)
170  {}
171 
176  template <class LhsEval>
177  static void addSolidEnergyStorage(Dune::FieldVector<LhsEval, numEq>&,
178  const IntensiveQuantities&)
179  {}
180 
187  template <class Context>
188  static void addAdvectiveFlux(RateVector&,
189  const Context&,
190  unsigned,
191  unsigned)
192  {}
193 
199  template <class Context>
200  static void handleFractureFlux(RateVector&,
201  const Context&,
202  unsigned,
203  unsigned)
204  {}
205 
212  template <class Context>
213  static void addDiffusiveFlux(RateVector&,
214  const Context&,
215  unsigned,
216  unsigned)
217  {}
218 };
219 
223 template <class TypeTag>
224 class EnergyModule<TypeTag, /*enableEnergy=*/true>
225 {
231  using IntensiveQuantities = GetPropType<TypeTag, Properties::IntensiveQuantities>;
232  using ExtensiveQuantities = GetPropType<TypeTag, Properties::ExtensiveQuantities>;
235 
236  enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
237  enum { numPhases = FluidSystem::numPhases };
238  enum { energyEqIdx = Indices::energyEqIdx };
239  enum { temperatureIdx = Indices::temperatureIdx };
240 
241  using Toolbox = Opm::MathToolbox<Evaluation>;
242 
243 public:
247  static void registerParameters()
248  {}
249 
255  static std::string primaryVarName(unsigned pvIdx)
256  {
257  if (pvIdx == temperatureIdx) {
258  return "temperature";
259  }
260  return "";
261  }
262 
268  static std::string eqName(unsigned eqIdx)
269  {
270  if (eqIdx == energyEqIdx) {
271  return "energy";
272  }
273  return "";
274  }
275 
280  static Scalar primaryVarWeight(const Model& model, unsigned globalDofIdx, unsigned pvIdx)
281  {
282  if (pvIdx != temperatureIdx) {
283  return -1;
284  }
285 
286  // make the weight of the temperature primary variable inversly proportional to its value
287  return std::max(static_cast<Scalar>(1.0) / 1000,
288  1.0 / model.solution(/*timeIdx=*/0)[globalDofIdx][temperatureIdx]);
289  }
290 
294  static Scalar eqWeight(const Model&,
295  unsigned,
296  unsigned eqIdx)
297  {
298  if (eqIdx != energyEqIdx) {
299  return -1;
300  }
301 
302  // approximate change of internal energy of 1kg of liquid water for a temperature
303  // change of 30K
304  return static_cast<Scalar>(1.0) / (4.184e3 * 30.0);
305  }
306 
310  static void setEnthalpyRate(RateVector& rateVec, const Evaluation& rate)
311  { rateVec[energyEqIdx] = rate; }
312 
316  static void addToEnthalpyRate(RateVector& rateVec, const Evaluation& rate)
317  { rateVec[energyEqIdx] += rate; }
318 
322  static Evaluation thermalConductionRate(const ExtensiveQuantities& extQuants)
323  { return -extQuants.temperatureGradNormal() * extQuants.thermalConductivity(); }
324 
329  template <class RateVector, class FluidState>
330  static void setEnthalpyRate(RateVector& rateVec,
331  const FluidState& fluidState,
332  unsigned phaseIdx,
333  const Evaluation& volume)
334  {
335  rateVec[energyEqIdx] =
336  volume *
337  fluidState.density(phaseIdx) *
338  fluidState.enthalpy(phaseIdx);
339  }
340 
344  template <class FluidState>
345  static void setPriVarTemperatures(PrimaryVariables& priVars,
346  const FluidState& fs)
347  {
348  priVars[temperatureIdx] = Toolbox::value(fs.temperature(/*phaseIdx=*/0));
349 #ifndef NDEBUG
350  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
351  assert(std::abs(Toolbox::value(fs.temperature(/*phaseIdx=*/0))
352  - Toolbox::value(fs.temperature(phaseIdx))) < 1e-30);
353  }
354 #endif
355  }
356 
361  template <class LhsEval>
362  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq>& storage,
363  const IntensiveQuantities& intQuants,
364  unsigned phaseIdx)
365  {
366  const auto& fs = intQuants.fluidState();
367  storage[energyEqIdx] +=
368  Toolbox::template decay<LhsEval>(fs.density(phaseIdx)) *
369  Toolbox::template decay<LhsEval>(fs.internalEnergy(phaseIdx)) *
370  Toolbox::template decay<LhsEval>(fs.saturation(phaseIdx)) *
371  Toolbox::template decay<LhsEval>(intQuants.porosity());
372  }
373 
378  template <class Scv, class LhsEval>
379  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq>& storage,
380  const IntensiveQuantities& intQuants,
381  const Scv& scv,
382  unsigned phaseIdx)
383  {
384  const auto& fs = intQuants.fractureFluidState();
385  storage[energyEqIdx] +=
386  Toolbox::template decay<LhsEval>(fs.density(phaseIdx)) *
387  Toolbox::template decay<LhsEval>(fs.internalEnergy(phaseIdx)) *
388  Toolbox::template decay<LhsEval>(fs.saturation(phaseIdx)) *
389  Toolbox::template decay<LhsEval>(intQuants.fracturePorosity()) *
390  Toolbox::template decay<LhsEval>(intQuants.fractureVolume()) / scv.volume();
391  }
392 
397  template <class LhsEval>
398  static void addSolidEnergyStorage(Dune::FieldVector<LhsEval, numEq>& storage,
399  const IntensiveQuantities& intQuants)
400  { storage[energyEqIdx] += Opm::decay<LhsEval>(intQuants.solidInternalEnergy()); }
401 
408  template <class Context>
409  static void addAdvectiveFlux(RateVector& flux,
410  const Context& context,
411  unsigned spaceIdx,
412  unsigned timeIdx)
413  {
414  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
415 
416  // advective energy flux in all phases
417  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
418  if (!context.model().phaseIsConsidered(phaseIdx)) {
419  continue;
420  }
421 
422  // intensive quantities of the upstream and the downstream DOFs
423  const unsigned upIdx = static_cast<unsigned>(extQuants.upstreamIndex(phaseIdx));
424  const IntensiveQuantities& up = context.intensiveQuantities(upIdx, timeIdx);
425 
426  flux[energyEqIdx] +=
427  extQuants.volumeFlux(phaseIdx) *
428  up.fluidState().enthalpy(phaseIdx) *
429  up.fluidState().density(phaseIdx);
430  }
431  }
432 
438  template <class Context>
439  static void handleFractureFlux(RateVector& flux,
440  const Context& context,
441  unsigned spaceIdx,
442  unsigned timeIdx)
443  {
444  const auto& scvf = context.stencil(timeIdx).interiorFace(spaceIdx);
445  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
446 
447  // reduce the energy flux in the matrix by the half the width occupied by the
448  // fracture
449  flux[energyEqIdx] *= 1 - extQuants.fractureWidth() / (2 * scvf.area());
450 
451  // advective energy flux in all phases
452  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
453  if (!context.model().phaseIsConsidered(phaseIdx)) {
454  continue;
455  }
456 
457  // intensive quantities of the upstream and the downstream DOFs
458  const unsigned upIdx = static_cast<unsigned>(extQuants.upstreamIndex(phaseIdx));
459  const IntensiveQuantities& up = context.intensiveQuantities(upIdx, timeIdx);
460 
461  flux[energyEqIdx] +=
462  extQuants.fractureVolumeFlux(phaseIdx) *
463  up.fluidState().enthalpy(phaseIdx) *
464  up.fluidState().density(phaseIdx);
465  }
466  }
467 
474  template <class Context>
475  static void addDiffusiveFlux(RateVector& flux,
476  const Context& context,
477  unsigned spaceIdx,
478  unsigned timeIdx)
479  {
480  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
481 
482  // diffusive energy flux
483  flux[energyEqIdx] += -extQuants.temperatureGradNormal() * extQuants.thermalConductivity();
484  }
485 };
486 
493 template <unsigned PVOffset, bool enableEnergy>
495 
499 template <unsigned PVOffset>
500 struct EnergyIndices<PVOffset, /*enableEnergy=*/false>
501 {
503  enum { temperatureIdx = -1000 };
504 
506  enum { energyEqIdx = -1000 };
507 
508 protected:
509  enum { numEq_ = 0 };
510 };
511 
515 template <unsigned PVOffset>
516 struct EnergyIndices<PVOffset, /*enableEnergy=*/true>
517 {
519  enum { temperatureIdx = PVOffset };
520 
522  enum { energyEqIdx = PVOffset };
523 
524 protected:
525  enum { numEq_ = 1 };
526 };
527 
534 template <class TypeTag, bool enableEnergy>
536 
540 template <class TypeTag>
541 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/false>
542 {
547 
548  using Toolbox = Opm::MathToolbox<Evaluation>;
549 
550 public:
555  Evaluation solidInternalEnergy() const
556  {
557  throw std::logic_error("solidInternalEnergy() does not make sense for isothermal models");
558  }
559 
564  Evaluation thermalConductivity() const
565  {
566  throw std::logic_error("thermalConductivity() does not make sense for isothermal models");
567  }
568 
569 protected:
573  template <class FluidState, class Context>
574  static void updateTemperatures_(FluidState& fluidState,
575  const Context& context,
576  unsigned spaceIdx,
577  unsigned timeIdx)
578  {
579  const Scalar T = context.problem().temperature(context, spaceIdx, timeIdx);
580  fluidState.setTemperature(Toolbox::createConstant(T));
581  }
582 
587  template <class FluidState>
588  void update_(FluidState&,
589  typename FluidSystem::template ParameterCache<typename FluidState::ValueType>&,
590  const ElementContext&,
591  unsigned,
592  unsigned)
593  {}
594 };
595 
599 template <class TypeTag>
600 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/true>
601 {
606  using ThermalConductionLaw = GetPropType<TypeTag, Properties::ThermalConductionLaw>;
609 
610  enum { numPhases = FluidSystem::numPhases };
611  enum { temperatureIdx = Indices::temperatureIdx };
612 
613  using Toolbox = Opm::MathToolbox<Evaluation>;
614 
615 protected:
619  template <class FluidState, class Context>
620  static void updateTemperatures_(FluidState& fluidState,
621  const Context& context,
622  unsigned spaceIdx,
623  unsigned timeIdx)
624  {
625  const auto& priVars = context.primaryVars(spaceIdx, timeIdx);
626  if constexpr (std::is_same_v<Evaluation, Scalar>) { // finite differences
627  fluidState.setTemperature(Toolbox::createConstant(priVars[temperatureIdx]));
628  }
629  else {
630  // automatic differentiation
631  if (timeIdx == 0) {
632  fluidState.setTemperature(Toolbox::createVariable(priVars[temperatureIdx], temperatureIdx));
633  }
634  else {
635  fluidState.setTemperature(Toolbox::createConstant(priVars[temperatureIdx]));
636  }
637  }
638  }
639 
644  template <class FluidState>
645  void update_(FluidState& fs,
646  typename FluidSystem::template ParameterCache<typename FluidState::ValueType>& paramCache,
647  const ElementContext& elemCtx,
648  unsigned dofIdx,
649  unsigned timeIdx)
650  {
651  // set the specific enthalpies of the fluids
652  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
653  if (!elemCtx.model().phaseIsConsidered(phaseIdx)) {
654  continue;
655  }
656 
657  fs.setEnthalpy(phaseIdx,
658  FluidSystem::enthalpy(fs, paramCache, phaseIdx));
659  }
660 
661  // compute and set the volumetric internal energy of the solid phase
662  const auto& problem = elemCtx.problem();
663  const auto& solidEnergyParams = problem.solidEnergyLawParams(elemCtx, dofIdx, timeIdx);
664  const auto& thermalCondParams = problem.thermalConductionLawParams(elemCtx, dofIdx, timeIdx);
665 
666  solidInternalEnergy_ = SolidEnergyLaw::solidInternalEnergy(solidEnergyParams, fs);
667  thermalConductivity_ = ThermalConductionLaw::thermalConductivity(thermalCondParams, fs);
668 
669  Opm::Valgrind::CheckDefined(solidInternalEnergy_);
670  Opm::Valgrind::CheckDefined(thermalConductivity_);
671  }
672 
673 public:
678  const Evaluation& solidInternalEnergy() const
679  { return solidInternalEnergy_; }
680 
685  const Evaluation& thermalConductivity() const
686  { return thermalConductivity_; }
687 
688 private:
689  Evaluation solidInternalEnergy_;
690  Evaluation thermalConductivity_;
691 };
692 
699 template <class TypeTag, bool enableEnergy>
701 
705 template <class TypeTag>
706 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/false>
707 {
710 
711 protected:
716  void update_(const ElementContext&,
717  unsigned,
718  unsigned)
719  {}
720 
721  template <class Context, class FluidState>
722  void updateBoundary_(const Context&,
723  unsigned,
724  unsigned,
725  const FluidState&)
726  {}
727 
728 public:
732  Scalar temperatureGradNormal() const
733  {
734  throw std::logic_error("Calling temperatureGradNormal() does not make sense "
735  "for isothermal models");
736  }
737 
741  Scalar thermalConductivity() const
742  {
743  throw std::logic_error("Calling thermalConductivity() does not make sense for "
744  "isothermal models");
745  }
746 };
747 
751 template <class TypeTag>
752 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/true>
753 {
758 
759  enum { dimWorld = GridView::dimensionworld };
760  using EvalDimVector = Dune::FieldVector<Evaluation, dimWorld>;
761  using DimVector = Dune::FieldVector<Scalar, dimWorld>;
762 
763 protected:
768  void update_(const ElementContext& elemCtx, unsigned faceIdx, unsigned timeIdx)
769  {
770  const auto& gradCalc = elemCtx.gradientCalculator();
771  TemperatureCallback<TypeTag> temperatureCallback(elemCtx);
772 
773  EvalDimVector temperatureGrad;
774  gradCalc.calculateGradient(temperatureGrad,
775  elemCtx,
776  faceIdx,
777  temperatureCallback);
778 
779  // scalar product of temperature gradient and scvf normal
780  const auto& face = elemCtx.stencil(/*timeIdx=*/0).interiorFace(faceIdx);
781 
782  temperatureGradNormal_ = 0;
783  for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
784  temperatureGradNormal_ += (face.normal()[dimIdx]*temperatureGrad[dimIdx]);
785  }
786 
787  const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, timeIdx);
788  const auto& intQuantsInside = elemCtx.intensiveQuantities(extQuants.interiorIndex(), timeIdx);
789  const auto& intQuantsOutside = elemCtx.intensiveQuantities(extQuants.exteriorIndex(), timeIdx);
790 
791  // arithmetic mean
792  thermalConductivity_ = 0.5 * (intQuantsInside.thermalConductivity() +
793  intQuantsOutside.thermalConductivity());
794  Opm::Valgrind::CheckDefined(thermalConductivity_);
795  }
796 
797  template <class Context, class FluidState>
798  void updateBoundary_(const Context& context, unsigned bfIdx, unsigned timeIdx, const FluidState& fs)
799  {
800  const auto& stencil = context.stencil(timeIdx);
801  const auto& face = stencil.boundaryFace(bfIdx);
802 
803  const auto& elemCtx = context.elementContext();
804  const unsigned insideScvIdx = face.interiorIndex();
805  const auto& insideScv = elemCtx.stencil(timeIdx).subControlVolume(insideScvIdx);
806 
807  const auto& intQuantsInside = elemCtx.intensiveQuantities(insideScvIdx, timeIdx);
808  const auto& fsInside = intQuantsInside.fluidState();
809 
810  // distance between the center of the SCV and center of the boundary face
811  DimVector distVec = face.integrationPos();
812  distVec -= insideScv.geometry().center();
813 
814  Scalar dist = 0;
815  for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
816  dist += distVec[dimIdx] * face.normal()[dimIdx];
817  }
818 
819  // if the following assertation triggers, the center of the
820  // center of the interior SCV was not inside the element!
821  assert(dist > 0);
822 
823  // calculate the temperature gradient using two-point gradient
824  // appoximation
825  temperatureGradNormal_ =
826  (fs.temperature(/*phaseIdx=*/0) - fsInside.temperature(/*phaseIdx=*/0)) / dist;
827 
828  // take the value for thermal conductivity from the interior finite volume
829  thermalConductivity_ = intQuantsInside.thermalConductivity();
830  }
831 
832 public:
836  const Evaluation& temperatureGradNormal() const
837  { return temperatureGradNormal_; }
838 
843  const Evaluation& thermalConductivity() const
844  { return thermalConductivity_; }
845 
846 private:
847  Evaluation temperatureGradNormal_;
848  Evaluation thermalConductivity_;
849 };
850 
851 } // namespace Opm
852 
853 #endif
static void setEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Set the rate of energy flux of a rate vector.
Definition: energymodule.hh:310
static void addPhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, unsigned phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:362
const Evaluation & thermalConductivity() const
The total thermal conductivity at the face .
Definition: energymodule.hh:843
static void addDiffusiveFlux(RateVector &, const Context &, unsigned, unsigned)
Adds the diffusive energy flux to the flux vector over the face of a sub-control volume.
Definition: energymodule.hh:213
static void updateTemperatures_(FluidState &fluidState, const Context &context, unsigned spaceIdx, unsigned timeIdx)
Update the temperatures of the fluids of a fluid state.
Definition: energymodule.hh:620
static void addAdvectiveFlux(RateVector &flux, const Context &context, unsigned spaceIdx, unsigned timeIdx)
Evaluates the advective energy fluxes for a flux integration point and adds the result in the flux ve...
Definition: energymodule.hh:409
static std::string primaryVarName(unsigned pvIdx)
Returns the name of a primary variable or an empty string if the specified primary variable index doe...
Definition: energymodule.hh:255
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:233
static Scalar primaryVarWeight(const Model &, unsigned, unsigned)
Returns the relative weight of a primary variable for calculating relative errors.
Definition: energymodule.hh:99
void update_(FluidState &, typename FluidSystem::template ParameterCache< typename FluidState::ValueType > &, const ElementContext &, unsigned, unsigned)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:588
static void setEnthalpyRate(RateVector &rateVec, const FluidState &fluidState, unsigned phaseIdx, const Evaluation &volume)
Given a fluid state, set the enthalpy rate which emerges from a volumetric rate.
Definition: energymodule.hh:330
static void handleFractureFlux(RateVector &, const Context &, unsigned, unsigned)
Evaluates the advective energy fluxes over a fracture which should be attributed to a face of a subco...
Definition: energymodule.hh:200
static void handleFractureFlux(RateVector &flux, const Context &context, unsigned spaceIdx, unsigned timeIdx)
Evaluates the advective energy fluxes over a fracture which should be attributed to a face of a subco...
Definition: energymodule.hh:439
Provides the quantities required to calculate energy fluxes.
Definition: energymodule.hh:700
void update_(const ElementContext &, unsigned, unsigned)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:716
void update_(const ElementContext &elemCtx, unsigned faceIdx, unsigned timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:768
Scalar thermalConductivity() const
The total thermal conductivity at the face .
Definition: energymodule.hh:741
Defines the common properties required by the porous medium multi-phase models.
static void setPriVarTemperatures(PrimaryVariables &, const FluidState &)
Given a fluid state, set the temperature in the primary variables.
Definition: energymodule.hh:116
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:247
static void setEnthalpyRate(RateVector &, const Evaluation &)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:134
Evaluation solidInternalEnergy() const
Returns the volumetric internal energy of the solid matrix in the sub-control volume.
Definition: energymodule.hh:555
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
static void addToEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:316
static Scalar primaryVarWeight(const Model &model, unsigned globalDofIdx, unsigned pvIdx)
Returns the relative weight of a primary variable for calculating relative errors.
Definition: energymodule.hh:280
Provides the volumetric quantities required for the energy equation.
Definition: energymodule.hh:535
const Evaluation & solidInternalEnergy() const
Returns the volumetric internal energy of the solid matrix in the sub-control volume.
Definition: energymodule.hh:678
static void addAdvectiveFlux(RateVector &, const Context &, unsigned, unsigned)
Evaluates the advective energy fluxes over a face of a subcontrol volume and adds the result in the f...
Definition: energymodule.hh:188
const Evaluation & thermalConductivity() const
Returns the total conductivity capacity of the solid matrix in the sub-control volume.
Definition: energymodule.hh:685
Declare the properties used by the infrastructure code of the finite volume discretizations.
static void addToEnthalpyRate(RateVector &, const Evaluation &)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:141
static void addDiffusiveFlux(RateVector &flux, const Context &context, unsigned spaceIdx, unsigned timeIdx)
Adds the diffusive energy flux to the flux vector over the face of a sub-control volume.
Definition: energymodule.hh:475
static std::string eqName(unsigned)
Returns the name of an equation or an empty string if the specified equation index does not belong to...
Definition: energymodule.hh:92
This method contains all callback classes for quantities that are required by some extensive quantiti...
static void addFracturePhaseStorage(Dune::FieldVector< LhsEval, numEq > &, const IntensiveQuantities &, const Scv &, unsigned)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:166
Callback class for temperature.
Definition: quantitycallbacks.hh:48
static void updateTemperatures_(FluidState &fluidState, const Context &context, unsigned spaceIdx, unsigned timeIdx)
Update the temperatures of the fluids of a fluid state.
Definition: energymodule.hh:574
const Evaluation & temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:836
static std::string primaryVarName(unsigned)
Returns the name of a primary variable or an empty string if the specified primary variable index doe...
Definition: energymodule.hh:84
static void setPriVarTemperatures(PrimaryVariables &priVars, const FluidState &fs)
Given a fluid state, set the temperature in the primary variables.
Definition: energymodule.hh:345
void update_(FluidState &fs, typename FluidSystem::template ParameterCache< typename FluidState::ValueType > &paramCache, const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:645
static Scalar eqWeight(const Model &, unsigned, unsigned eqIdx)
Returns the relative weight of a equation.
Definition: energymodule.hh:294
static void addSolidEnergyStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:398
static std::string eqName(unsigned eqIdx)
Returns the name of an equation or an empty string if the specified equation index does not belong to...
Definition: energymodule.hh:268
static void addPhaseStorage(Dune::FieldVector< LhsEval, numEq > &, const IntensiveQuantities &, unsigned)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:156
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
Provides the indices required for the energy equation.
Definition: energymodule.hh:494
static void addFracturePhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, const Scv &scv, unsigned phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:379
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:76
static void setEnthalpyRate(RateVector &, const FluidState &, unsigned, const Evaluation &)
Given a fluid state, set the enthalpy rate which emerges from a volumetric rate.
Definition: energymodule.hh:125
Evaluation thermalConductivity() const
Returns the total thermal conductivity of the solid matrix in the sub-control volume.
Definition: energymodule.hh:564
Scalar temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:732
static Scalar thermalConductionRate(const ExtensiveQuantities &)
Add the rate of the conductive energy flux to a rate vector.
Definition: energymodule.hh:148
static void addSolidEnergyStorage(Dune::FieldVector< LhsEval, numEq > &, const IntensiveQuantities &)
Add the energy storage term for the fracture part a fluid phase to an equation vector.
Definition: energymodule.hh:177
static Evaluation thermalConductionRate(const ExtensiveQuantities &extQuants)
Returns the conductive energy flux for a given flux integration point.
Definition: energymodule.hh:322
static Scalar eqWeight(const Model &, unsigned, unsigned)
Returns the relative weight of a equation of the residual.
Definition: energymodule.hh:107