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);
202template<
class TypeTag>
272template<
class TypeTag >
290 enum { numComponents = FluidSystem::numComponents };
295 static constexpr bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
296 static constexpr bool waterEnabled = Indices::waterEnabled;
313 eqWeights_.resize(numEq, 1.0);
327 DiffusionModule::registerParameters();
340 {
return "blackoil"; }
347 std::ostringstream
oss;
349 if (
pvIdx == Indices::waterSwitchIdx)
350 oss <<
"water_switching";
351 else if (
pvIdx == Indices::pressureSwitchIdx)
352 oss <<
"pressure_switching";
353 else if (
static_cast<int>(
pvIdx) == Indices::compositionSwitchIdx)
354 oss <<
"composition_switching";
355 else if (SolventModule::primaryVarApplies(
pvIdx))
356 return SolventModule::primaryVarName(
pvIdx);
357 else if (ExtboModule::primaryVarApplies(
pvIdx))
358 return ExtboModule::primaryVarName(
pvIdx);
359 else if (PolymerModule::primaryVarApplies(
pvIdx))
360 return PolymerModule::primaryVarName(
pvIdx);
361 else if (EnergyModule::primaryVarApplies(
pvIdx))
362 return EnergyModule::primaryVarName(
pvIdx);
374 std::ostringstream
oss;
376 if (Indices::conti0EqIdx <=
eqIdx &&
eqIdx < Indices::conti0EqIdx + numComponents)
377 oss <<
"conti_" << FluidSystem::phaseName(
eqIdx - Indices::conti0EqIdx);
378 else if (SolventModule::eqApplies(
eqIdx))
379 return SolventModule::eqName(
eqIdx);
380 else if (ExtboModule::eqApplies(
eqIdx))
381 return ExtboModule::eqName(
eqIdx);
382 else if (PolymerModule::eqApplies(
eqIdx))
383 return PolymerModule::eqName(
eqIdx);
384 else if (EnergyModule::eqApplies(
eqIdx))
385 return EnergyModule::eqName(
eqIdx);
399 if (globalDofIdx >= this->numGridDof())
403 if (
int(Indices::waterSwitchIdx) ==
int(
pvIdx))
408 else if (
int(Indices::pressureSwitchIdx) ==
int(
pvIdx))
412 else if (SolventModule::primaryVarApplies(
pvIdx))
413 return SolventModule::primaryVarWeight(
pvIdx);
416 else if (ExtboModule::primaryVarApplies(
pvIdx))
417 return ExtboModule::primaryVarWeight(
pvIdx);
420 else if (PolymerModule::primaryVarApplies(
pvIdx))
421 return PolymerModule::primaryVarWeight(
pvIdx);
424 else if (EnergyModule::primaryVarApplies(
pvIdx))
425 return EnergyModule::primaryVarWeight(
pvIdx);
428 assert(
int(Indices::compositionSwitchIdx) ==
int(
pvIdx));
430 auto pvMeaning = this->solution(0)[globalDofIdx].primaryVarsMeaningGas();
431 if (
pvMeaning == PrimaryVariables::GasMeaning::Sg)
433 else if (
pvMeaning == PrimaryVariables::GasMeaning::Rs)
449 if (globalDofIdx >= this->numGridDof())
452 return eqWeights_[
eqIdx];
455 void setEqWeight(
unsigned eqIdx, Scalar value) {
456 eqWeights_[
eqIdx] = value;
467 template <
class DofEntity>
470 unsigned dofIdx =
static_cast<unsigned>(asImp_().dofMapper().index(
dof));
474 throw std::runtime_error(
"Could not serialize degree of freedom "+std::to_string(dofIdx));
477 const auto& priVars = this->solution(0)[dofIdx];
486 outstream << priVars.pvtRegionIndex() <<
" ";
488 SolventModule::serializeEntity(asImp_(),
outstream,
dof);
490 PolymerModule::serializeEntity(asImp_(),
outstream,
dof);
491 EnergyModule::serializeEntity(asImp_(),
outstream,
dof);
502 template <
class DofEntity>
506 unsigned dofIdx =
static_cast<unsigned>(asImp_().dofMapper().index(
dof));
509 auto& priVars = this->solution(0)[dofIdx];
512 throw std::runtime_error(
"Could not deserialize degree of freedom "+std::to_string(dofIdx));
517 unsigned primaryVarsMeaningGas;
520 unsigned primaryVarsMeaningWater;
521 instream >> primaryVarsMeaningWater;
523 unsigned primaryVarsMeaningPressure;
524 instream >> primaryVarsMeaningPressure;
526 unsigned pvtRegionIdx;
530 throw std::runtime_error(
"Could not deserialize degree of freedom "+std::to_string(dofIdx));
532 SolventModule::deserializeEntity(asImp_(),
instream,
dof);
533 ExtboModule::deserializeEntity(asImp_(),
instream,
dof);
534 PolymerModule::deserializeEntity(asImp_(),
instream,
dof);
535 EnergyModule::deserializeEntity(asImp_(),
instream,
dof);
537 using PVM_G =
typename PrimaryVariables::GasMeaning;
538 using PVM_W =
typename PrimaryVariables::WaterMeaning;
539 using PVM_P =
typename PrimaryVariables::PressureMeaning;
540 priVars.setPrimaryVarsMeaningGas(
static_cast<PVM_G>(primaryVarsMeaningGas));
541 priVars.setPrimaryVarsMeaningWater(
static_cast<PVM_W>(primaryVarsMeaningWater));
542 priVars.setPrimaryVarsMeaningPressure(
static_cast<PVM_P>(primaryVarsMeaningPressure));
544 priVars.setPvtRegionIndex(pvtRegionIdx);
554 template <
class Restarter>
557 ParentType::deserialize(
res);
562 ElementContext elemCtx(this->simulator_);
564 elemCtx.updateStencil(
elem);
565 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
566 unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
567 updatePvtRegionIndex_(this->solution(0)[globalDofIdx],
574 this->solution(1) = this->solution(0);
584 template <
class Context>
585 void supplementInitialSolution_(PrimaryVariables& priVars,
586 const Context& context,
589 { updatePvtRegionIndex_(priVars, context, dofIdx,
timeIdx); }
591 void registerOutputModules_()
593 ParentType::registerOutputModules_();
604 if constexpr (enableDiffusion)
609 std::vector<Scalar> eqWeights_;
610 Implementation& asImp_()
611 {
return *
static_cast<Implementation*
>(
this); }
612 const Implementation& asImp_()
const
613 {
return *
static_cast<const Implementation*
>(
this); }
615 template <
class Context>
616 void updatePvtRegionIndex_(PrimaryVariables& priVars,
617 const Context& context,
621 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:48
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:80
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:105
static void registerOutputModules(Model &model, Simulator &simulator)
Register all MICP specific VTK and ECL output modules.
Definition blackoilmicpmodules.hh:117
A fully-implicit black-oil flow model.
Definition blackoilmodel.hh:275
std::string primaryVarName(int pvIdx) const
Given an primary variable index, return a human readable name.
Definition blackoilmodel.hh:345
Scalar primaryVarWeight(unsigned globalDofIdx, unsigned pvIdx) const
Returns the relative weight of a primary variable for calculating relative errors.
Definition blackoilmodel.hh:395
Scalar eqWeight(unsigned globalDofIdx, unsigned eqIdx) const
Returns the relative weight of an equation.
Definition blackoilmodel.hh:445
void serializeEntity(std::ostream &outstream, const DofEntity &dof)
Write the current solution for a degree of freedom to a restart file.
Definition blackoilmodel.hh:468
std::string eqName(int eqIdx) const
Given an equation index, return a human readable name.
Definition blackoilmodel.hh:372
static std::string name()
Definition blackoilmodel.hh:339
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:503
static void registerParameters()
Register all run-time parameters for the immiscible model.
Definition blackoilmodel.hh:319
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition blackoilmodel.hh:555
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
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.