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  Copyright (C) 2008-2013 by Andreas Lauser
5  Copyright (C) 2012 by Klaus Mosthaf
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
28 #ifndef EWOMS_ENERGY_MODULE_HH
29 #define EWOMS_ENERGY_MODULE_HH
30 
33 
34 #include <dune/common/fvector.hh>
35 
36 #include <string>
37 
38 namespace Ewoms {
39 namespace Properties {
40 NEW_PROP_TAG(Indices);
41 NEW_PROP_TAG(EnableEnergy);
42 NEW_PROP_TAG(HeatConductionLaw);
43 NEW_PROP_TAG(HeatConductionLawParams);
44 }
45 }
46 
47 namespace Ewoms {
53 template <class TypeTag, bool enableEnergy>
55 
59 template <class TypeTag>
60 class EnergyModule<TypeTag, /*enableEnergy=*/false>
61 {
62  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
63  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
64  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
65  typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
66  typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
67  typedef typename GET_PROP_TYPE(TypeTag, ExtensiveQuantities) ExtensiveQuantities;
68  typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
69  typedef typename GET_PROP_TYPE(TypeTag, Model) Model;
70  typedef typename FluidSystem::ParameterCache ParameterCache;
71 
72  enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) };
73 
74  typedef Dune::FieldVector<Evaluation, numEq> EvalEqVector;
75 
76 public:
80  static void registerParameters()
81  {}
82 
88  static std::string primaryVarName(int pvIdx)
89  { return ""; }
90 
96  static std::string eqName(int eqIdx)
97  { return ""; }
98 
103  static Scalar primaryVarWeight(const Model &model,
104  int globalDofIdx,
105  int pvIdx)
106  { return -1; }
107 
111  static Scalar eqWeight(const Model &model,
112  int globalDofIdx,
113  int eqIdx)
114  { return -1; }
115 
119  template <class FluidState>
120  static void setPriVarTemperatures(PrimaryVariables &priVars,
121  const FluidState &fs)
122  {}
123 
128  template <class FluidState>
129  static void setEnthalpyRate(RateVector &rateVec,
130  const FluidState &fluidState,
131  int phaseIdx,
132  const Evaluation& volume)
133  {}
134 
138  static void setEnthalpyRate(RateVector &rateVec,
139  const Evaluation& rate)
140  {}
141 
145  static void addToEnthalpyRate(RateVector &rateVec,
146  const Evaluation& rate)
147  {}
148 
152  static Evaluation heatConductionRate(const ExtensiveQuantities &extQuants)
153  {
154  typedef Opm::MathToolbox<Evaluation> Toolbox;
155 
156  return Toolbox::createConstant(0.0);
157  }
158 
163  template <class LhsEval>
164  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq> &storage,
165  const IntensiveQuantities &intQuants,
166  int phaseIdx)
167  {}
168 
173  template <class LhsEval, class Scv>
174  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq> &storage,
175  const IntensiveQuantities& intQuants,
176  const Scv& scv,
177  int phaseIdx)
178  {}
179 
184  template <class LhsEval>
185  static void addSolidHeatStorage(Dune::FieldVector<LhsEval, numEq> &storage,
186  const IntensiveQuantities& intQuants)
187  {}
188 
195  template <class Context>
196  static void addAdvectiveFlux(RateVector &flux,
197  const Context &context,
198  int spaceIdx,
199  int timeIdx)
200  {}
201 
207  template <class Context>
208  static void handleFractureFlux(RateVector &flux,
209  const Context &context,
210  int spaceIdx,
211  int timeIdx)
212  {}
213 
220  template <class Context>
221  static void addDiffusiveFlux(RateVector &flux,
222  const Context &context,
223  int spaceIdx,
224  int timeIdx)
225  {}
226 };
227 
231 template <class TypeTag>
232 class EnergyModule<TypeTag, /*enableEnergy=*/true>
233 {
234  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
235  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
236  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
237  typedef typename GET_PROP_TYPE(TypeTag, EqVector) EqVector;
238  typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
239  typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
240  typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
241  typedef typename GET_PROP_TYPE(TypeTag, ExtensiveQuantities) ExtensiveQuantities;
242  typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
243  typedef typename GET_PROP_TYPE(TypeTag, Model) Model;
244  typedef typename FluidSystem::ParameterCache ParameterCache;
245 
246  enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) };
247  enum { numPhases = FluidSystem::numPhases };
248  enum { energyEqIdx = Indices::energyEqIdx };
249  enum { temperatureIdx = Indices::temperatureIdx };
250 
251  typedef Dune::FieldVector<Evaluation, numEq> EvalEqVector;
252  typedef Opm::MathToolbox<Evaluation> Toolbox;
253 
254 public:
258  static void registerParameters()
259  {}
260 
266  static std::string primaryVarName(int pvIdx)
267  {
268  if (pvIdx == temperatureIdx)
269  return "temperature";
270  return "";
271  }
272 
278  static std::string eqName(int eqIdx)
279  {
280  if (eqIdx == energyEqIdx)
281  return "energy";
282  return "";
283  }
284 
289  static Scalar primaryVarWeight(const Model &model, int globalDofIdx, int pvIdx)
290  {
291  if (pvIdx != temperatureIdx)
292  return -1;
293 
294  // make the weight of the temperature primary variable inversly proportional to its value
295  return std::max(1.0/1000, 1.0/model.solution(/*timeIdx=*/0)[globalDofIdx][temperatureIdx]);
296  }
297 
301  static Scalar eqWeight(const Model &model,
302  int globalDofIdx,
303  int eqIdx)
304  {
305  if (eqIdx != energyEqIdx)
306  return -1;
307 
308  // approximate heat capacity of 1kg of air
309  return 1.0 / 1.0035e3;
310  }
311 
315  static void setEnthalpyRate(RateVector &rateVec, const Evaluation& rate)
316  { rateVec[energyEqIdx] = rate; }
317 
321  static void addToEnthalpyRate(RateVector &rateVec, const Evaluation& rate)
322  { rateVec[energyEqIdx] += rate; }
323 
328  static Evaluation heatConductionRate(const ExtensiveQuantities &extQuants)
329  { return -extQuants.temperatureGradNormal() * extQuants.heatConductivity(); }
330 
335  template <class FluidState>
336  static void setEnthalpyRate(RateVector &rateVec,
337  const FluidState &fluidState, int phaseIdx,
338  Scalar volume)
339  {
340  rateVec[energyEqIdx] =
341  volume
342  * fluidState.density(phaseIdx)
343  * fluidState.enthalpy(phaseIdx);
344  }
345 
349  template <class FluidState>
350  static void setPriVarTemperatures(PrimaryVariables &priVars,
351  const FluidState &fs)
352  {
353  priVars[temperatureIdx] = Toolbox::value(fs.temperature(/*phaseIdx=*/0));
354 #ifndef NDEBUG
355  for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
356  assert(std::abs(Toolbox::value(fs.temperature(/*phaseIdx=*/0))
357  - Toolbox::value(fs.temperature(phaseIdx))) < 1e-30);
358  }
359 #endif
360  }
361 
366  template <class LhsEval>
367  static void addPhaseStorage(Dune::FieldVector<LhsEval, numEq> &storage,
368  const IntensiveQuantities &intQuants, int phaseIdx)
369  {
370  const auto &fs = intQuants.fluidState();
371  storage[energyEqIdx] +=
372  Toolbox::template toLhs<LhsEval>(fs.density(phaseIdx))
373  * Toolbox::template toLhs<LhsEval>(fs.internalEnergy(phaseIdx))
374  * Toolbox::template toLhs<LhsEval>(fs.saturation(phaseIdx))
375  * Toolbox::template toLhs<LhsEval>(intQuants.porosity());
376  }
377 
382  template <class Scv, class LhsEval>
383  static void addFracturePhaseStorage(Dune::FieldVector<LhsEval, numEq> &storage,
384  const IntensiveQuantities &intQuants,
385  const Scv &scv, int phaseIdx)
386  {
387  const auto &fs = intQuants.fractureFluidState();
388  storage[energyEqIdx] +=
389  Toolbox::template toLhs<LhsEval>(fs.density(phaseIdx))
390  * Toolbox::template toLhs<LhsEval>(fs.internalEnergy(phaseIdx))
391  * Toolbox::template toLhs<LhsEval>(fs.saturation(phaseIdx))
392  * Toolbox::template toLhs<LhsEval>(intQuants.fracturePorosity())
393  * Toolbox::template toLhs<LhsEval>(intQuants.fractureVolume())/scv.volume();
394  }
395 
400  template <class LhsEval>
401  static void addSolidHeatStorage(Dune::FieldVector<LhsEval, numEq> &storage,
402  const IntensiveQuantities &intQuants)
403  {
404  storage[energyEqIdx] +=
405  Toolbox::template toLhs<LhsEval>(intQuants.heatCapacitySolid())
406  * Toolbox::template toLhs<LhsEval>(intQuants.fluidState().temperature(/*phaseIdx=*/0));
407  }
408 
415  template <class Context>
416  static void addAdvectiveFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
417  {
418  const auto &extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
419 
420  // advective heat flux in all phases
421  for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
422  if (!context.model().phaseIsConsidered(phaseIdx))
423  continue;
424 
425  // intensive quantities of the upstream and the downstream DOFs
426  const IntensiveQuantities &up =
427  context.intensiveQuantities(extQuants.upstreamIndex(phaseIdx), timeIdx);
428 
429  flux[energyEqIdx] +=
430  extQuants.volumeFlux(phaseIdx)
431  * up.fluidState().enthalpy(phaseIdx)
432  * up.fluidState().density(phaseIdx);
433  }
434  }
435 
441  template <class Context>
442  static void handleFractureFlux(RateVector &flux, const Context &context,
443  int spaceIdx, int timeIdx)
444  {
445  const auto &scvf = context.stencil(timeIdx).interiorFace(spaceIdx);
446  const auto &extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
447 
448  // reduce the heat flux in the matrix by the half the width
449  // occupied by the fracture
450  flux[energyEqIdx] *=
451  1 - extQuants.fractureWidth()/(2*scvf.area());
452 
453  // advective heat flux in all phases
454  for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
455  if (!context.model().phaseIsConsidered(phaseIdx))
456  continue;
457 
458  // intensive quantities of the upstream and the downstream DOFs
459  const IntensiveQuantities &up =
460  context.intensiveQuantities(extQuants.upstreamIndex(phaseIdx), 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, const Context &context,
477  int spaceIdx, int timeIdx)
478  {
479  const auto &extQuants = context.extensiveQuantities(spaceIdx, timeIdx);
480 
481  // diffusive heat flux
482  flux[energyEqIdx] +=
483  - extQuants.temperatureGradNormal()
484  * extQuants.heatConductivity();
485  }
486 };
487 
494 template <int PVOffset, bool enableEnergy>
496 
500 template <int PVOffset>
501 struct EnergyIndices<PVOffset, /*enableEnergy=*/false>
502 {
503 protected:
504  enum { numEq_ = 0 };
505 };
506 
510 template <int PVOffset>
511 struct EnergyIndices<PVOffset, /*enableEnergy=*/true>
512 {
514  enum { temperatureIdx = PVOffset };
515 
517  enum { energyEqIdx = PVOffset };
518 
519 protected:
520  enum { numEq_ = 1 };
521 };
522 
529 template <class TypeTag, bool enableEnergy>
531 
535 template <class TypeTag>
536 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/false>
537 {
538  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
539  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
540  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
541  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
542  typedef typename FluidSystem::ParameterCache ParameterCache;
543 
544  typedef Opm::MathToolbox<Evaluation> Toolbox;
545 
546 public:
552  Evaluation heatCapacitySolid() const
553  {
554  OPM_THROW(std::logic_error, "Method heatCapacitySolid() does not make "
555  "sense for isothermal models");
556  }
557 
563  Evaluation heatConductivity() const
564  {
565  OPM_THROW(std::logic_error, "Method heatConductivity() does not make "
566  "sense for isothermal models");
567  }
568 
569 protected:
573  template <class FluidState, class Context>
574  static void updateTemperatures_(FluidState &fluidState,
575  const Context &context, int spaceIdx,
576  int timeIdx)
577  {
578  Scalar T = context.problem().temperature(context, spaceIdx, timeIdx);
579  fluidState.setTemperature(Toolbox::createConstant(T));
580  }
581 
586  template <class FluidState>
587  void update_(FluidState &fs,
588  ParameterCache &paramCache,
589  const ElementContext &elemCtx,
590  int dofIdx,
591  int timeIdx)
592  { }
593 };
594 
598 template <class TypeTag>
599 class EnergyIntensiveQuantities<TypeTag, /*enableEnergy=*/true>
600 {
601  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
602  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
603  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
604  typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
605  typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw;
606  typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
607  typedef typename FluidSystem::ParameterCache ParameterCache;
608 
609  enum { numPhases = FluidSystem::numPhases };
610  enum { energyEqIdx = Indices::energyEqIdx };
611  enum { temperatureIdx = Indices::temperatureIdx };
612 
613  typedef Opm::MathToolbox<Evaluation> Toolbox;
614 
615 protected:
619  template <class FluidState, class Context>
620  static void updateTemperatures_(FluidState &fluidState,
621  const Context &context, int spaceIdx,
622  int timeIdx)
623  {
624  const auto& priVars = context.primaryVars(spaceIdx, timeIdx);
625  Evaluation val;
626  if (timeIdx == 0)
627  val = Toolbox::createVariable(priVars[temperatureIdx], temperatureIdx);
628  else
629  val = Toolbox::createConstant(priVars[temperatureIdx]);
630 
631  fluidState.setTemperature(val);
632  }
633 
638  template <class FluidState>
639  void update_(FluidState &fs,
640  ParameterCache &paramCache,
641  const ElementContext &elemCtx,
642  int dofIdx,
643  int timeIdx)
644  {
645  // set the specific enthalpies of the fluids
646  for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
647  if (!elemCtx.model().phaseIsConsidered(phaseIdx))
648  continue;
649 
650  fs.setEnthalpy(phaseIdx,
651  FluidSystem::enthalpy(fs, paramCache, phaseIdx));
652  }
653 
654  // compute and set the heat capacity of the solid phase
655  const auto &problem = elemCtx.problem();
656  const auto &heatCondParams = problem.heatConductionParams(elemCtx, dofIdx, timeIdx);
657 
658  heatCapacitySolid_ = problem.heatCapacitySolid(elemCtx, dofIdx, timeIdx);
659  heatConductivity_ =
660  HeatConductionLaw::template heatConductivity<FluidState, Evaluation>(heatCondParams, fs);
661 
662  Valgrind::CheckDefined(heatCapacitySolid_);
663  Valgrind::CheckDefined(heatConductivity_);
664  }
665 
666 public:
672  const Evaluation& heatCapacitySolid() const
673  { return heatCapacitySolid_; }
674 
680  const Evaluation& heatConductivity() const
681  { return heatConductivity_; }
682 
683 private:
684  Evaluation heatCapacitySolid_;
685  Evaluation heatConductivity_;
686 };
687 
694 template <class TypeTag, bool enableEnergy>
696 
700 template <class TypeTag>
701 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/false>
702 {
703  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
704  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
705 
706 protected:
711  void update_(const ElementContext &elemCtx, int faceIdx, int timeIdx)
712  {}
713 
714  template <class Context, class FluidState>
715  void updateBoundary_(const Context &context, int bfIdx, int timeIdx,
716  const FluidState &fs)
717  {}
718 
719 public:
723  Scalar temperatureGradNormal() const
724  {
725  OPM_THROW(std::logic_error, "Method temperatureGradNormal() does not "
726  "make sense for isothermal models");
727  }
728 
733  Scalar heatConductivity() const
734  {
735  OPM_THROW(std::logic_error, "Method heatConductivity() does not make "
736  "sense for isothermal models");
737  }
738 };
739 
743 template <class TypeTag>
744 class EnergyExtensiveQuantities<TypeTag, /*enableEnergy=*/true>
745 {
746  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
747  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
748  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
749  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
750 
751  enum { dimWorld = GridView::dimensionworld };
752  typedef Dune::FieldVector<Evaluation, dimWorld> EvalDimVector;
753  typedef Dune::FieldVector<Scalar, dimWorld> DimVector;
754 
755 protected:
760  void update_(const ElementContext &elemCtx, int faceIdx, int timeIdx)
761  {
762  const auto& gradCalc = elemCtx.gradientCalculator();
763  Ewoms::TemperatureCallback<TypeTag> temperatureCallback(elemCtx);
764 
765  EvalDimVector temperatureGrad;
766  gradCalc.calculateGradient(temperatureGrad,
767  elemCtx,
768  faceIdx,
769  temperatureCallback);
770 
771  // scalar product of temperature gradient and scvf normal
772  const auto &face = elemCtx.stencil(/*timeIdx=*/0).interiorFace(faceIdx);
773 
774  temperatureGradNormal_ = 0;
775  for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
776  temperatureGradNormal_ += (face.normal()[dimIdx]*temperatureGrad[dimIdx]);
777 
778  const auto &extQuants = elemCtx.extensiveQuantities(faceIdx, timeIdx);
779  const auto &intQuantsInside = elemCtx.intensiveQuantities(extQuants.interiorIndex(), timeIdx);
780  const auto &intQuantsOutside = elemCtx.intensiveQuantities(extQuants.exteriorIndex(), timeIdx);
781 
782  // arithmetic mean
783  heatConductivity_ =
784  0.5 * (intQuantsInside.heatConductivity() + intQuantsOutside.heatConductivity());
785  Valgrind::CheckDefined(heatConductivity_);
786  }
787 
788  template <class Context, class FluidState>
789  void updateBoundary_(const Context &context, int bfIdx, int timeIdx, const FluidState &fs)
790  {
791  const auto &stencil = context.stencil(timeIdx);
792  const auto &face = stencil.boundaryFace(bfIdx);
793 
794  const auto &elemCtx = context.elementContext();
795  int insideScvIdx = face.interiorIndex();
796  const auto &insideScv = elemCtx.stencil(timeIdx).subControlVolume(insideScvIdx);
797 
798  const auto &intQuantsInside = elemCtx.intensiveQuantities(insideScvIdx, timeIdx);
799  const auto &fsInside = intQuantsInside.fluidState();
800 
801  // distance between the center of the SCV and center of the boundary face
802  DimVector distVec = face.integrationPos();
803  distVec -= insideScv.geometry().center();
804 
805  Scalar tmp = 0;
806  for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
807  tmp += distVec[dimIdx] * face.normal()[dimIdx];
808  Scalar dist = tmp;
809 
810  // if the following assertation triggers, the center of the
811  // center of the interior SCV was not inside the element!
812  assert(dist > 0);
813 
814  // calculate the temperature gradient using two-point gradient
815  // appoximation
816  temperatureGradNormal_ =
817  (fs.temperature(/*phaseIdx=*/0) - fsInside.temperature(/*phaseIdx=*/0)) / dist;
818 
819  // take the value for heat conductivity from the interior finite volume
820  heatConductivity_ = intQuantsInside.heatConductivity();
821  }
822 
823 public:
827  const Evaluation& temperatureGradNormal() const
828  { return temperatureGradNormal_; }
829 
834  const Evaluation& heatConductivity() const
835  { return heatConductivity_; }
836 
837 private:
838  Evaluation temperatureGradNormal_;
839  Evaluation heatConductivity_;
840 };
841 
842 } // namespace Ewoms
843 
844 #endif
static void addAdvectiveFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Evaluates the advective energy fluxes for a flux integration point and adds the result in the flux ve...
Definition: energymodule.hh:416
Provides the volumetric quantities required for the energy equation.
Definition: energymodule.hh:530
static std::string eqName(int eqIdx)
Returns the name of an equation or an empty string if the specified equation index does not belong to...
Definition: energymodule.hh:278
static void addDiffusiveFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Adds the diffusive heat flux to the flux vector over the face of a sub-control volume.
Definition: energymodule.hh:476
static Evaluation heatConductionRate(const ExtensiveQuantities &extQuants)
Add the rate of the conductive heat flux to a rate vector.
Definition: energymodule.hh:152
static Scalar primaryVarWeight(const Model &model, int globalDofIdx, int pvIdx)
Returns the relative weight of a primary variable for calculating relative errors.
Definition: energymodule.hh:289
Provides the quantities required to calculate energy fluxes.
Definition: energymodule.hh:695
Scalar temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:723
static void addToEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:145
static void addFracturePhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, const Scv &scv, int phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:174
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:80
static void addFracturePhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, const Scv &scv, int phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:383
const Evaluation & heatCapacitySolid() const
Returns the total heat capacity of the rock matrix in the sub-control volume.
Definition: energymodule.hh:672
Declare the properties used by the infrastructure code of the finite volume discretizations.
Provides the indices required for the energy equation.
Definition: energymodule.hh:495
Callback class for temperature.
Definition: quantitycallbacks.hh:44
static void setEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:138
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
static void handleFractureFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Evaluates the advective energy fluxes over a fracture which should be attributed to a face of a subco...
Definition: energymodule.hh:442
static void setEnthalpyRate(RateVector &rateVec, const FluidState &fluidState, int phaseIdx, Scalar volume)
Given a fluid state, set the enthalpy rate which emerges from a volumetric rate.
Definition: energymodule.hh:336
static Evaluation heatConductionRate(const ExtensiveQuantities &extQuants)
Returns the rate of the conductive heat flux for a given flux integration point.
Definition: energymodule.hh:328
static void addToEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:321
static std::string primaryVarName(int pvIdx)
Returns the name of a primary variable or an empty string if the specified primary variable index doe...
Definition: energymodule.hh:88
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
static Scalar eqWeight(const Model &model, int globalDofIdx, int eqIdx)
Returns the relative weight of a equation of the residual.
Definition: energymodule.hh:111
static void setPriVarTemperatures(PrimaryVariables &priVars, const FluidState &fs)
Given a fluid state, set the temperature in the primary variables.
Definition: energymodule.hh:350
static void setPriVarTemperatures(PrimaryVariables &priVars, const FluidState &fs)
Given a fluid state, set the temperature in the primary variables.
Definition: energymodule.hh:120
void update_(const ElementContext &elemCtx, int faceIdx, int timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:760
NEW_PROP_TAG(Grid)
The type of the DUNE grid.
static Scalar primaryVarWeight(const Model &model, int globalDofIdx, int pvIdx)
Returns the relative weight of a primary variable for calculating relative errors.
Definition: energymodule.hh:103
static void addSolidHeatStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants)
Add the energy storage term for the fracture part a fluid phase to an equation vector.
Definition: energymodule.hh:185
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
static void registerParameters()
Register all run-time parameters for the energy module.
Definition: energymodule.hh:258
static void addAdvectiveFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Evaluates the advective energy fluxes over a face of a subcontrol volume and adds the result in the f...
Definition: energymodule.hh:196
Definition: baseauxiliarymodule.hh:35
Scalar heatConductivity() const
The total heat conductivity at the face .
Definition: energymodule.hh:733
static void addSolidHeatStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:401
void update_(const ElementContext &elemCtx, int faceIdx, int timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:711
static void addPhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, int phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:367
static void addPhaseStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants, int phaseIdx)
Add the energy storage term for a fluid phase to an equation vector.
Definition: energymodule.hh:164
static void updateTemperatures_(FluidState &fluidState, const Context &context, int spaceIdx, int timeIdx)
Update the temperatures of the fluids of a fluid state.
Definition: energymodule.hh:620
This method contains all callback classes for quantities that are required by some extensive quantiti...
const Evaluation & temperatureGradNormal() const
The temperature gradient times the face normal [K m^2 / m].
Definition: energymodule.hh:827
void updateBoundary_(const Context &context, int bfIdx, int timeIdx, const FluidState &fs)
Definition: energymodule.hh:715
static void updateTemperatures_(FluidState &fluidState, const Context &context, int spaceIdx, int timeIdx)
Update the temperatures of the fluids of a fluid state.
Definition: energymodule.hh:574
Evaluation heatConductivity() const
Returns the total conductivity capacity of the rock matrix in the sub-control volume.
Definition: energymodule.hh:563
void update_(FluidState &fs, ParameterCache &paramCache, const ElementContext &elemCtx, int dofIdx, int timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:587
static void setEnthalpyRate(RateVector &rateVec, const Evaluation &rate)
Add the rate of the enthalpy flux to a rate vector.
Definition: energymodule.hh:315
static std::string primaryVarName(int pvIdx)
Returns the name of a primary variable or an empty string if the specified primary variable index doe...
Definition: energymodule.hh:266
const Evaluation & heatConductivity() const
The total heat conductivity at the face .
Definition: energymodule.hh:834
void update_(FluidState &fs, ParameterCache &paramCache, const ElementContext &elemCtx, int dofIdx, int timeIdx)
Update the quantities required to calculate energy fluxes.
Definition: energymodule.hh:639
static void setEnthalpyRate(RateVector &rateVec, const FluidState &fluidState, int phaseIdx, const Evaluation &volume)
Given a fluid state, set the enthalpy rate which emerges from a volumetric rate.
Definition: energymodule.hh:129
Evaluation heatCapacitySolid() const
Returns the total heat capacity of the rock matrix in the sub-control volume.
Definition: energymodule.hh:552
static std::string eqName(int eqIdx)
Returns the name of an equation or an empty string if the specified equation index does not belong to...
Definition: energymodule.hh:96
static void handleFractureFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Evaluates the advective energy fluxes over a fracture which should be attributed to a face of a subco...
Definition: energymodule.hh:208
const Evaluation & heatConductivity() const
Returns the total conductivity capacity of the rock matrix in the sub-control volume.
Definition: energymodule.hh:680
static void addDiffusiveFlux(RateVector &flux, const Context &context, int spaceIdx, int timeIdx)
Adds the diffusive heat flux to the flux vector over the face of a sub-control volume.
Definition: energymodule.hh:221
void updateBoundary_(const Context &context, int bfIdx, int timeIdx, const FluidState &fs)
Definition: energymodule.hh:789
static Scalar eqWeight(const Model &model, int globalDofIdx, int eqIdx)
Returns the relative weight of a equation.
Definition: energymodule.hh:301