28#ifndef EWOMS_NCP_MODEL_HH
29#define EWOMS_NCP_MODEL_HH
31#include <opm/material/densead/Math.hpp>
43#include <opm/common/Exceptions.hpp>
52#include <opm/material/common/Valgrind.hpp>
54#include <dune/common/fvector.hh>
61template <
class TypeTag>
65namespace Opm::Properties {
71struct NcpModel {
using InheritsFrom = std::tuple<MultiPhaseBaseModel>; };
75template<
class TypeTag>
79template<
class TypeTag>
83template<
class TypeTag>
87template<
class TypeTag>
91template<
class TypeTag>
95template<
class TypeTag>
99template<
class TypeTag>
103template<
class TypeTag>
107template<
class TypeTag>
111template<
class TypeTag>
115template<
class TypeTag>
119template<
class TypeTag>
123template<
class TypeTag>
127 static constexpr type value = 1.0;
130template<
class TypeTag>
134 static constexpr type value = 1.0;
137template<
class TypeTag>
141 static constexpr type value = 1.0e-6;
222template <
class TypeTag>
235 enum { numPhases = FluidSystem::numPhases };
236 enum { numComponents = FluidSystem::numComponents };
237 enum { fugacity0Idx = Indices::fugacity0Idx };
238 enum { pressure0Idx = Indices::pressure0Idx };
239 enum { saturation0Idx = Indices::saturation0Idx };
240 enum { conti0EqIdx = Indices::conti0EqIdx };
241 enum { ncp0EqIdx = Indices::ncp0EqIdx };
245 using ComponentVector = Dune::FieldVector<Scalar, numComponents>;
264 DiffusionModule::registerParameters();
265 EnergyModule::registerParameters();
282 ParentType::finishInit();
284 minActivityCoeff_.resize(this->numGridDof());
285 std::fill(minActivityCoeff_.begin(), minActivityCoeff_.end(), 1.0);
290 ParentType::adaptGrid();
291 minActivityCoeff_.resize(this->numGridDof());
306 if (!(s = EnergyModule::primaryVarName(
pvIdx)).empty())
309 std::ostringstream
oss;
310 if (
pvIdx == pressure0Idx)
311 oss <<
"pressure_" << FluidSystem::phaseName(0);
312 else if (saturation0Idx <=
pvIdx &&
pvIdx < saturation0Idx + (numPhases - 1))
313 oss <<
"saturation_" << FluidSystem::phaseName(
pvIdx - saturation0Idx);
314 else if (fugacity0Idx <=
pvIdx &&
pvIdx < fugacity0Idx + numComponents)
315 oss <<
"fugacity^" << FluidSystem::componentName(
pvIdx - fugacity0Idx);
328 if (!(s = EnergyModule::eqName(
eqIdx)).empty())
331 std::ostringstream
oss;
332 if (conti0EqIdx <=
eqIdx &&
eqIdx < conti0EqIdx + numComponents)
333 oss <<
"continuity^" << FluidSystem::componentName(
eqIdx - conti0EqIdx);
334 else if (ncp0EqIdx <=
eqIdx &&
eqIdx < ncp0EqIdx + numPhases)
335 oss <<
"ncp_" << FluidSystem::phaseName(
eqIdx - ncp0EqIdx);
347 ParentType::updateBegin();
353 if (this->isLocalDof(
dofIdx)) {
355 this->solution(0)[
dofIdx][Indices::pressure0Idx];
374 minActivityCoeff_[globalIdx][
compIdx] =
375 std::min(minActivityCoeff_[globalIdx][
compIdx],
378 Valgrind::CheckDefined(minActivityCoeff_[globalIdx][
compIdx]);
380 if (minActivityCoeff_[globalIdx][
compIdx] <= 0)
382 +
" on DOF "+std::to_string(globalIdx)+
" is negative or zero!");
397 else if (fugacity0Idx <=
pvIdx &&
pvIdx < fugacity0Idx + numComponents) {
407 else if (Indices::pressure0Idx ==
pvIdx) {
439 else if (ncp0EqIdx <=
eqIdx &&
eqIdx < Indices::ncp0EqIdx + numPhases)
447 return FluidSystem::molarMass(
compIdx);
463 void registerOutputModules_()
465 ParentType::registerOutputModules_();
474 mutable Scalar referencePressure_;
475 mutable std::vector<ComponentVector> minActivityCoeff_;
Provides the auxiliary methods required for consideration of the diffusion equation.
Definition diffusionmodule.hh:48
Provides the auxiliary methods required for consideration of the energy equation.
Definition energymodule.hh:50
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
The base class for the problems of ECFV discretizations which deal with a multi-phase flow through a ...
Definition multiphasebaseproblem.hh:60
Implements a boundary vector for the fully implicit compositional multi-phase NCP model.
Definition ncpboundaryratevector.hh:46
This template class represents the extensive quantities of the compositional NCP model.
Definition ncpextensivequantities.hh:51
Contains the quantities which are are constant within a finite volume in the compositional multi-phas...
Definition ncpintensivequantities.hh:58
Details needed to calculate the local residual in the compositional multi-phase NCP-model .
Definition ncplocalresidual.hh:47
A compositional multi-phase model based on non-linear complementarity functions.
Definition ncpmodel.hh:225
void updatePVWeights(const ElementContext &elemCtx) const
Update the weights of all primary variables within an element given the complete set of intensive qua...
Definition ncpmodel.hh:364
std::string eqName(unsigned eqIdx) const
Given an equation index, return a human readable name.
Definition ncpmodel.hh:325
std::string primaryVarName(unsigned pvIdx) const
Given an primary variable index, return a human readable name.
Definition ncpmodel.hh:303
static std::string name()
Definition ncpmodel.hh:297
Scalar primaryVarWeight(unsigned globalDofIdx, unsigned pvIdx) const
Returns the relative weight of a primary variable for calculating relative errors.
Definition ncpmodel.hh:390
Scalar minActivityCoeff(unsigned globalDofIdx, unsigned compIdx) const
Returns the smallest activity coefficient of a component for the most current solution at a vertex.
Definition ncpmodel.hh:457
static void registerParameters()
Register all run-time parameters for the immiscible model.
Definition ncpmodel.hh:260
void finishInit()
Apply the initial conditions to the model.
Definition ncpmodel.hh:280
void updateBegin()
Called by the update() method before it tries to apply the newton method.
Definition ncpmodel.hh:345
Scalar eqWeight(unsigned globalDofIdx, unsigned eqIdx) const
Returns the relative weight of an equation.
Definition ncpmodel.hh:432
A Newton solver specific to the NCP model.
Definition ncpnewtonmethod.hh:55
Represents the primary variables used by the compositional multi-phase NCP model.
Definition ncpprimaryvariables.hh:55
Implements a vector representing mass, molar or volumetric rates.
Definition ncpratevector.hh:51
VTK output module for the fluid composition.
Definition vtkcompositionmodule.hpp:57
static void registerParameters()
Register all run-time parameters for the Vtk output module.
Definition vtkcompositionmodule.hpp:86
VTK output module for quantities which make sense for models which incorperate molecular diffusion.
Definition vtkdiffusionmodule.hpp:58
static void registerParameters()
Register all run-time parameters for the Vtk output module.
Definition vtkdiffusionmodule.hpp:87
VTK output module for quantities which make sense for models which assume thermal equilibrium.
Definition vtkenergymodule.hpp:58
static void registerParameters()
Register all run-time parameters for the Vtk output module.
Definition vtkenergymodule.hpp:86
Classes required for molecular diffusion.
Contains the classes required to consider energy as a conservation quantity in a multi-phase module.
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
Implements a boundary vector for the fully implicit compositional multi-phase NCP model.
This template class represents the extensive quantities of the compositional NCP model.
The primary variable and equation indices for the compositional multi-phase NCP model.
Contains the quantities which are are constant within a finite volume in the compositional multi-phas...
Details needed to calculate the local residual in the compositional multi-phase NCP-model .
A Newton solver specific to the NCP model.
Represents the primary variables used by the compositional multi-phase NCP model.
Declares the properties required for the NCP compositional multi-phase model.
Implements a vector representing mass, molar or volumetric rates.
The primary variable and equation indices for the compositional multi-phase NCP model.
Definition ncpindices.hh:48
The type of the base class for all problems which use this model.
Definition fvbaseproperties.hh:84
Type of object for specifying boundary conditions.
Definition fvbaseproperties.hh:119
Enable diffusive fluxes?
Definition multiphasebaseproperties.hh:79
Specify whether energy should be considered as a conservation quantity or not.
Definition multiphasebaseproperties.hh:76
Data required to calculate a flux over a face.
Definition fvbaseproperties.hh:149
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
The unmodified weight for the fugacity primary variables.
Definition ncpproperties.hh:48
The unmodified weight for the pressure primary variable.
Definition ncpproperties.hh:42
The weight for the saturation primary variables.
Definition ncpproperties.hh:45
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
Define the type tag for the compositional NCP model.
Definition ncpmodel.hh:71
VTK output module for the fluid composition.
VTK output module for quantities which make sense for models which incorperate molecular diffusion.
VTK output module for quantities which make sense for models which assume thermal equilibrium.