28#ifndef OPM_BLACK_OIL_MODEL_HPP
29#define OPM_BLACK_OIL_MODEL_HPP
31#include <opm/material/densead/Math.hpp>
33#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
67template <
class TypeTag>
72namespace Opm::Properties {
78{
using InheritsFrom = std::tuple<VtkBlackOilPolymer, MultiPhaseBaseModel>; };
82template<
class TypeTag>
86template<
class TypeTag>
90template<
class TypeTag>
94template<
class TypeTag>
98template<
class TypeTag>
102template<
class TypeTag>
106template<
class TypeTag>
110template<
class TypeTag>
114template<
class TypeTag>
119template<
class TypeTag>
123template<
class TypeTag>
135template<
class TypeTag>
145template<
class TypeTag>
147template<
class TypeTag>
149template<
class TypeTag>
151template<
class TypeTag>
153template<
class TypeTag>
155template<
class TypeTag>
157template<
class TypeTag>
159template<
class TypeTag>
161template<
class TypeTag>
163template<
class TypeTag>
167template<
class TypeTag>
169template<
class TypeTag>
173template<
class TypeTag>
177template<
class TypeTag>
179template<
class TypeTag>
188template<
class TypeTag>
197 static constexpr Scalar value = 1.0/(30.0*4184.0*alpha);
201template<
class TypeTag>
210 static constexpr Scalar value = 1.0/(10.0*alpha);
215template<
class TypeTag>
285template<
class TypeTag >
303 enum { numComponents = FluidSystem::numComponents };
308 static constexpr bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
309 static constexpr bool waterEnabled = Indices::waterEnabled;
326 eqWeights_.resize(numEq, 1.0);
340 DiffusionModule::registerParameters();
353 {
return "blackoil"; }
360 std::ostringstream
oss;
362 if (
pvIdx == Indices::waterSwitchIdx)
363 oss <<
"water_switching";
364 else if (
pvIdx == Indices::pressureSwitchIdx)
365 oss <<
"pressure_switching";
366 else if (
static_cast<int>(
pvIdx) == Indices::compositionSwitchIdx)
367 oss <<
"composition_switching";
368 else if (SolventModule::primaryVarApplies(
pvIdx))
369 return SolventModule::primaryVarName(
pvIdx);
370 else if (ExtboModule::primaryVarApplies(
pvIdx))
371 return ExtboModule::primaryVarName(
pvIdx);
372 else if (PolymerModule::primaryVarApplies(
pvIdx))
373 return PolymerModule::primaryVarName(
pvIdx);
374 else if (EnergyModule::primaryVarApplies(
pvIdx))
375 return EnergyModule::primaryVarName(
pvIdx);
387 std::ostringstream
oss;
389 if (Indices::conti0EqIdx <=
eqIdx &&
eqIdx < Indices::conti0EqIdx + numComponents)
390 oss <<
"conti_" << FluidSystem::phaseName(
eqIdx - Indices::conti0EqIdx);
391 else if (SolventModule::eqApplies(
eqIdx))
392 return SolventModule::eqName(
eqIdx);
393 else if (ExtboModule::eqApplies(
eqIdx))
394 return ExtboModule::eqName(
eqIdx);
395 else if (PolymerModule::eqApplies(
eqIdx))
396 return PolymerModule::eqName(
eqIdx);
397 else if (EnergyModule::eqApplies(
eqIdx))
398 return EnergyModule::eqName(
eqIdx);
412 if (globalDofIdx >= this->numGridDof())
416 if (
int(Indices::waterSwitchIdx) ==
int(
pvIdx))
421 else if (
int(Indices::pressureSwitchIdx) ==
int(
pvIdx))
425 else if (SolventModule::primaryVarApplies(
pvIdx))
426 return SolventModule::primaryVarWeight(
pvIdx);
429 else if (ExtboModule::primaryVarApplies(
pvIdx))
430 return ExtboModule::primaryVarWeight(
pvIdx);
433 else if (PolymerModule::primaryVarApplies(
pvIdx))
434 return PolymerModule::primaryVarWeight(
pvIdx);
437 else if (EnergyModule::primaryVarApplies(
pvIdx))
438 return EnergyModule::primaryVarWeight(
pvIdx);
441 assert(
int(Indices::compositionSwitchIdx) ==
int(
pvIdx));
443 auto pvMeaning = this->solution(0)[globalDofIdx].primaryVarsMeaningGas();
444 if (
pvMeaning == PrimaryVariables::GasMeaning::Sg)
446 else if (
pvMeaning == PrimaryVariables::GasMeaning::Rs)
462 if (globalDofIdx >= this->numGridDof())
465 return eqWeights_[
eqIdx];
468 void setEqWeight(
unsigned eqIdx, Scalar value) {
469 eqWeights_[
eqIdx] = value;
480 template <
class DofEntity>
483 unsigned dofIdx =
static_cast<unsigned>(asImp_().dofMapper().index(
dof));
487 throw std::runtime_error(
"Could not serialize degree of freedom "+std::to_string(dofIdx));
490 const auto& priVars = this->solution(0)[dofIdx];
499 outstream << priVars.pvtRegionIndex() <<
" ";
501 SolventModule::serializeEntity(asImp_(),
outstream,
dof);
503 PolymerModule::serializeEntity(asImp_(),
outstream,
dof);
504 EnergyModule::serializeEntity(asImp_(),
outstream,
dof);
515 template <
class DofEntity>
519 unsigned dofIdx =
static_cast<unsigned>(asImp_().dofMapper().index(
dof));
522 auto& priVars = this->solution(0)[dofIdx];
525 throw std::runtime_error(
"Could not deserialize degree of freedom "+std::to_string(dofIdx));
530 unsigned primaryVarsMeaningGas;
533 unsigned primaryVarsMeaningWater;
534 instream >> primaryVarsMeaningWater;
536 unsigned primaryVarsMeaningPressure;
537 instream >> primaryVarsMeaningPressure;
539 unsigned pvtRegionIdx;
543 throw std::runtime_error(
"Could not deserialize degree of freedom "+std::to_string(dofIdx));
545 SolventModule::deserializeEntity(asImp_(),
instream,
dof);
546 ExtboModule::deserializeEntity(asImp_(),
instream,
dof);
547 PolymerModule::deserializeEntity(asImp_(),
instream,
dof);
548 EnergyModule::deserializeEntity(asImp_(),
instream,
dof);
550 using PVM_G =
typename PrimaryVariables::GasMeaning;
551 using PVM_W =
typename PrimaryVariables::WaterMeaning;
552 using PVM_P =
typename PrimaryVariables::PressureMeaning;
553 priVars.setPrimaryVarsMeaningGas(
static_cast<PVM_G>(primaryVarsMeaningGas));
554 priVars.setPrimaryVarsMeaningWater(
static_cast<PVM_W>(primaryVarsMeaningWater));
555 priVars.setPrimaryVarsMeaningPressure(
static_cast<PVM_P>(primaryVarsMeaningPressure));
557 priVars.setPvtRegionIndex(pvtRegionIdx);
567 template <
class Restarter>
570 ParentType::deserialize(
res);
575 ElementContext elemCtx(this->simulator_);
577 elemCtx.updateStencil(
elem);
578 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
579 unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
580 updatePvtRegionIndex_(this->solution(0)[globalDofIdx],
587 this->solution(1) = this->solution(0);
597 template <
class Context>
598 void supplementInitialSolution_(PrimaryVariables& priVars,
599 const Context& context,
602 { updatePvtRegionIndex_(priVars, context, dofIdx,
timeIdx); }
604 void registerOutputModules_()
606 ParentType::registerOutputModules_();
617 if constexpr (enableDiffusion)
622 std::vector<Scalar> eqWeights_;
623 Implementation& asImp_()
624 {
return *
static_cast<Implementation*
>(
this); }
625 const Implementation& asImp_()
const
626 {
return *
static_cast<const Implementation*
>(
this); }
628 template <
class Context>
629 void updatePvtRegionIndex_(PrimaryVariables& priVars,
630 const Context& context,
634 unsigned regionIdx = context.problem().pvtRegionIndex(context, dofIdx,
timeIdx);
Implements a boundary vector for the fully implicit black-oil model.
Contains the classes required to extend the black-oil model by brine.
This file contains the default flux module of the blackoil model.
Classes required for molecular diffusion.
Classes required for mechanical dispersion.
Contains the classes required to extend the black-oil model by solvent component.
This template class contains the data which is required to calculate the fluxes of the fluid phases o...
Contains the classes required to extend the black-oil model to include the effects of foam.
The primary variable and equation indices for the black-oil model.
Contains the quantities which are are constant within a finite volume in the black-oil model.
Calculates the local residual of the black oil model.
Contains the classes required to extend the black-oil model by MICP.
A newton solver which is specific to the black oil model.
Contains the classes required to extend the black-oil model by polymer.
Represents the primary variables used by the black-oil model.
Base class for all problems which use the black-oil model.
Declares the properties required by the black oil model.
Implements a vector representing mass, molar or volumetric rates for the black oil model.
Contains the classes required to extend the black-oil model by solvents.
The primary variable and equation indices for the black-oil model.
Implements a boundary vector for the fully implicit black-oil model.
Definition blackoilboundaryratevector.hh:46
Provides the auxiliary methods required for consideration of the diffusion equation.
Definition blackoildiffusionmodule.hh:49
Provides the auxiliary methods required for consideration of the dispersion equation.
Definition blackoildispersionmodule.hh:50
Contains the high level supplements required to extend the black oil model by energy.
Definition blackoilenergymodules.hh:52
static void registerParameters()
Register all run-time parameters for the black-oil energy module.
Definition blackoilenergymodules.hh:77
static void registerOutputModules(Model &model, Simulator &simulator)
Register all energy specific VTK and ECL output modules.
Definition blackoilenergymodules.hh:86
Contains the high level supplements required to extend the black oil model.
Definition blackoilextbomodules.hh:59
static void registerParameters()
Register all run-time parameters for the black-oil solvent module.
Definition blackoilextbomodules.hh:98
This template class contains the data which is required to calculate the fluxes of the fluid phases o...
Definition blackoilextensivequantities.hh:60
Contains the quantities which are are constant within a finite volume in the black-oil model.
Definition blackoilintensivequantities.hh:82
Calculates the local residual of the black oil model.
Definition blackoillocalresidual.hh:51
Contains the high level supplements required to extend the black oil model by MICP.
Definition blackoilmicpmodules.hh:49
static void registerParameters()
Register all run-time parameters for the black-oil MICP module.
Definition blackoilmicpmodules.hh:96
static void registerOutputModules(Model &model, Simulator &simulator)
Register all MICP specific VTK and ECL output modules.
Definition blackoilmicpmodules.hh:105
A fully-implicit black-oil flow model.
Definition blackoilmodel.hh:288
std::string primaryVarName(int pvIdx) const
Given an primary variable index, return a human readable name.
Definition blackoilmodel.hh:358
Scalar primaryVarWeight(unsigned globalDofIdx, unsigned pvIdx) const
Returns the relative weight of a primary variable for calculating relative errors.
Definition blackoilmodel.hh:408
Scalar eqWeight(unsigned globalDofIdx, unsigned eqIdx) const
Returns the relative weight of an equation.
Definition blackoilmodel.hh:458
void serializeEntity(std::ostream &outstream, const DofEntity &dof)
Write the current solution for a degree of freedom to a restart file.
Definition blackoilmodel.hh:481
std::string eqName(int eqIdx) const
Given an equation index, return a human readable name.
Definition blackoilmodel.hh:385
static std::string name()
Definition blackoilmodel.hh:352
void deserializeEntity(std::istream &instream, const DofEntity &dof)
Reads the current solution variables for a degree of freedom from a restart file.
Definition blackoilmodel.hh:516
static void registerParameters()
Register all run-time parameters for the immiscible model.
Definition blackoilmodel.hh:332
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition blackoilmodel.hh:568
A newton solver which is specific to the black oil model.
Definition blackoilnewtonmethod.hpp:57
Contains the high level supplements required to extend the black oil model by polymer.
Definition blackoilpolymermodules.hh:54
static void registerParameters()
Register all run-time parameters for the black-oil polymer module.
Definition blackoilpolymermodules.hh:138
static void registerOutputModules(Model &model, Simulator &simulator)
Register all polymer specific VTK and ECL output modules.
Definition blackoilpolymermodules.hh:147
Represents the primary variables used by the black-oil model.
Definition blackoilprimaryvariables.hh:64
Base class for all problems which use the black-oil model.
Definition blackoilproblem.hh:43
Implements a vector representing mass, molar or volumetric rates for the black oil model.
Definition blackoilratevector.hh:53
Contains the high level supplements required to extend the black oil model by solvents.
Definition blackoilsolventmodules.hh:58
static void registerOutputModules(Model &model, Simulator &simulator)
Register all solvent specific VTK and ECL output modules.
Definition blackoilsolventmodules.hh:117
static void registerParameters()
Register all run-time parameters for the black-oil solvent module.
Definition blackoilsolventmodules.hh:108
A base class for fully-implicit multi-phase porous-media flow models which assume multiple fluid phas...
Definition multiphasebasemodel.hh:153
static void registerParameters()
Register all run-time parameters for the immiscible model.
Definition multiphasebasemodel.hh:179
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition vtkblackoilmodule.hpp:88
static void registerParameters()
Register all run-time parameters for the Vtk output module.
Definition vtkcompositionmodule.hpp:86
static void registerParameters()
Register all run-time parameters for the Vtk output module.
Definition vtkdiffusionmodule.hpp:87
A base class for fully-implicit multi-phase porous-media flow models which assume multiple fluid phas...
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
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:235
Provides a Darcy flux module for the blackoil model.
Definition blackoildarcyfluxmodule.hh:49
The primary variable and equation indices for the black-oil model.
Definition blackoilindices.hh:47
The type of the base class for all problems which use this model.
Definition fvbaseproperties.hh:84
The relative weight of the residual of the energy equation compared to the mass residuals.
Definition blackoilproperties.hh:91
Similarly to the energy equation, a scaling is applied to the urea equation in MICP.
Definition blackoilproperties.hh:95
Enable surface volume scaling.
Definition blackoilproperties.hh:54
Type of object for specifying boundary conditions.
Definition fvbaseproperties.hh:119
Enable the ECL-blackoil extension for salt.
Definition blackoilproperties.hh:60
Enable convective mixing?
Definition multiphasebaseproperties.hh:85
Enable diffusive fluxes?
Definition multiphasebaseproperties.hh:79
Enable the ECL-blackoil extension for disolution of gas into water.
Definition blackoilproperties.hh:69
Enable dispersive fluxes?
Definition multiphasebaseproperties.hh:82
Specify whether energy should be considered as a conservation quantity or not.
Definition multiphasebaseproperties.hh:76
Enable the ECL-blackoil extension for extended BO. ("Second gas" - alternative approach)
Definition blackoilproperties.hh:45
Enable the ECL-blackoil extension for foam.
Definition blackoilproperties.hh:57
Enable the ECL-blackoil extension for MICP.
Definition blackoilproperties.hh:72
Enable the tracking polymer molecular weight tracking and related functionalities.
Definition blackoilproperties.hh:51
Enable the ECL-blackoil extension for polymer.
Definition blackoilproperties.hh:48
Enable the ECL-blackoil extension for salt precipitation.
Definition blackoilproperties.hh:63
Enable the ECL-blackoil extension for solvents. ("Second gas")
Definition blackoilproperties.hh:42
Allow the spatial and temporal domains to exhibit non-constant temperature in the black-oil model.
Definition blackoilproperties.hh:78
Enable the ECL-blackoil extension for water evaporation.
Definition blackoilproperties.hh:66
Data required to calculate a flux over a face.
Definition fvbaseproperties.hh:149
The fluid systems including the information about the phases.
Definition multiphasebaseproperties.hh:69
Specifies the relation used for velocity.
Definition multiphasebaseproperties.hh:72
Enumerations used by the model.
Definition multiphasebaseproperties.hh:48
The secondary variables within a sub-control volume.
Definition fvbaseproperties.hh:133
The type of the local residual function.
Definition fvbaseproperties.hh:94
The type of the model.
Definition basicproperties.hh:88
Specifies the type of the actual Newton method.
Definition newtonmethodproperties.hh:32
A vector of primary variables within a sub-control volume.
Definition fvbaseproperties.hh:130
Vector containing volumetric or areal rates of quantities.
Definition fvbaseproperties.hh:116
The type tag for the black-oil problems.
Definition blackoilmodel.hh:78
VTK output module for the black oil model's parameters.
VTK output module for the fluid composition.
VTK output module for quantities which make sense for models which incorperate molecular diffusion.