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 <limits>
44 #include <stdexcept>
45 #include <string>
46 #include <type_traits>
47 
48 namespace Opm {
54 template <class TypeTag, bool enableEnergy>
56 
60 template <class TypeTag>
61 class EnergyModule<TypeTag, /*enableEnergy=*/false>
62 {
70 
71  enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
72 
73 public:
77  static void registerParameters()
78  {}
79 
85  static std::string primaryVarName(unsigned)
86  { return ""; }
87 
93  static std::string eqName(unsigned)
94  { return ""; }
95 
100  static Scalar primaryVarWeight(const Model&,
101  unsigned,
102  unsigned)
103  { return -1; }
104 
108  static Scalar eqWeight(const Model&,
109  unsigned,
110  unsigned)
111  { return -1; }
112 
116  template <class FluidState>
117  static void setPriVarTemperatures(PrimaryVariables&,
118  const FluidState&)
119  {}
120 
125  template <class RateVector, class FluidState>
126  static void setEnthalpyRate(RateVector&,
127  const FluidState&,
128  unsigned,
129  const Evaluation&)
130  {}
131 
135  static void setEnthalpyRate(RateVector&,
136  const Evaluation&)
137  {}
138 
142  static void addToEnthalpyRate(RateVector&,
143  const Evaluation&)
144  {}
145 
149  static Scalar thermalConductionRate(const ExtensiveQuantities&)
150  { return 0.0; }
151 
156  template <class LhsEval>
157  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq>&,
158  const IntensiveQuantities&,
159  unsigned)
160  {}
161 
166  template <class LhsEval, class Scv>
167  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq>&,
168  const IntensiveQuantities&,
169  const Scv&,
170  unsigned)
171  {}
172 
177  template <class LhsEval>
178  static void addSolidEnergyStorage(Dune::FieldVector<LhsEval, numEq>&,
179  const IntensiveQuantities&)
180  {}
181 
188  template <class Context>
189  static void addAdvectiveFlux(RateVector&,
190  const Context&,
191  unsigned,
192  unsigned)
193  {}
194 
200  template <class Context>
201  static void handleFractureFlux(RateVector&,
202  const Context&,
203  unsigned,
204  unsigned)
205  {}
206 
213  template <class Context>
214  static void addDiffusiveFlux(RateVector&,
215  const Context&,
216  unsigned,
217  unsigned)
218  {}
219 };
220 
224 template <class TypeTag>
225 class EnergyModule<TypeTag, /*enableEnergy=*/true>
226 {
232  using IntensiveQuantities = GetPropType<TypeTag, Properties::IntensiveQuantities>;
233  using ExtensiveQuantities = GetPropType<TypeTag, Properties::ExtensiveQuantities>;
236 
237  enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
238  enum { numPhases = FluidSystem::numPhases };
239  enum { energyEqIdx = Indices::energyEqIdx };
240  static constexpr unsigned temperatureIdx = Indices::temperatureIdx;
241 
242  using Toolbox = Opm::MathToolbox<Evaluation>;
243 
244 public:
248  static void registerParameters()
249  {}
250 
256  static std::string primaryVarName(unsigned pvIdx)
257  {
258  if (pvIdx == temperatureIdx) {
259  return "temperature";
260  }
261  return "";
262  }
263 
269  static std::string eqName(unsigned eqIdx)
270  {
271  if (eqIdx == energyEqIdx) {
272  return "energy";
273  }
274  return "";
275  }
276 
281  static Scalar primaryVarWeight(const Model& model, unsigned globalDofIdx, unsigned pvIdx)
282  {
283  if (pvIdx != temperatureIdx) {
284  return -1;
285  }
286 
287  // make the weight of the temperature primary variable inversly proportional to its value
288  return std::max(static_cast<Scalar>(1.0) / 1000,
289  1.0 / model.solution(/*timeIdx=*/0)[globalDofIdx][temperatureIdx]);
290  }
291 
295  static Scalar eqWeight(const Model&,
296  unsigned,
297  unsigned eqIdx)
298  {
299  if (eqIdx != energyEqIdx) {
300  return -1;
301  }
302 
303  // approximate change of internal energy of 1kg of liquid water for a temperature
304  // change of 30K
305  return static_cast<Scalar>(1.0) / (4.184e3 * 30.0);
306  }
307 
311  static void setEnthalpyRate(RateVector& rateVec, const Evaluation& rate)
312  { rateVec[energyEqIdx] = rate; }
313 
317  static void addToEnthalpyRate(RateVector& rateVec, const Evaluation& rate)
318  { rateVec[energyEqIdx] += rate; }
319 
323  static Evaluation thermalConductionRate(const ExtensiveQuantities& extQuants)
324  { return -extQuants.temperatureGradNormal() * extQuants.thermalConductivity(); }
325 
330  template <class RateVector, class FluidState>
331  static void setEnthalpyRate(RateVector& rateVec,
332  const FluidState& fluidState,
333  unsigned phaseIdx,
334  const Evaluation& volume)
335  {
336  rateVec[energyEqIdx] =
337  volume *
338  fluidState.density(phaseIdx) *
339  fluidState.enthalpy(phaseIdx);
340  }
341 
345  template <class FluidState>
346  static void setPriVarTemperatures(PrimaryVariables& priVars,
347  const FluidState& fs)
348  {
349  priVars[temperatureIdx] = Toolbox::value(fs.temperature(/*phaseIdx=*/0));
350 #ifndef NDEBUG
351  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
352  assert(std::abs(Toolbox::value(fs.temperature(/*phaseIdx=*/0))
353  - Toolbox::value(fs.temperature(phaseIdx))) < 1e-30);
354  }
355 #endif
356  }
357 
362  template <class LhsEval>
363  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq>& storage,
364  const IntensiveQuantities& intQuants,
365  unsigned phaseIdx)
366  {
367  const auto& fs = intQuants.fluidState();
368  storage[energyEqIdx] +=
369  Toolbox::template decay<LhsEval>(fs.density(phaseIdx)) *
370  Toolbox::template decay<LhsEval>(fs.internalEnergy(phaseIdx)) *
371  Toolbox::template decay<LhsEval>(fs.saturation(phaseIdx)) *
372  Toolbox::template decay<LhsEval>(intQuants.porosity());
373  }
374 
379  template <class Scv, class LhsEval>
380  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq>& storage,
381  const IntensiveQuantities& intQuants,
382  const Scv& scv,
383  unsigned phaseIdx)
384  {
385  const auto& fs = intQuants.fractureFluidState();
386  storage[energyEqIdx] +=
387  Toolbox::template decay<LhsEval>(fs.density(phaseIdx)) *
388  Toolbox::template decay<LhsEval>(fs.internalEnergy(phaseIdx)) *
389  Toolbox::template decay<LhsEval>(fs.saturation(phaseIdx)) *
390  Toolbox::template decay<LhsEval>(intQuants.fracturePorosity()) *
391  Toolbox::template decay<LhsEval>(intQuants.fractureVolume()) / scv.volume();
392  }
393 
398  template <class LhsEval>
399  static void addSolidEnergyStorage(Dune::FieldVector<LhsEval, numEq>& storage,
400  const IntensiveQuantities& intQuants)
401  { storage[energyEqIdx] += Opm::decay<LhsEval>(intQuants.solidInternalEnergy()); }
402 
409  template <class Context>
410  static void addAdvectiveFlux(RateVector& flux,
411  const Context& context,
412  unsigned spaceIdx,
413  unsigned timeIdx)
414  {
415  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
416 
417  // advective energy flux in all phases
418  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
419  if (!context.model().phaseIsConsidered(phaseIdx)) {
420  continue;
421  }
422 
423  // intensive quantities of the upstream and the downstream DOFs
424  const unsigned upIdx = static_cast<unsigned>(extQuants.upstreamIndex(phaseIdx));
425  const IntensiveQuantities& up = context.intensiveQuantities(upIdx, timeIdx);
426 
427  flux[energyEqIdx] +=
428  extQuants.volumeFlux(phaseIdx) *
429  up.fluidState().enthalpy(phaseIdx) *
430  up.fluidState().density(phaseIdx);
431  }
432  }
433 
439  template <class Context>
440  static void handleFractureFlux(RateVector& flux,
441  const Context& context,
442  unsigned spaceIdx,
443  unsigned timeIdx)
444  {
445  const auto& scvf = context.stencil(timeIdx).interiorFace(spaceIdx);
446  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
447 
448  // reduce the energy flux in the matrix by the half the width occupied by the
449  // fracture
450  flux[energyEqIdx] *= 1 - extQuants.fractureWidth() / (2 * scvf.area());
451 
452  // advective energy flux in all phases
453  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
454  if (!context.model().phaseIsConsidered(phaseIdx)) {
455  continue;
456  }
457 
458  // intensive quantities of the upstream and the downstream DOFs
459  const unsigned upIdx = static_cast<unsigned>(extQuants.upstreamIndex(phaseIdx));
460  const IntensiveQuantities& up = context.intensiveQuantities(upIdx, timeIdx);
461 
462  flux[energyEqIdx] +=
463  extQuants.fractureVolumeFlux(phaseIdx) *
464  up.fluidState().enthalpy(phaseIdx) *
465  up.fluidState().density(phaseIdx);
466  }
467  }
468 
475  template <class Context>
476  static void addDiffusiveFlux(RateVector& flux,
477  const Context& context,
478  unsigned spaceIdx,
479  unsigned timeIdx)
480  {
481  const auto& extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
482 
483  // diffusive energy flux
484  flux[energyEqIdx] += -extQuants.temperatureGradNormal() * extQuants.thermalConductivity();
485  }
486 };
487 
494 template <unsigned PVOffset, bool enableEnergy>
496 
500 template <unsigned PVOffset>
501 struct EnergyIndices<PVOffset, /*enableEnergy=*/false>
502 {
504  static constexpr unsigned temperatureIdx = std::numeric_limits<unsigned>::max();
505 
507  enum { energyEqIdx = -1000 };
508 
509 protected:
510  enum { numEq_ = 0 };
511 };
512 
516 template <unsigned PVOffset>
517 struct EnergyIndices<PVOffset, /*enableEnergy=*/true>
518 {
520  static constexpr unsigned temperatureIdx = PVOffset;
521 
523  enum { energyEqIdx = PVOffset };
524 
525 protected:
526  enum { numEq_ = 1 };
527 };
528 
535 template <class TypeTag, bool enableEnergy>
537 
541 template <class TypeTag>
542 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/false>
543 {
548 
549  using Toolbox = Opm::MathToolbox<Evaluation>;
550 
551 public:
556  Evaluation solidInternalEnergy() const
557  {
558  throw std::logic_error("solidInternalEnergy() does not make sense for isothermal models");
559  }
560 
565  Evaluation thermalConductivity() const
566  {
567  throw std::logic_error("thermalConductivity() does not make sense for isothermal models");
568  }
569 
570 protected:
574  template <class FluidState, class Context>
575  static void updateTemperatures_(FluidState& fluidState,
576  const Context& context,
577  unsigned spaceIdx,
578  unsigned timeIdx)
579  {
580  const Scalar T = context.problem().temperature(context, spaceIdx, timeIdx);
581  fluidState.setTemperature(Toolbox::createConstant(T));
582  }
583 
588  template <class FluidState>
589  void update_(FluidState&,
590  typename FluidSystem::template ParameterCache<typename FluidState::ValueType>&,
591  const ElementContext&,
592  unsigned,
593  unsigned)
594  {}
595 };
596 
600 template <class TypeTag>
601 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/true>
602 {
607  using ThermalConductionLaw = GetPropType<TypeTag, Properties::ThermalConductionLaw>;
610 
611  enum { numPhases = FluidSystem::numPhases };
612  static constexpr unsigned temperatureIdx = Indices::temperatureIdx;
613 
614  using Toolbox = Opm::MathToolbox<Evaluation>;
615 
616 protected:
620  template <class FluidState, class Context>
621  static void updateTemperatures_(FluidState& fluidState,
622  const Context& context,
623  unsigned spaceIdx,
624  unsigned timeIdx)
625  {
626  const auto& priVars = context.primaryVars(spaceIdx, timeIdx);
627  if constexpr (std::is_same_v<Evaluation, Scalar>) { // finite differences
628  fluidState.setTemperature(Toolbox::createConstant(priVars[temperatureIdx]));
629  }
630  else {
631  // automatic differentiation
632  if (timeIdx == 0) {
633  fluidState.setTemperature(Toolbox::createVariable(priVars[temperatureIdx], temperatureIdx));
634  }
635  else {
636  fluidState.setTemperature(Toolbox::createConstant(priVars[temperatureIdx]));
637  }
638  }
639  }
640 
645  template <class FluidState>
646  void update_(FluidState& fs,
647  typename FluidSystem::template ParameterCache<typename FluidState::ValueType>& paramCache,
648  const ElementContext& elemCtx,
649  unsigned dofIdx,
650  unsigned timeIdx)
651  {
652  // set the specific enthalpies of the fluids
653  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
654  if (!elemCtx.model().phaseIsConsidered(phaseIdx)) {
655  continue;
656  }
657 
658  fs.setEnthalpy(phaseIdx,
659  FluidSystem::enthalpy(fs, paramCache, phaseIdx));
660  }
661 
662  // compute and set the volumetric internal energy of the solid phase
663  const auto& problem = elemCtx.problem();
664  const auto& solidEnergyParams = problem.solidEnergyLawParams(elemCtx, dofIdx, timeIdx);
665  const auto& thermalCondParams = problem.thermalConductionLawParams(elemCtx, dofIdx, timeIdx);
666 
667  solidInternalEnergy_ = SolidEnergyLaw::solidInternalEnergy(solidEnergyParams, fs);
668  thermalConductivity_ = ThermalConductionLaw::thermalConductivity(thermalCondParams, fs);
669 
670  Opm::Valgrind::CheckDefined(solidInternalEnergy_);
671  Opm::Valgrind::CheckDefined(thermalConductivity_);
672  }
673 
674 public:
679  const Evaluation& solidInternalEnergy() const
680  { return solidInternalEnergy_; }
681 
686  const Evaluation& thermalConductivity() const
687  { return thermalConductivity_; }
688 
689 private:
690  Evaluation solidInternalEnergy_;
691  Evaluation thermalConductivity_;
692 };
693 
700 template <class TypeTag, bool enableEnergy>
702 
706 template <class TypeTag>
707 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/false>
708 {
711 
712 protected:
717  void update_(const ElementContext&,
718  unsigned,
719  unsigned)
720  {}
721 
722  template <class Context, class FluidState>
723  void updateBoundary_(const Context&,
724  unsigned,
725  unsigned,
726  const FluidState&)
727  {}
728 
729 public:
733  Scalar temperatureGradNormal() const
734  {
735  throw std::logic_error("Calling temperatureGradNormal() does not make sense "
736  "for isothermal models");
737  }
738 
742  Scalar thermalConductivity() const
743  {
744  throw std::logic_error("Calling thermalConductivity() does not make sense for "
745  "isothermal models");
746  }
747 };
748 
752 template <class TypeTag>
753 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/true>
754 {
759 
760  enum { dimWorld = GridView::dimensionworld };
761  using EvalDimVector = Dune::FieldVector<Evaluation, dimWorld>;
762  using DimVector = Dune::FieldVector<Scalar, dimWorld>;
763 
764 protected:
769  void update_(const ElementContext& elemCtx, unsigned faceIdx, unsigned timeIdx)
770  {
771  const auto& gradCalc = elemCtx.gradientCalculator();
772  TemperatureCallback<TypeTag> temperatureCallback(elemCtx);
773 
774  EvalDimVector temperatureGrad;
775  gradCalc.calculateGradient(temperatureGrad,
776  elemCtx,
777  faceIdx,
778  temperatureCallback);
779 
780  // scalar product of temperature gradient and scvf normal
781  const auto& face = elemCtx.stencil(/*timeIdx=*/0).interiorFace(faceIdx);
782 
783  temperatureGradNormal_ = 0;
784  for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
785  temperatureGradNormal_ += (face.normal()[dimIdx]*temperatureGrad[dimIdx]);
786  }
787 
788  const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, timeIdx);
789  const auto& intQuantsInside = elemCtx.intensiveQuantities(extQuants.interiorIndex(), timeIdx);
790  const auto& intQuantsOutside = elemCtx.intensiveQuantities(extQuants.exteriorIndex(), timeIdx);
791 
792  // arithmetic mean
793  thermalConductivity_ = 0.5 * (intQuantsInside.thermalConductivity() +
794  intQuantsOutside.thermalConductivity());
795  Opm::Valgrind::CheckDefined(thermalConductivity_);
796  }
797 
798  template <class Context, class FluidState>
799  void updateBoundary_(const Context& context, unsigned bfIdx, unsigned timeIdx, const FluidState& fs)
800  {
801  const auto& stencil = context.stencil(timeIdx);
802  const auto& face = stencil.boundaryFace(bfIdx);
803 
804  const auto& elemCtx = context.elementContext();
805  const unsigned insideScvIdx = face.interiorIndex();
806  const auto& insideScv = elemCtx.stencil(timeIdx).subControlVolume(insideScvIdx);
807 
808  const auto& intQuantsInside = elemCtx.intensiveQuantities(insideScvIdx, timeIdx);
809  const auto& fsInside = intQuantsInside.fluidState();
810 
811  // distance between the center of the SCV and center of the boundary face
812  DimVector distVec = face.integrationPos();
813  distVec -= insideScv.geometry().center();
814 
815  Scalar dist = 0;
816  for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
817  dist += distVec[dimIdx] * face.normal()[dimIdx];
818  }
819 
820  // if the following assertation triggers, the center of the
821  // center of the interior SCV was not inside the element!
822  assert(dist > 0);
823 
824  // calculate the temperature gradient using two-point gradient
825  // appoximation
826  temperatureGradNormal_ =
827  (fs.temperature(/*phaseIdx=*/0) - fsInside.temperature(/*phaseIdx=*/0)) / dist;
828 
829  // take the value for thermal conductivity from the interior finite volume
830  thermalConductivity_ = intQuantsInside.thermalConductivity();
831  }
832 
833 public:
837  const Evaluation& temperatureGradNormal() const
838  { return temperatureGradNormal_; }
839 
844  const Evaluation& thermalConductivity() const
845  { return thermalConductivity_; }
846 
847 private:
848  Evaluation temperatureGradNormal_;
849  Evaluation thermalConductivity_;
850 };
851 
852 } // namespace Opm
853 
854 #endif
static void setEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Set the rate of energy flux of a rate vector.
Definition: energymodule.hh:311
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:363
const Evaluation & thermalConductivity() const
The total thermal conductivity at the face .
Definition: energymodule.hh:844
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:214
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:621
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:410
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:256
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:100
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:589
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:331
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:201
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:440
Provides the quantities required to calculate energy fluxes.
Definition: energymodule.hh:701
void update_(const ElementContext &, unsigned, unsigned)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:717
void update_(const ElementContext &elemCtx, unsigned faceIdx, unsigned timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:769
Scalar thermalConductivity() const
The total thermal conductivity at the face .
Definition: energymodule.hh:742
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:117
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:248
static void setEnthalpyRate(RateVector &, const Evaluation &)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:135
Evaluation solidInternalEnergy() const
Returns the volumetric internal energy of the solid matrix in the sub-control volume.
Definition: energymodule.hh:556
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
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:317
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:281
Provides the volumetric quantities required for the energy equation.
Definition: energymodule.hh:536
const Evaluation & solidInternalEnergy() const
Returns the volumetric internal energy of the solid matrix in the sub-control volume.
Definition: energymodule.hh:679
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:189
const Evaluation & thermalConductivity() const
Returns the total conductivity capacity of the solid matrix in the sub-control volume.
Definition: energymodule.hh:686
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:142
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:476
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:93
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:167
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:575
const Evaluation & temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:837
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:85
static void setPriVarTemperatures(PrimaryVariables &priVars, const FluidState &fs)
Given a fluid state, set the temperature in the primary variables.
Definition: energymodule.hh:346
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:646
static Scalar eqWeight(const Model &, unsigned, unsigned eqIdx)
Returns the relative weight of a equation.
Definition: energymodule.hh:295
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:399
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:269
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:157
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:55
Provides the indices required for the energy equation.
Definition: energymodule.hh:495
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:380
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:77
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:126
Evaluation thermalConductivity() const
Returns the total thermal conductivity of the solid matrix in the sub-control volume.
Definition: energymodule.hh:565
Scalar temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:733
static Scalar thermalConductionRate(const ExtensiveQuantities &)
Add the rate of the conductive energy flux to a rate vector.
Definition: energymodule.hh:149
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:178
static Evaluation thermalConductionRate(const ExtensiveQuantities &extQuants)
Returns the conductive energy flux for a given flux integration point.
Definition: energymodule.hh:323
static Scalar eqWeight(const Model &, unsigned, unsigned)
Returns the relative weight of a equation of the residual.
Definition: energymodule.hh:108