further development regarding the compositional

This commit is contained in:
Kai Bao 2024-03-22 17:09:43 +01:00
parent 131eaf4703
commit 70a845b6db
9 changed files with 4073 additions and 10 deletions

View File

@ -703,6 +703,16 @@ opm_add_test(flowexp_blackoil
$<TARGET_OBJECTS:moduleVersion>
)
opm_add_test(flowexp_comp
ONLY_COMPILE
ALWAYS_ENABLE
DEPENDS opmsimulators
LIBRARIES opmsimulators
SOURCES
flowexperimental/comp/flowexp_comp.cpp
$<TARGET_OBJECTS:moduleVersion>
)
if(dune-alugrid_FOUND)
if (NOT BUILD_FLOW_ALU_GRID)
set(FLOW_ALUGRID_ONLY_DEFAULT_ENABLE_IF "FALSE")

View File

@ -480,7 +480,9 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/FlowGenericVanguard.hpp
opm/simulators/flow/FlowMain.hpp
opm/simulators/flow/FlowProblem.hpp
opm/simulators/flow/FlowProblemComp.hpp
opm/simulators/flow/FlowProblemProperties.hpp
opm/simulators/flow/FlowProblemCompProperties.hpp
opm/simulators/flow/FlowUtils.hpp
opm/simulators/flow/FlowsData.hpp
opm/simulators/flow/FlowThresholdPressure.hpp

View File

@ -0,0 +1,249 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \brief The common settings for all ebos variants.
*/
#ifndef EBOSCOMP_HH
#define EBOSCOMP_HH
#include <opm/simulators/flow/FlowProblemComp.hpp>
#include <opm/simulators/flow/FlowProblemCompProperties.hpp>
#include <opm/models/utils/start.hh>
#include <opm/models/discretization/common/fvbaseproblem.hh>
#include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
#include <opm/simulators/linalg/ISTLSolver.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
// #include <opm/common/utility/OutputTypeTag.hpp>
namespace Opm {
template <class TypeTag>
class EbosProblemComp;
}
namespace Opm::Properties {
namespace TTag {
struct EbosTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, FlowBaseProblemComp, BlackOilModel, EclTimeSteppingParameters>;
};
}
// Set the problem class
template<class TypeTag>
struct Problem<TypeTag, TTag::EbosTypeTag> {
using type = EbosProblemComp<TypeTag>;
};
// Enable experimental features for ebos: ebos is the research simulator of the OPM
// project. If you're looking for a more stable "production quality" simulator, consider
// using `flow`
template<class TypeTag>
struct EnableExperiments<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = true;
};
// use flow's well model for now
/* template<class TypeTag>
struct WellModel<TypeTag, TTag::EbosTypeTag> {
using type = BlackoilWellModel<TypeTag>;
}; */
// currently, ebos uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still
// available in ebos, but hidden from view.
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = false;
};
// set some properties that are only required by the well model
template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = false;
};
// flow's well model only works with surface volumes
template<class TypeTag>
struct BlackoilConserveSurfaceVolume<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = true;
};
// the values for the residual are for the whole cell instead of for a cubic meter of the cell
template<class TypeTag>
struct UseVolumetricResidual<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = false;
};
// by default use flow's aquifer model for now
template<class TypeTag>
struct AquiferModel<TypeTag, TTag::EbosTypeTag> {
using type = BlackoilAquiferModel<TypeTag>;
};
// use flow's linear solver backend for now
template<class TypeTag>
struct LinearSolverSplice<TypeTag, TTag::EbosTypeTag> {
using type = TTag::FlowIstlSolver;
};
template<>
struct LinearSolverBackend<TTag::EbosTypeTag, TTag::FlowIstlSolverParams> {
using type = ISTLSolver<TTag::EbosTypeTag>;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::EbosTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-1;
};
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
template<class TypeTag>
struct EclNewtonRelaxedVolumeFraction<TypeTag, TTag::EbosTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.05;
};
// the maximum volumetric error of a cell in the relaxed region
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, TTag::EbosTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e6*getPropValue<TypeTag, Properties::NewtonTolerance>();
};
// the tolerated amount of "incorrect" amount of oil per time step for the complete
// reservoir. this is scaled by the pore volume of the reservoir, i.e., larger reservoirs
// will tolerate larger residuals.
template<class TypeTag>
struct EclNewtonSumTolerance<TypeTag, TTag::EbosTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-5;
};
// make all Newton iterations strict, i.e., the volumetric Newton tolerance must be
// always be upheld in the majority of the spatial domain. In this context, "majority"
// means 1 - EclNewtonRelaxedVolumeFraction.
template<class TypeTag>
struct EclNewtonStrictIterations<TypeTag, TTag::EbosTypeTag> {
static constexpr int value = 100;
};
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::EbosTypeTag> {
static constexpr int value = 8;
};
// if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available).
#if _OPENMP
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::EbosTypeTag> {
static constexpr int value = 2;
};
#endif
// By default, ebos accepts the result of the time integration unconditionally if the
// smallest time step size is reached.
template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, TTag::EbosTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::EbosTypeTag> {
using type = ISTLSolver<TypeTag>;
};
} // namespace Opm::Properties
namespace Opm {
template <class TypeTag>
class EbosProblemComp : public FlowProblemComp<TypeTag> //, public FvBaseProblem<TypeTag>
{
typedef FlowProblemComp<TypeTag> ParentType; // FlowProblemComp
using BaseType = GetPropType<TypeTag, Properties::BaseProblem>; // multiphase problem
public:
void writeOutput(bool verbose = true)
{
OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to
// write the desired VTK files.
if (Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>() || this->simulator().episodeWillBeOver()){
BaseType::writeOutput(verbose);
}
}
static void registerParameters()
{
// outputTypeTagInfo<ParentType>();
// outputTypeTagInfo<BaseType>();
ParentType::registerParameters();
BaseType::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableTerminalOutput>("Do *NOT* use!");
Parameters::hideParam<TypeTag, Properties::DbhpMaxRel>();
Parameters::hideParam<TypeTag, Properties::DwellFractionMax>();
Parameters::hideParam<TypeTag, Properties::MaxResidualAllowed>();
Parameters::hideParam<TypeTag, Properties::ToleranceMb>();
Parameters::hideParam<TypeTag, Properties::ToleranceMbRelaxed>();
Parameters::hideParam<TypeTag, Properties::ToleranceCnv>();
Parameters::hideParam<TypeTag, Properties::ToleranceCnvRelaxed>();
Parameters::hideParam<TypeTag, Properties::ToleranceWells>();
Parameters::hideParam<TypeTag, Properties::ToleranceWellControl>();
Parameters::hideParam<TypeTag, Properties::MaxWelleqIter>();
Parameters::hideParam<TypeTag, Properties::UseMultisegmentWell>();
Parameters::hideParam<TypeTag, Properties::TolerancePressureMsWells>();
Parameters::hideParam<TypeTag, Properties::MaxPressureChangeMsWells>();
Parameters::hideParam<TypeTag, Properties::MaxInnerIterMsWells>();
Parameters::hideParam<TypeTag, Properties::MaxNewtonIterationsWithInnerWellIterations>();
Parameters::hideParam<TypeTag, Properties::MaxInnerIterWells>();
Parameters::hideParam<TypeTag, Properties::MaxSinglePrecisionDays>();
Parameters::hideParam<TypeTag, Properties::MinStrictCnvIter>();
Parameters::hideParam<TypeTag, Properties::MinStrictMbIter>();
Parameters::hideParam<TypeTag, Properties::SolveWelleqInitially>();
Parameters::hideParam<TypeTag, Properties::UpdateEquationsScaling>();
Parameters::hideParam<TypeTag, Properties::UseUpdateStabilization>();
Parameters::hideParam<TypeTag, Properties::MatrixAddWellContributions>();
Parameters::hideParam<TypeTag, Properties::EnableTerminalOutput>();
}
// inherit the constructors
using ParentType::FlowProblemComp;
};
}
#endif // EBOS_HH

View File

@ -0,0 +1,383 @@
/*
Copyright 2024, SINTEF Digital
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <opm/models/utils/start.hh>
#include <opm/simulators/flow/FlowProblemComp.hpp>
#include <opm/material/constraintsolvers/PTFlash.hpp>
#include "../FlowExpNewtonMethod.hpp"
#include "ebosComp.hh"
#include <opm/models/ptflash/flashmodel.hh>
#include <opm/material/fluidsystems/GenericOilGasFluidSystem.hpp>
// #include <opm/simulators/flow/Main.hpp>
// #include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/discretization/common/tpfalinearizer.hh>
// #include <flowexperimental/blackoilintensivequantitiessimple.hh>
// #include "BlackOilModelFvNoCache.hpp"
// #include "co2ptflowproblem.hh"
// #include <tests/problems/co2ptflashproblem.hh>
#include <opm/simulators/flow/FlowGenericProblem.hpp>
#include <opm/simulators/flow/FlowGenericProblem_impl.hpp>
#include <opm/simulators/linalg/parallelbicgstabbackend.hh>
// // the current code use eclnewtonmethod adding other conditions to proceed_ should do the trick for KA
// // adding linearshe sould be chaning the update_ function in the same class with condition that the error is reduced.
// the trick is to be able to recalculate the residual from here.
// unsure where the timestepping is done from suggestedtime??
// suggestTimeStep is taken from newton solver in problem.limitTimestep
namespace Opm{
template<typename TypeTag>
class EmptyModel : public BaseAuxiliaryModule<TypeTag>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using GlobalEqVector = GetPropType<TypeTag, Properties::GlobalEqVector>;
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>;
public:
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
EmptyModel(Simulator& /*simulator*/){
};
void init(){}
template<class Something>
void init(Something /*A*/){}
void prepareTracerBatches(){};
using NeighborSet = std::set<unsigned>;
void linearize(SparseMatrixAdapter& /*matrix*/, GlobalEqVector& /*residual*/){};
unsigned numDofs() const{return 0;};
void addNeighbors(std::vector<NeighborSet>& /*neighbors*/) const{};
//void applyInitial(){};
void initialSolutionApplied(){};
//void initFromRestart(const data::Aquifers& aquiferSoln);
template <class Restarter>
void serialize(Restarter& /*res*/){};
template <class Restarter>
void deserialize(Restarter& /*res*/){};
void beginEpisode(){};
void beginTimeStep(){};
void beginIteration(){};
// add the water rate due to aquifers to the source term.
template<class RateVector, class Context>
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const{};
template<class RateVector>
void addToSource(RateVector& rates, unsigned globalSpaceIdx, unsigned timeIdx) const{};
void endIteration()const{};
void endTimeStep(){};
void endEpisode(){};
void applyInitial(){};
template<class RateType>
void computeTotalRatesForDof(RateType& /*rate*/, unsigned /*globalIdx*/) const{};
};
}
namespace Opm::Properties {
namespace TTag {
struct FlowExpCompProblem {
using InheritsFrom = std::tuple<FlashModel, FlowModelParameters, VtkTracer, CpGridVanguard,
EclTimeSteppingParameters, FlowBaseProblemComp>;
};
}
#if 0
template<class TypeTag, class MyTypeTag>
struct ExpliciteRockCompaction{
using type = UndefinedProperty;
};
#endif
#if 1
template<class TypeTag>
struct MaterialLaw<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using Indices = GetPropType<TypeTag, Properties::Indices>;
using Traits = ThreePhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/0,
/*nonWettingPhaseIdx=*/1,
/*gasPhaseIdx=*/2>;
public:
using EclMaterialLawManager = ::Opm::EclMaterialLawManager<Traits>;
//using EclMaterialLawManager = ::Opm::EclMaterialLawManager<Traits>;
using type = typename EclMaterialLawManager::MaterialLaw;
};
#endif
template<class TypeTag>
struct SparseMatrixAdapter<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
using Block = MatrixBlock<Scalar, numEq, numEq>;
public:
using type = typename Linear::IstlSparseMatrixAdapter<Block>;
};
#if 1
template<class TypeTag>
struct SolidEnergyLaw<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
public:
using EclThermalLawManager = ::Opm::EclThermalLawManager<Scalar, FluidSystem>;
using type = typename EclThermalLawManager::SolidEnergyLaw;
};
#endif
// Set the material law for thermal conduction
template<class TypeTag>
struct ThermalConductionLaw<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
public:
using EclThermalLawManager = ::Opm::EclThermalLawManager<Scalar, FluidSystem>;
using type = typename EclThermalLawManager::ThermalConductionLaw;
};
template <class TypeTag>
struct SpatialDiscretizationSplice<TypeTag, TTag::FlowExpCompProblem>
{
using type = TTag::EcfvDiscretization;
};
template <class TypeTag>
struct LocalLinearizerSplice<TypeTag, TTag::FlowExpCompProblem>
{
using type = TTag::AutoDiffLocalLinearizer;
};
// Set the problem property
template <class TypeTag>
struct Problem<TypeTag, TTag::FlowExpCompProblem>
{
using type = EbosProblemComp<TypeTag>;
};
template<class TypeTag>
struct AquiferModel<TypeTag, TTag::FlowExpCompProblem> {
using type = EmptyModel<TypeTag>;
};
template<class TypeTag>
struct WellModel<TypeTag, TTag::FlowExpCompProblem> {
using type = EmptyModel<TypeTag>;
};
template<class TypeTag>
struct TracerModelDef<TypeTag, TTag::FlowExpCompProblem> {
using type = EmptyModel<TypeTag>;
};
template <class TypeTag>
struct FlashSolver<TypeTag, TTag::FlowExpCompProblem> {
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
public:
using type = Opm::PTFlash<Scalar, FluidSystem>;
};
template <class TypeTag, class MyTypeTag>
struct NumComp { using type = UndefinedProperty; };
// TODO: this is unfortunate, have to check why we need to hard-code it
template <class TypeTag>
struct NumComp<TypeTag, TTag::FlowExpCompProblem> {
static constexpr int value = 3;
};
// set the defaults for the problem specific properties
// TODO: should it be here?
template<class TypeTag, class MyTypeTag>
struct Temperature { using type = UndefinedProperty; };
template <class TypeTag>
struct Temperature<TypeTag, TTag::FlowExpCompProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 423.25;//TODO
};
/* template <class TypeTag>
struct SimulationName<TypeTag, TTag::FlowExpCompProblem> {
static constexpr auto value = "co2_ptflash";
}; */
template <class TypeTag>
struct FluidSystem<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
static constexpr int num_comp = getPropValue<TypeTag, Properties::NumComp>();
public:
using type = Opm::GenericOilGasFluidSystem<Scalar, num_comp>;
};
template<class TypeTag>
struct EnableWriteAllSolutions<TypeTag, TTag::FlowExpCompProblem>{
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableMech<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct OutputMode<TypeTag, TTag::FlowExpCompProblem> { inline static const std::string value = "all"; };
template<class TypeTag>
struct RestartWritingInterval<TypeTag, TTag::FlowExpCompProblem> { static constexpr int value = 10; };
template<class TypeTag>
struct EnableDriftCompensation<TypeTag, TTag::FlowExpCompProblem> { static constexpr bool value = false; };
template<class TypeTag>
struct NumPressurePointsEquil<TypeTag, TTag::FlowExpCompProblem> { static constexpr int value = 100; };
// template<class TypeTag>
// struct ExpliciteRockCompaction<TypeTag, TTag::FlowExpCompProblem> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableEclOutput<TypeTag, TTag::FlowExpCompProblem> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, TTag::FlowExpCompProblem> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableDisgasInWater<TypeTag, TTag::FlowExpCompProblem> { static constexpr bool value = false; };
template<class TypeTag>
struct Stencil<TypeTag, TTag::FlowExpCompProblem>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
public:
using type = EcfvStencil<Scalar, GridView>;
};
template<class TypeTag>
struct EnableApiTracking<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableTemperature<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableSaltPrecipitation<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnablePolymerMW<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnablePolymer<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EclOutputDoublePrecision<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableBrine<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableVapwat<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableSolvent<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableFoam<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableExtbo<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableMICP<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
// disable thermal flux boundaries by default
#if 0
template<class TypeTag>
struct EnableThermalFluxBoundaries<TypeTag, TTag::FlowExpCompProblem> {
static constexpr bool value = false;
};
#endif
} // namespace Opm::Properties
int main(int argc, char** argv)
{
//using TypeTag = Opm::Properties::TTag::EclFlowProblemEbos;
using TypeTag = Opm::Properties::TTag::FlowExpCompProblem;
Opm::registerEclTimeSteppingParameters<TypeTag>();
return Opm::start<TypeTag>(argc, argv);
}

View File

@ -289,7 +289,7 @@ public:
serializer(solventSaturation_);
serializer(solventRsw_);
serializer(micp_);
//serializer(mixControls_);
serializer(mixControls_);
}
protected:
@ -364,13 +364,13 @@ protected:
std::vector<Scalar> solventRsw_;
MICPSolutionContainer<Scalar> micp_;
//MixingRateControls<FluidSystem> mixControls_;
MixingRateControls<FluidSystem> mixControls_;
// time stepping parameters
bool enableTuning_;
Scalar initialTimeStepSize_;
Scalar maxTimeStepAfterWellEvent_;
// equilibration parameters
int numPressurePointsEquil_;

View File

@ -86,7 +86,7 @@ FlowGenericProblem(const EclipseState& eclState,
: eclState_(eclState)
, schedule_(schedule)
, gridView_(gridView)
//, mixControls_(schedule)
, mixControls_(schedule)
, lookUpData_(gridView)
{
}
@ -107,7 +107,7 @@ serializationTestObject(const EclipseState& eclState,
result.solventRsw_ = {18.0};
result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject();
result.micp_ = MICPSolutionContainer<Scalar>::serializationTestObject();
//result.mixControls_ = MixingRateControls<FluidSystem>::serializationTestObject(schedule);
result.mixControls_ = MixingRateControls<FluidSystem>::serializationTestObject(schedule);
return result;
}
@ -477,7 +477,7 @@ beginTimeStep_(bool enableExperiments,
}
// update explicit quantities between timesteps.
// this->mixControls_.updateExplicitQuantities(episodeIdx, timeStepSize);
this->mixControls_.updateExplicitQuantities(episodeIdx, timeStepSize);
}
template<class GridView, class FluidSystem>
@ -612,8 +612,8 @@ typename FlowGenericProblem<GridView,FluidSystem>::Scalar
FlowGenericProblem<GridView,FluidSystem>::
drsdtcon(unsigned elemIdx, int episodeIdx) const
{
// return this->mixControls_.drsdtcon(elemIdx, episodeIdx,
// this->pvtRegionIndex(elemIdx));
return this->mixControls_.drsdtcon(elemIdx, episodeIdx,
this->pvtRegionIndex(elemIdx));
}
template<class GridView, class FluidSystem>
@ -762,8 +762,8 @@ operator==(const FlowGenericProblem& rhs) const
this->solventSaturation_ == rhs.solventSaturation_ &&
this->solventRsw_ == rhs.solventRsw_ &&
this->polymer_ == rhs.polymer_ &&
this->micp_ == rhs.micp_;// &&
//this->mixControls_ == rhs.mixControls_;
this->micp_ == rhs.micp_ &&
this->mixControls_ == rhs.mixControls_;
}
} // namespace Opm

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,505 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \copydoc Opm::FlowProblem
*/
#ifndef OPM_FLOW_PROBLEM_COMP_PROPERTIES_HPP
#define OPM_FLOW_PROBLEM_COMP_PROPERTIES_HPP
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
#include <opm/material/thermal/EclThermalLawManager.hpp>
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/simulators/flow/BaseAquiferModel.hpp>
#include <opm/simulators/flow/CpGridVanguard.hpp>
#include <opm/simulators/flow/DummyGradientCalculator.hpp>
#include <opm/simulators/flow/EclWriter.hpp>
#include <opm/simulators/flow/FIBlackoilModel.hpp>
#include <opm/simulators/flow/NewTranFluxModule.hpp>
#include <opm/simulators/flow/OutputBlackoilModule.hpp>
#include <opm/simulators/flow/VtkTracerModule.hpp>
#include <opm/simulators/flow/TracerModel.hpp>
#if HAVE_DAMARIS
#include <opm/simulators/flow/DamarisWriter.hpp>
#endif
#include <tuple>
namespace Opm {
template <class TypeTag>
class FlowProblemComp;
}
namespace Opm::Properties {
namespace TTag {
struct FlowBaseProblemComp {
using InheritsFrom = std::tuple<VtkTracer, /* OutputBlackOil, */ CpGridVanguard>;
};
}
// The class which deals with wells
template<class TypeTag, class MyTypeTag>
struct WellModel {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct TracerModelDef {
using type = UndefinedProperty;
};
// The number of time steps skipped between writing two consequtive restart files
template<class TypeTag, class MyTypeTag>
struct RestartWritingInterval {
using type = UndefinedProperty;
};
// Enable partial compensation of systematic mass losses via the source term of the next time
// step
template<class TypeTag, class MyTypeTag>
struct EnableDriftCompensation {
using type = UndefinedProperty;
};
// Enable the additional checks even if compiled in debug mode (i.e., with the NDEBUG
// macro undefined). Next to a slightly better performance, this also eliminates some
// print statements in debug mode.
template<class TypeTag, class MyTypeTag>
struct EnableDebuggingChecks {
using type = UndefinedProperty;
};
// if thermal flux boundaries are enabled an effort is made to preserve the initial
// thermal gradient specified via the TEMPVD keyword
template<class TypeTag, class MyTypeTag>
struct EnableThermalFluxBoundaries {
using type = UndefinedProperty;
};
// Specify whether API tracking should be enabled (replaces PVT regions).
// TODO: This is not yet implemented
template<class TypeTag, class MyTypeTag>
struct EnableApiTracking {
using type = UndefinedProperty;
};
// The class which deals with ECL aquifers
template<class TypeTag, class MyTypeTag>
struct AquiferModel {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct OutputMode {
using type = UndefinedProperty;
};
// Parameterize equilibration accuracy
template<class TypeTag, class MyTypeTag>
struct NumPressurePointsEquil {
using type = UndefinedProperty;
};
// implicit or explicit pressure in rock compaction
template<class TypeTag, class MyTypeTag>
struct ExplicitRockCompaction {
using type = UndefinedProperty;
};
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::FlowBaseProblemComp> {
using type = FlowProblemComp<TypeTag>;
};
/* template<class TypeTag>
struct Model<TypeTag, TTag::FlowBaseProblemComp> {
using type = FIBlackOilModel<TypeTag>;
}; */
template<class TypeTag>
struct TracerModelDef<TypeTag, TTag::FlowBaseProblemComp> {
using type = ::Opm::TracerModel<TypeTag>;
};
// Select the element centered finite volume method as spatial discretization
template<class TypeTag>
struct SpatialDiscretizationSplice<TypeTag, TTag::FlowBaseProblemComp> {
using type = TTag::EcfvDiscretization;
};
// use automatic differentiation to linearize the system of PDEs
template<class TypeTag>
struct LocalLinearizerSplice<TypeTag, TTag::FlowBaseProblemComp> {
using type = TTag::AutoDiffLocalLinearizer;
};
template<class TypeTag>
struct BaseDiscretizationType<TypeTag, TTag::FlowBaseProblemComp> {
using type = FvBaseDiscretizationNoAdapt<TypeTag>;
};
template<class TypeTag>
struct DiscreteFunction<TypeTag, TTag::FlowBaseProblemComp> {
using BaseDiscretization = FvBaseDiscretization<TypeTag>;
using type = typename BaseDiscretization::BlockVectorWrapper;
};
template<class TypeTag>
struct GridView<TypeTag, TTag::FlowBaseProblemComp>
{
using type = typename GetPropType<TypeTag, Properties::Grid>::LeafGridView;
};
// Set the material law for energy storage in rock
template<class TypeTag>
struct SolidEnergyLaw<TypeTag, TTag::FlowBaseProblemComp>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
public:
using EclThermalLawManager = ::Opm::EclThermalLawManager<Scalar, FluidSystem>;
using type = typename EclThermalLawManager::SolidEnergyLaw;
};
// Set the material law for thermal conduction
template<class TypeTag>
struct ThermalConductionLaw<TypeTag, TTag::FlowBaseProblemComp>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
public:
using EclThermalLawManager = ::Opm::EclThermalLawManager<Scalar, FluidSystem>;
using type = typename EclThermalLawManager::ThermalConductionLaw;
};
// use a slightly faster stencil class because it does not need the normals and
// the integration points of intersections
template<class TypeTag>
struct Stencil<TypeTag, TTag::FlowBaseProblemComp>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
public:
using type = EcfvStencil<Scalar,
GridView,
/*needIntegrationPos=*/false,
/*needNormal=*/false>;
};
// by default use the dummy aquifer "model"
template<class TypeTag>
struct AquiferModel<TypeTag, TTag::FlowBaseProblemComp> {
using type = BaseAquiferModel<TypeTag>;
};
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Enable diffusion
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Enable dispersion
template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// only write the solutions for the report steps to disk
template<class TypeTag>
struct EnableWriteAllSolutions<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// disable API tracking
template<class TypeTag>
struct EnableApiTracking<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// The default for the end time of the simulation [s]
//
// By default, stop it after the universe will probably have stopped
// to exist. (the ECL problem will finish the simulation explicitly
// after it simulated the last episode specified in the deck.)
template<class TypeTag>
struct EndTime<TypeTag, TTag::FlowBaseProblemComp> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e100;
};
// The default for the initial time step size of the simulation [s].
//
// The chosen value means that the size of the first time step is the
// one of the initial episode (if the length of the initial episode is
// not millions of trillions of years, that is...)
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, TTag::FlowBaseProblemComp> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 3600*24;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::FlowBaseProblemComp> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-2;
};
// Disable the VTK output by default for this problem ...
template<class TypeTag>
struct EnableVtkOutput<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// ... but enable the ECL output by default
template<class TypeTag>
struct EnableEclOutput<TypeTag,TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
#ifdef HAVE_DAMARIS
//! Disable the Damaris HDF5 output by default
template<class TypeTag>
struct EnableDamarisOutput<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// If Damaris is available, write specific variable output in parallel
template<class TypeTag>
struct DamarisOutputHdfCollective<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Save the reservoir model mesh data to the HDF5 file (even if field data HDF5 output is disabled)
template<class TypeTag>
struct DamarisSaveMeshToHdf<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// Save the simulation fields (currently only PRESSURE) variables to HDF5 file
template<class TypeTag>
struct DamarisSaveToHdf<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Specify path and filename of a Python script to run on each end of iteration output
template<class TypeTag>
struct DamarisPythonScript<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "";
};
// Specifiy a Paraview Catalyst in situ visualisation script (if Paraview is enabled in Damaris)
template<class TypeTag>
struct DamarisPythonParaviewScript<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "";
};
// Specify a unique name for the Damaris simulation (used as prefix to HDF5 filenames)
template<class TypeTag>
struct DamarisSimName<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "";
};
// Specify the number of Damaris cores (dc) to create (per-node). Must divide into the remaining ranks
// equally, e.g. mpirun -np 16 ... -> (if running on one node)
// The following are allowed:
// 1 dc + 15 sim ranks
// or 2 dc + 14 sim
// or 4 dc + 12 sim
// *not* 3 dc + 13 sim ranks
template<class TypeTag>
struct DamarisDedicatedCores<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr int value = 1;
};
// Specify the number of Damaris nodes to create
template<class TypeTag>
struct DamarisDedicatedNodes<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr int value = 0;
};
// Specify a name for the Damaris shared memory file (a unique name will be created by default)
template<class TypeTag>
struct DamarisSharedMemoryName<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "" ; // default name is empty, will make unique if needed in DamarisKeywords()
};
// Specify the shared memory file size
template<class TypeTag>
struct DamarisSharedMemorySizeBytes<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr long value = 536870912; // 512 MB
};
// Specify the Damaris log level - if set to debug then log is flushed regularly
template<class TypeTag>
struct DamarisLogLevel<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "info";
};
// Specify the dask file jason file that specifies the Dask scheduler etc.
template<class TypeTag>
struct DamarisDaskFile<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "";
};
#endif
// If available, write the ECL output in a non-blocking manner
template<class TypeTag>
struct EnableAsyncEclOutput<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Write ESMRY file for fast loading of summary data
template<class TypeTag>
struct EnableEsmry<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// By default, use single precision for the ECL formated results
template<class TypeTag>
struct EclOutputDoublePrecision<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// The default location for the ECL output files
template<class TypeTag>
struct OutputDir<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = ".";
};
// the cache for intensive quantities can be used for ECL problems and also yields a
// decent speedup...
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// the cache for the storage term can also be used and also yields a decent speedup
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities
template<class TypeTag>
struct FluxModule<TypeTag, TTag::FlowBaseProblemComp> {
using type = NewTranFluxModule<TypeTag>;
};
// The frequency of writing restart (*.ers) files. This is the number of time steps
// between writing restart files
template<class TypeTag>
struct RestartWritingInterval<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr int value = 0xffffff; // disable
};
// Drift compensation is an experimental feature, i.e., systematic errors in the
// conservation quantities are only compensated for
// as default if experimental mode is enabled.
template<class TypeTag>
struct EnableDriftCompensation<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// By default, we enable the debugging checks if we're compiled in debug mode
template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
// store temperature (but do not conserve energy, as long as EnableEnergy is false)
template<class TypeTag>
struct EnableTemperature<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableMech<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// disable all extensions supported by black oil model. this should not really be
// necessary but it makes things a bit more explicit
template<class TypeTag>
struct EnablePolymer<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableSolvent<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableFoam<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableExtbo<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct EnableMICP<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// disable thermal flux boundaries by default
template<class TypeTag>
struct EnableThermalFluxBoundaries<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
// By default, simulators derived from the FlowBaseProblemComp are production simulators,
// i.e., experimental features must be explicitly enabled at compile time
template<class TypeTag>
struct EnableExperiments<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
template<class TypeTag>
struct OutputMode<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr auto value = "all";
};
// Parameterize equilibration accuracy
template<class TypeTag>
struct NumPressurePointsEquil<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue;
};
// By default, use implicit pressure in rock compaction
template<class TypeTag>
struct ExplicitRockCompaction<TypeTag, TTag::FlowBaseProblemComp> {
static constexpr bool value = false;
};
} // namespace Opm::Properties
#endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP

View File

@ -30,6 +30,7 @@
#include <opm/simulators/flow/MixingRateControls.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/material/fluidsystems/GenericOilGasFluidSystem.hpp>
#include <algorithm>
#include <limits>
@ -300,4 +301,8 @@ updateConvectiveDRsDt_(const unsigned compressedDofIdx,
template class MixingRateControls<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
// TODO: investigating whether and why we need the following
// The current MixingRateControls is based on Blackoil, the following one may not make sense anyway
template class MixingRateControls<GenericOilGasFluidSystem<double, 3>>;
} // namespace Opm