blackoilenergymodules.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*/
28#ifndef EWOMS_BLACK_OIL_ENERGY_MODULE_HH
29#define EWOMS_BLACK_OIL_ENERGY_MODULE_HH
30
31#include <dune/common/fvector.hh>
32
33#include <opm/material/common/Tabulated1DFunction.hpp>
34#include <opm/material/common/Valgrind.hpp>
35
40#include <opm/material/thermal/EnergyModuleType.hpp>
41
42#include <cassert>
43#include <cmath>
44#include <istream>
45#include <memory>
46#include <ostream>
47#include <stdexcept>
48#include <string>
49
50
51namespace Opm {
52
58template <class TypeTag, EnergyModules activeModule = getPropValue<TypeTag, Properties::EnergyModuleType>()>
60{
72
73 static constexpr unsigned temperatureIdx = Indices::temperatureIdx;
74 static constexpr unsigned contiEnergyEqIdx = Indices::contiEnergyEqIdx;
75
76 static constexpr unsigned enableEnergy = (activeModule == EnergyModules::FullyImplicitThermal);
77 static constexpr unsigned numEq = getPropValue<TypeTag, Properties::NumEq>();
78 static constexpr unsigned numPhases = FluidSystem::numPhases;
79
80public:
82
86 static void registerParameters()
87 {
88 if constexpr (enableEnergy) {
90 }
91 }
92
96 static void registerOutputModules(Model& model,
97 Simulator& simulator)
98 {
99 if constexpr (enableEnergy) {
100 model.addOutputModule(std::make_unique<VtkBlackOilEnergyModule<TypeTag>>(simulator));
101 }
102 }
103
104 static bool primaryVarApplies(unsigned pvIdx)
105 {
106 if constexpr (enableEnergy) {
107 return pvIdx == temperatureIdx;
108 }
109 else {
110 return false;
111 }
112 }
113
114 static std::string primaryVarName([[maybe_unused]] unsigned pvIdx)
115 {
116 assert(primaryVarApplies(pvIdx));
117
118 return "temperature";
119 }
120
121 static Scalar primaryVarWeight([[maybe_unused]] unsigned pvIdx)
122 {
123 assert(primaryVarApplies(pvIdx));
124
125 // TODO: it may be beneficial to chose this differently.
126 return static_cast<Scalar>(1.0);
127 }
128
129 static bool eqApplies(unsigned eqIdx)
130 {
131 if constexpr (enableEnergy) {
132 return eqIdx == contiEnergyEqIdx;
133 }
134 else {
135 return false;
136 }
137 }
138
139 static std::string eqName([[maybe_unused]] unsigned eqIdx)
140 {
141 assert(eqApplies(eqIdx));
142
143 return "conti^energy";
144 }
145
146 static Scalar eqWeight([[maybe_unused]] unsigned eqIdx)
147 {
148 assert(eqApplies(eqIdx));
149
150 return 1.0;
151 }
152
153 // must be called after water storage is computed
154 template <class LhsEval>
155 static void addStorage(Dune::FieldVector<LhsEval, numEq>& storage,
156 const IntensiveQuantities& intQuants)
157 {
158 if constexpr (enableEnergy) {
159 const auto& poro = decay<LhsEval>(intQuants.porosity());
160
161 // accumulate the internal energy of the fluids
162 const auto& fs = intQuants.fluidState();
163 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
164 if (!FluidSystem::phaseIsActive(phaseIdx)) {
165 continue;
166 }
167
168 const auto& u = decay<LhsEval>(fs.internalEnergy(phaseIdx));
169 const auto& S = decay<LhsEval>(fs.saturation(phaseIdx));
170 const auto& rho = decay<LhsEval>(fs.density(phaseIdx));
171
172 storage[contiEnergyEqIdx] += poro*S*u*rho;
173 }
174
175 // add the internal energy of the rock
176 const Scalar rockFraction = intQuants.rockFraction();
177 const auto& uRock = decay<LhsEval>(intQuants.rockInternalEnergy());
178 storage[contiEnergyEqIdx] += rockFraction * uRock;
179 storage[contiEnergyEqIdx] *= getPropValue<TypeTag, Properties::BlackOilEnergyScalingFactor>();
180 }
181 }
182
183 static void computeFlux([[maybe_unused]] RateVector& flux,
184 [[maybe_unused]] const ElementContext& elemCtx,
185 [[maybe_unused]] unsigned scvfIdx,
186 [[maybe_unused]] unsigned timeIdx)
187 {
188 if constexpr (enableEnergy) {
189 flux[contiEnergyEqIdx] = 0.0;
190
191 const auto& extQuants = elemCtx.extensiveQuantities(scvfIdx, timeIdx);
192 const unsigned focusIdx = elemCtx.focusDofIndex();
193 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
194 if (!FluidSystem::phaseIsActive(phaseIdx)) {
195 continue;
196 }
197
198 const unsigned upIdx = extQuants.upstreamIndex(phaseIdx);
199 if (upIdx == focusIdx) {
200 addPhaseEnthalpyFlux_<Evaluation>(flux, phaseIdx, elemCtx, scvfIdx, timeIdx);
201 }
202 else {
203 addPhaseEnthalpyFlux_<Scalar>(flux, phaseIdx, elemCtx, scvfIdx, timeIdx);
204 }
205 }
206
207 // diffusive energy flux
208 flux[contiEnergyEqIdx] += extQuants.energyFlux();
209 flux[contiEnergyEqIdx] *= getPropValue<TypeTag, Properties::BlackOilEnergyScalingFactor>();
210 }
211 }
212
213 static void addHeatFlux(RateVector& flux,
214 const Evaluation& heatFlux)
215 {
216 if constexpr (enableEnergy) {
217 // diffusive energy flux
218 flux[contiEnergyEqIdx] += heatFlux;
219 flux[contiEnergyEqIdx] *= getPropValue<TypeTag, Properties::BlackOilEnergyScalingFactor>();
220 }
221 }
222
223 template <class UpEval, class Eval, class FluidState>
224 static void addPhaseEnthalpyFluxes_(RateVector& flux,
225 unsigned phaseIdx,
226 const Eval& volumeFlux,
227 const FluidState& upFs)
228 {
229 flux[contiEnergyEqIdx] +=
230 decay<UpEval>(upFs.enthalpy(phaseIdx)) *
231 decay<UpEval>(upFs.density(phaseIdx)) *
232 volumeFlux;
233 }
234
235 template <class UpstreamEval>
236 static void addPhaseEnthalpyFlux_(RateVector& flux,
237 unsigned phaseIdx,
238 const ElementContext& elemCtx,
239 unsigned scvfIdx,
240 unsigned timeIdx)
241 {
242 const auto& extQuants = elemCtx.extensiveQuantities(scvfIdx, timeIdx);
243 const unsigned upIdx = extQuants.upstreamIndex(phaseIdx);
244 const auto& up = elemCtx.intensiveQuantities(upIdx, timeIdx);
245 const auto& fs = up.fluidState();
246 const auto& volFlux = extQuants.volumeFlux(phaseIdx);
247 addPhaseEnthalpyFluxes_<UpstreamEval>(flux,
248 phaseIdx,
249 volFlux,
250 fs);
251 }
252
253 static void addToEnthalpyRate(RateVector& flux,
254 const Evaluation& hRate)
255 {
256 if constexpr (enableEnergy) {
257 flux[contiEnergyEqIdx] += hRate;
258 }
259 }
260
264 template <class FluidState>
265 static void assignPrimaryVars(PrimaryVariables& priVars,
266 const FluidState& fluidState)
267 {
268 if constexpr (enableEnergy) {
269 priVars[temperatureIdx] = getValue(fluidState.temperature(/*phaseIdx=*/0));
270 }
271 }
272
276 static void updatePrimaryVars(PrimaryVariables& newPv,
277 const PrimaryVariables& oldPv,
278 const EqVector& delta)
279 {
280 if constexpr (enableEnergy) {
281 // do a plain unchopped Newton update
282 newPv[temperatureIdx] = oldPv[temperatureIdx] - delta[temperatureIdx];
283 }
284 }
285
289 static Scalar computeUpdateError(const PrimaryVariables&,
290 const EqVector&)
291 {
292 // do not consider consider the cange of energy primary variables for
293 // convergence
294 // TODO: maybe this should be changed
295 return static_cast<Scalar>(0.0);
296 }
297
301 static Scalar computeResidualError(const EqVector& resid)
302 {
303 // do not weight the residual of energy when it comes to convergence
304 return std::abs(scalarValue(resid[contiEnergyEqIdx]));
305 }
306
307 template <class DofEntity>
308 static void serializeEntity(const Model& model, std::ostream& outstream, const DofEntity& dof)
309 {
310 if constexpr (enableEnergy) {
311 const unsigned dofIdx = model.dofMapper().index(dof);
312 const PrimaryVariables& priVars = model.solution(/*timeIdx=*/0)[dofIdx];
313 outstream << priVars[temperatureIdx];
314 }
315 }
316
317 template <class DofEntity>
318 static void deserializeEntity(Model& model, std::istream& instream, const DofEntity& dof)
319 {
320 if constexpr (enableEnergy) {
321 const unsigned dofIdx = model.dofMapper().index(dof);
322 PrimaryVariables& priVars0 = model.solution(/*timeIdx=*/0)[dofIdx];
323 PrimaryVariables& priVars1 = model.solution(/*timeIdx=*/1)[dofIdx];
324
325 instream >> priVars0[temperatureIdx];
326
327 // set the primary variables for the beginning of the current time step.
328 priVars1 = priVars0[temperatureIdx];
329 }
330 }
331};
332
333template <class TypeTag, EnergyModules activeModule>
335
343template <class TypeTag>
344class BlackOilEnergyIntensiveQuantities<TypeTag, EnergyModules::FullyImplicitThermal>
345{
347
357
358 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
359 static constexpr int temperatureIdx = Indices::temperatureIdx;
360
361public:
366 void updateTemperature_(const ElementContext& elemCtx,
367 unsigned dofIdx,
368 unsigned timeIdx)
369 {
370 auto& fs = asImp_().fluidState_;
371 const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
372
373 // set temperature
374 fs.setTemperature(priVars.makeEvaluation(temperatureIdx, timeIdx, elemCtx.linearizationType()));
375 }
376
381 void updateTemperature_([[maybe_unused]] const Problem& problem,
382 const PrimaryVariables& priVars,
383 [[maybe_unused]] unsigned globalDofIdx,
384 const unsigned timeIdx,
385 const LinearizationType& lintype)
386 {
387 auto& fs = asImp_().fluidState_;
388 fs.setTemperature(priVars.makeEvaluation(temperatureIdx, timeIdx, lintype));
389 }
390
395 void updateEnergyQuantities_(const ElementContext& elemCtx,
396 unsigned dofIdx,
397 unsigned timeIdx)
398 {
399 updateEnergyQuantities_(elemCtx.problem(), elemCtx.globalSpaceIndex(dofIdx, timeIdx), timeIdx);
400 }
401
402 void updateEnergyQuantities_(const Problem& problem,
403 const unsigned globalSpaceIdx,
404 const unsigned timeIdx)
405 {
406 auto& fs = asImp_().fluidState_;
407
408 // compute the specific enthalpy of the fluids, the specific enthalpy of the rock
409 // and the thermal condictivity coefficients
410 for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
411 if (!FluidSystem::phaseIsActive(phaseIdx)) {
412 continue;
413 }
414
415 const auto& h = FluidSystem::enthalpy(fs, phaseIdx, problem.pvtRegionIndex(globalSpaceIdx));
416 fs.setEnthalpy(phaseIdx, h);
417 }
418
419 const auto& solidEnergyLawParams = problem.solidEnergyLawParams(globalSpaceIdx, timeIdx);
420 rockInternalEnergy_ = SolidEnergyLaw::solidInternalEnergy(solidEnergyLawParams, fs);
421
422 const auto& thermalConductionLawParams = problem.thermalConductionLawParams(globalSpaceIdx, timeIdx);
423 totalThermalConductivity_ = ThermalConductionLaw::thermalConductivity(thermalConductionLawParams, fs);
424
425 // Retrieve the rock fraction from the problem
426 // Usually 1 - porosity, but if pvmult is used to modify porosity
427 // we will apply the same multiplier to the rock fraction
428 // i.e. pvmult*(1 - porosity) and thus interpret multpv as a volume
429 // multiplier. This is to avoid negative rock volume for pvmult*porosity > 1
430 rockFraction_ = problem.rockFraction(globalSpaceIdx, timeIdx);
431 }
432
433 const Evaluation& rockInternalEnergy() const
434 { return rockInternalEnergy_; }
435
436 const Evaluation& totalThermalConductivity() const
437 { return totalThermalConductivity_; }
438
439 Scalar rockFraction() const
440 { return rockFraction_; }
441
442protected:
443 Implementation& asImp_()
444 { return *static_cast<Implementation*>(this); }
445
449};
450
451template <class TypeTag>
452class BlackOilEnergyIntensiveQuantities<TypeTag, EnergyModules::ConstantTemperature>
453{
460
462
463public:
464 void updateTemperature_([[maybe_unused]] const ElementContext& elemCtx,
465 [[maybe_unused]] unsigned dofIdx,
466 [[maybe_unused]] unsigned timeIdx)
467 {
468 auto& fs = asImp_().fluidState_;
469 const Scalar T = elemCtx.problem().temperature(elemCtx, dofIdx, timeIdx);
470 fs.setTemperature(T);
471 }
472
473 template<class Problem>
474 void updateTemperature_([[maybe_unused]] const Problem& problem,
475 [[maybe_unused]] const PrimaryVariables& priVars,
476 [[maybe_unused]] unsigned globalDofIdx,
477 [[maybe_unused]] unsigned timeIdx,
478 [[maybe_unused]] const LinearizationType& lintype
479 )
480 {
481 auto& fs = asImp_().fluidState_;
482 const Scalar T = problem.temperature(globalDofIdx, timeIdx);
483 fs.setTemperature(T);
484 }
485
486 void updateEnergyQuantities_(const ElementContext&,
487 unsigned,
488 unsigned,
489 const typename FluidSystem::template ParameterCache<Evaluation>&)
490 {}
491
492 const Evaluation& rockInternalEnergy() const
493 {
494 throw std::logic_error("Requested the rock internal energy, which is "
495 "unavailable because energy is not conserved");
496 }
497
498 const Evaluation& totalThermalConductivity() const
499 {
500 throw std::logic_error("Requested the total thermal conductivity, which is "
501 "unavailable because energy is not conserved");
502 }
503
504protected:
505 Implementation& asImp_()
506 { return *static_cast<Implementation*>(this); }
507};
508
509template <class TypeTag>
510class BlackOilEnergyIntensiveQuantities<TypeTag, EnergyModules::NoTemperature>
511{
518
519public:
520 void updateTemperature_([[maybe_unused]] const ElementContext& elemCtx,
521 [[maybe_unused]] unsigned dofIdx,
522 [[maybe_unused]] unsigned timeIdx)
523 {
524 }
525
526 template<class Problem>
527 void updateTemperature_([[maybe_unused]] const Problem& problem,
528 [[maybe_unused]] const PrimaryVariables& priVars,
529 [[maybe_unused]] unsigned globalDofIdx,
530 [[maybe_unused]] unsigned timeIdx,
531 [[maybe_unused]] const LinearizationType& lintype)
532 {
533 }
534
535 void updateEnergyQuantities_(const ElementContext&,
536 unsigned,
537 unsigned,
538 const typename FluidSystem::template ParameterCache<Evaluation>&)
539 {}
540
541 const Evaluation& rockInternalEnergy() const
542 {
543 throw std::logic_error("Requested the rock internal energy, which is "
544 "unavailable because energy is not conserved");
545 }
546
547 const Evaluation& totalThermalConductivity() const
548 {
549 throw std::logic_error("Requested the total thermal conductivity, which is "
550 "unavailable because energy is not conserved");
551 }
552
553protected:
554 Implementation& asImp_()
555 { return *static_cast<Implementation*>(this); }
556};
557
558template <class TypeTag, EnergyModules activeModule>
560
568template <class TypeTag>
569class BlackOilEnergyExtensiveQuantities<TypeTag, EnergyModules::FullyImplicitThermal>
570{
572
577
578public:
579 template<class FluidState>
580 static void updateEnergy(Evaluation& energyFlux,
581 const unsigned& focusDofIndex,
582 const unsigned& inIdx,
583 const unsigned& exIdx,
584 const IntensiveQuantities& inIq,
585 const IntensiveQuantities& exIq,
586 const FluidState& inFs,
587 const FluidState& exFs,
588 const Scalar& inAlpha,
589 const Scalar& outAlpha,
590 const Scalar& faceArea)
591 {
592 Evaluation deltaT;
593 if (focusDofIndex == inIdx) {
594 deltaT = decay<Scalar>(exFs.temperature(/*phaseIdx=*/0)) -
595 inFs.temperature(/*phaseIdx=*/0);
596 }
597 else if (focusDofIndex == exIdx) {
598 deltaT = exFs.temperature(/*phaseIdx=*/0) -
599 decay<Scalar>(inFs.temperature(/*phaseIdx=*/0));
600 }
601 else {
602 deltaT = decay<Scalar>(exFs.temperature(/*phaseIdx=*/0)) -
603 decay<Scalar>(inFs.temperature(/*phaseIdx=*/0));
604 }
605
606 Evaluation inLambda;
607 if (focusDofIndex == inIdx) {
608 inLambda = inIq.totalThermalConductivity();
609 }
610 else {
611 inLambda = decay<Scalar>(inIq.totalThermalConductivity());
612 }
613
614 Evaluation exLambda;
615 if (focusDofIndex == exIdx) {
616 exLambda = exIq.totalThermalConductivity();
617 }
618 else {
619 exLambda = decay<Scalar>(exIq.totalThermalConductivity());
620 }
621
622 Evaluation H;
623 const Evaluation& inH = inLambda*inAlpha;
624 const Evaluation& exH = exLambda*outAlpha;
625 if (inH > 0 && exH > 0) {
626 // compute the "thermal transmissibility". In contrast to the normal
627 // transmissibility this cannot be done as a preprocessing step because the
628 // average thermal conductivity is analogous to the permeability but
629 // depends on the solution.
630 H = 1.0 / (1.0 / inH + 1.0 / exH);
631 }
632 else {
633 H = 0.0;
634 }
635
636 energyFlux = deltaT * (-H / faceArea);
637 }
638
639 void updateEnergy(const ElementContext& elemCtx,
640 unsigned scvfIdx,
641 unsigned timeIdx)
642 {
643 const auto& stencil = elemCtx.stencil(timeIdx);
644 const auto& scvf = stencil.interiorFace(scvfIdx);
645
646 const Scalar faceArea = scvf.area();
647 const unsigned inIdx = scvf.interiorIndex();
648 const unsigned exIdx = scvf.exteriorIndex();
649 const auto& inIq = elemCtx.intensiveQuantities(inIdx, timeIdx);
650 const auto& exIq = elemCtx.intensiveQuantities(exIdx, timeIdx);
651 const auto& inFs = inIq.fluidState();
652 const auto& exFs = exIq.fluidState();
653 const Scalar inAlpha = elemCtx.problem().thermalHalfTransmissibilityIn(elemCtx, scvfIdx, timeIdx);
654 const Scalar outAlpha = elemCtx.problem().thermalHalfTransmissibilityOut(elemCtx, scvfIdx, timeIdx);
655 updateEnergy(energyFlux_,
656 elemCtx.focusDofIndex(),
657 inIdx,
658 exIdx,
659 inIq,
660 exIq,
661 inFs,
662 exFs,
663 inAlpha,
664 outAlpha,
665 faceArea);
666 }
667
668 template <class Context, class BoundaryFluidState>
669 void updateEnergyBoundary(const Context& ctx,
670 unsigned scvfIdx,
671 unsigned timeIdx,
672 const BoundaryFluidState& boundaryFs)
673 {
674 const auto& stencil = ctx.stencil(timeIdx);
675 const auto& scvf = stencil.boundaryFace(scvfIdx);
676
677 const unsigned inIdx = scvf.interiorIndex();
678 const auto& inIq = ctx.intensiveQuantities(inIdx, timeIdx);
679 const auto& focusDofIdx = ctx.focusDofIndex();
680 const Scalar alpha = ctx.problem().thermalHalfTransmissibilityBoundary(ctx, scvfIdx);
681 updateEnergyBoundary(energyFlux_, inIq, focusDofIdx, inIdx, alpha, boundaryFs);
682 }
683
684 template <class BoundaryFluidState>
685 static void updateEnergyBoundary(Evaluation& energyFlux,
686 const IntensiveQuantities& inIq,
687 unsigned focusDofIndex,
688 unsigned inIdx,
689 Scalar alpha,
690 const BoundaryFluidState& boundaryFs)
691 {
692 const auto& inFs = inIq.fluidState();
693 Evaluation deltaT;
694 if (focusDofIndex == inIdx) {
695 deltaT = boundaryFs.temperature(/*phaseIdx=*/0) -
696 inFs.temperature(/*phaseIdx=*/0);
697 }
698 else {
699 deltaT = decay<Scalar>(boundaryFs.temperature(/*phaseIdx=*/0)) -
700 decay<Scalar>(inFs.temperature(/*phaseIdx=*/0));
701 }
702
703 Evaluation lambda;
704 if (focusDofIndex == inIdx) {
705 lambda = inIq.totalThermalConductivity();
706 }
707 else {
708 lambda = decay<Scalar>(inIq.totalThermalConductivity());
709 }
710
711 if (lambda > 0.0) {
712 // compute the "thermal transmissibility". In contrast to the normal
713 // transmissibility this cannot be done as a preprocessing step because the
714 // average thermal conductivity is analogous to the permeability but depends
715 // on the solution.
716 energyFlux = deltaT * lambda * -alpha;
717 }
718 else {
719 energyFlux = 0.0;
720 }
721 }
722
723 const Evaluation& energyFlux() const
724 { return energyFlux_; }
725
726private:
727 Implementation& asImp_()
728 { return *static_cast<Implementation*>(this); }
729
730 Evaluation energyFlux_;
731};
732
733template <class TypeTag>
734class BlackOilEnergyExtensiveQuantities<TypeTag, EnergyModules::ConstantTemperature>
735{
740
741public:
742 template<class FluidState>
743 static void updateEnergy(Evaluation& /*energyFlux*/,
744 const unsigned& /*focusDofIndex*/,
745 const unsigned& /*inIdx*/,
746 const unsigned& /*exIdx*/,
747 const IntensiveQuantities& /*inIq*/,
748 const IntensiveQuantities& /*exIq*/,
749 const FluidState& /*inFs*/,
750 const FluidState& /*exFs*/,
751 const Scalar& /*inAlpha*/,
752 const Scalar& /*outAlpha*/,
753 const Scalar& /*faceArea*/)
754 {}
755
756 void updateEnergy(const ElementContext&,
757 unsigned,
758 unsigned)
759 {}
760
761 template <class Context, class BoundaryFluidState>
762 void updateEnergyBoundary(const Context&,
763 unsigned,
764 unsigned,
765 const BoundaryFluidState&)
766 {}
767
768 template <class BoundaryFluidState>
769 static void updateEnergyBoundary(Evaluation& /*heatFlux*/,
770 const IntensiveQuantities& /*inIq*/,
771 unsigned /*focusDofIndex*/,
772 unsigned /*inIdx*/,
773 unsigned /*timeIdx*/,
774 Scalar /*alpha*/,
775 const BoundaryFluidState& /*boundaryFs*/)
776 {}
777
778 const Evaluation& energyFlux() const
779 { throw std::logic_error("Requested the energy flux, but energy is not conserved"); }
780};
781
782template <class TypeTag>
783class BlackOilEnergyExtensiveQuantities<TypeTag, EnergyModules::NoTemperature>
784{
789
790public:
791 template<class FluidState>
792 static void updateEnergy(Evaluation& /*energyFlux*/,
793 const unsigned& /*focusDofIndex*/,
794 const unsigned& /*inIdx*/,
795 const unsigned& /*exIdx*/,
796 const IntensiveQuantities& /*inIq*/,
797 const IntensiveQuantities& /*exIq*/,
798 const FluidState& /*inFs*/,
799 const FluidState& /*exFs*/,
800 const Scalar& /*inAlpha*/,
801 const Scalar& /*outAlpha*/,
802 const Scalar& /*faceArea*/)
803 {}
804
805 void updateEnergy(const ElementContext&,
806 unsigned,
807 unsigned)
808 {}
809
810 template <class Context, class BoundaryFluidState>
811 void updateEnergyBoundary(const Context&,
812 unsigned,
813 unsigned,
814 const BoundaryFluidState&)
815 {}
816
817 template <class BoundaryFluidState>
818 static void updateEnergyBoundary(Evaluation& /*heatFlux*/,
819 const IntensiveQuantities& /*inIq*/,
820 unsigned /*focusDofIndex*/,
821 unsigned /*inIdx*/,
822 unsigned /*timeIdx*/,
823 Scalar /*alpha*/,
824 const BoundaryFluidState& /*boundaryFs*/)
825 {}
826
827 const Evaluation& energyFlux() const
828 { throw std::logic_error("Requested the energy flux, but energy is not conserved"); }
829};
830
831} // namespace Opm
832
833#endif
Declares the properties required by the black oil model.
static void updateEnergyBoundary(Evaluation &, const IntensiveQuantities &, unsigned, unsigned, unsigned, Scalar, const BoundaryFluidState &)
Definition: blackoilenergymodules.hh:769
void updateEnergyBoundary(const Context &, unsigned, unsigned, const BoundaryFluidState &)
Definition: blackoilenergymodules.hh:762
const Evaluation & energyFlux() const
Definition: blackoilenergymodules.hh:778
static void updateEnergy(Evaluation &, const unsigned &, const unsigned &, const unsigned &, const IntensiveQuantities &, const IntensiveQuantities &, const FluidState &, const FluidState &, const Scalar &, const Scalar &, const Scalar &)
Definition: blackoilenergymodules.hh:743
void updateEnergy(const ElementContext &, unsigned, unsigned)
Definition: blackoilenergymodules.hh:756
const Evaluation & energyFlux() const
Definition: blackoilenergymodules.hh:723
void updateEnergyBoundary(const Context &ctx, unsigned scvfIdx, unsigned timeIdx, const BoundaryFluidState &boundaryFs)
Definition: blackoilenergymodules.hh:669
static void updateEnergyBoundary(Evaluation &energyFlux, const IntensiveQuantities &inIq, unsigned focusDofIndex, unsigned inIdx, Scalar alpha, const BoundaryFluidState &boundaryFs)
Definition: blackoilenergymodules.hh:685
void updateEnergy(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Definition: blackoilenergymodules.hh:639
static void updateEnergy(Evaluation &energyFlux, const unsigned &focusDofIndex, const unsigned &inIdx, const unsigned &exIdx, const IntensiveQuantities &inIq, const IntensiveQuantities &exIq, const FluidState &inFs, const FluidState &exFs, const Scalar &inAlpha, const Scalar &outAlpha, const Scalar &faceArea)
Definition: blackoilenergymodules.hh:580
const Evaluation & energyFlux() const
Definition: blackoilenergymodules.hh:827
void updateEnergyBoundary(const Context &, unsigned, unsigned, const BoundaryFluidState &)
Definition: blackoilenergymodules.hh:811
static void updateEnergyBoundary(Evaluation &, const IntensiveQuantities &, unsigned, unsigned, unsigned, Scalar, const BoundaryFluidState &)
Definition: blackoilenergymodules.hh:818
static void updateEnergy(Evaluation &, const unsigned &, const unsigned &, const unsigned &, const IntensiveQuantities &, const IntensiveQuantities &, const FluidState &, const FluidState &, const Scalar &, const Scalar &, const Scalar &)
Definition: blackoilenergymodules.hh:792
void updateEnergy(const ElementContext &, unsigned, unsigned)
Definition: blackoilenergymodules.hh:805
Provides the energy specific extensive quantities to the generic black-oil module's extensive quantit...
Definition: blackoilenergymodules.hh:559
Implementation & asImp_()
Definition: blackoilenergymodules.hh:505
const Evaluation & rockInternalEnergy() const
Definition: blackoilenergymodules.hh:492
void updateTemperature_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Definition: blackoilenergymodules.hh:464
const Evaluation & totalThermalConductivity() const
Definition: blackoilenergymodules.hh:498
void updateTemperature_(const Problem &problem, const PrimaryVariables &priVars, unsigned globalDofIdx, unsigned timeIdx, const LinearizationType &lintype)
Definition: blackoilenergymodules.hh:474
void updateEnergyQuantities_(const ElementContext &, unsigned, unsigned, const typename FluidSystem::template ParameterCache< Evaluation > &)
Definition: blackoilenergymodules.hh:486
const Evaluation & totalThermalConductivity() const
Definition: blackoilenergymodules.hh:436
void updateEnergyQuantities_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Compute the intensive quantities needed to handle energy conservation.
Definition: blackoilenergymodules.hh:395
Scalar rockFraction() const
Definition: blackoilenergymodules.hh:439
void updateTemperature_(const Problem &problem, const PrimaryVariables &priVars, unsigned globalDofIdx, const unsigned timeIdx, const LinearizationType &lintype)
Update the temperature of the intensive quantity's fluid state.
Definition: blackoilenergymodules.hh:381
Evaluation totalThermalConductivity_
Definition: blackoilenergymodules.hh:447
const Evaluation & rockInternalEnergy() const
Definition: blackoilenergymodules.hh:433
void updateTemperature_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Update the temperature of the intensive quantity's fluid state.
Definition: blackoilenergymodules.hh:366
Implementation & asImp_()
Definition: blackoilenergymodules.hh:443
void updateEnergyQuantities_(const Problem &problem, const unsigned globalSpaceIdx, const unsigned timeIdx)
Definition: blackoilenergymodules.hh:402
void updateTemperature_(const Problem &problem, const PrimaryVariables &priVars, unsigned globalDofIdx, unsigned timeIdx, const LinearizationType &lintype)
Definition: blackoilenergymodules.hh:527
const Evaluation & rockInternalEnergy() const
Definition: blackoilenergymodules.hh:541
void updateEnergyQuantities_(const ElementContext &, unsigned, unsigned, const typename FluidSystem::template ParameterCache< Evaluation > &)
Definition: blackoilenergymodules.hh:535
const Evaluation & totalThermalConductivity() const
Definition: blackoilenergymodules.hh:547
Implementation & asImp_()
Definition: blackoilenergymodules.hh:554
void updateTemperature_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Definition: blackoilenergymodules.hh:520
Provides the volumetric quantities required for the equations needed by the energys extension of the ...
Definition: blackoilenergymodules.hh:334
Contains the high level supplements required to extend the black oil model by energy.
Definition: blackoilenergymodules.hh:60
static void addPhaseEnthalpyFluxes_(RateVector &flux, unsigned phaseIdx, const Eval &volumeFlux, const FluidState &upFs)
Definition: blackoilenergymodules.hh:224
static void addHeatFlux(RateVector &flux, const Evaluation &heatFlux)
Definition: blackoilenergymodules.hh:213
static std::string eqName(unsigned eqIdx)
Definition: blackoilenergymodules.hh:139
static bool eqApplies(unsigned eqIdx)
Definition: blackoilenergymodules.hh:129
static void addStorage(Dune::FieldVector< LhsEval, numEq > &storage, const IntensiveQuantities &intQuants)
Definition: blackoilenergymodules.hh:155
static std::string primaryVarName(unsigned pvIdx)
Definition: blackoilenergymodules.hh:114
static void serializeEntity(const Model &model, std::ostream &outstream, const DofEntity &dof)
Definition: blackoilenergymodules.hh:308
static Scalar computeResidualError(const EqVector &resid)
Return how much a residual is considered an error.
Definition: blackoilenergymodules.hh:301
static Scalar primaryVarWeight(unsigned pvIdx)
Definition: blackoilenergymodules.hh:121
static void deserializeEntity(Model &model, std::istream &instream, const DofEntity &dof)
Definition: blackoilenergymodules.hh:318
static void computeFlux(RateVector &flux, const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Definition: blackoilenergymodules.hh:183
static Scalar eqWeight(unsigned eqIdx)
Definition: blackoilenergymodules.hh:146
static void registerOutputModules(Model &model, Simulator &simulator)
Register all energy specific VTK and ECL output modules.
Definition: blackoilenergymodules.hh:96
static bool primaryVarApplies(unsigned pvIdx)
Definition: blackoilenergymodules.hh:104
GetPropType< TypeTag, Properties::ExtensiveQuantities > ExtensiveQuantities
Definition: blackoilenergymodules.hh:81
static void assignPrimaryVars(PrimaryVariables &priVars, const FluidState &fluidState)
Assign the energy specific primary variables to a PrimaryVariables object.
Definition: blackoilenergymodules.hh:265
static void updatePrimaryVars(PrimaryVariables &newPv, const PrimaryVariables &oldPv, const EqVector &delta)
Do a Newton-Raphson update the primary variables of the energys.
Definition: blackoilenergymodules.hh:276
static void registerParameters()
Register all run-time parameters for the black-oil energy module.
Definition: blackoilenergymodules.hh:86
static void addPhaseEnthalpyFlux_(RateVector &flux, unsigned phaseIdx, const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
Definition: blackoilenergymodules.hh:236
static void addToEnthalpyRate(RateVector &flux, const Evaluation &hRate)
Definition: blackoilenergymodules.hh:253
static Scalar computeUpdateError(const PrimaryVariables &, const EqVector &)
Return how much a Newton-Raphson update is considered an error.
Definition: blackoilenergymodules.hh:289
VTK output module for the black oil model's energy related quantities.
Definition: vtkblackoilenergymodule.hpp:54
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition: vtkblackoilenergymodule.hpp:84
Definition: blackoilbioeffectsmodules.hh:43
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
This method contains all callback classes for quantities that are required by some extensive quantiti...
Definition: linearizationtype.hh:34