tpfa linearizer for thermal used for co2store and blackoil

-- add new function need for tpfa linearizer in thermal
-- set tpfa linearizer for blackoil with energy
-- set tpfa linearizer for gasoil and energy which include co2store
-- NB diffusion is disabled for this simulators
This commit is contained in:
hnil 2023-06-30 12:54:18 +02:00
parent c4a3aff39c
commit 13308ed2af
4 changed files with 128 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include <opm/common/TimingMacros.hpp>
#include <opm/models/common/multiphasebaseproperties.hh>
#include <opm/models/blackoil/blackoilproperties.hh>
#include <array>
#include <functional>
@ -108,9 +109,73 @@ public:
EclCpGridVanguard(Simulator& simulator)
: EclBaseVanguard<TypeTag>(simulator)
{
this->checkConsistency();
this->callImplementationInit();
}
/*!
* Checking consistency of simulator
*/
void checkConsistency()
{
const auto& runspec = this->eclState().runspec();
const auto& config = this->eclState().getSimulationConfig();
const auto& phases = runspec.phases();
// check for correct module setup
if (config.isThermal()) {
if (getPropValue<TypeTag, Properties::EnableEnergy>() == false) {
throw std::runtime_error("Input specifies energy while simulator has disabled it, try xxx_energy");
}
} else {
if (getPropValue<TypeTag, Properties::EnableEnergy>() == true) {
throw std::runtime_error("Input specifies no energy while simulator has energy, try run without _energy");
}
}
if (config.isDiffusive()) {
if (getPropValue<TypeTag, Properties::EnableDiffusion>() == false) {
throw std::runtime_error("Input specifies diffusion while simulator has disabled it, try xxx_diffusion");
}
}
if (runspec.micp()) {
if (getPropValue<TypeTag, Properties::EnableMICP>() == false) {
throw std::runtime_error("Input specifies MICP while simulator has it disabled");
}
}
if (phases.active(Phase::BRINE)) {
if (getPropValue<TypeTag, Properties::EnableBrine>() == false) {
throw std::runtime_error("Input specifies Brine while simulator has it disabled");
}
}
if (phases.active(Phase::POLYMER)) {
if (getPropValue<TypeTag, Properties::EnablePolymer>() == false) {
throw std::runtime_error("Input specifies Polymer while simulator has it disabled");
}
}
// checking for correct phases is more difficult TODO!
if (phases.active(Phase::ZFRACTION)) {
if (getPropValue<TypeTag, Properties::EnableExtbo>() == false) {
throw std::runtime_error("Input specifies ExBo while simulator has it disabled");
}
}
if (phases.active(Phase::FOAM)) {
if (getPropValue<TypeTag, Properties::EnableFoam>() == false) {
throw std::runtime_error("Input specifies Foam while simulator has it disabled");
}
}
if (phases.active(Phase::SOLVENT)) {
if (getPropValue<TypeTag, Properties::EnableSolvent>() == false) {
throw std::runtime_error("Input specifies Solvent while simulator has it disabled");
}
}
}
/*!
* \brief Free the memory occupied by the global transmissibility object.
*
@ -160,7 +225,7 @@ public:
unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const {
return elemIndex;
}
unsigned int gridIdxToEquilGridIdx(unsigned int elemIndex) const {
return elemIndex;
}

View File

@ -790,6 +790,25 @@ public:
return *pffDofData_.get(context.element(), toDofLocalIdx).diffusivity;
}
/*!
* give the transmissibility for a face i.e. pair. should be symmetric?
*/
Scalar diffusivity(const unsigned globalCellIn, const unsigned globalCellOut) const{
return transmissibilities_.diffusivity(globalCellIn, globalCellOut);
}
/*!
* \brief Direct access to a boundary transmissibility.
*/
Scalar thermalTransmissibilityBoundary(const unsigned globalSpaceIdx,
const unsigned boundaryFaceIdx) const
{
return transmissibilities_.thermalTransmissibilityBoundary(globalSpaceIdx, boundaryFaceIdx);
}
/*!
* \copydoc EclTransmissiblity::transmissibilityBoundary
*/
@ -810,6 +829,16 @@ public:
return transmissibilities_.transmissibilityBoundary(globalSpaceIdx, boundaryFaceIdx);
}
/*!
* \copydoc EclTransmissiblity::thermalHalfTransmissibility
*/
Scalar thermalHalfTransmissibility(const unsigned globalSpaceIdxIn,
const unsigned globalSpaceIdxOut) const
{
return transmissibilities_.thermalHalfTrans(globalSpaceIdxIn,globalSpaceIdxOut);
}
/*!
* \copydoc EclTransmissiblity::thermalHalfTransmissibility
*/
@ -1078,6 +1107,27 @@ public:
return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0);
}
Scalar temperature(unsigned globalDofIdx, unsigned timeIdx) const
{
// use the initial temperature of the DOF if temperature is not a primary
// variable
return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0);
}
const SolidEnergyLawParams&
solidEnergyLawParams(unsigned globalSpaceIdx,
unsigned /*timeIdx*/) const
{
return this->thermalLawManager_->solidEnergyLawParams(globalSpaceIdx);
}
const ThermalConductionLawParams &
thermalConductionLawParams(unsigned globalSpaceIdx,
unsigned /*timeIdx*/)const
{
return this->thermalLawManager_->thermalConductionLawParams(globalSpaceIdx);
}
/*!
* \copydoc FvBaseProblem::boundary
*

View File

@ -30,6 +30,7 @@ struct EclFlowEnergyProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EclFlowEnergyProblem> {
static constexpr bool value = true;

View File

@ -24,6 +24,8 @@
#include <opm/grid/CpGrid.hpp>
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/simulators/flow/Main.hpp>
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/discretization/common/tpfalinearizer.hh>
namespace Opm {
namespace Properties {
@ -59,6 +61,15 @@ template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EclFlowGasOilEnergyProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct Linearizer<TypeTag, TTag::EclFlowGasOilEnergyProblem> { using type = TpfaLinearizer<TypeTag>; };
template<class TypeTag>
struct LocalResidual<TypeTag, TTag::EclFlowGasOilEnergyProblem> { using type = BlackOilLocalResidualTPFA<TypeTag>; };
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::EclFlowGasOilEnergyProblem> { static constexpr bool value = false; };
}}
namespace Opm {