mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5612 from akva2/more_tus
Split out vtk module parameters to separate translation units
This commit is contained in:
@@ -321,7 +321,8 @@ macro (sources_hook)
|
||||
get_target_property(qm_defs QuadMath::QuadMath INTERFACE_COMPILE_DEFINITIONS)
|
||||
list(APPEND qm_defs HAVE_QUAD=1)
|
||||
get_target_property(qm_options QuadMath::QuadMath INTERFACE_COMPILE_OPTIONS)
|
||||
set_source_files_properties(opm/models/utils/parametersystem.cpp
|
||||
set_source_files_properties(opm/models/nonlinear/newtonmethodparams.cpp
|
||||
opm/models/utils/parametersystem.cpp
|
||||
opm/models/utils/simulatorutils.cpp
|
||||
PROPERTIES COMPILE_DEFINITIONS "${qm_defs}"
|
||||
COMPILE_OPTIONS "${qm_options}")
|
||||
|
||||
@@ -59,9 +59,25 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/models/blackoil/blackoilextboparams.cpp
|
||||
opm/models/blackoil/blackoilfoamparams.cpp
|
||||
opm/models/blackoil/blackoilmicpparams.cpp
|
||||
opm/models/blackoil/blackoilnewtonmethodparams.cpp
|
||||
opm/models/blackoil/blackoilpolymerparams.cpp
|
||||
opm/models/blackoil/blackoilsolventparams.cpp
|
||||
opm/models/io/vtkblackoilenergyparams.cpp
|
||||
opm/models/io/vtkblackoilmicpparams.cpp
|
||||
opm/models/io/vtkblackoilpolymerparams.cpp
|
||||
opm/models/io/vtkblackoilparams.cpp
|
||||
opm/models/io/vtkblackoilsolventparams.cpp
|
||||
opm/models/io/vtkcompositionparams.cpp
|
||||
opm/models/io/vtkdiffusionparams.cpp
|
||||
opm/models/io/vtkdiscretefractureparams.cpp
|
||||
opm/models/io/vtkenergyparams.cpp
|
||||
opm/models/io/vtkmultiphaseparams.cpp
|
||||
opm/models/io/vtkphasepresenceparams.cpp
|
||||
opm/models/io/vtkprimaryvarsparams.cpp
|
||||
opm/models/io/vtkptflashparams.cpp
|
||||
opm/models/io/vtktemperatureparams.cpp
|
||||
opm/models/io/restart.cpp
|
||||
opm/models/nonlinear/newtonmethodparams.cpp
|
||||
opm/models/parallel/mpiutil.cpp
|
||||
opm/models/parallel/tasklets.cpp
|
||||
opm/models/parallel/threadmanager.cpp
|
||||
@@ -553,8 +569,8 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/blackoil/blackoilmicpmodules.hh
|
||||
opm/models/blackoil/blackoilmicpparams.hpp
|
||||
opm/models/blackoil/blackoilmodel.hh
|
||||
opm/models/blackoil/blackoilnewtonmethod.hh
|
||||
opm/models/blackoil/blackoilnewtonmethodparameters.hh
|
||||
opm/models/blackoil/blackoilnewtonmethod.hpp
|
||||
opm/models/blackoil/blackoilnewtonmethodparams.hpp
|
||||
opm/models/blackoil/blackoilonephaseindices.hh
|
||||
opm/models/blackoil/blackoilpolymermodules.hh
|
||||
opm/models/blackoil/blackoilpolymerparams.hpp
|
||||
@@ -648,22 +664,36 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/io/simplexvanguard.hh
|
||||
opm/models/io/structuredgridvanguard.hh
|
||||
opm/models/io/unstructuredgridvanguard.hh
|
||||
opm/models/io/vtkblackoilenergymodule.hh
|
||||
opm/models/io/vtkblackoilmicpmodule.hh
|
||||
opm/models/io/vtkblackoilmodule.hh
|
||||
opm/models/io/vtkblackoilpolymermodule.hh
|
||||
opm/models/io/vtkblackoilsolventmodule.hh
|
||||
opm/models/io/vtkcompositionmodule.hh
|
||||
opm/models/io/vtkdiffusionmodule.hh
|
||||
opm/models/io/vtkdiscretefracturemodule.hh
|
||||
opm/models/io/vtkenergymodule.hh
|
||||
opm/models/io/vtkmultiphasemodule.hh
|
||||
opm/models/io/vtkblackoilenergymodule.hpp
|
||||
opm/models/io/vtkblackoilenergyparams.hpp
|
||||
opm/models/io/vtkblackoilmicpmodule.hpp
|
||||
opm/models/io/vtkblackoilmicpparams.hpp
|
||||
opm/models/io/vtkblackoilmodule.hpp
|
||||
opm/models/io/vtkblackoilparams.hpp
|
||||
opm/models/io/vtkblackoilpolymermodule.hpp
|
||||
opm/models/io/vtkblackoilpolymerparams.hpp
|
||||
opm/models/io/vtkblackoilsolventmodule.hpp
|
||||
opm/models/io/vtkblackoilsolventparams.hpp
|
||||
opm/models/io/vtkcompositionmodule.hpp
|
||||
opm/models/io/vtkcompositionparams.hpp
|
||||
opm/models/io/vtkdiffusionmodule.hpp
|
||||
opm/models/io/vtkdiffusionparams.hpp
|
||||
opm/models/io/vtkdiscretefracturemodule.hpp
|
||||
opm/models/io/vtkdiscretefractureparams.hpp
|
||||
opm/models/io/vtkenergymodule.hpp
|
||||
opm/models/io/vtkenergyparams.hpp
|
||||
opm/models/io/vtkmultiphasemodule.hpp
|
||||
opm/models/io/vtkmultiphaseparams.hpp
|
||||
opm/models/io/vtkmultiwriter.hh
|
||||
opm/models/io/vtkphasepresencemodule.hh
|
||||
opm/models/io/vtkprimaryvarsmodule.hh
|
||||
opm/models/io/vtkptflashmodule.hh
|
||||
opm/models/io/vtkphasepresencemodule.hpp
|
||||
opm/models/io/vtkphasepresenceparams.hpp
|
||||
opm/models/io/vtkprimaryvarsmodule.hpp
|
||||
opm/models/io/vtkprimaryvarsparams.hpp
|
||||
opm/models/io/vtkptflashmodule.hpp
|
||||
opm/models/io/vtkptflashparams.hpp
|
||||
opm/models/io/vtkscalarfunction.hh
|
||||
opm/models/io/vtktemperaturemodule.hh
|
||||
opm/models/io/vtktemperaturemodule.hpp
|
||||
opm/models/io/vtktemperatureparams.hpp
|
||||
opm/models/io/vtktensorfunction.hh
|
||||
opm/models/io/vtkvectorfunction.hh
|
||||
opm/models/ncp/ncpboundaryratevector.hh
|
||||
@@ -677,7 +707,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/ncp/ncpproperties.hh
|
||||
opm/models/ncp/ncpratevector.hh
|
||||
opm/models/nonlinear/newtonmethod.hh
|
||||
opm/models/nonlinear/newtonmethodparameters.hh
|
||||
opm/models/nonlinear/newtonmethodparams.hpp
|
||||
opm/models/nonlinear/newtonmethodproperties.hh
|
||||
opm/models/nonlinear/nullconvergencewriter.hh
|
||||
opm/models/parallel/gridcommhandles.hh
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include <opm/models/immiscible/immiscibleproperties.hh>
|
||||
|
||||
#include <opm/models/io/structuredgridvanguard.hh>
|
||||
#include <opm/models/io/vtkmultiphasemodule.hh>
|
||||
#include <opm/models/io/vtkmultiphasemodule.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/models/nonlinear/newtonmethodparameters.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
|
||||
#include <opm/models/utils/basicproperties.hh>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilnewtonmethod.hh>
|
||||
#include <opm/models/blackoil/blackoilnewtonmethod.hpp>
|
||||
#include <opm/models/utils/signum.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
{
|
||||
const auto& constraintsMap = this->model().linearizer().constraintsMap();
|
||||
this->lastError_ = this->error_;
|
||||
Scalar newtonMaxError = Parameters::Get<Parameters::NewtonMaxError<Scalar>>();
|
||||
Scalar newtonMaxError = this->params_.maxError_;
|
||||
|
||||
// calculate the error as the maximum weighted tolerance of
|
||||
// the solution's residual
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
|
||||
this->error_ = max(std::abs(tmpError), this->error_);
|
||||
|
||||
if (std::abs(tmpError) > this->tolerance_) {
|
||||
if (std::abs(tmpError) > this->params_.tolerance_) {
|
||||
cnvViolated = true;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
Scalar y = Parameters::Get<Parameters::EclNewtonSumToleranceExponent<Scalar>>();
|
||||
sumTolerance_ = x*std::pow(sumPv, y);
|
||||
|
||||
this->endIterMsg() << " (max: " << this->tolerance_
|
||||
this->endIterMsg() << " (max: " << this->params_.tolerance_
|
||||
<< ", violated for " << errorPvFraction_ * 100
|
||||
<< "% of the pore volume), aggegate error: "
|
||||
<< errorSum_ << " (max: " << sumTolerance_ << ")";
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define EWOMS_BLACK_OIL_ENERGY_MODULE_HH
|
||||
|
||||
#include "blackoilproperties.hh"
|
||||
#include <opm/models/io/vtkblackoilenergymodule.hh>
|
||||
#include <opm/models/io/vtkblackoilenergymodule.hpp>
|
||||
#include <opm/models/common/quantitycallbacks.hh>
|
||||
#include <opm/models/discretization/common/linearizationtype.hh>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <opm/models/blackoil/blackoilmicpparams.hpp>
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/io/vtkblackoilmicpmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilmicpmodule.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
* \copydoc Opm::BlackOilModel
|
||||
*/
|
||||
#ifndef EWOMS_BLACK_OIL_MODEL_HH
|
||||
#define EWOMS_BLACK_OIL_MODEL_HH
|
||||
#ifndef OPM_BLACK_OIL_MODEL_HPP
|
||||
#define OPM_BLACK_OIL_MODEL_HPP
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <opm/models/blackoil/blackoilintensivequantities.hh>
|
||||
#include <opm/models/blackoil/blackoillocalresidual.hh>
|
||||
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
||||
#include <opm/models/blackoil/blackoilnewtonmethod.hh>
|
||||
#include <opm/models/blackoil/blackoilnewtonmethod.hpp>
|
||||
#include <opm/models/blackoil/blackoilpolymermodules.hh>
|
||||
#include <opm/models/blackoil/blackoilprimaryvariables.hh>
|
||||
#include <opm/models/blackoil/blackoilproblem.hh>
|
||||
@@ -55,9 +55,9 @@
|
||||
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
|
||||
#include <opm/models/io/vtkblackoilmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilmodule.hpp>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -606,7 +606,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Scalar> eqWeights_;
|
||||
Implementation& asImp_()
|
||||
{ return *static_cast<Implementation*>(this); }
|
||||
@@ -623,6 +622,7 @@ private:
|
||||
priVars.setPvtRegionIndex(regionIdx);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_BLACK_OIL_MODEL_HPP
|
||||
|
||||
@@ -25,17 +25,18 @@
|
||||
*
|
||||
* \copydoc Opm::BlackOilNewtonMethod
|
||||
*/
|
||||
#ifndef EWOMS_BLACK_OIL_NEWTON_METHOD_HH
|
||||
#define EWOMS_BLACK_OIL_NEWTON_METHOD_HH
|
||||
|
||||
#include <opm/models/blackoil/blackoilnewtonmethodparameters.hh>
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
#ifndef OPM_BLACK_OIL_NEWTON_METHOD_HPP
|
||||
#define OPM_BLACK_OIL_NEWTON_METHOD_HPP
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/utils/signum.hh>
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
#include <opm/models/blackoil/blackoilmicpmodules.hh>
|
||||
#include <opm/models/blackoil/blackoilnewtonmethodparams.hpp>
|
||||
|
||||
#include <opm/models/nonlinear/newtonmethod.hh>
|
||||
#include "blackoilmicpmodules.hh"
|
||||
|
||||
#include <opm/models/utils/signum.hh>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
@@ -72,17 +73,7 @@ class BlackOilNewtonMethod : public GetPropType<TypeTag, Properties::DiscNewtonM
|
||||
public:
|
||||
BlackOilNewtonMethod(Simulator& simulator) : ParentType(simulator)
|
||||
{
|
||||
priVarOscilationThreshold_ = Parameters::Get<Parameters::PriVarOscilationThreshold<Scalar>>();
|
||||
dpMaxRel_ = Parameters::Get<Parameters::DpMaxRel<Scalar>>();
|
||||
dsMax_ = Parameters::Get<Parameters::DsMax<Scalar>>();
|
||||
projectSaturations_ = Parameters::Get<Parameters::ProjectSaturations>();
|
||||
maxTempChange_ = Parameters::Get<Parameters::MaxTemperatureChange<Scalar>>();
|
||||
tempMax_ = Parameters::Get<Parameters::TemperatureMax<Scalar>>();
|
||||
tempMin_ = Parameters::Get<Parameters::TemperatureMin<Scalar>>();
|
||||
pressMax_ = Parameters::Get<Parameters::PressureMax<Scalar>>();
|
||||
pressMin_ = Parameters::Get<Parameters::PressureMin<Scalar>>();
|
||||
waterSaturationMax_ = Parameters::Get<Parameters::MaximumWaterSaturation<Scalar>>();
|
||||
waterOnlyThreshold_ = Parameters::Get<Parameters::WaterOnlyThreshold<Scalar>>();
|
||||
bparams_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -92,40 +83,16 @@ public:
|
||||
{
|
||||
ParentType::finishInit();
|
||||
|
||||
wasSwitched_.resize(this->model().numTotalDof());
|
||||
std::fill(wasSwitched_.begin(), wasSwitched_.end(), false);
|
||||
wasSwitched_.resize(this->model().numTotalDof(), false);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the immiscible model.
|
||||
* \brief Register all run-time parameters for the blackoil newton method.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
ParentType::registerParameters();
|
||||
|
||||
Parameters::Register<Parameters::DpMaxRel<Scalar>>
|
||||
("Maximum relative change of pressure in a single iteration");
|
||||
Parameters::Register<Parameters::DsMax<Scalar>>
|
||||
("Maximum absolute change of any saturation in a single iteration");
|
||||
Parameters::Register<Parameters::PriVarOscilationThreshold<Scalar>>
|
||||
("The threshold value for the primary variable switching conditions "
|
||||
"after its meaning has switched to hinder oscilations");
|
||||
Parameters::Register<Parameters::ProjectSaturations>
|
||||
("Option for doing saturation projection");
|
||||
Parameters::Register<Parameters::MaxTemperatureChange<Scalar>>
|
||||
("Maximum absolute change of temperature in a single iteration");
|
||||
Parameters::Register<Parameters::TemperatureMax<Scalar>>
|
||||
("Maximum absolute temperature");
|
||||
Parameters::Register<Parameters::TemperatureMin<Scalar>>
|
||||
("Minimum absolute temperature");
|
||||
Parameters::Register<Parameters::PressureMax<Scalar>>
|
||||
("Maximum absolute pressure");
|
||||
Parameters::Register<Parameters::PressureMin<Scalar>>
|
||||
("Minimum absolute pressure");
|
||||
Parameters::Register<Parameters::MaximumWaterSaturation<Scalar>>
|
||||
("Maximum water saturation");
|
||||
Parameters::Register<Parameters::WaterOnlyThreshold<Scalar>>
|
||||
("Cells with water saturation above or equal is considered one-phase water only");
|
||||
BlackoilNewtonParams<Scalar>::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -193,8 +160,9 @@ public:
|
||||
}
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
if (!succeeded) {
|
||||
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
||||
}
|
||||
|
||||
numPriVarsSwitched_ = comm.sum(numPriVarsSwitched_);
|
||||
}
|
||||
@@ -271,8 +239,9 @@ protected:
|
||||
// scaling factor for saturation deltas to make sure that none of them exceeds
|
||||
// the specified threshold value.
|
||||
Scalar satAlpha = 1.0;
|
||||
if (maxSatDelta > dsMax_)
|
||||
satAlpha = dsMax_/maxSatDelta;
|
||||
if (maxSatDelta > bparams_.dsMax_) {
|
||||
satAlpha = bparams_.dsMax_ / maxSatDelta;
|
||||
}
|
||||
|
||||
for (int pvIdx = 0; pvIdx < int(numEq); ++pvIdx) {
|
||||
// calculate the update of the current primary variable. For the black-oil
|
||||
@@ -285,26 +254,30 @@ protected:
|
||||
|
||||
// limit pressure delta
|
||||
if (pvIdx == Indices::pressureSwitchIdx) {
|
||||
if (std::abs(delta) > dpMaxRel_*currentValue[pvIdx])
|
||||
delta = signum(delta)*dpMaxRel_*currentValue[pvIdx];
|
||||
if (std::abs(delta) > bparams_.dpMaxRel_ * currentValue[pvIdx]) {
|
||||
delta = signum(delta) * bparams_.dpMaxRel_ * currentValue[pvIdx];
|
||||
}
|
||||
}
|
||||
// water saturation delta
|
||||
else if (pvIdx == Indices::waterSwitchIdx)
|
||||
if (currentValue.primaryVarsMeaningWater() == PrimaryVariables::WaterMeaning::Sw)
|
||||
if (currentValue.primaryVarsMeaningWater() == PrimaryVariables::WaterMeaning::Sw) {
|
||||
delta *= satAlpha;
|
||||
}
|
||||
else {
|
||||
//Ensure Rvw and Rsw factor does not become negative
|
||||
if (delta > currentValue[ Indices::waterSwitchIdx])
|
||||
if (delta > currentValue[ Indices::waterSwitchIdx]) {
|
||||
delta = currentValue[ Indices::waterSwitchIdx];
|
||||
}
|
||||
}
|
||||
else if (pvIdx == Indices::compositionSwitchIdx) {
|
||||
// the switching primary variable for composition is tricky because the
|
||||
// "reasonable" value ranges it exhibits vary widely depending on its
|
||||
// interpretation since it can represent Sg, Rs or Rv. For now, we only
|
||||
// limit saturation deltas and ensure that the R factors do not become
|
||||
// negative.
|
||||
if (currentValue.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Sg)
|
||||
if (currentValue.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Sg) {
|
||||
delta *= satAlpha;
|
||||
}
|
||||
else {
|
||||
//Ensure Rv and Rs factor does not become negative
|
||||
if (delta > currentValue[Indices::compositionSwitchIdx])
|
||||
@@ -336,7 +309,7 @@ protected:
|
||||
}
|
||||
else if (enableEnergy && pvIdx == Indices::temperatureIdx) {
|
||||
const double sign = delta >= 0. ? 1. : -1.;
|
||||
delta = sign * std::min(std::abs(delta), maxTempChange_);
|
||||
delta = sign * std::min(std::abs(delta), bparams_.maxTempChange_);
|
||||
}
|
||||
else if (enableBrine && pvIdx == Indices::saltConcentrationIdx &&
|
||||
enableSaltPrecipitation &&
|
||||
@@ -351,44 +324,52 @@ protected:
|
||||
|
||||
// keep the solvent saturation between 0 and 1
|
||||
if (enableSolvent && pvIdx == Indices::solventSaturationIdx) {
|
||||
if (currentValue.primaryVarsMeaningSolvent() == PrimaryVariables::SolventMeaning::Ss )
|
||||
if (currentValue.primaryVarsMeaningSolvent() == PrimaryVariables::SolventMeaning::Ss) {
|
||||
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
||||
}
|
||||
}
|
||||
|
||||
// keep the z fraction between 0 and 1
|
||||
if (enableExtbo && pvIdx == Indices::zFractionIdx)
|
||||
if (enableExtbo && pvIdx == Indices::zFractionIdx) {
|
||||
nextValue[pvIdx] = std::min(std::max(nextValue[pvIdx], Scalar{0.0}), Scalar{1.0});
|
||||
}
|
||||
|
||||
// keep the polymer concentration above 0
|
||||
if (enablePolymer && pvIdx == Indices::polymerConcentrationIdx)
|
||||
if (enablePolymer && pvIdx == Indices::polymerConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||
}
|
||||
|
||||
if (enablePolymerWeight && pvIdx == Indices::polymerMoleWeightIdx) {
|
||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||
const double polymerConcentration = nextValue[Indices::polymerConcentrationIdx];
|
||||
if (polymerConcentration < 1.e-10)
|
||||
if (polymerConcentration < 1.e-10) {
|
||||
nextValue[pvIdx] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// keep the foam concentration above 0
|
||||
if (enableFoam && pvIdx == Indices::foamConcentrationIdx)
|
||||
if (enableFoam && pvIdx == Indices::foamConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||
}
|
||||
|
||||
if (enableBrine && pvIdx == Indices::saltConcentrationIdx) {
|
||||
// keep the salt concentration above 0
|
||||
if (!enableSaltPrecipitation || (enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Cs))
|
||||
if (!enableSaltPrecipitation || (enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Cs)) {
|
||||
nextValue[pvIdx] = std::max(nextValue[pvIdx], Scalar{0.0});
|
||||
}
|
||||
// keep the salt saturation below upperlimit
|
||||
if ((enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Sp))
|
||||
if ((enableSaltPrecipitation && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::BrineMeaning::Sp)) {
|
||||
nextValue[pvIdx] = std::min(nextValue[pvIdx], Scalar{1.0-1.e-8});
|
||||
}
|
||||
}
|
||||
|
||||
// keep the temperature within given values
|
||||
if (enableEnergy && pvIdx == Indices::temperatureIdx)
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], tempMin_, tempMax_);
|
||||
if (enableEnergy && pvIdx == Indices::temperatureIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], bparams_.tempMin_, bparams_.tempMax_);
|
||||
}
|
||||
|
||||
if (pvIdx == Indices::pressureSwitchIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], pressMin_, pressMax_);
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], bparams_.pressMin_, bparams_.pressMax_);
|
||||
}
|
||||
|
||||
|
||||
@@ -397,29 +378,44 @@ protected:
|
||||
// For the oxygen and urea we set this value to the maximum injected
|
||||
// concentration (the urea concentration has been scaled by 10). For
|
||||
// the biofilm and calcite, we set this value equal to the porosity minus the clogging tolerance.
|
||||
if (enableMICP && pvIdx == Indices::microbialConcentrationIdx)
|
||||
if (enableMICP && pvIdx == Indices::microbialConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::densityBiofilm());
|
||||
if (enableMICP && pvIdx == Indices::oxygenConcentrationIdx)
|
||||
}
|
||||
if (enableMICP && pvIdx == Indices::oxygenConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumOxygenConcentration());
|
||||
if (enableMICP && pvIdx == Indices::ureaConcentrationIdx)
|
||||
}
|
||||
if (enableMICP && pvIdx == Indices::ureaConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::maximumUreaConcentration());
|
||||
if (enableMICP && pvIdx == Indices::biofilmConcentrationIdx)
|
||||
}
|
||||
if (enableMICP && pvIdx == Indices::biofilmConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
||||
if (enableMICP && pvIdx == Indices::calciteConcentrationIdx)
|
||||
}
|
||||
if (enableMICP && pvIdx == Indices::calciteConcentrationIdx) {
|
||||
nextValue[pvIdx] = std::clamp(nextValue[pvIdx], Scalar{0.0}, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging());
|
||||
}
|
||||
}
|
||||
|
||||
// switch the new primary variables to something which is physically meaningful.
|
||||
// use a threshold value after a switch to make it harder to switch back
|
||||
// immediately.
|
||||
if (wasSwitched_[globalDofIdx])
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx, waterSaturationMax_, waterOnlyThreshold_, priVarOscilationThreshold_);
|
||||
else
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(), globalDofIdx, waterSaturationMax_, waterOnlyThreshold_);
|
||||
if (wasSwitched_[globalDofIdx]) {
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(),
|
||||
globalDofIdx,
|
||||
bparams_.waterSaturationMax_,
|
||||
bparams_.waterOnlyThreshold_,
|
||||
bparams_.priVarOscilationThreshold_);
|
||||
}
|
||||
else {
|
||||
wasSwitched_[globalDofIdx] = nextValue.adaptPrimaryVariables(this->problem(),
|
||||
globalDofIdx,
|
||||
bparams_.waterSaturationMax_,
|
||||
bparams_.waterOnlyThreshold_);
|
||||
}
|
||||
|
||||
if (wasSwitched_[globalDofIdx])
|
||||
if (wasSwitched_[globalDofIdx]) {
|
||||
++numPriVarsSwitched_;
|
||||
if(projectSaturations_){
|
||||
}
|
||||
if (bparams_.projectSaturations_) {
|
||||
nextValue.chopAndNormalizeSaturations();
|
||||
}
|
||||
|
||||
@@ -427,26 +423,15 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
int numPriVarsSwitched_;
|
||||
int numPriVarsSwitched_{};
|
||||
|
||||
Scalar priVarOscilationThreshold_;
|
||||
Scalar waterSaturationMax_;
|
||||
Scalar waterOnlyThreshold_;
|
||||
|
||||
Scalar dpMaxRel_;
|
||||
Scalar dsMax_;
|
||||
bool projectSaturations_;
|
||||
Scalar maxTempChange_;
|
||||
Scalar tempMax_;
|
||||
Scalar tempMin_;
|
||||
Scalar pressMax_;
|
||||
Scalar pressMin_;
|
||||
BlackoilNewtonParams<Scalar> bparams_{};
|
||||
|
||||
// keep track of cells where the primary variable meaning has changed
|
||||
// to detect and hinder oscillations
|
||||
std::vector<bool> wasSwitched_;
|
||||
std::vector<bool> wasSwitched_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_BLACK_OIL_NEWTHON_METHOD_HPP
|
||||
81
opm/models/blackoil/blackoilnewtonmethodparams.cpp
Normal file
81
opm/models/blackoil/blackoilnewtonmethodparams.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/blackoil/blackoilnewtonmethodparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
void BlackoilNewtonParams<Scalar>::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::DpMaxRel<Scalar>>
|
||||
("Maximum relative change of pressure in a single iteration");
|
||||
Parameters::Register<Parameters::DsMax<Scalar>>
|
||||
("Maximum absolute change of any saturation in a single iteration");
|
||||
Parameters::Register<Parameters::PriVarOscilationThreshold<Scalar>>
|
||||
("The threshold value for the primary variable switching conditions "
|
||||
"after its meaning has switched to hinder oscillations");
|
||||
Parameters::Register<Parameters::ProjectSaturations>
|
||||
("Option for doing saturation projection");
|
||||
Parameters::Register<Parameters::MaxTemperatureChange<Scalar>>
|
||||
("Maximum absolute change of temperature in a single iteration");
|
||||
Parameters::Register<Parameters::TemperatureMax<Scalar>>
|
||||
("Maximum absolute temperature");
|
||||
Parameters::Register<Parameters::TemperatureMin<Scalar>>
|
||||
("Minimum absolute temperature");
|
||||
Parameters::Register<Parameters::PressureMax<Scalar>>
|
||||
("Maximum absolute pressure");
|
||||
Parameters::Register<Parameters::PressureMin<Scalar>>
|
||||
("Minimum absolute pressure");
|
||||
Parameters::Register<Parameters::MaximumWaterSaturation<Scalar>>
|
||||
("Maximum water saturation");
|
||||
Parameters::Register<Parameters::WaterOnlyThreshold<Scalar>>
|
||||
("Cells with water saturation above or equal is considered one-phase water only");
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void BlackoilNewtonParams<Scalar>::read()
|
||||
{
|
||||
priVarOscilationThreshold_ = Parameters::Get<Parameters::PriVarOscilationThreshold<Scalar>>();
|
||||
dpMaxRel_ = Parameters::Get<Parameters::DpMaxRel<Scalar>>();
|
||||
dsMax_ = Parameters::Get<Parameters::DsMax<Scalar>>();
|
||||
projectSaturations_ = Parameters::Get<Parameters::ProjectSaturations>();
|
||||
maxTempChange_ = Parameters::Get<Parameters::MaxTemperatureChange<Scalar>>();
|
||||
tempMax_ = Parameters::Get<Parameters::TemperatureMax<Scalar>>();
|
||||
tempMin_ = Parameters::Get<Parameters::TemperatureMin<Scalar>>();
|
||||
pressMax_ = Parameters::Get<Parameters::PressureMax<Scalar>>();
|
||||
pressMin_ = Parameters::Get<Parameters::PressureMin<Scalar>>();
|
||||
waterSaturationMax_ = Parameters::Get<Parameters::MaximumWaterSaturation<Scalar>>();
|
||||
waterOnlyThreshold_ = Parameters::Get<Parameters::WaterOnlyThreshold<Scalar>>();
|
||||
}
|
||||
|
||||
template struct BlackoilNewtonParams<double>;
|
||||
|
||||
#if FLOW_INSTANTIATE_FLOAT
|
||||
template struct BlackoilNewtonParams<float>;
|
||||
#endif
|
||||
|
||||
} // namespace Opm
|
||||
@@ -64,4 +64,34 @@ struct WaterOnlyThreshold { static constexpr Scalar value = 1.0; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for BlackoilNewtonMethod.
|
||||
*/
|
||||
template<class Scalar>
|
||||
struct BlackoilNewtonParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
Scalar priVarOscilationThreshold_;
|
||||
Scalar waterSaturationMax_;
|
||||
Scalar waterOnlyThreshold_;
|
||||
|
||||
Scalar dpMaxRel_;
|
||||
Scalar dsMax_;
|
||||
bool projectSaturations_;
|
||||
Scalar maxTempChange_;
|
||||
Scalar tempMax_;
|
||||
Scalar tempMin_;
|
||||
Scalar pressMax_;
|
||||
Scalar pressMin_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <opm/models/blackoil/blackoilpolymerparams.hpp>
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/io/vtkblackoilpolymermodule.hh>
|
||||
#include <opm/models/io/vtkblackoilpolymermodule.hpp>
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <opm/models/common/multiphasebaseparameters.hh>
|
||||
#include <opm/models/common/quantitycallbacks.hh>
|
||||
|
||||
#include <opm/models/io/vtkblackoilsolventmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilsolventmodule.hpp>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
|
||||
#include <opm/models/discretization/vcfv/vcfvdiscretization.hh>
|
||||
|
||||
#include <opm/models/io/vtkmultiphasemodule.hh>
|
||||
#include <opm/models/io/vtktemperaturemodule.hh>
|
||||
#include <opm/models/io/vtkmultiphasemodule.hpp>
|
||||
#include <opm/models/io/vtktemperaturemodule.hpp>
|
||||
|
||||
namespace Opm {
|
||||
template <class TypeTag>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "discretefractureproblem.hh"
|
||||
|
||||
#include <opm/models/immiscible/immisciblemodel.hh>
|
||||
#include <opm/models/io/vtkdiscretefracturemodule.hh>
|
||||
#include <opm/models/io/vtkdiscretefracturemodule.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <opm/models/immiscible/immiscibleproperties.hh>
|
||||
|
||||
#include <opm/models/io/vtkdiscretefracturemodule.hh>
|
||||
#include <opm/models/io/vtkdiscretefracturemodule.hpp>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
#include <opm/models/discretization/common/fvbaseprimaryvariables.hh>
|
||||
|
||||
#include <opm/models/io/vtkprimaryvarsmodule.hh>
|
||||
#include <opm/models/io/vtkprimaryvarsmodule.hpp>
|
||||
|
||||
#include <opm/models/parallel/gridcommhandles.hh>
|
||||
#include <opm/models/parallel/threadmanager.hpp>
|
||||
@@ -68,7 +68,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
#include <opm/models/flash/flashproperties.hh>
|
||||
#include <opm/models/flash/flashratevector.hh>
|
||||
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
#include <opm/material/components/NullComponent.hpp>
|
||||
#include <opm/material/fluidsystems/GasPhase.hpp>
|
||||
#include <opm/material/fluidsystems/LiquidPhase.hpp>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define EWOMS_IMMISCIBLE_PROPERTIES_HH
|
||||
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
// -*- 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::VtkBlackOilEnergyModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_BLACK_OIL_ENERGY_MODULE_HH
|
||||
#define EWOMS_VTK_BLACK_OIL_ENERGY_MODULE_HH
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteRockInternalEnergy { static constexpr bool value = true; };
|
||||
struct VtkWriteTotalThermalConductivity { static constexpr bool value = true; };
|
||||
struct VtkWriteFluidInternalEnergies { static constexpr bool value = true; };
|
||||
struct VtkWriteFluidEnthalpies { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's energy related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilEnergyModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
|
||||
enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
using PhaseBuffer = typename ParentType::PhaseBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilEnergyModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if (!enableEnergy)
|
||||
return;
|
||||
|
||||
Parameters::Register<Parameters::VtkWriteRockInternalEnergy>
|
||||
("Include the volumetric internal energy of rock "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalThermalConductivity>
|
||||
("Include the total thermal conductivity of the medium and the fluids "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFluidInternalEnergies>
|
||||
("Include the internal energies of the fluids in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFluidEnthalpies>
|
||||
("Include the enthalpies of the fluids in the VTK output files");
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableEnergy)
|
||||
return;
|
||||
|
||||
if (rockInternalEnergyOutput_())
|
||||
this->resizeScalarBuffer_(rockInternalEnergy_);
|
||||
if (totalThermalConductivityOutput_())
|
||||
this->resizeScalarBuffer_(totalThermalConductivity_);
|
||||
if (fluidInternalEnergiesOutput_())
|
||||
this->resizePhaseBuffer_(fluidInternalEnergies_);
|
||||
if (fluidEnthalpiesOutput_())
|
||||
this->resizePhaseBuffer_(fluidEnthalpies_);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableEnergy)
|
||||
return;
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (rockInternalEnergyOutput_())
|
||||
rockInternalEnergy_[globalDofIdx] =
|
||||
scalarValue(intQuants.rockInternalEnergy());
|
||||
|
||||
if (totalThermalConductivityOutput_())
|
||||
totalThermalConductivity_[globalDofIdx] =
|
||||
scalarValue(intQuants.totalThermalConductivity());
|
||||
|
||||
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
if (FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
if (fluidInternalEnergiesOutput_())
|
||||
fluidInternalEnergies_[phaseIdx][globalDofIdx] =
|
||||
scalarValue(intQuants.fluidState().internalEnergy(phaseIdx));
|
||||
|
||||
if (fluidEnthalpiesOutput_())
|
||||
fluidEnthalpies_[phaseIdx][globalDofIdx] =
|
||||
scalarValue(intQuants.fluidState().enthalpy(phaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
return;
|
||||
|
||||
if (!enableEnergy)
|
||||
return;
|
||||
|
||||
if (rockInternalEnergyOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "volumetric internal energy rock", rockInternalEnergy_);
|
||||
|
||||
if (totalThermalConductivityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "total thermal conductivity", totalThermalConductivity_);
|
||||
|
||||
if (fluidInternalEnergiesOutput_())
|
||||
this->commitPhaseBuffer_(baseWriter, "internal energy_%s", fluidInternalEnergies_);
|
||||
|
||||
if (fluidEnthalpiesOutput_())
|
||||
this->commitPhaseBuffer_(baseWriter, "enthalpy_%s", fluidEnthalpies_);
|
||||
}
|
||||
|
||||
private:
|
||||
static bool rockInternalEnergyOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteRockInternalEnergy>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool totalThermalConductivityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteTotalThermalConductivity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool fluidInternalEnergiesOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFluidInternalEnergies>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool fluidEnthalpiesOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFluidEnthalpies>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer rockInternalEnergy_;
|
||||
ScalarBuffer totalThermalConductivity_;
|
||||
PhaseBuffer fluidInternalEnergies_;
|
||||
PhaseBuffer fluidEnthalpies_;
|
||||
};
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
201
opm/models/io/vtkblackoilenergymodule.hpp
Normal file
201
opm/models/io/vtkblackoilenergymodule.hpp
Normal file
@@ -0,0 +1,201 @@
|
||||
// -*- 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::VtkBlackOilEnergyModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_ENERGY_MODULE_HPP
|
||||
#define OPM_VTK_BLACK_OIL_ENERGY_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilenergyparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's energy related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilEnergyModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
|
||||
enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
using PhaseBuffer = typename ParentType::PhaseBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilEnergyModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
if constexpr (enableEnergy) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if constexpr (enableEnergy) {
|
||||
VtkBlackoilEnergyParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if constexpr (enableEnergy) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.rockInternalEnergyOutput_) {
|
||||
this->resizeScalarBuffer_(rockInternalEnergy_);
|
||||
}
|
||||
if (params_.totalThermalConductivityOutput_) {
|
||||
this->resizeScalarBuffer_(totalThermalConductivity_);
|
||||
}
|
||||
if (params_.fluidInternalEnergiesOutput_) {
|
||||
this->resizePhaseBuffer_(fluidInternalEnergies_);
|
||||
}
|
||||
if (params_.fluidEnthalpiesOutput_) {
|
||||
this->resizePhaseBuffer_(fluidEnthalpies_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if constexpr (enableEnergy) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (params_.rockInternalEnergyOutput_) {
|
||||
rockInternalEnergy_[globalDofIdx] =
|
||||
scalarValue(intQuants.rockInternalEnergy());
|
||||
}
|
||||
|
||||
if (params_.totalThermalConductivityOutput_) {
|
||||
totalThermalConductivity_[globalDofIdx] =
|
||||
scalarValue(intQuants.totalThermalConductivity());
|
||||
}
|
||||
|
||||
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
if (FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
if (params_.fluidInternalEnergiesOutput_) {
|
||||
fluidInternalEnergies_[phaseIdx][globalDofIdx] =
|
||||
scalarValue(intQuants.fluidState().internalEnergy(phaseIdx));
|
||||
}
|
||||
|
||||
if (params_.fluidEnthalpiesOutput_) {
|
||||
fluidEnthalpies_[phaseIdx][globalDofIdx] =
|
||||
scalarValue(intQuants.fluidState().enthalpy(phaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
if constexpr (enableEnergy) {
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.rockInternalEnergyOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "volumetric internal energy rock", rockInternalEnergy_);
|
||||
}
|
||||
|
||||
if (params_.totalThermalConductivityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "total thermal conductivity", totalThermalConductivity_);
|
||||
}
|
||||
|
||||
if (params_.fluidInternalEnergiesOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "internal energy_%s", fluidInternalEnergies_);
|
||||
}
|
||||
|
||||
if (params_.fluidEnthalpiesOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "enthalpy_%s", fluidEnthalpies_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VtkBlackoilEnergyParams params_{};
|
||||
|
||||
ScalarBuffer rockInternalEnergy_{};
|
||||
ScalarBuffer totalThermalConductivity_{};
|
||||
PhaseBuffer fluidInternalEnergies_{};
|
||||
PhaseBuffer fluidEnthalpies_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACKOIL_ENERGY_MODULE_HPP
|
||||
53
opm/models/io/vtkblackoilenergyparams.cpp
Normal file
53
opm/models/io/vtkblackoilenergyparams.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkblackoilenergyparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkBlackoilEnergyParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteRockInternalEnergy>
|
||||
("Include the volumetric internal energy of rock "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalThermalConductivity>
|
||||
("Include the total thermal conductivity of the medium and the fluids "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFluidInternalEnergies>
|
||||
("Include the internal energies of the fluids in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFluidEnthalpies>
|
||||
("Include the enthalpies of the fluids in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkBlackoilEnergyParams::read()
|
||||
{
|
||||
rockInternalEnergyOutput_ = Parameters::Get<Parameters::VtkWriteRockInternalEnergy>();
|
||||
totalThermalConductivityOutput_ = Parameters::Get<Parameters::VtkWriteTotalThermalConductivity>();
|
||||
fluidInternalEnergiesOutput_ = Parameters::Get<Parameters::VtkWriteFluidInternalEnergies>();
|
||||
fluidEnthalpiesOutput_ = Parameters::Get<Parameters::VtkWriteFluidEnthalpies>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
61
opm/models/io/vtkblackoilenergyparams.hpp
Normal file
61
opm/models/io/vtkblackoilenergyparams.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// -*- 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::VtkBlackOilEnergyModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_ENERGY_PARAMS_HPP
|
||||
#define OPM_VTK_BLACK_OIL_ENERGY_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteRockInternalEnergy { static constexpr bool value = true; };
|
||||
struct VtkWriteTotalThermalConductivity { static constexpr bool value = true; };
|
||||
struct VtkWriteFluidInternalEnergies { static constexpr bool value = true; };
|
||||
struct VtkWriteFluidEnthalpies { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkBlackoilEnergyOutputModule.
|
||||
*/
|
||||
struct VtkBlackoilEnergyParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool rockInternalEnergyOutput_;
|
||||
bool totalThermalConductivityOutput_;
|
||||
bool fluidInternalEnergiesOutput_;
|
||||
bool fluidEnthalpiesOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACKOIL_ENERGY_PARAMS_HPP
|
||||
@@ -1,242 +0,0 @@
|
||||
// -*- 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::VtkBlackOilMICPModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_BLACK_OIL_MICP_MODULE_HH
|
||||
#define EWOMS_VTK_BLACK_OIL_MICP_MODULE_HH
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteMicrobialConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteOxygenConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteUreaConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteBiofilmConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteCalciteConcentration { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the MICP model's related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilMICPModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableMICP = getPropValue<TypeTag, Properties::EnableMICP>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilMICPModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if (!enableMICP)
|
||||
return;
|
||||
|
||||
Parameters::Register<Parameters::VtkWriteMicrobialConcentration>
|
||||
("Include the concentration of the microbial component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOxygenConcentration>
|
||||
("Include the concentration of the oxygen component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteUreaConcentration>
|
||||
("Include the concentration of the urea component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteBiofilmConcentration>
|
||||
("Include the biofilm volume fraction in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteCalciteConcentration>
|
||||
("Include the calcite volume fraction in the VTK output files");
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableMICP)
|
||||
return;
|
||||
|
||||
if (microbialConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(microbialConcentration_);
|
||||
if (oxygenConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(oxygenConcentration_);
|
||||
if (ureaConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(ureaConcentration_);
|
||||
if (biofilmConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(biofilmConcentration_);
|
||||
if (calciteConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(calciteConcentration_);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableMICP)
|
||||
return;
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (microbialConcentrationOutput_())
|
||||
microbialConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.microbialConcentration());
|
||||
|
||||
if (oxygenConcentrationOutput_())
|
||||
oxygenConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.oxygenConcentration());
|
||||
|
||||
if (ureaConcentrationOutput_())
|
||||
ureaConcentration_[globalDofIdx] =
|
||||
10 * scalarValue(intQuants.ureaConcentration());//Multypliging by scaling factor 10 (see WellInterface_impl.hpp)
|
||||
|
||||
if (biofilmConcentrationOutput_())
|
||||
biofilmConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.biofilmConcentration());
|
||||
|
||||
if (calciteConcentrationOutput_())
|
||||
calciteConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.calciteConcentration());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
return;
|
||||
|
||||
if (!enableMICP)
|
||||
return;
|
||||
|
||||
if (microbialConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "microbial concentration", microbialConcentration_);
|
||||
|
||||
if (oxygenConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "oxygen concentration", oxygenConcentration_);
|
||||
|
||||
if (ureaConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "urea concentration", ureaConcentration_);
|
||||
|
||||
if (biofilmConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "biofilm fraction", biofilmConcentration_);
|
||||
|
||||
if (calciteConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "calcite fraction", calciteConcentration_);
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
static bool microbialConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteMicrobialConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool oxygenConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteOxygenConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool ureaConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteUreaConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool biofilmConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteBiofilmConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool calciteConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteCalciteConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer microbialConcentration_;
|
||||
ScalarBuffer oxygenConcentration_;
|
||||
ScalarBuffer ureaConcentration_;
|
||||
ScalarBuffer biofilmConcentration_;
|
||||
ScalarBuffer calciteConcentration_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
205
opm/models/io/vtkblackoilmicpmodule.hpp
Normal file
205
opm/models/io/vtkblackoilmicpmodule.hpp
Normal file
@@ -0,0 +1,205 @@
|
||||
// -*- 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::VtkBlackOilMICPModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_MICP_MODULE_HPP
|
||||
#define OPM_VTK_BLACK_OIL_MICP_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilmicpparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the MICP model's related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilMICPModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableMICP = getPropValue<TypeTag, Properties::EnableMICP>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilMICPModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
if constexpr (enableMICP) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if constexpr (enableMICP) {
|
||||
VtkBlackoilMICPParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if constexpr (enableMICP) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.microbialConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(microbialConcentration_);
|
||||
}
|
||||
if (params_.oxygenConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(oxygenConcentration_);
|
||||
}
|
||||
if (params_.ureaConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(ureaConcentration_);
|
||||
}
|
||||
if (params_.biofilmConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(biofilmConcentration_);
|
||||
}
|
||||
if (params_.calciteConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(calciteConcentration_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if constexpr (enableMICP) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (params_.microbialConcentrationOutput_) {
|
||||
microbialConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.microbialConcentration());
|
||||
}
|
||||
|
||||
if (params_.oxygenConcentrationOutput_) {
|
||||
oxygenConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.oxygenConcentration());
|
||||
}
|
||||
|
||||
if (params_.ureaConcentrationOutput_) {
|
||||
ureaConcentration_[globalDofIdx] =
|
||||
10 * scalarValue(intQuants.ureaConcentration());//Multypliging by scaling factor 10 (see WellInterface_impl.hpp)
|
||||
}
|
||||
|
||||
if (params_.biofilmConcentrationOutput_) {
|
||||
biofilmConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.biofilmConcentration());
|
||||
}
|
||||
|
||||
if (params_.calciteConcentrationOutput_) {
|
||||
calciteConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.calciteConcentration());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
if constexpr (enableMICP) {
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.microbialConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "microbial concentration", microbialConcentration_);
|
||||
}
|
||||
|
||||
if (params_.oxygenConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "oxygen concentration", oxygenConcentration_);
|
||||
}
|
||||
|
||||
if (params_.ureaConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "urea concentration", ureaConcentration_);
|
||||
}
|
||||
|
||||
if (params_.biofilmConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "biofilm fraction", biofilmConcentration_);
|
||||
}
|
||||
|
||||
if (params_.calciteConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "calcite fraction", calciteConcentration_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VtkBlackoilMICPParams params_{};
|
||||
ScalarBuffer microbialConcentration_{};
|
||||
ScalarBuffer oxygenConcentration_{};
|
||||
ScalarBuffer ureaConcentration_{};
|
||||
ScalarBuffer biofilmConcentration_{};
|
||||
ScalarBuffer calciteConcentration_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACKOIL_MICP_MODULE_HPP
|
||||
57
opm/models/io/vtkblackoilmicpparams.cpp
Normal file
57
opm/models/io/vtkblackoilmicpparams.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkblackoilmicpparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkBlackoilMICPParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteMicrobialConcentration>
|
||||
("Include the concentration of the microbial component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOxygenConcentration>
|
||||
("Include the concentration of the oxygen component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteUreaConcentration>
|
||||
("Include the concentration of the urea component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteBiofilmConcentration>
|
||||
("Include the biofilm volume fraction in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteCalciteConcentration>
|
||||
("Include the calcite volume fraction in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkBlackoilMICPParams::read()
|
||||
{
|
||||
microbialConcentrationOutput_ = Parameters::Get<Parameters::VtkWriteMicrobialConcentration>();
|
||||
oxygenConcentrationOutput_ = Parameters::Get<Parameters::VtkWriteOxygenConcentration>();
|
||||
ureaConcentrationOutput_ = Parameters::Get<Parameters::VtkWriteUreaConcentration>();
|
||||
biofilmConcentrationOutput_ = Parameters::Get<Parameters::VtkWriteBiofilmConcentration>();
|
||||
calciteConcentrationOutput_ = Parameters::Get<Parameters::VtkWriteCalciteConcentration>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
63
opm/models/io/vtkblackoilmicpparams.hpp
Normal file
63
opm/models/io/vtkblackoilmicpparams.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
// -*- 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::VtkBlackOilMICPModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_MICP_PARAMS_HPP
|
||||
#define OPM_VTK_BLACK_OIL_MICP_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteMicrobialConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteOxygenConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteUreaConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteBiofilmConcentration { static constexpr bool value = true; };
|
||||
struct VtkWriteCalciteConcentration { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkBlackoilMICPModule.
|
||||
*/
|
||||
struct VtkBlackoilMICPParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool microbialConcentrationOutput_;
|
||||
bool oxygenConcentrationOutput_;
|
||||
bool ureaConcentrationOutput_;
|
||||
bool biofilmConcentrationOutput_;
|
||||
bool calciteConcentrationOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACKOIL_MICP_PARAMS_HPP
|
||||
@@ -24,11 +24,8 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkBlackOilModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_BLACK_OIL_MODULE_HH
|
||||
#define EWOMS_VTK_BLACK_OIL_MODULE_HH
|
||||
|
||||
#include "vtkmultiwriter.hh"
|
||||
#include "baseoutputmodule.hh"
|
||||
#ifndef OPM_VTK_BLACK_OIL_MODULE_HPP
|
||||
#define OPM_VTK_BLACK_OIL_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -38,26 +35,13 @@
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteGasDissolutionFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilVaporizationFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteGasFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteWaterFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilSaturationPressure { static constexpr bool value = false; };
|
||||
struct VtkWriteGasSaturationPressure { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturationRatios { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturatedOilGasDissolutionFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturatedGasOilVaporizationFactor { static constexpr bool value = false; };
|
||||
struct VtkWritePrimaryVarsMeaning { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
@@ -93,7 +77,9 @@ class VtkBlackOilModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkBlackOilModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
@@ -101,38 +87,7 @@ public:
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteGasDissolutionFactor>
|
||||
("Include the gas dissolution factor (R_s) of the observed oil "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilVaporizationFactor>
|
||||
("Include the oil vaporization factor (R_v) of the observed gas "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilFormationVolumeFactor>
|
||||
("Include the oil formation volume factor (B_o) in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteGasFormationVolumeFactor>
|
||||
("Include the gas formation volume factor (B_g) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteWaterFormationVolumeFactor>
|
||||
("Include the water formation volume factor (B_w) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilSaturationPressure>
|
||||
("Include the saturation pressure of oil (p_o,sat) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteGasSaturationPressure>
|
||||
("Include the saturation pressure of gas (p_g,sat) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturatedOilGasDissolutionFactor>
|
||||
("Include the gas dissolution factor (R_s,sat) of gas saturated "
|
||||
"oil in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturatedGasOilVaporizationFactor>
|
||||
("Include the oil vaporization factor (R_v,sat) of oil saturated "
|
||||
"gas in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturationRatios>
|
||||
("Write the ratio of the actually and maximum dissolved component of "
|
||||
"the mixtures");
|
||||
Parameters::Register<Parameters::VtkWritePrimaryVarsMeaning>
|
||||
("Include how the primary variables should be interpreted to the "
|
||||
"VTK output files");
|
||||
VtkBlackoilParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -141,29 +96,38 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (gasDissolutionFactorOutput_())
|
||||
if (params_.gasDissolutionFactorOutput_) {
|
||||
this->resizeScalarBuffer_(gasDissolutionFactor_);
|
||||
if (oilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.oilVaporizationFactorOutput_) {
|
||||
this->resizeScalarBuffer_(oilVaporizationFactor_);
|
||||
if (oilFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.oilFormationVolumeFactorOutput_) {
|
||||
this->resizeScalarBuffer_(oilFormationVolumeFactor_);
|
||||
if (gasFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.gasFormationVolumeFactorOutput_) {
|
||||
this->resizeScalarBuffer_(gasFormationVolumeFactor_);
|
||||
if (waterFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.waterFormationVolumeFactorOutput_) {
|
||||
this->resizeScalarBuffer_(waterFormationVolumeFactor_);
|
||||
if (oilSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.oilSaturationPressureOutput_) {
|
||||
this->resizeScalarBuffer_(oilSaturationPressure_);
|
||||
if (gasSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.gasSaturationPressureOutput_) {
|
||||
this->resizeScalarBuffer_(gasSaturationPressure_);
|
||||
if (saturatedOilGasDissolutionFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedOilGasDissolutionFactorOutput_) {
|
||||
this->resizeScalarBuffer_(saturatedOilGasDissolutionFactor_);
|
||||
if (saturatedGasOilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedGasOilVaporizationFactorOutput_) {
|
||||
this->resizeScalarBuffer_(saturatedGasOilVaporizationFactor_);
|
||||
if (saturationRatiosOutput_()) {
|
||||
}
|
||||
if (params_.saturationRatiosOutput_) {
|
||||
this->resizeScalarBuffer_(oilSaturationRatio_);
|
||||
this->resizeScalarBuffer_(gasSaturationRatio_);
|
||||
}
|
||||
if (primaryVarsMeaningOutput_()) {
|
||||
if (params_.primaryVarsMeaningOutput_) {
|
||||
this->resizeScalarBuffer_(primaryVarsMeaningPressure_);
|
||||
this->resizeScalarBuffer_(primaryVarsMeaningWater_);
|
||||
this->resizeScalarBuffer_(primaryVarsMeaningGas_);
|
||||
@@ -216,43 +180,56 @@ public:
|
||||
SoMax);
|
||||
Scalar X_gO_sat = FluidSystem::convertRvToXgO(RvSat, pvtRegionIdx);
|
||||
Scalar x_gO_sat = FluidSystem::convertXgOToxgO(X_gO_sat, pvtRegionIdx);
|
||||
if (gasDissolutionFactorOutput_())
|
||||
if (params_.gasDissolutionFactorOutput_) {
|
||||
gasDissolutionFactor_[globalDofIdx] = Rs;
|
||||
if (oilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.oilVaporizationFactorOutput_) {
|
||||
oilVaporizationFactor_[globalDofIdx] = Rv;
|
||||
if (oilSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.oilSaturationPressureOutput_) {
|
||||
oilSaturationPressure_[globalDofIdx] =
|
||||
FluidSystem::template saturationPressure<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
|
||||
if (gasSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.gasSaturationPressureOutput_) {
|
||||
gasSaturationPressure_[globalDofIdx] =
|
||||
FluidSystem::template saturationPressure<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
|
||||
if (saturatedOilGasDissolutionFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedOilGasDissolutionFactorOutput_) {
|
||||
saturatedOilGasDissolutionFactor_[globalDofIdx] = RsSat;
|
||||
if (saturatedGasOilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedGasOilVaporizationFactorOutput_) {
|
||||
saturatedGasOilVaporizationFactor_[globalDofIdx] = RvSat;
|
||||
if (saturationRatiosOutput_()) {
|
||||
if (x_oG_sat <= 0.0)
|
||||
}
|
||||
if (params_.saturationRatiosOutput_) {
|
||||
if (x_oG_sat <= 0.0) {
|
||||
oilSaturationRatio_[globalDofIdx] = 1.0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
oilSaturationRatio_[globalDofIdx] = x_oG / x_oG_sat;
|
||||
}
|
||||
|
||||
if (x_gO_sat <= 0.0)
|
||||
if (x_gO_sat <= 0.0) {
|
||||
gasSaturationRatio_[globalDofIdx] = 1.0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
gasSaturationRatio_[globalDofIdx] = x_gO / x_gO_sat;
|
||||
}
|
||||
}
|
||||
if (oilFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.oilFormationVolumeFactorOutput_) {
|
||||
oilFormationVolumeFactor_[globalDofIdx] =
|
||||
1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
|
||||
if (gasFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.gasFormationVolumeFactorOutput_) {
|
||||
gasFormationVolumeFactor_[globalDofIdx] =
|
||||
1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
|
||||
if (waterFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.waterFormationVolumeFactorOutput_) {
|
||||
waterFormationVolumeFactor_[globalDofIdx] =
|
||||
1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, waterPhaseIdx, pvtRegionIdx);
|
||||
}
|
||||
|
||||
if (primaryVarsMeaningOutput_()) {
|
||||
if (params_.primaryVarsMeaningOutput_) {
|
||||
primaryVarsMeaningWater_[globalDofIdx] =
|
||||
static_cast<int>(primaryVars.primaryVarsMeaningWater());
|
||||
primaryVarsMeaningGas_[globalDofIdx] =
|
||||
@@ -269,33 +246,43 @@ public:
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gasDissolutionFactorOutput_())
|
||||
if (params_.gasDissolutionFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "R_s", gasDissolutionFactor_);
|
||||
if (oilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.oilVaporizationFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "R_v", oilVaporizationFactor_);
|
||||
if (oilFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.oilFormationVolumeFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "B_o", oilFormationVolumeFactor_);
|
||||
if (gasFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.gasFormationVolumeFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "B_g", gasFormationVolumeFactor_);
|
||||
if (waterFormationVolumeFactorOutput_())
|
||||
}
|
||||
if (params_.waterFormationVolumeFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "B_w", waterFormationVolumeFactor_);
|
||||
if (oilSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.oilSaturationPressureOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "p_o,sat", oilSaturationPressure_);
|
||||
if (gasSaturationPressureOutput_())
|
||||
}
|
||||
if (params_.gasSaturationPressureOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "p_g,sat", gasSaturationPressure_);
|
||||
if (saturatedOilGasDissolutionFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedOilGasDissolutionFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "R_s,sat", saturatedOilGasDissolutionFactor_);
|
||||
if (saturatedGasOilVaporizationFactorOutput_())
|
||||
}
|
||||
if (params_.saturatedGasOilVaporizationFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "R_v,sat", saturatedGasOilVaporizationFactor_);
|
||||
if (saturationRatiosOutput_()) {
|
||||
}
|
||||
if (params_.saturationRatiosOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "saturation ratio_oil", oilSaturationRatio_);
|
||||
this->commitScalarBuffer_(baseWriter, "saturation ratio_gas", gasSaturationRatio_);
|
||||
}
|
||||
|
||||
if (primaryVarsMeaningOutput_()) {
|
||||
if (params_.primaryVarsMeaningOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "primary vars meaning water", primaryVarsMeaningWater_);
|
||||
this->commitScalarBuffer_(baseWriter, "primary vars meaning gas", primaryVarsMeaningGas_);
|
||||
this->commitScalarBuffer_(baseWriter, "primary vars meaning pressure", primaryVarsMeaningPressure_);
|
||||
@@ -303,90 +290,25 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static bool gasDissolutionFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteGasDissolutionFactor>();
|
||||
return val;
|
||||
}
|
||||
VtkBlackoilParams params_{};
|
||||
ScalarBuffer gasDissolutionFactor_{};
|
||||
ScalarBuffer oilVaporizationFactor_{};
|
||||
ScalarBuffer oilFormationVolumeFactor_{};
|
||||
ScalarBuffer gasFormationVolumeFactor_{};
|
||||
ScalarBuffer waterFormationVolumeFactor_{};
|
||||
ScalarBuffer oilSaturationPressure_{};
|
||||
ScalarBuffer gasSaturationPressure_{};
|
||||
|
||||
static bool oilVaporizationFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteOilVaporizationFactor>();
|
||||
return val;
|
||||
}
|
||||
ScalarBuffer saturatedOilGasDissolutionFactor_{};
|
||||
ScalarBuffer saturatedGasOilVaporizationFactor_{};
|
||||
ScalarBuffer oilSaturationRatio_{};
|
||||
ScalarBuffer gasSaturationRatio_{};
|
||||
|
||||
static bool oilFormationVolumeFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteOilFormationVolumeFactor>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool gasFormationVolumeFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteGasFormationVolumeFactor>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool waterFormationVolumeFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteWaterFormationVolumeFactor>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool oilSaturationPressureOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteOilSaturationPressure>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool gasSaturationPressureOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteGasSaturationPressure>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool saturatedOilGasDissolutionFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSaturatedOilGasDissolutionFactor>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool saturatedGasOilVaporizationFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSaturatedGasOilVaporizationFactor>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool saturationRatiosOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSaturationRatios>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool primaryVarsMeaningOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePrimaryVarsMeaning>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer gasDissolutionFactor_;
|
||||
ScalarBuffer oilVaporizationFactor_;
|
||||
ScalarBuffer oilFormationVolumeFactor_;
|
||||
ScalarBuffer gasFormationVolumeFactor_;
|
||||
ScalarBuffer waterFormationVolumeFactor_;
|
||||
ScalarBuffer oilSaturationPressure_;
|
||||
ScalarBuffer gasSaturationPressure_;
|
||||
|
||||
ScalarBuffer saturatedOilGasDissolutionFactor_;
|
||||
ScalarBuffer saturatedGasOilVaporizationFactor_;
|
||||
ScalarBuffer oilSaturationRatio_;
|
||||
ScalarBuffer gasSaturationRatio_;
|
||||
|
||||
ScalarBuffer primaryVarsMeaningPressure_;
|
||||
ScalarBuffer primaryVarsMeaningWater_;
|
||||
ScalarBuffer primaryVarsMeaningGas_;
|
||||
ScalarBuffer primaryVarsMeaningPressure_{};
|
||||
ScalarBuffer primaryVarsMeaningWater_{};
|
||||
ScalarBuffer primaryVarsMeaningGas_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_BLACK_OIL_MODULE_HPP
|
||||
82
opm/models/io/vtkblackoilparams.cpp
Normal file
82
opm/models/io/vtkblackoilparams.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkblackoilparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkBlackoilParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteGasDissolutionFactor>
|
||||
("Include the gas dissolution factor (R_s) of the observed oil "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilVaporizationFactor>
|
||||
("Include the oil vaporization factor (R_v) of the observed gas "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilFormationVolumeFactor>
|
||||
("Include the oil formation volume factor (B_o) in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteGasFormationVolumeFactor>
|
||||
("Include the gas formation volume factor (B_g) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteWaterFormationVolumeFactor>
|
||||
("Include the water formation volume factor (B_w) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteOilSaturationPressure>
|
||||
("Include the saturation pressure of oil (p_o,sat) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteGasSaturationPressure>
|
||||
("Include the saturation pressure of gas (p_g,sat) in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturatedOilGasDissolutionFactor>
|
||||
("Include the gas dissolution factor (R_s,sat) of gas saturated "
|
||||
"oil in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturatedGasOilVaporizationFactor>
|
||||
("Include the oil vaporization factor (R_v,sat) of oil saturated "
|
||||
"gas in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturationRatios>
|
||||
("Write the ratio of the actually and maximum dissolved component of "
|
||||
"the mixtures");
|
||||
Parameters::Register<Parameters::VtkWritePrimaryVarsMeaning>
|
||||
("Include how the primary variables should be interpreted to the "
|
||||
"VTK output files");
|
||||
}
|
||||
|
||||
void VtkBlackoilParams::read()
|
||||
{
|
||||
gasDissolutionFactorOutput_ = Parameters::Get<Parameters::VtkWriteGasDissolutionFactor>();
|
||||
oilVaporizationFactorOutput_ = Parameters::Get<Parameters::VtkWriteOilVaporizationFactor>();
|
||||
oilFormationVolumeFactorOutput_ = Parameters::Get<Parameters::VtkWriteOilFormationVolumeFactor>();
|
||||
gasFormationVolumeFactorOutput_ = Parameters::Get<Parameters::VtkWriteGasFormationVolumeFactor>();
|
||||
waterFormationVolumeFactorOutput_ = Parameters::Get<Parameters::VtkWriteWaterFormationVolumeFactor>();
|
||||
oilSaturationPressureOutput_ = Parameters::Get<Parameters::VtkWriteOilSaturationPressure>();
|
||||
gasSaturationPressureOutput_ = Parameters::Get<Parameters::VtkWriteGasSaturationPressure>();
|
||||
saturatedOilGasDissolutionFactorOutput_ = Parameters::Get<Parameters::VtkWriteSaturatedOilGasDissolutionFactor>();
|
||||
saturatedGasOilVaporizationFactorOutput_ = Parameters::Get<Parameters::VtkWriteSaturatedGasOilVaporizationFactor>();
|
||||
saturationRatiosOutput_ = Parameters::Get<Parameters::VtkWriteSaturationRatios>();
|
||||
primaryVarsMeaningOutput_ = Parameters::Get<Parameters::VtkWritePrimaryVarsMeaning>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
75
opm/models/io/vtkblackoilparams.hpp
Normal file
75
opm/models/io/vtkblackoilparams.hpp
Normal file
@@ -0,0 +1,75 @@
|
||||
// -*- 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::VtkBlackOilModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_PARAMS_HPP
|
||||
#define OPM_VTK_BLACK_OIL_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteGasDissolutionFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilVaporizationFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteGasFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteWaterFormationVolumeFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteOilSaturationPressure { static constexpr bool value = false; };
|
||||
struct VtkWriteGasSaturationPressure { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturationRatios { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturatedOilGasDissolutionFactor { static constexpr bool value = false; };
|
||||
struct VtkWriteSaturatedGasOilVaporizationFactor { static constexpr bool value = false; };
|
||||
struct VtkWritePrimaryVarsMeaning { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkBlackoilOutputModule.
|
||||
*/
|
||||
struct VtkBlackoilParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool gasDissolutionFactorOutput_;
|
||||
bool oilVaporizationFactorOutput_;
|
||||
bool oilFormationVolumeFactorOutput_;
|
||||
bool gasFormationVolumeFactorOutput_;
|
||||
bool waterFormationVolumeFactorOutput_;
|
||||
bool oilSaturationPressureOutput_;
|
||||
bool gasSaturationPressureOutput_;
|
||||
bool saturatedOilGasDissolutionFactorOutput_;
|
||||
bool saturatedGasOilVaporizationFactorOutput_;
|
||||
bool saturationRatiosOutput_;
|
||||
bool primaryVarsMeaningOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACK_OIL_PARAMS_HPP
|
||||
@@ -1,268 +0,0 @@
|
||||
// -*- 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::VtkBlackOilPolymerModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_BLACK_OIL_POLYMER_MODULE_HH
|
||||
#define EWOMS_VTK_BLACK_OIL_POLYMER_MODULE_HH
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Properties::TTag {
|
||||
|
||||
// create new type tag for the VTK multi-phase output
|
||||
struct VtkBlackOilPolymer {};
|
||||
|
||||
} // namespace Opm::Properties::TTag
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWritePolymerConcentration { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerDeadPoreVolume { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerViscosityCorrection { static constexpr bool value = true; };
|
||||
struct VtkWriteWaterViscosityCorrection { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerRockDensity { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerAdsorption { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's polymer related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilPolymerModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enablePolymer = getPropValue<TypeTag, Properties::EnablePolymer>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilPolymerModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
Parameters::Register<Parameters::VtkWritePolymerConcentration>
|
||||
("Include the concentration of the polymer component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerDeadPoreVolume>
|
||||
("Include the fraction of the \"dead\" pore volume "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerRockDensity>
|
||||
("Include the amount of already adsorbed polymer component"
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerAdsorption>
|
||||
("Include the adsorption rate of the polymer component"
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerViscosityCorrection>
|
||||
("Include the viscosity correction of the polymer component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteWaterViscosityCorrection>
|
||||
("Include the viscosity correction of the water component "
|
||||
"due to polymers in the VTK output files");
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
if (polymerConcentrationOutput_())
|
||||
this->resizeScalarBuffer_(polymerConcentration_);
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
this->resizeScalarBuffer_(polymerDeadPoreVolume_);
|
||||
if (polymerRockDensityOutput_())
|
||||
this->resizeScalarBuffer_(polymerRockDensity_);
|
||||
if (polymerAdsorptionOutput_())
|
||||
this->resizeScalarBuffer_(polymerAdsorption_);
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
this->resizeScalarBuffer_(polymerViscosityCorrection_);
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
this->resizeScalarBuffer_(waterViscosityCorrection_);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (polymerConcentrationOutput_())
|
||||
polymerConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerConcentration());
|
||||
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
polymerDeadPoreVolume_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerDeadPoreVolume());
|
||||
|
||||
if (polymerRockDensityOutput_())
|
||||
polymerRockDensity_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerRockDensity());
|
||||
|
||||
if (polymerAdsorptionOutput_())
|
||||
polymerAdsorption_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerAdsorption());
|
||||
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
polymerViscosityCorrection_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerViscosityCorrection());
|
||||
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
waterViscosityCorrection_[globalDofIdx] =
|
||||
scalarValue(intQuants.waterViscosityCorrection());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
return;
|
||||
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
if (polymerConcentrationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "polymer concentration", polymerConcentration_);
|
||||
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "dead pore volume fraction", polymerDeadPoreVolume_);
|
||||
|
||||
if (polymerRockDensityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "polymer rock density", polymerRockDensity_);
|
||||
|
||||
if (polymerAdsorptionOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "polymer adsorption", polymerAdsorption_);
|
||||
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "polymer viscosity correction", polymerViscosityCorrection_);
|
||||
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "water viscosity correction", waterViscosityCorrection_);
|
||||
}
|
||||
|
||||
private:
|
||||
static bool polymerConcentrationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerConcentration>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool polymerDeadPoreVolumeOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerDeadPoreVolume>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool polymerRockDensityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerRockDensity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool polymerAdsorptionOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerAdsorption>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool polymerViscosityCorrectionOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerViscosityCorrection>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool waterViscosityCorrectionOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePolymerViscosityCorrection>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer polymerConcentration_;
|
||||
ScalarBuffer polymerDeadPoreVolume_;
|
||||
ScalarBuffer polymerRockDensity_;
|
||||
ScalarBuffer polymerAdsorption_;
|
||||
ScalarBuffer polymerViscosityCorrection_;
|
||||
ScalarBuffer waterViscosityCorrection_;
|
||||
};
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
226
opm/models/io/vtkblackoilpolymermodule.hpp
Normal file
226
opm/models/io/vtkblackoilpolymermodule.hpp
Normal file
@@ -0,0 +1,226 @@
|
||||
// -*- 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::VtkBlackOilPolymerModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_POLYMER_MODULE_HPP
|
||||
#define OPM_VTK_BLACK_OIL_POLYMER_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilpolymerparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Properties::TTag {
|
||||
|
||||
// create new type tag for the VTK multi-phase output
|
||||
struct VtkBlackOilPolymer {};
|
||||
|
||||
} // namespace Opm::Properties::TTag
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's polymer related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilPolymerModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enablePolymer = getPropValue<TypeTag, Properties::EnablePolymer>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilPolymerModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
VtkBlackoilPolymerParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(polymerConcentration_);
|
||||
}
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
this->resizeScalarBuffer_(polymerDeadPoreVolume_);
|
||||
}
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
this->resizeScalarBuffer_(polymerRockDensity_);
|
||||
}
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
this->resizeScalarBuffer_(polymerAdsorption_);
|
||||
}
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
this->resizeScalarBuffer_(polymerViscosityCorrection_);
|
||||
}
|
||||
if (params_.waterViscosityCorrectionOutput_) {
|
||||
this->resizeScalarBuffer_(waterViscosityCorrection_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
polymerConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerConcentration());
|
||||
}
|
||||
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
polymerDeadPoreVolume_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerDeadPoreVolume());
|
||||
}
|
||||
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
polymerRockDensity_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerRockDensity());
|
||||
}
|
||||
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
polymerAdsorption_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerAdsorption());
|
||||
}
|
||||
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
polymerViscosityCorrection_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerViscosityCorrection());
|
||||
}
|
||||
|
||||
if (params_.waterViscosityCorrectionOutput_) {
|
||||
waterViscosityCorrection_[globalDofIdx] =
|
||||
scalarValue(intQuants.waterViscosityCorrection());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer concentration", polymerConcentration_);
|
||||
}
|
||||
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "dead pore volume fraction", polymerDeadPoreVolume_);
|
||||
}
|
||||
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer rock density", polymerRockDensity_);
|
||||
}
|
||||
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer adsorption", polymerAdsorption_);
|
||||
}
|
||||
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer viscosity correction", polymerViscosityCorrection_);
|
||||
}
|
||||
|
||||
if (params_.waterViscosityCorrectionOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "water viscosity correction", waterViscosityCorrection_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VtkBlackoilPolymerParams params_{};
|
||||
ScalarBuffer polymerConcentration_{};
|
||||
ScalarBuffer polymerDeadPoreVolume_{};
|
||||
ScalarBuffer polymerRockDensity_{};
|
||||
ScalarBuffer polymerAdsorption_{};
|
||||
ScalarBuffer polymerViscosityCorrection_{};
|
||||
ScalarBuffer waterViscosityCorrection_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACK_OIL_POLYMER_MODULE_HPP
|
||||
63
opm/models/io/vtkblackoilpolymerparams.cpp
Normal file
63
opm/models/io/vtkblackoilpolymerparams.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkblackoilpolymerparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkBlackoilPolymerParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWritePolymerConcentration>
|
||||
("Include the concentration of the polymer component in the water phase "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerDeadPoreVolume>
|
||||
("Include the fraction of the \"dead\" pore volume "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerRockDensity>
|
||||
("Include the amount of already adsorbed polymer component"
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerAdsorption>
|
||||
("Include the adsorption rate of the polymer component"
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePolymerViscosityCorrection>
|
||||
("Include the viscosity correction of the polymer component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteWaterViscosityCorrection>
|
||||
("Include the viscosity correction of the water component "
|
||||
"due to polymers in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkBlackoilPolymerParams::read()
|
||||
{
|
||||
polymerConcentrationOutput_ = Parameters::Get<Parameters::VtkWritePolymerConcentration>();
|
||||
polymerDeadPoreVolumeOutput_ = Parameters::Get<Parameters::VtkWritePolymerDeadPoreVolume>();
|
||||
polymerRockDensityOutput_ = Parameters::Get<Parameters::VtkWritePolymerRockDensity>();
|
||||
polymerAdsorptionOutput_ = Parameters::Get<Parameters::VtkWritePolymerAdsorption>();
|
||||
polymerViscosityCorrectionOutput_ = Parameters::Get<Parameters::VtkWritePolymerViscosityCorrection>();
|
||||
waterViscosityCorrectionOutput_ = Parameters::Get<Parameters::VtkWritePolymerViscosityCorrection>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
65
opm/models/io/vtkblackoilpolymerparams.hpp
Normal file
65
opm/models/io/vtkblackoilpolymerparams.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
// -*- 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::VtkBlackOilPolymerModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_POLYMER_PARAMS_HPP
|
||||
#define OPM_VTK_BLACK_OIL_POLYMER_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWritePolymerConcentration { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerDeadPoreVolume { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerViscosityCorrection { static constexpr bool value = true; };
|
||||
struct VtkWriteWaterViscosityCorrection { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerRockDensity { static constexpr bool value = true; };
|
||||
struct VtkWritePolymerAdsorption { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkBlackoilPolymerModule.
|
||||
*/
|
||||
struct VtkBlackoilPolymerParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool polymerConcentrationOutput_;
|
||||
bool polymerDeadPoreVolumeOutput_;
|
||||
bool polymerRockDensityOutput_;
|
||||
bool polymerAdsorptionOutput_;
|
||||
bool polymerViscosityCorrectionOutput_;
|
||||
bool waterViscosityCorrectionOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACK_OIL_POLYMER_MODULE_HPP
|
||||
@@ -1,243 +0,0 @@
|
||||
// -*- 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::VtkBlackOilSolventModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_BLACK_OIL_SOLVENT_MODULE_HH
|
||||
#define EWOMS_VTK_BLACK_OIL_SOLVENT_MODULE_HH
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteSolventSaturation { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventRsw { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventDensity { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventViscosity { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventMobility { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm {
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's solvent related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilSolventModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilSolventModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if (!enableSolvent)
|
||||
return;
|
||||
|
||||
Parameters::Register<Parameters::VtkWriteSolventSaturation>
|
||||
("Include the \"saturation\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventRsw>
|
||||
("Include the \"dissolved volume in water\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventDensity>
|
||||
("Include the \"density\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventViscosity>
|
||||
("Include the \"viscosity\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventMobility>
|
||||
("Include the \"mobility\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableSolvent)
|
||||
return;
|
||||
|
||||
if (solventSaturationOutput_())
|
||||
this->resizeScalarBuffer_(solventSaturation_);
|
||||
if (solventRswOutput_())
|
||||
this->resizeScalarBuffer_(solventRsw_);
|
||||
if (solventDensityOutput_())
|
||||
this->resizeScalarBuffer_(solventDensity_);
|
||||
if (solventViscosityOutput_())
|
||||
this->resizeScalarBuffer_(solventViscosity_);
|
||||
if (solventMobilityOutput_())
|
||||
this->resizeScalarBuffer_(solventMobility_);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableSolvent)
|
||||
return;
|
||||
|
||||
using Toolbox = MathToolbox<Evaluation>;
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (solventSaturationOutput_())
|
||||
solventSaturation_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventSaturation());
|
||||
|
||||
if (solventRswOutput_())
|
||||
solventRsw_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.rsSolw());
|
||||
|
||||
if (solventDensityOutput_())
|
||||
solventDensity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventDensity());
|
||||
|
||||
if (solventViscosityOutput_())
|
||||
solventViscosity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventViscosity());
|
||||
|
||||
if (solventMobilityOutput_())
|
||||
solventMobility_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventMobility());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
return;
|
||||
|
||||
if (!enableSolvent)
|
||||
return;
|
||||
|
||||
if (solventSaturationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "saturation_solvent", solventSaturation_);
|
||||
|
||||
if (solventRswOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "dissolved_solvent", solventRsw_);
|
||||
|
||||
if (solventDensityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "density_solvent", solventDensity_);
|
||||
|
||||
if (solventViscosityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "viscosity_solvent", solventViscosity_);
|
||||
|
||||
if (solventMobilityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "mobility_solvent", solventMobility_);
|
||||
}
|
||||
|
||||
private:
|
||||
static bool solventSaturationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolventSaturation>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool solventRswOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolventRsw>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool solventDensityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolventDensity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool solventViscosityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolventViscosity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool solventMobilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolventMobility>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer solventSaturation_;
|
||||
ScalarBuffer solventRsw_;
|
||||
ScalarBuffer solventDensity_;
|
||||
ScalarBuffer solventViscosity_;
|
||||
ScalarBuffer solventMobility_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
207
opm/models/io/vtkblackoilsolventmodule.hpp
Normal file
207
opm/models/io/vtkblackoilsolventmodule.hpp
Normal file
@@ -0,0 +1,207 @@
|
||||
// -*- 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::VtkBlackOilSolventModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
|
||||
#define OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkblackoilsolventparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
* \brief VTK output module for the black oil model's solvent related quantities.
|
||||
*/
|
||||
template <class TypeTag>
|
||||
class VtkBlackOilSolventModule : public BaseOutputModule<TypeTag>
|
||||
{
|
||||
using ParentType = BaseOutputModule<TypeTag>;
|
||||
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GridView = GetPropType<TypeTag, Properties::GridView>;
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
|
||||
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
||||
|
||||
static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
|
||||
using VtkMultiWriter = ::Opm::VtkMultiWriter<GridView, vtkFormat>;
|
||||
|
||||
enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
|
||||
|
||||
using ScalarBuffer = typename ParentType::ScalarBuffer;
|
||||
|
||||
public:
|
||||
VtkBlackOilSolventModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
* module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
VtkBlackOilSolventParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Allocate memory for the scalar fields we would like to
|
||||
* write to the VTK file.
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.solventSaturationOutput_) {
|
||||
this->resizeScalarBuffer_(solventSaturation_);
|
||||
}
|
||||
if (params_.solventRswOutput_) {
|
||||
this->resizeScalarBuffer_(solventRsw_);
|
||||
}
|
||||
if (params_.solventDensityOutput_) {
|
||||
this->resizeScalarBuffer_(solventDensity_);
|
||||
}
|
||||
if (params_.solventViscosityOutput_) {
|
||||
this->resizeScalarBuffer_(solventViscosity_);
|
||||
}
|
||||
if (params_.solventMobilityOutput_) {
|
||||
this->resizeScalarBuffer_(solventMobility_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
* an element
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
using Toolbox = MathToolbox<Evaluation>;
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
|
||||
if (params_.solventSaturationOutput_) {
|
||||
solventSaturation_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventSaturation());
|
||||
}
|
||||
|
||||
if (params_.solventRswOutput_) {
|
||||
solventRsw_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.rsSolw());
|
||||
}
|
||||
|
||||
if (params_.solventDensityOutput_) {
|
||||
solventDensity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventDensity());
|
||||
}
|
||||
|
||||
if (params_.solventViscosityOutput_) {
|
||||
solventViscosity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventViscosity());
|
||||
}
|
||||
|
||||
if (params_.solventMobilityOutput_) {
|
||||
solventMobility_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventMobility());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_.solventSaturationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "saturation_solvent", solventSaturation_);
|
||||
}
|
||||
|
||||
if (params_.solventRswOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "dissolved_solvent", solventRsw_);
|
||||
}
|
||||
|
||||
if (params_.solventDensityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "density_solvent", solventDensity_);
|
||||
}
|
||||
|
||||
if (params_.solventViscosityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "viscosity_solvent", solventViscosity_);
|
||||
}
|
||||
|
||||
if (params_.solventMobilityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "mobility_solvent", solventMobility_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VtkBlackOilSolventParams params_{};
|
||||
ScalarBuffer solventSaturation_{};
|
||||
ScalarBuffer solventRsw_{};
|
||||
ScalarBuffer solventDensity_{};
|
||||
ScalarBuffer solventViscosity_{};
|
||||
ScalarBuffer solventMobility_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
|
||||
59
opm/models/io/vtkblackoilsolventparams.cpp
Normal file
59
opm/models/io/vtkblackoilsolventparams.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkblackoilsolventparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkBlackOilSolventParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteSolventSaturation>
|
||||
("Include the \"saturation\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventRsw>
|
||||
("Include the \"dissolved volume in water\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventDensity>
|
||||
("Include the \"density\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventViscosity>
|
||||
("Include the \"viscosity\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSolventMobility>
|
||||
("Include the \"mobility\" of the solvent component "
|
||||
"in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkBlackOilSolventParams::read()
|
||||
{
|
||||
solventSaturationOutput_ = Parameters::Get<Parameters::VtkWriteSolventSaturation>();
|
||||
solventRswOutput_ = Parameters::Get<Parameters::VtkWriteSolventRsw>();
|
||||
solventDensityOutput_ = Parameters::Get<Parameters::VtkWriteSolventDensity>();
|
||||
solventViscosityOutput_ = Parameters::Get<Parameters::VtkWriteSolventViscosity>();
|
||||
solventMobilityOutput_ = Parameters::Get<Parameters::VtkWriteSolventMobility>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
63
opm/models/io/vtkblackoilsolventparams.hpp
Normal file
63
opm/models/io/vtkblackoilsolventparams.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
// -*- 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::VtkBlackOilSolventModule
|
||||
*/
|
||||
#ifndef OPM_VTK_BLACK_OIL_SOLVENT_PARAMS_HPP
|
||||
#define OPM_VTK_BLACK_OIL_SOLVENT_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteSolventSaturation { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventRsw { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventDensity { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventViscosity { static constexpr bool value = true; };
|
||||
struct VtkWriteSolventMobility { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkBlackoilPolymerModule.
|
||||
*/
|
||||
struct VtkBlackOilSolventParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool solventSaturationOutput_;
|
||||
bool solventRswOutput_;
|
||||
bool solventDensityOutput_;
|
||||
bool solventViscosityOutput_;
|
||||
bool solventMobilityOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_BLACK_OIL_SOLVENT_PARAMS_HPP
|
||||
@@ -24,32 +24,20 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkCompositionModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_COMPOSITION_MODULE_HH
|
||||
#define EWOMS_VTK_COMPOSITION_MODULE_HH
|
||||
#ifndef OPM_VTK_COMPOSITION_MODULE_HPP
|
||||
#define OPM_VTK_COMPOSITION_MODULE_HPP
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteMassFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteMoleFractions { static constexpr bool value = true; };
|
||||
struct VtkWriteTotalMassFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteTotalMoleFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteMolarities { static constexpr bool value = false; };
|
||||
struct VtkWriteFugacities { static constexpr bool value = false; };
|
||||
struct VtkWriteFugacityCoeffs { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
@@ -88,27 +76,16 @@ class VtkCompositionModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkCompositionModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteMassFractions>
|
||||
("Include mass fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMoleFractions>
|
||||
("Include mole fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalMassFractions>
|
||||
("Include total mass fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalMoleFractions>
|
||||
("Include total mole fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMolarities>
|
||||
("Include component molarities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFugacities>
|
||||
("Include component fugacities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFugacityCoeffs>
|
||||
("Include component fugacity coefficients in the VTK output files");
|
||||
VtkCompositionParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -117,22 +94,29 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (moleFracOutput_())
|
||||
if (params_.moleFracOutput_) {
|
||||
this->resizePhaseComponentBuffer_(moleFrac_);
|
||||
if (massFracOutput_())
|
||||
}
|
||||
if (params_.massFracOutput_) {
|
||||
this->resizePhaseComponentBuffer_(massFrac_);
|
||||
if (totalMassFracOutput_())
|
||||
}
|
||||
if (params_.totalMassFracOutput_) {
|
||||
this->resizeComponentBuffer_(totalMassFrac_);
|
||||
if (totalMoleFracOutput_())
|
||||
}
|
||||
if (params_.totalMoleFracOutput_) {
|
||||
this->resizeComponentBuffer_(totalMoleFrac_);
|
||||
if (molarityOutput_())
|
||||
}
|
||||
if (params_.molarityOutput_) {
|
||||
this->resizePhaseComponentBuffer_(molarity_);
|
||||
}
|
||||
|
||||
if (fugacityOutput_())
|
||||
if (params_.fugacityOutput_) {
|
||||
this->resizeComponentBuffer_(fugacity_);
|
||||
if (fugacityCoeffOutput_())
|
||||
}
|
||||
if (params_.fugacityCoeffOutput_) {
|
||||
this->resizePhaseComponentBuffer_(fugacityCoeff_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant
|
||||
@@ -153,21 +137,25 @@ public:
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (moleFracOutput_())
|
||||
if (params_.moleFracOutput_) {
|
||||
moleFrac_[phaseIdx][compIdx][I] = Toolbox::value(fs.moleFraction(phaseIdx, compIdx));
|
||||
if (massFracOutput_())
|
||||
}
|
||||
if (params_.massFracOutput_) {
|
||||
massFrac_[phaseIdx][compIdx][I] = Toolbox::value(fs.massFraction(phaseIdx, compIdx));
|
||||
if (molarityOutput_())
|
||||
}
|
||||
if (params_.molarityOutput_) {
|
||||
molarity_[phaseIdx][compIdx][I] = Toolbox::value(fs.molarity(phaseIdx, compIdx));
|
||||
}
|
||||
|
||||
if (fugacityCoeffOutput_())
|
||||
if (params_.fugacityCoeffOutput_) {
|
||||
fugacityCoeff_[phaseIdx][compIdx][I] =
|
||||
Toolbox::value(fs.fugacityCoefficient(phaseIdx, compIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (totalMassFracOutput_()) {
|
||||
if (params_.totalMassFracOutput_) {
|
||||
Scalar compMass = 0;
|
||||
Scalar totalMass = 0;
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
@@ -179,7 +167,7 @@ public:
|
||||
}
|
||||
totalMassFrac_[compIdx][I] = compMass / totalMass;
|
||||
}
|
||||
if (totalMoleFracOutput_()) {
|
||||
if (params_.totalMoleFracOutput_) {
|
||||
Scalar compMoles = 0;
|
||||
Scalar totalMoles = 0;
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
@@ -193,11 +181,12 @@ public:
|
||||
}
|
||||
totalMoleFrac_[compIdx][I] = compMoles / totalMoles;
|
||||
}
|
||||
if (fugacityOutput_())
|
||||
if (params_.fugacityOutput_) {
|
||||
fugacity_[compIdx][I] = Toolbox::value(intQuants.fluidState().fugacity(/*phaseIdx=*/0, compIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -209,76 +198,42 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (moleFracOutput_())
|
||||
if (params_.moleFracOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter, "moleFrac_%s^%s", moleFrac_);
|
||||
if (massFracOutput_())
|
||||
}
|
||||
if (params_.massFracOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter, "massFrac_%s^%s", massFrac_);
|
||||
if (molarityOutput_())
|
||||
}
|
||||
if (params_.molarityOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter, "molarity_%s^%s", molarity_);
|
||||
if (totalMassFracOutput_())
|
||||
}
|
||||
if (params_.totalMassFracOutput_) {
|
||||
this->commitComponentBuffer_(baseWriter, "totalMassFrac^%s", totalMassFrac_);
|
||||
if (totalMoleFracOutput_())
|
||||
}
|
||||
if (params_.totalMoleFracOutput_) {
|
||||
this->commitComponentBuffer_(baseWriter, "totalMoleFrac^%s", totalMoleFrac_);
|
||||
}
|
||||
|
||||
if (fugacityOutput_())
|
||||
if (params_.fugacityOutput_) {
|
||||
this->commitComponentBuffer_(baseWriter, "fugacity^%s", fugacity_);
|
||||
if (fugacityCoeffOutput_())
|
||||
}
|
||||
if (params_.fugacityCoeffOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter, "fugacityCoeff_%s^%s", fugacityCoeff_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool massFracOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteMassFractions>();
|
||||
return val;
|
||||
}
|
||||
VtkCompositionParams params_{};
|
||||
PhaseComponentBuffer moleFrac_{};
|
||||
PhaseComponentBuffer massFrac_{};
|
||||
PhaseComponentBuffer molarity_{};
|
||||
ComponentBuffer totalMassFrac_{};
|
||||
ComponentBuffer totalMoleFrac_{};
|
||||
|
||||
static bool moleFracOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteMoleFractions>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool totalMassFracOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteTotalMassFractions>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool totalMoleFracOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteTotalMoleFractions>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool molarityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteMolarities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool fugacityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFugacities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool fugacityCoeffOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFugacityCoeffs>();
|
||||
return val;
|
||||
}
|
||||
|
||||
PhaseComponentBuffer moleFrac_;
|
||||
PhaseComponentBuffer massFrac_;
|
||||
PhaseComponentBuffer molarity_;
|
||||
ComponentBuffer totalMassFrac_;
|
||||
ComponentBuffer totalMoleFrac_;
|
||||
|
||||
ComponentBuffer fugacity_;
|
||||
PhaseComponentBuffer fugacityCoeff_;
|
||||
ComponentBuffer fugacity_{};
|
||||
PhaseComponentBuffer fugacityCoeff_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_COMPOSITION_MODULE_HPP
|
||||
60
opm/models/io/vtkcompositionparams.cpp
Normal file
60
opm/models/io/vtkcompositionparams.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkcompositionparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkCompositionParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteMassFractions>
|
||||
("Include mass fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMoleFractions>
|
||||
("Include mole fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalMassFractions>
|
||||
("Include total mass fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteTotalMoleFractions>
|
||||
("Include total mole fractions in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMolarities>
|
||||
("Include component molarities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFugacities>
|
||||
("Include component fugacities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFugacityCoeffs>
|
||||
("Include component fugacity coefficients in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkCompositionParams::read()
|
||||
{
|
||||
massFracOutput_ = Parameters::Get<Parameters::VtkWriteMassFractions>();
|
||||
moleFracOutput_ = Parameters::Get<Parameters::VtkWriteMoleFractions>();
|
||||
totalMassFracOutput_ = Parameters::Get<Parameters::VtkWriteTotalMassFractions>();
|
||||
totalMoleFracOutput_ = Parameters::Get<Parameters::VtkWriteTotalMoleFractions>();
|
||||
molarityOutput_ = Parameters::Get<Parameters::VtkWriteMolarities>();
|
||||
fugacityOutput_ = Parameters::Get<Parameters::VtkWriteFugacities>();
|
||||
fugacityCoeffOutput_ = Parameters::Get<Parameters::VtkWriteFugacityCoeffs>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
67
opm/models/io/vtkcompositionparams.hpp
Normal file
67
opm/models/io/vtkcompositionparams.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
// -*- 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::VtkCompositionModule
|
||||
*/
|
||||
#ifndef OPM_VTK_COMPOSITION_PARAMS_HPP
|
||||
#define OPM_VTK_COMPOSITION_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteMassFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteMoleFractions { static constexpr bool value = true; };
|
||||
struct VtkWriteTotalMassFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteTotalMoleFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteMolarities { static constexpr bool value = false; };
|
||||
struct VtkWriteFugacities { static constexpr bool value = false; };
|
||||
struct VtkWriteFugacityCoeffs { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkCompositionModule.
|
||||
*/
|
||||
struct VtkCompositionParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool massFracOutput_;
|
||||
bool moleFracOutput_;
|
||||
bool totalMassFracOutput_;
|
||||
bool totalMoleFracOutput_;
|
||||
bool molarityOutput_;
|
||||
bool fugacityOutput_;
|
||||
bool fugacityCoeffOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_COMPOSITION_PARAMS_HPP
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
* \copydoc Opm::VtkDiffusionModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_DIFFUSION_MODULE_HH
|
||||
#define EWOMS_VTK_DIFFUSION_MODULE_HH
|
||||
#ifndef OPM_VTK_DIFFUSION_MODULE_HPP
|
||||
#define OPM_VTK_DIFFUSION_MODULE_HPP
|
||||
|
||||
#include <opm/material/densead/Evaluation.hpp>
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
@@ -34,21 +34,14 @@
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteTortuosities { static constexpr bool value = false; };
|
||||
struct VtkWriteDiffusionCoefficients { static constexpr bool value = false; };
|
||||
struct VtkWriteEffectiveDiffusionCoefficients { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
@@ -84,21 +77,16 @@ class VtkDiffusionModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkDiffusionModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteTortuosities>
|
||||
("Include the tortuosity for each phase in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDiffusionCoefficients>
|
||||
("Include the molecular diffusion coefficients in "
|
||||
"the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEffectiveDiffusionCoefficients>
|
||||
("Include the effective molecular diffusion "
|
||||
"coefficients the medium in the VTK output files");
|
||||
VtkDiffusionParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -107,13 +95,16 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (tortuosityOutput_())
|
||||
if (params_.tortuosityOutput_) {
|
||||
this->resizePhaseBuffer_(tortuosity_);
|
||||
if (diffusionCoefficientOutput_())
|
||||
}
|
||||
if (params_.diffusionCoefficientOutput_) {
|
||||
this->resizePhaseComponentBuffer_(diffusionCoefficient_);
|
||||
if (effectiveDiffusionCoefficientOutput_())
|
||||
}
|
||||
if (params_.effectiveDiffusionCoefficientOutput_) {
|
||||
this->resizePhaseComponentBuffer_(effectiveDiffusionCoefficient_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quanties relevant
|
||||
@@ -130,19 +121,22 @@ public:
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (tortuosityOutput_())
|
||||
if (params_.tortuosityOutput_) {
|
||||
tortuosity_[phaseIdx][I] = Toolbox::value(intQuants.tortuosity(phaseIdx));
|
||||
}
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (diffusionCoefficientOutput_())
|
||||
if (params_.diffusionCoefficientOutput_) {
|
||||
diffusionCoefficient_[phaseIdx][compIdx][I] =
|
||||
Toolbox::value(intQuants.diffusionCoefficient(phaseIdx, compIdx));
|
||||
if (effectiveDiffusionCoefficientOutput_())
|
||||
}
|
||||
if (params_.effectiveDiffusionCoefficientOutput_) {
|
||||
effectiveDiffusionCoefficient_[phaseIdx][compIdx][I] =
|
||||
Toolbox::value(intQuants.effectiveDiffusionCoefficient(phaseIdx, compIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -154,41 +148,27 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (tortuosityOutput_())
|
||||
if (params_.tortuosityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "tortuosity", tortuosity_);
|
||||
if (diffusionCoefficientOutput_())
|
||||
}
|
||||
if (params_.diffusionCoefficientOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter, "diffusionCoefficient",
|
||||
diffusionCoefficient_);
|
||||
if (effectiveDiffusionCoefficientOutput_())
|
||||
}
|
||||
if (params_.effectiveDiffusionCoefficientOutput_) {
|
||||
this->commitPhaseComponentBuffer_(baseWriter,
|
||||
"effectiveDiffusionCoefficient",
|
||||
effectiveDiffusionCoefficient_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool tortuosityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteTortuosities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool diffusionCoefficientOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteDiffusionCoefficients>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool effectiveDiffusionCoefficientOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteEffectiveDiffusionCoefficients>();
|
||||
return val;
|
||||
}
|
||||
|
||||
PhaseBuffer tortuosity_;
|
||||
PhaseComponentBuffer diffusionCoefficient_;
|
||||
PhaseComponentBuffer effectiveDiffusionCoefficient_;
|
||||
VtkDiffusionParams params_{};
|
||||
PhaseBuffer tortuosity_{};
|
||||
PhaseComponentBuffer diffusionCoefficient_{};
|
||||
PhaseComponentBuffer effectiveDiffusionCoefficient_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_DIFFUSION_MODULE_HPP
|
||||
50
opm/models/io/vtkdiffusionparams.cpp
Normal file
50
opm/models/io/vtkdiffusionparams.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkdiffusionparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkDiffusionParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteTortuosities>
|
||||
("Include the tortuosity for each phase in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDiffusionCoefficients>
|
||||
("Include the molecular diffusion coefficients in "
|
||||
"the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEffectiveDiffusionCoefficients>
|
||||
("Include the effective molecular diffusion "
|
||||
"coefficients the medium in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkDiffusionParams::read()
|
||||
{
|
||||
tortuosityOutput_ = Parameters::Get<Parameters::VtkWriteTortuosities>();
|
||||
diffusionCoefficientOutput_ = Parameters::Get<Parameters::VtkWriteDiffusionCoefficients>();
|
||||
effectiveDiffusionCoefficientOutput_ = Parameters::Get<Parameters::VtkWriteEffectiveDiffusionCoefficients>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
60
opm/models/io/vtkdiffusionparams.hpp
Normal file
60
opm/models/io/vtkdiffusionparams.hpp
Normal file
@@ -0,0 +1,60 @@
|
||||
// -*- 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::VtkDiffusionModule
|
||||
*/
|
||||
#ifndef OPM_VTK_DIFFUSION_PARAMS_HPP
|
||||
#define OPM_VTK_DIFFUSION_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteTortuosities { static constexpr bool value = false; };
|
||||
struct VtkWriteDiffusionCoefficients { static constexpr bool value = false; };
|
||||
struct VtkWriteEffectiveDiffusionCoefficients { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkDiffusionModule.
|
||||
*/
|
||||
struct VtkDiffusionParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool tortuosityOutput_;
|
||||
bool diffusionCoefficientOutput_;
|
||||
bool effectiveDiffusionCoefficientOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_DIFFUSION_PARAMS_HPP
|
||||
@@ -24,8 +24,8 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkDiscreteFractureModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_DISCRETE_FRACTURE_MODULE_HH
|
||||
#define EWOMS_VTK_DISCRETE_FRACTURE_MODULE_HH
|
||||
#ifndef OPM_VTK_DISCRETE_FRACTURE_MODULE_HPP
|
||||
#define OPM_VTK_DISCRETE_FRACTURE_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkdiscretefractureparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
@@ -41,20 +42,8 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteFractureSaturations { static constexpr bool value = true; };
|
||||
struct VtkWriteFractureMobilities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureRelativePermeabilities { static constexpr bool value = true; };
|
||||
struct VtkWriteFracturePorosity { static constexpr bool value = true; };
|
||||
struct VtkWriteFractureIntrinsicPermeabilities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureFilterVelocities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureVolumeFraction { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
@@ -97,29 +86,16 @@ class VtkDiscreteFractureModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkDiscreteFractureModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteFractureSaturations>
|
||||
("Include the phase saturations in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureMobilities>
|
||||
("Include the phase mobilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureRelativePermeabilities>
|
||||
("Include the phase relative permeabilities in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFracturePorosity>
|
||||
("Include the porosity in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureIntrinsicPermeabilities>
|
||||
("Include the intrinsic permeability in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureFilterVelocities>
|
||||
("Include in the filter velocities of the phases in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureVolumeFraction>
|
||||
("Add the fraction of the total volume which is "
|
||||
"occupied by fractures in the VTK output");
|
||||
VtkDiscreteFractureParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -128,21 +104,27 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (saturationOutput_())
|
||||
if (params_.saturationOutput_) {
|
||||
this->resizePhaseBuffer_(fractureSaturation_);
|
||||
if (mobilityOutput_())
|
||||
}
|
||||
if (params_.mobilityOutput_) {
|
||||
this->resizePhaseBuffer_(fractureMobility_);
|
||||
if (relativePermeabilityOutput_())
|
||||
}
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
this->resizePhaseBuffer_(fractureRelativePermeability_);
|
||||
}
|
||||
|
||||
if (porosityOutput_())
|
||||
if (params_.porosityOutput_) {
|
||||
this->resizeScalarBuffer_(fracturePorosity_);
|
||||
if (intrinsicPermeabilityOutput_())
|
||||
}
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
this->resizeScalarBuffer_(fractureIntrinsicPermeability_);
|
||||
if (volumeFractionOutput_())
|
||||
}
|
||||
if (params_.volumeFractionOutput_) {
|
||||
this->resizeScalarBuffer_(fractureVolumeFraction_);
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
size_t nDof = this->simulator_.model().numGridDof();
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
fractureVelocity_[phaseIdx].resize(nDof);
|
||||
@@ -169,43 +151,44 @@ public:
|
||||
|
||||
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
|
||||
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);
|
||||
if (!fractureMapper.isFractureVertex(I))
|
||||
if (!fractureMapper.isFractureVertex(I)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fractureFluidState();
|
||||
|
||||
if (porosityOutput_()) {
|
||||
if (params_.porosityOutput_) {
|
||||
Opm::Valgrind::CheckDefined(intQuants.fracturePorosity());
|
||||
fracturePorosity_[I] = intQuants.fracturePorosity();
|
||||
}
|
||||
if (intrinsicPermeabilityOutput_()) {
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
const auto& K = intQuants.fractureIntrinsicPermeability();
|
||||
fractureIntrinsicPermeability_[I] = K[0][0];
|
||||
}
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (saturationOutput_()) {
|
||||
if (params_.saturationOutput_) {
|
||||
Opm::Valgrind::CheckDefined(fs.saturation(phaseIdx));
|
||||
fractureSaturation_[phaseIdx][I] = fs.saturation(phaseIdx);
|
||||
}
|
||||
if (mobilityOutput_()) {
|
||||
if (params_.mobilityOutput_) {
|
||||
Opm::Valgrind::CheckDefined(intQuants.fractureMobility(phaseIdx));
|
||||
fractureMobility_[phaseIdx][I] = intQuants.fractureMobility(phaseIdx);
|
||||
}
|
||||
if (relativePermeabilityOutput_()) {
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
Opm::Valgrind::CheckDefined(intQuants.fractureRelativePermeability(phaseIdx));
|
||||
fractureRelativePermeability_[phaseIdx][I] =
|
||||
intQuants.fractureRelativePermeability(phaseIdx);
|
||||
}
|
||||
if (volumeFractionOutput_()) {
|
||||
if (params_.volumeFractionOutput_) {
|
||||
Opm::Valgrind::CheckDefined(intQuants.fractureVolume());
|
||||
fractureVolumeFraction_[I] += intQuants.fractureVolume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
// calculate velocities if requested by the simulator
|
||||
for (unsigned scvfIdx = 0; scvfIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ scvfIdx) {
|
||||
const auto& extQuants = elemCtx.extensiveQuantities(scvfIdx, /*timeIdx=*/0);
|
||||
@@ -216,8 +199,9 @@ public:
|
||||
unsigned j = extQuants.exteriorIndex();
|
||||
unsigned J = elemCtx.globalSpaceIndex(j, /*timeIdx=*/0);
|
||||
|
||||
if (!fractureMapper.isFractureEdge(I, J))
|
||||
if (!fractureMapper.isFractureEdge(I, J)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
Scalar weight =
|
||||
@@ -251,33 +235,40 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (saturationOutput_())
|
||||
if (params_.saturationOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "fractureSaturation_%s", fractureSaturation_);
|
||||
if (mobilityOutput_())
|
||||
}
|
||||
if (params_.mobilityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "fractureMobility_%s", fractureMobility_);
|
||||
if (relativePermeabilityOutput_())
|
||||
}
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "fractureRelativePerm_%s", fractureRelativePermeability_);
|
||||
}
|
||||
|
||||
if (porosityOutput_())
|
||||
if (params_.porosityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "fracturePorosity", fracturePorosity_);
|
||||
if (intrinsicPermeabilityOutput_())
|
||||
}
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "fractureIntrinsicPerm", fractureIntrinsicPermeability_);
|
||||
if (volumeFractionOutput_()) {
|
||||
}
|
||||
if (params_.volumeFractionOutput_) {
|
||||
// divide the fracture volume by the total volume of the finite volumes
|
||||
for (unsigned I = 0; I < fractureVolumeFraction_.size(); ++I)
|
||||
for (unsigned I = 0; I < fractureVolumeFraction_.size(); ++I) {
|
||||
fractureVolumeFraction_[I] /= this->simulator_.model().dofTotalVolume(I);
|
||||
}
|
||||
this->commitScalarBuffer_(baseWriter, "fractureVolumeFraction", fractureVolumeFraction_);
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
size_t nDof = this->simulator_.model().numGridDof();
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
// first, divide the velocity field by the
|
||||
// respective finite volume's surface area
|
||||
for (unsigned dofIdx = 0; dofIdx < nDof; ++dofIdx)
|
||||
for (unsigned dofIdx = 0; dofIdx < nDof; ++dofIdx) {
|
||||
fractureVelocity_[phaseIdx][dofIdx] /=
|
||||
std::max<Scalar>(1e-20, fractureVelocityWeight_[phaseIdx][dofIdx]);
|
||||
}
|
||||
// commit the phase velocity
|
||||
char name[512];
|
||||
snprintf(name, 512, "fractureFilterVelocity_%s", FluidSystem::phaseName(phaseIdx).data());
|
||||
@@ -288,63 +279,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static bool saturationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureSaturations>();
|
||||
return val;
|
||||
}
|
||||
VtkDiscreteFractureParams params_{};
|
||||
PhaseBuffer fractureSaturation_{};
|
||||
PhaseBuffer fractureMobility_{};
|
||||
PhaseBuffer fractureRelativePermeability_{};
|
||||
|
||||
static bool mobilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureMobilities>();
|
||||
return val;
|
||||
}
|
||||
ScalarBuffer fracturePorosity_{};
|
||||
ScalarBuffer fractureVolumeFraction_{};
|
||||
ScalarBuffer fractureIntrinsicPermeability_{};
|
||||
|
||||
static bool relativePermeabilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureRelativePermeabilities>();
|
||||
return val;
|
||||
}
|
||||
PhaseVectorBuffer fractureVelocity_{};
|
||||
PhaseBuffer fractureVelocityWeight_{};
|
||||
|
||||
static bool porosityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFracturePorosity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool intrinsicPermeabilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureIntrinsicPermeabilities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool volumeFractionOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureVolumeFraction>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool velocityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFractureFilterVelocities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
PhaseBuffer fractureSaturation_;
|
||||
PhaseBuffer fractureMobility_;
|
||||
PhaseBuffer fractureRelativePermeability_;
|
||||
|
||||
ScalarBuffer fracturePorosity_;
|
||||
ScalarBuffer fractureVolumeFraction_;
|
||||
ScalarBuffer fractureIntrinsicPermeability_;
|
||||
|
||||
PhaseVectorBuffer fractureVelocity_;
|
||||
PhaseBuffer fractureVelocityWeight_;
|
||||
|
||||
PhaseVectorBuffer potentialGradient_;
|
||||
PhaseBuffer potentialWeight_;
|
||||
PhaseVectorBuffer potentialGradient_{};
|
||||
PhaseBuffer potentialWeight_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_DISCRETE_FRACTURE_MODULE_HPP
|
||||
62
opm/models/io/vtkdiscretefractureparams.cpp
Normal file
62
opm/models/io/vtkdiscretefractureparams.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkdiscretefractureparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkDiscreteFractureParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteFractureSaturations>
|
||||
("Include the phase saturations in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureMobilities>
|
||||
("Include the phase mobilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureRelativePermeabilities>
|
||||
("Include the phase relative permeabilities in the "
|
||||
"VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFracturePorosity>
|
||||
("Include the porosity in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureIntrinsicPermeabilities>
|
||||
("Include the intrinsic permeability in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureFilterVelocities>
|
||||
("Include in the filter velocities of the phases in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFractureVolumeFraction>
|
||||
("Add the fraction of the total volume which is "
|
||||
"occupied by fractures in the VTK output");
|
||||
}
|
||||
|
||||
void VtkDiscreteFractureParams::read()
|
||||
{
|
||||
saturationOutput_ = Parameters::Get<Parameters::VtkWriteFractureSaturations>();
|
||||
mobilityOutput_ = Parameters::Get<Parameters::VtkWriteFractureMobilities>();
|
||||
relativePermeabilityOutput_ = Parameters::Get<Parameters::VtkWriteFractureRelativePermeabilities>();
|
||||
porosityOutput_ = Parameters::Get<Parameters::VtkWriteFracturePorosity>();
|
||||
intrinsicPermeabilityOutput_ = Parameters::Get<Parameters::VtkWriteFractureIntrinsicPermeabilities>();
|
||||
volumeFractionOutput_ = Parameters::Get<Parameters::VtkWriteFractureVolumeFraction>();
|
||||
velocityOutput_ = Parameters::Get<Parameters::VtkWriteFractureFilterVelocities>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
67
opm/models/io/vtkdiscretefractureparams.hpp
Normal file
67
opm/models/io/vtkdiscretefractureparams.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
// -*- 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::VtkDiscreteFractureModule
|
||||
*/
|
||||
#ifndef OPM_VTK_DISCRETE_FRACTURE_PARAMS_HPP
|
||||
#define OPM_VTK_DISCRETE_FRACTURE_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteFractureSaturations { static constexpr bool value = true; };
|
||||
struct VtkWriteFractureMobilities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureRelativePermeabilities { static constexpr bool value = true; };
|
||||
struct VtkWriteFracturePorosity { static constexpr bool value = true; };
|
||||
struct VtkWriteFractureIntrinsicPermeabilities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureFilterVelocities { static constexpr bool value = false; };
|
||||
struct VtkWriteFractureVolumeFraction { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkDiscreteFractureModule.
|
||||
*/
|
||||
struct VtkDiscreteFractureParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool saturationOutput_;
|
||||
bool mobilityOutput_;
|
||||
bool relativePermeabilityOutput_;
|
||||
bool porosityOutput_;
|
||||
bool intrinsicPermeabilityOutput_;
|
||||
bool volumeFractionOutput_;
|
||||
bool velocityOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_DISCRETE_FRACTURE_MODULE_HPP
|
||||
@@ -24,12 +24,13 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkEnergyModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_ENERGY_MODULE_HH
|
||||
#define EWOMS_VTK_ENERGY_MODULE_HH
|
||||
#ifndef OPM_VTK_ENERGY_MODULE_HPP
|
||||
#define OPM_VTK_ENERGY_MODULE_HPP
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkenergyparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
@@ -37,17 +38,8 @@
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteSolidInternalEnergy { static constexpr bool value = false; };
|
||||
struct VtkWriteThermalConductivity { static constexpr bool value = false; };
|
||||
struct VtkWriteInternalEnergies { static constexpr bool value = false; };
|
||||
struct VtkWriteEnthalpies { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
@@ -85,6 +77,7 @@ public:
|
||||
VtkEnergyModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -92,18 +85,7 @@ public:
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteSolidInternalEnergy>
|
||||
("Include the volumetric internal energy of solid"
|
||||
"matrix in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteThermalConductivity>
|
||||
("Include the total thermal conductivity of the"
|
||||
"medium in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEnthalpies>
|
||||
("Include the specific enthalpy of the phases in "
|
||||
"the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteInternalEnergies>
|
||||
("Include the specific internal energy of the "
|
||||
"phases in the VTK output files");
|
||||
VtkEnergyParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -112,16 +94,20 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (enthalpyOutput_())
|
||||
if (params_.enthalpyOutput_) {
|
||||
this->resizePhaseBuffer_(enthalpy_);
|
||||
if (internalEnergyOutput_())
|
||||
}
|
||||
if (params_.internalEnergyOutput_) {
|
||||
this->resizePhaseBuffer_(internalEnergy_);
|
||||
}
|
||||
|
||||
if (solidInternalEnergyOutput_())
|
||||
if (params_.solidInternalEnergyOutput_) {
|
||||
this->resizeScalarBuffer_(solidInternalEnergy_);
|
||||
if (thermalConductivityOutput_())
|
||||
}
|
||||
if (params_.thermalConductivityOutput_) {
|
||||
this->resizeScalarBuffer_(thermalConductivity_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quanties relevant
|
||||
@@ -138,19 +124,23 @@ public:
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
if (solidInternalEnergyOutput_())
|
||||
if (params_.solidInternalEnergyOutput_) {
|
||||
solidInternalEnergy_[I] = Toolbox::value(intQuants.solidInternalEnergy());
|
||||
if (thermalConductivityOutput_())
|
||||
}
|
||||
if (params_.thermalConductivityOutput_) {
|
||||
thermalConductivity_[I] = Toolbox::value(intQuants.thermalConductivity());
|
||||
}
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (enthalpyOutput_())
|
||||
if (params_.enthalpyOutput_) {
|
||||
enthalpy_[phaseIdx][I] = Toolbox::value(fs.enthalpy(phaseIdx));
|
||||
if (internalEnergyOutput_())
|
||||
}
|
||||
if (params_.internalEnergyOutput_) {
|
||||
internalEnergy_[phaseIdx][I] = Toolbox::value(fs.internalEnergy(phaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -162,49 +152,30 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (solidInternalEnergyOutput_())
|
||||
if (params_.solidInternalEnergyOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "internalEnergySolid", solidInternalEnergy_);
|
||||
if (thermalConductivityOutput_())
|
||||
}
|
||||
if (params_.thermalConductivityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "thermalConductivity", thermalConductivity_);
|
||||
}
|
||||
|
||||
if (enthalpyOutput_())
|
||||
if (params_.enthalpyOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "enthalpy_%s", enthalpy_);
|
||||
if (internalEnergyOutput_())
|
||||
}
|
||||
if (params_.internalEnergyOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "internalEnergy_%s", internalEnergy_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool solidInternalEnergyOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSolidInternalEnergy>();
|
||||
return val;
|
||||
}
|
||||
VtkEnergyParams params_{};
|
||||
PhaseBuffer enthalpy_{};
|
||||
PhaseBuffer internalEnergy_{};
|
||||
|
||||
static bool thermalConductivityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteThermalConductivity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool enthalpyOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteEnthalpies>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool internalEnergyOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteInternalEnergies>();
|
||||
return val;
|
||||
}
|
||||
|
||||
PhaseBuffer enthalpy_;
|
||||
PhaseBuffer internalEnergy_;
|
||||
|
||||
ScalarBuffer thermalConductivity_;
|
||||
ScalarBuffer solidInternalEnergy_;
|
||||
ScalarBuffer thermalConductivity_{};
|
||||
ScalarBuffer solidInternalEnergy_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_ENERGY_MODULE_HPP
|
||||
55
opm/models/io/vtkenergyparams.cpp
Normal file
55
opm/models/io/vtkenergyparams.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkenergyparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkEnergyParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteSolidInternalEnergy>
|
||||
("Include the volumetric internal energy of solid"
|
||||
"matrix in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteThermalConductivity>
|
||||
("Include the total thermal conductivity of the"
|
||||
"medium in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEnthalpies>
|
||||
("Include the specific enthalpy of the phases in "
|
||||
"the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteInternalEnergies>
|
||||
("Include the specific internal energy of the "
|
||||
"phases in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkEnergyParams::read()
|
||||
{
|
||||
solidInternalEnergyOutput_ = Parameters::Get<Parameters::VtkWriteSolidInternalEnergy>();
|
||||
thermalConductivityOutput_ = Parameters::Get<Parameters::VtkWriteThermalConductivity>();
|
||||
enthalpyOutput_ = Parameters::Get<Parameters::VtkWriteEnthalpies>();
|
||||
internalEnergyOutput_ = Parameters::Get<Parameters::VtkWriteInternalEnergies>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
61
opm/models/io/vtkenergyparams.hpp
Normal file
61
opm/models/io/vtkenergyparams.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// -*- 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::VtkEnergyModule
|
||||
*/
|
||||
#ifndef OPM_VTK_ENERGY_PARAMS_HPP
|
||||
#define OPM_VTK_ENERGY_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteSolidInternalEnergy { static constexpr bool value = false; };
|
||||
struct VtkWriteThermalConductivity { static constexpr bool value = false; };
|
||||
struct VtkWriteInternalEnergies { static constexpr bool value = false; };
|
||||
struct VtkWriteEnthalpies { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkEnergyModule.
|
||||
*/
|
||||
struct VtkEnergyParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool solidInternalEnergyOutput_;
|
||||
bool thermalConductivityOutput_;
|
||||
bool enthalpyOutput_;
|
||||
bool internalEnergyOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_ENERGY_PARAMS_HPP
|
||||
@@ -24,8 +24,8 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkMultiPhaseModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_MULTI_PHASE_MODULE_HH
|
||||
#define EWOMS_VTK_MULTI_PHASE_MODULE_HH
|
||||
#ifndef OPM_VTK_MULTI_PHASE_MODULE_HPP
|
||||
#define OPM_VTK_MULTI_PHASE_MODULE_HPP
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiphaseparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
@@ -42,24 +43,6 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteExtrusionFactor { static constexpr bool value = false; };
|
||||
struct VtkWritePressures { static constexpr bool value = true; };
|
||||
struct VtkWriteDensities { static constexpr bool value = true; };
|
||||
struct VtkWriteSaturations { static constexpr bool value = true; };
|
||||
struct VtkWriteMobilities { static constexpr bool value = false; };
|
||||
struct VtkWriteRelativePermeabilities { static constexpr bool value = true; };
|
||||
struct VtkWriteViscosities { static constexpr bool value = false; };
|
||||
struct VtkWriteAverageMolarMasses { static constexpr bool value = false; };
|
||||
struct VtkWritePorosity { static constexpr bool value = true; };
|
||||
struct VtkWriteIntrinsicPermeabilities { static constexpr bool value = false; };
|
||||
struct VtkWritePotentialGradients { static constexpr bool value = false; };
|
||||
struct VtkWriteFilterVelocities { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
@@ -111,37 +94,16 @@ class VtkMultiPhaseModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkMultiPhaseModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{}
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteExtrusionFactor>
|
||||
("Include the extrusion factor of the degrees of freedom into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePressures>
|
||||
("Include the phase pressures in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDensities>
|
||||
("Include the phase densities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturations>
|
||||
("Include the phase saturations in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMobilities>
|
||||
("Include the phase mobilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteRelativePermeabilities>
|
||||
("Include the phase relative permeabilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteViscosities>
|
||||
("Include component phase viscosities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteAverageMolarMasses>
|
||||
("Include the average phase mass in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePorosity>
|
||||
("Include the porosity in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteIntrinsicPermeabilities>
|
||||
("Include the intrinsic permeability in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFilterVelocities>
|
||||
("Include in the filter velocities of the phases the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePotentialGradients>
|
||||
("Include the phase pressure potential gradients in the VTK output files");
|
||||
VtkMultiPhaseParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -150,19 +112,39 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (extrusionFactorOutput_()) this->resizeScalarBuffer_(extrusionFactor_);
|
||||
if (pressureOutput_()) this->resizePhaseBuffer_(pressure_);
|
||||
if (densityOutput_()) this->resizePhaseBuffer_(density_);
|
||||
if (saturationOutput_()) this->resizePhaseBuffer_(saturation_);
|
||||
if (mobilityOutput_()) this->resizePhaseBuffer_(mobility_);
|
||||
if (relativePermeabilityOutput_()) this->resizePhaseBuffer_(relativePermeability_);
|
||||
if (viscosityOutput_()) this->resizePhaseBuffer_(viscosity_);
|
||||
if (averageMolarMassOutput_()) this->resizePhaseBuffer_(averageMolarMass_);
|
||||
if (params_.extrusionFactorOutput_) {
|
||||
this->resizeScalarBuffer_(extrusionFactor_);
|
||||
}
|
||||
if (params_.pressureOutput_) {
|
||||
this->resizePhaseBuffer_(pressure_);
|
||||
}
|
||||
if (params_.densityOutput_) {
|
||||
this->resizePhaseBuffer_(density_);
|
||||
}
|
||||
if (params_.saturationOutput_) {
|
||||
this->resizePhaseBuffer_(saturation_);
|
||||
}
|
||||
if (params_.mobilityOutput_) {
|
||||
this->resizePhaseBuffer_(mobility_);
|
||||
}
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
this->resizePhaseBuffer_(relativePermeability_);
|
||||
}
|
||||
if (params_.viscosityOutput_) {
|
||||
this->resizePhaseBuffer_(viscosity_);
|
||||
}
|
||||
if (params_.averageMolarMassOutput_) {
|
||||
this->resizePhaseBuffer_(averageMolarMass_);
|
||||
}
|
||||
|
||||
if (porosityOutput_()) this->resizeScalarBuffer_(porosity_);
|
||||
if (intrinsicPermeabilityOutput_()) this->resizeTensorBuffer_(intrinsicPermeability_);
|
||||
if (params_.porosityOutput_) {
|
||||
this->resizeScalarBuffer_(porosity_);
|
||||
}
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
this->resizeTensorBuffer_(intrinsicPermeability_);
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
size_t nDof = this->simulator_.model().numGridDof();
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
velocity_[phaseIdx].resize(nDof);
|
||||
@@ -174,7 +156,7 @@ public:
|
||||
this->resizePhaseBuffer_(velocityWeight_);
|
||||
}
|
||||
|
||||
if (potentialGradientOutput_()) {
|
||||
if (params_.potentialGradientOutput_) {
|
||||
size_t nDof = this->simulator_.model().numGridDof();
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
potentialGradient_[phaseIdx].resize(nDof);
|
||||
@@ -204,38 +186,51 @@ public:
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
if (extrusionFactorOutput_()) extrusionFactor_[I] = intQuants.extrusionFactor();
|
||||
if (porosityOutput_()) porosity_[I] = getValue(intQuants.porosity());
|
||||
if (params_.extrusionFactorOutput_) {
|
||||
extrusionFactor_[I] = intQuants.extrusionFactor();
|
||||
}
|
||||
if (params_.porosityOutput_) {
|
||||
porosity_[I] = getValue(intQuants.porosity());
|
||||
}
|
||||
|
||||
if (intrinsicPermeabilityOutput_()) {
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
const auto& K = problem.intrinsicPermeability(elemCtx, i, /*timeIdx=*/0);
|
||||
for (unsigned rowIdx = 0; rowIdx < K.rows; ++rowIdx)
|
||||
for (unsigned colIdx = 0; colIdx < K.cols; ++colIdx)
|
||||
for (unsigned rowIdx = 0; rowIdx < K.rows; ++rowIdx) {
|
||||
for (unsigned colIdx = 0; colIdx < K.cols; ++colIdx) {
|
||||
intrinsicPermeability_[I][rowIdx][colIdx] = K[rowIdx][colIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
continue;
|
||||
}
|
||||
if (pressureOutput_())
|
||||
if (params_.pressureOutput_) {
|
||||
pressure_[phaseIdx][I] = getValue(fs.pressure(phaseIdx));
|
||||
if (densityOutput_())
|
||||
}
|
||||
if (params_.densityOutput_) {
|
||||
density_[phaseIdx][I] = getValue(fs.density(phaseIdx));
|
||||
if (saturationOutput_())
|
||||
}
|
||||
if (params_.saturationOutput_) {
|
||||
saturation_[phaseIdx][I] = getValue(fs.saturation(phaseIdx));
|
||||
if (mobilityOutput_())
|
||||
}
|
||||
if (params_.mobilityOutput_) {
|
||||
mobility_[phaseIdx][I] = getValue(intQuants.mobility(phaseIdx));
|
||||
if (relativePermeabilityOutput_())
|
||||
}
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
relativePermeability_[phaseIdx][I] = getValue(intQuants.relativePermeability(phaseIdx));
|
||||
if (viscosityOutput_())
|
||||
}
|
||||
if (params_.viscosityOutput_) {
|
||||
viscosity_[phaseIdx][I] = getValue(fs.viscosity(phaseIdx));
|
||||
if (averageMolarMassOutput_())
|
||||
}
|
||||
if (params_.averageMolarMassOutput_) {
|
||||
averageMolarMass_[phaseIdx][I] = getValue(fs.averageMolarMass(phaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (potentialGradientOutput_()) {
|
||||
if (params_.potentialGradientOutput_) {
|
||||
// calculate velocities if requested
|
||||
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
||||
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
||||
@@ -250,14 +245,15 @@ public:
|
||||
|
||||
const auto& inputPGrad = extQuants.potentialGrad(phaseIdx);
|
||||
DimVector pGrad;
|
||||
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
|
||||
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
|
||||
pGrad[dimIdx] = getValue(inputPGrad[dimIdx])*weight;
|
||||
}
|
||||
potentialGradient_[phaseIdx][I] += pGrad;
|
||||
} // end for all phases
|
||||
} // end for all faces
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
// calculate velocities if requested
|
||||
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
||||
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
||||
@@ -277,10 +273,12 @@ public:
|
||||
|
||||
const auto& inputV = extQuants.filterVelocity(phaseIdx);
|
||||
DimVector v;
|
||||
for (unsigned k = 0; k < dimWorld; ++k)
|
||||
for (unsigned k = 0; k < dimWorld; ++k) {
|
||||
v[k] = getValue(inputV[k]);
|
||||
if (v.two_norm() > 1e-20)
|
||||
}
|
||||
if (v.two_norm() > 1e-20) {
|
||||
weight /= v.two_norm();
|
||||
}
|
||||
v *= weight;
|
||||
|
||||
velocity_[phaseIdx][I] += v;
|
||||
@@ -299,39 +297,51 @@ public:
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (extrusionFactorOutput_())
|
||||
if (params_.extrusionFactorOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "extrusionFactor", extrusionFactor_);
|
||||
if (pressureOutput_())
|
||||
}
|
||||
if (params_.pressureOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "pressure_%s", pressure_);
|
||||
if (densityOutput_())
|
||||
}
|
||||
if (params_.densityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "density_%s", density_);
|
||||
if (saturationOutput_())
|
||||
}
|
||||
if (params_.saturationOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "saturation_%s", saturation_);
|
||||
if (mobilityOutput_())
|
||||
}
|
||||
if (params_.mobilityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "mobility_%s", mobility_);
|
||||
if (relativePermeabilityOutput_())
|
||||
}
|
||||
if (params_.relativePermeabilityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "relativePerm_%s", relativePermeability_);
|
||||
if (viscosityOutput_())
|
||||
}
|
||||
if (params_.viscosityOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "viscosity_%s", viscosity_);
|
||||
if (averageMolarMassOutput_())
|
||||
}
|
||||
if (params_.averageMolarMassOutput_) {
|
||||
this->commitPhaseBuffer_(baseWriter, "averageMolarMass_%s", averageMolarMass_);
|
||||
}
|
||||
|
||||
if (porosityOutput_())
|
||||
if (params_.porosityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "porosity", porosity_);
|
||||
if (intrinsicPermeabilityOutput_())
|
||||
}
|
||||
if (params_.intrinsicPermeabilityOutput_) {
|
||||
this->commitTensorBuffer_(baseWriter, "intrinsicPerm", intrinsicPermeability_);
|
||||
}
|
||||
|
||||
if (velocityOutput_()) {
|
||||
if (params_.velocityOutput_) {
|
||||
size_t numDof = this->simulator_.model().numGridDof();
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
// first, divide the velocity field by the
|
||||
// respective finite volume's surface area
|
||||
for (unsigned i = 0; i < numDof; ++i)
|
||||
for (unsigned i = 0; i < numDof; ++i) {
|
||||
velocity_[phaseIdx][i] /= velocityWeight_[phaseIdx][i];
|
||||
}
|
||||
// commit the phase velocity
|
||||
char name[512];
|
||||
snprintf(name, 512, "filterVelocity_%s", FluidSystem::phaseName(phaseIdx).data());
|
||||
@@ -340,14 +350,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (potentialGradientOutput_()) {
|
||||
if (params_.potentialGradientOutput_) {
|
||||
size_t numDof = this->simulator_.model().numGridDof();
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
// first, divide the velocity field by the
|
||||
// respective finite volume's surface area
|
||||
for (unsigned i = 0; i < numDof; ++i)
|
||||
for (unsigned i = 0; i < numDof; ++i) {
|
||||
potentialGradient_[phaseIdx][i] /= potentialWeight_[phaseIdx][i];
|
||||
}
|
||||
// commit the phase velocity
|
||||
char name[512];
|
||||
snprintf(name, 512, "gradP_%s", FluidSystem::phaseName(phaseIdx).data());
|
||||
@@ -367,103 +378,32 @@ public:
|
||||
* returning true here does not do any harm from the correctness perspective, but it
|
||||
* slows down writing the output fields.
|
||||
*/
|
||||
virtual bool needExtensiveQuantities() const final
|
||||
bool needExtensiveQuantities() const final
|
||||
{
|
||||
return velocityOutput_() || potentialGradientOutput_();
|
||||
return params_.velocityOutput_ || params_.potentialGradientOutput_;
|
||||
}
|
||||
|
||||
private:
|
||||
static bool extrusionFactorOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteExtrusionFactor>();
|
||||
return val;
|
||||
}
|
||||
VtkMultiPhaseParams params_{};
|
||||
ScalarBuffer extrusionFactor_{};
|
||||
PhaseBuffer pressure_{};
|
||||
PhaseBuffer density_{};
|
||||
PhaseBuffer saturation_{};
|
||||
PhaseBuffer mobility_{};
|
||||
PhaseBuffer relativePermeability_{};
|
||||
PhaseBuffer viscosity_{};
|
||||
PhaseBuffer averageMolarMass_{};
|
||||
|
||||
static bool pressureOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePressures>();
|
||||
return val;
|
||||
}
|
||||
ScalarBuffer porosity_{};
|
||||
TensorBuffer intrinsicPermeability_{};
|
||||
|
||||
static bool densityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteDensities>();
|
||||
return val;
|
||||
}
|
||||
PhaseVectorBuffer velocity_{};
|
||||
PhaseBuffer velocityWeight_{};
|
||||
|
||||
static bool saturationOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteSaturations>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool mobilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteMobilities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool relativePermeabilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteRelativePermeabilities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool viscosityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteViscosities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool averageMolarMassOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteAverageMolarMasses>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool porosityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePorosity>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool intrinsicPermeabilityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteIntrinsicPermeabilities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool velocityOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteFilterVelocities>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool potentialGradientOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePotentialGradients>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer extrusionFactor_;
|
||||
PhaseBuffer pressure_;
|
||||
PhaseBuffer density_;
|
||||
PhaseBuffer saturation_;
|
||||
PhaseBuffer mobility_;
|
||||
PhaseBuffer relativePermeability_;
|
||||
PhaseBuffer viscosity_;
|
||||
PhaseBuffer averageMolarMass_;
|
||||
|
||||
ScalarBuffer porosity_;
|
||||
TensorBuffer intrinsicPermeability_;
|
||||
|
||||
PhaseVectorBuffer velocity_;
|
||||
PhaseBuffer velocityWeight_;
|
||||
|
||||
PhaseVectorBuffer potentialGradient_;
|
||||
PhaseBuffer potentialWeight_;
|
||||
PhaseVectorBuffer potentialGradient_{};
|
||||
PhaseBuffer potentialWeight_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_MULTI_PHASE_MODULE_HPP
|
||||
75
opm/models/io/vtkmultiphaseparams.cpp
Normal file
75
opm/models/io/vtkmultiphaseparams.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkmultiphaseparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkMultiPhaseParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteExtrusionFactor>
|
||||
("Include the extrusion factor of the degrees of freedom into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePressures>
|
||||
("Include the phase pressures in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDensities>
|
||||
("Include the phase densities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteSaturations>
|
||||
("Include the phase saturations in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteMobilities>
|
||||
("Include the phase mobilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteRelativePermeabilities>
|
||||
("Include the phase relative permeabilities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteViscosities>
|
||||
("Include component phase viscosities in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteAverageMolarMasses>
|
||||
("Include the average phase mass in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePorosity>
|
||||
("Include the porosity in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteIntrinsicPermeabilities>
|
||||
("Include the intrinsic permeability in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteFilterVelocities>
|
||||
("Include in the filter velocities of the phases the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWritePotentialGradients>
|
||||
("Include the phase pressure potential gradients in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkMultiPhaseParams::read()
|
||||
{
|
||||
extrusionFactorOutput_ = Parameters::Get<Parameters::VtkWriteExtrusionFactor>();
|
||||
pressureOutput_ = Parameters::Get<Parameters::VtkWritePressures>();
|
||||
densityOutput_ = Parameters::Get<Parameters::VtkWriteDensities>();
|
||||
saturationOutput_ = Parameters::Get<Parameters::VtkWriteSaturations>();
|
||||
mobilityOutput_ = Parameters::Get<Parameters::VtkWriteMobilities>();
|
||||
relativePermeabilityOutput_ = Parameters::Get<Parameters::VtkWriteRelativePermeabilities>();
|
||||
viscosityOutput_ = Parameters::Get<Parameters::VtkWriteViscosities>();
|
||||
averageMolarMassOutput_ = Parameters::Get<Parameters::VtkWriteAverageMolarMasses>();
|
||||
porosityOutput_ = Parameters::Get<Parameters::VtkWritePorosity>();
|
||||
intrinsicPermeabilityOutput_ = Parameters::Get<Parameters::VtkWriteIntrinsicPermeabilities>();
|
||||
velocityOutput_ = Parameters::Get<Parameters::VtkWriteFilterVelocities>();
|
||||
potentialGradientOutput_ = Parameters::Get<Parameters::VtkWritePotentialGradients>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
77
opm/models/io/vtkmultiphaseparams.hpp
Normal file
77
opm/models/io/vtkmultiphaseparams.hpp
Normal file
@@ -0,0 +1,77 @@
|
||||
// -*- 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::VtkMultiPhaseModule
|
||||
*/
|
||||
#ifndef OPM_VTK_MULTI_PHASE_PARAMS_HPP
|
||||
#define OPM_VTK_MULTI_PHASE_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteExtrusionFactor { static constexpr bool value = false; };
|
||||
struct VtkWritePressures { static constexpr bool value = true; };
|
||||
struct VtkWriteDensities { static constexpr bool value = true; };
|
||||
struct VtkWriteSaturations { static constexpr bool value = true; };
|
||||
struct VtkWriteMobilities { static constexpr bool value = false; };
|
||||
struct VtkWriteRelativePermeabilities { static constexpr bool value = true; };
|
||||
struct VtkWriteViscosities { static constexpr bool value = false; };
|
||||
struct VtkWriteAverageMolarMasses { static constexpr bool value = false; };
|
||||
struct VtkWritePorosity { static constexpr bool value = true; };
|
||||
struct VtkWriteIntrinsicPermeabilities { static constexpr bool value = false; };
|
||||
struct VtkWritePotentialGradients { static constexpr bool value = false; };
|
||||
struct VtkWriteFilterVelocities { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkMultiPhaseModule.
|
||||
*/
|
||||
struct VtkMultiPhaseParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool extrusionFactorOutput_;
|
||||
bool pressureOutput_;
|
||||
bool densityOutput_;
|
||||
bool saturationOutput_;
|
||||
bool mobilityOutput_;
|
||||
bool relativePermeabilityOutput_;
|
||||
bool viscosityOutput_;
|
||||
bool averageMolarMassOutput_;
|
||||
bool porosityOutput_;
|
||||
bool intrinsicPermeabilityOutput_;
|
||||
bool velocityOutput_;
|
||||
bool potentialGradientOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_MULTI_PHASE_MODULE_HPP
|
||||
@@ -24,24 +24,20 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkPhasePresenceModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_PHASE_PRESENCE_MODULE_HH
|
||||
#define EWOMS_VTK_PHASE_PRESENCE_MODULE_HH
|
||||
#ifndef OPM_VTK_PHASE_PRESENCE_MODULE_HPP
|
||||
#define OPM_VTK_PHASE_PRESENCE_MODULE_HPP
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkphasepresenceparams.hpp>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
struct VtkWritePhasePresence { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \ingroup Vtk
|
||||
*
|
||||
@@ -66,16 +62,16 @@ class VtkPhasePresenceModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkPhasePresenceModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWritePhasePresence>
|
||||
("Include the phase presence pseudo primary "
|
||||
"variable in the VTK output files");
|
||||
VtkPhasePresenceParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -84,7 +80,9 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (phasePresenceOutput_()) this->resizeScalarBuffer_(phasePresence_);
|
||||
if (params_.phasePresenceOutput_) {
|
||||
this->resizeScalarBuffer_(phasePresence_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -102,10 +100,11 @@ public:
|
||||
int phasePresence = elemCtx.primaryVars(i, /*timeIdx=*/0).phasePresence();
|
||||
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);
|
||||
|
||||
if (phasePresenceOutput_())
|
||||
if (params_.phasePresenceOutput_) {
|
||||
phasePresence_[I] = phasePresence;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the output writer.
|
||||
@@ -117,20 +116,16 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (phasePresenceOutput_())
|
||||
if (params_.phasePresenceOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "phase presence", phasePresence_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool phasePresenceOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePhasePresence>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer phasePresence_;
|
||||
VtkPhasePresenceParams params_{};
|
||||
ScalarBuffer phasePresence_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_PHASE_PRESENCE_MODULE_HPP
|
||||
43
opm/models/io/vtkphasepresenceparams.cpp
Normal file
43
opm/models/io/vtkphasepresenceparams.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkphasepresenceparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkPhasePresenceParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWritePhasePresence>
|
||||
("Include the phase presence pseudo primary "
|
||||
"variable in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkPhasePresenceParams::read()
|
||||
{
|
||||
phasePresenceOutput_ = Parameters::Get<Parameters::VtkWritePhasePresence>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
54
opm/models/io/vtkphasepresenceparams.hpp
Normal file
54
opm/models/io/vtkphasepresenceparams.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
// -*- 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::VtkPhasePresenceModule
|
||||
*/
|
||||
#ifndef OPM_VTK_PHASE_PRESENCE_PARAMS_HPP
|
||||
#define OPM_VTK_PHASE_PRESENCE_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
struct VtkWritePhasePresence { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkPhasePresenceModule.
|
||||
*/
|
||||
struct VtkPhasePresenceParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool phasePresenceOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_PHASE_PRESENCE_PARAMS_HPP
|
||||
@@ -24,25 +24,18 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkPrimaryVarsModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_PRIMARY_VARS_MODULE_HH
|
||||
#define EWOMS_VTK_PRIMARY_VARS_MODULE_HH
|
||||
#ifndef OPM_VTK_PRIMARY_VARS_MODULE_HPP
|
||||
#define OPM_VTK_PRIMARY_VARS_MODULE_HPP
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
#include <opm/models/io/vtkprimaryvarsparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
struct VtkWritePrimaryVars { static constexpr bool value = false; };
|
||||
struct VtkWriteProcessRank { static constexpr bool value = false; };
|
||||
struct VtkWriteDofIndex { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
@@ -70,19 +63,16 @@ class VtkPrimaryVarsModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkPrimaryVarsModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWritePrimaryVars>
|
||||
("Include the primary variables into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteProcessRank>
|
||||
("Include the MPI process rank into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDofIndex>
|
||||
("Include the index of the degrees of freedom into the VTK output files");
|
||||
VtkPrimaryVarsParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -91,14 +81,17 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (primaryVarsOutput_())
|
||||
if (params_.primaryVarsOutput_) {
|
||||
this->resizeEqBuffer_(primaryVars_);
|
||||
if (processRankOutput_())
|
||||
}
|
||||
if (params_.processRankOutput_) {
|
||||
this->resizeScalarBuffer_(processRank_,
|
||||
/*bufferType=*/ParentType::ElementBuffer);
|
||||
if (dofIndexOutput_())
|
||||
}
|
||||
if (params_.dofIndexOutput_) {
|
||||
this->resizeScalarBuffer_(dofIndex_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
@@ -112,22 +105,25 @@ public:
|
||||
|
||||
const auto& elementMapper = elemCtx.model().elementMapper();
|
||||
unsigned elemIdx = static_cast<unsigned>(elementMapper.index(elemCtx.element()));
|
||||
if (processRankOutput_() && !processRank_.empty())
|
||||
if (params_.processRankOutput_ && !processRank_.empty()) {
|
||||
processRank_[elemIdx] = static_cast<unsigned>(this->simulator_.gridView().comm().rank());
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
|
||||
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);
|
||||
const auto& priVars = elemCtx.primaryVars(i, /*timeIdx=*/0);
|
||||
|
||||
if (dofIndexOutput_())
|
||||
if (params_.dofIndexOutput_) {
|
||||
dofIndex_[I] = I;
|
||||
}
|
||||
|
||||
for (unsigned eqIdx = 0; eqIdx < numEq; ++eqIdx) {
|
||||
if (primaryVarsOutput_() && !primaryVars_[eqIdx].empty())
|
||||
if (params_.primaryVarsOutput_ && !primaryVars_[eqIdx].empty()) {
|
||||
primaryVars_[eqIdx][I] = priVars[eqIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -139,39 +135,27 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (primaryVarsOutput_())
|
||||
if (params_.primaryVarsOutput_) {
|
||||
this->commitPriVarsBuffer_(baseWriter, "PV_%s", primaryVars_);
|
||||
if (processRankOutput_())
|
||||
}
|
||||
if (params_.processRankOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter,
|
||||
"process rank",
|
||||
processRank_,
|
||||
/*bufferType=*/ParentType::ElementBuffer);
|
||||
if (dofIndexOutput_())
|
||||
}
|
||||
if (params_.dofIndexOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "DOF index", dofIndex_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool primaryVarsOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWritePrimaryVars>();
|
||||
return val;
|
||||
}
|
||||
static bool processRankOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteProcessRank>();
|
||||
return val;
|
||||
}
|
||||
static bool dofIndexOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteDofIndex>();
|
||||
return val;
|
||||
}
|
||||
|
||||
EqBuffer primaryVars_;
|
||||
ScalarBuffer processRank_;
|
||||
ScalarBuffer dofIndex_;
|
||||
VtkPrimaryVarsParams params_{};
|
||||
EqBuffer primaryVars_{};
|
||||
ScalarBuffer processRank_{};
|
||||
ScalarBuffer dofIndex_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_PRIMARY_VARS_MODULE_HPP
|
||||
48
opm/models/io/vtkprimaryvarsparams.cpp
Normal file
48
opm/models/io/vtkprimaryvarsparams.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkprimaryvarsparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkPrimaryVarsParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWritePrimaryVars>
|
||||
("Include the primary variables into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteProcessRank>
|
||||
("Include the MPI process rank into the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteDofIndex>
|
||||
("Include the index of the degrees of freedom into the VTK output files");
|
||||
}
|
||||
|
||||
void VtkPrimaryVarsParams::read()
|
||||
{
|
||||
primaryVarsOutput_ = Parameters::Get<Parameters::VtkWritePrimaryVars>();
|
||||
processRankOutput_ = Parameters::Get<Parameters::VtkWriteProcessRank>();
|
||||
dofIndexOutput_ = Parameters::Get<Parameters::VtkWriteDofIndex>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
58
opm/models/io/vtkprimaryvarsparams.hpp
Normal file
58
opm/models/io/vtkprimaryvarsparams.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// -*- 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::VtkPrimaryVarsModule
|
||||
*/
|
||||
#ifndef OPM_VTK_PRIMARY_VARS_PARAMS_HPP
|
||||
#define OPM_VTK_PRIMARY_VARS_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
struct VtkWritePrimaryVars { static constexpr bool value = false; };
|
||||
struct VtkWriteProcessRank { static constexpr bool value = false; };
|
||||
struct VtkWriteDofIndex { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkPrimaryPhaseModule.
|
||||
*/
|
||||
struct VtkPrimaryVarsParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool primaryVarsOutput_;
|
||||
bool processRankOutput_;
|
||||
bool dofIndexOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_PRIMARY_VARS_PARAMS_HPP
|
||||
@@ -24,8 +24,8 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkPTFlashModule
|
||||
*/
|
||||
#ifndef OPM_VTK_PTFLASH_MODULE_HH
|
||||
#define OPM_VTK_PTFLASH_MODULE_HH
|
||||
#ifndef OPM_VTK_PTFLASH_MODULE_HPP
|
||||
#define OPM_VTK_PTFLASH_MODULE_HPP
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
|
||||
@@ -33,18 +33,11 @@
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
#include <opm/models/io/vtkptflashparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteLiquidMoleFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteEquilibriumConstants { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
@@ -79,17 +72,16 @@ class VtkPTFlashModule: public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
explicit VtkPTFlashModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteLiquidMoleFractions>
|
||||
("Include liquid mole fractions (L) in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEquilibriumConstants>
|
||||
("Include equilibrium constants (K) in the VTK output files");
|
||||
VtkPtFlashParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -98,11 +90,13 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (LOutput_())
|
||||
if (params_.LOutput_) {
|
||||
this->resizeScalarBuffer_(L_);
|
||||
if (equilConstOutput_())
|
||||
}
|
||||
if (params_.equilConstOutput_) {
|
||||
this->resizeComponentBuffer_(K_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant
|
||||
@@ -121,15 +115,17 @@ public:
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
if (LOutput_())
|
||||
if (params_.LOutput_) {
|
||||
L_[I] = Toolbox::value(fs.L());
|
||||
}
|
||||
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (equilConstOutput_())
|
||||
if (params_.equilConstOutput_) {
|
||||
K_[compIdx][I] = Toolbox::value(fs.K(compIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -141,29 +137,20 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (equilConstOutput_())
|
||||
if (params_.equilConstOutput_) {
|
||||
this->commitComponentBuffer_(baseWriter, "K^%s", K_);
|
||||
if (LOutput_())
|
||||
}
|
||||
if (params_.LOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "L", L_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool LOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteLiquidMoleFractions>();
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool equilConstOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteEquilibriumConstants>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ComponentBuffer K_;
|
||||
ScalarBuffer L_;
|
||||
VtkPtFlashParams params_{};
|
||||
ComponentBuffer K_{};
|
||||
ScalarBuffer L_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_PTFLASH_MODULE_HPP
|
||||
45
opm/models/io/vtkptflashparams.cpp
Normal file
45
opm/models/io/vtkptflashparams.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtkptflashparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkPtFlashParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteLiquidMoleFractions>
|
||||
("Include liquid mole fractions (L) in the VTK output files");
|
||||
Parameters::Register<Parameters::VtkWriteEquilibriumConstants>
|
||||
("Include equilibrium constants (K) in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkPtFlashParams::read()
|
||||
{
|
||||
LOutput_ = Parameters::Get<Parameters::VtkWriteLiquidMoleFractions>();
|
||||
equilConstOutput_ = Parameters::Get<Parameters::VtkWriteEquilibriumConstants>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
57
opm/models/io/vtkptflashparams.hpp
Normal file
57
opm/models/io/vtkptflashparams.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// -*- 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::VtkPTFlashModule
|
||||
*/
|
||||
#ifndef OPM_VTK_PTFLASH_PARAMS_HPP
|
||||
#define OPM_VTK_PTFLASH_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteLiquidMoleFractions { static constexpr bool value = false; };
|
||||
struct VtkWriteEquilibriumConstants { static constexpr bool value = false; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkPtFlashModule.
|
||||
*/
|
||||
struct VtkPtFlashParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool LOutput_;
|
||||
bool equilConstOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_PTFLASH_MODULE_HPP
|
||||
@@ -24,8 +24,8 @@
|
||||
* \file
|
||||
* \copydoc Opm::VtkTemperatureModule
|
||||
*/
|
||||
#ifndef EWOMS_VTK_TEMPERATURE_MODULE_HH
|
||||
#define EWOMS_VTK_TEMPERATURE_MODULE_HH
|
||||
#ifndef OPM_VTK_TEMPERATURE_MODULE_HPP
|
||||
#define OPM_VTK_TEMPERATURE_MODULE_HPP
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
|
||||
@@ -33,17 +33,11 @@
|
||||
|
||||
#include <opm/models/io/baseoutputmodule.hh>
|
||||
#include <opm/models/io/vtkmultiwriter.hh>
|
||||
#include <opm/models/io/vtktemperatureparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteTemperature { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
@@ -71,15 +65,16 @@ class VtkTemperatureModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkTemperatureModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{}
|
||||
{
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the Vtk output module.
|
||||
*/
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteTemperature>
|
||||
("Include the temperature in the VTK output files");
|
||||
VtkTemperatureParams::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -88,7 +83,9 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (temperatureOutput_()) this->resizeScalarBuffer_(temperature_);
|
||||
if (params_.temperatureOutput_) {
|
||||
this->resizeScalarBuffer_(temperature_);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -108,10 +105,11 @@ public:
|
||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
if (temperatureOutput_())
|
||||
if (params_.temperatureOutput_) {
|
||||
temperature_[I] = Toolbox::value(fs.temperature(/*phaseIdx=*/0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add all buffers to the VTK output writer.
|
||||
@@ -123,20 +121,16 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (temperatureOutput_())
|
||||
if (params_.temperatureOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "temperature", temperature_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static bool temperatureOutput_()
|
||||
{
|
||||
static bool val = Parameters::Get<Parameters::VtkWriteTemperature>();
|
||||
return val;
|
||||
}
|
||||
|
||||
ScalarBuffer temperature_;
|
||||
VtkTemperatureParams params_{};
|
||||
ScalarBuffer temperature_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif
|
||||
#endif // OPM_VTK_TEMPERATURE_MODULE_HPP
|
||||
42
opm/models/io/vtktemperatureparams.cpp
Normal file
42
opm/models/io/vtktemperatureparams.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/io/vtktemperatureparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void VtkTemperatureParams::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::VtkWriteTemperature>
|
||||
("Include the temperature in the VTK output files");
|
||||
}
|
||||
|
||||
void VtkTemperatureParams::read()
|
||||
{
|
||||
temperatureOutput_ = Parameters::Get<Parameters::VtkWriteTemperature>();
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
55
opm/models/io/vtktemperatureparams.hpp
Normal file
55
opm/models/io/vtktemperatureparams.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
// -*- 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::VtkTemperatureModule
|
||||
*/
|
||||
#ifndef OPM_VTK_TEMPERATURE_PARAMS_HPP
|
||||
#define OPM_VTK_TEMPERATURE_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// set default values for what quantities to output
|
||||
struct VtkWriteTemperature { static constexpr bool value = true; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for VtkTemperatureModule.
|
||||
*/
|
||||
struct VtkTemperatureParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool temperatureOutput_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_VTK_TEMPERATURE_PARAMS_HPP
|
||||
@@ -45,9 +45,9 @@
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
#include <opm/models/common/diffusionmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
namespace Opm {
|
||||
template <class TypeTag>
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#define EWOMS_NCP_PROPERTIES_HH
|
||||
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/models/nonlinear/newtonmethodparameters.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
#include <opm/models/nonlinear/newtonmethodproperties.hh>
|
||||
#include <opm/models/nonlinear/nullconvergencewriter.hh>
|
||||
|
||||
@@ -118,9 +118,9 @@ public:
|
||||
{
|
||||
lastError_ = 1e100;
|
||||
error_ = 1e100;
|
||||
tolerance_ = Parameters::Get<Parameters::NewtonTolerance<Scalar>>();
|
||||
|
||||
numIterations_ = 0;
|
||||
params_.read();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -129,23 +129,7 @@ public:
|
||||
static void registerParameters()
|
||||
{
|
||||
LinearSolverBackend::registerParameters();
|
||||
|
||||
Parameters::Register<Parameters::NewtonVerbose>
|
||||
("Specify whether the Newton method should inform "
|
||||
"the user about its progress or not");
|
||||
Parameters::Register<Parameters::NewtonWriteConvergence>
|
||||
("Write the convergence behaviour of the Newton "
|
||||
"method to a VTK file");
|
||||
Parameters::Register<Parameters::NewtonTargetIterations>
|
||||
("The 'optimum' number of Newton iterations per time step");
|
||||
Parameters::Register<Parameters::NewtonMaxIterations>
|
||||
("The maximum number of Newton iterations per time step");
|
||||
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
|
||||
("The maximum raw error tolerated by the Newton"
|
||||
"method for considering a solution to be converged");
|
||||
Parameters::Register<Parameters::NewtonMaxError<Scalar>>
|
||||
("The maximum error tolerated by the Newton "
|
||||
"method to which does not cause an abort");
|
||||
NewtonMethodParams<Scalar>::registerParameters();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -210,14 +194,14 @@ public:
|
||||
* be converged.
|
||||
*/
|
||||
Scalar tolerance() const
|
||||
{ return tolerance_; }
|
||||
{ return params_.tolerance_; }
|
||||
|
||||
/*!
|
||||
* \brief Set the current tolerance at which the Newton method considers itself to
|
||||
* be converged.
|
||||
*/
|
||||
void setTolerance(Scalar value)
|
||||
{ tolerance_ = value; }
|
||||
{ params_.tolerance_ = value; }
|
||||
|
||||
/*!
|
||||
* \brief Run the Newton method.
|
||||
@@ -451,14 +435,14 @@ public:
|
||||
// conservative when increasing it. the rationale is
|
||||
// that we want to avoid failing in the next time
|
||||
// integration which would be quite expensive
|
||||
if (numIterations_ > targetIterations_()) {
|
||||
Scalar percent = Scalar(numIterations_ - targetIterations_())/targetIterations_();
|
||||
if (numIterations_ > params_.targetIterations_) {
|
||||
Scalar percent = Scalar(numIterations_ - params_.targetIterations_) / params_.targetIterations_;
|
||||
Scalar nextDt = std::max(problem().minTimeStepSize(),
|
||||
oldDt / (Scalar{1.0} + percent));
|
||||
return nextDt;
|
||||
}
|
||||
|
||||
Scalar percent = Scalar(targetIterations_() - numIterations_)/targetIterations_();
|
||||
Scalar percent = Scalar(params_.targetIterations_ - numIterations_) / params_.targetIterations_;
|
||||
Scalar nextDt = std::max(problem().minTimeStepSize(),
|
||||
oldDt*(Scalar{1.0} + percent / Scalar{1.2}));
|
||||
return nextDt;
|
||||
@@ -508,7 +492,7 @@ protected:
|
||||
*/
|
||||
bool verbose_() const
|
||||
{
|
||||
return Parameters::Get<Parameters::NewtonVerbose>() && (comm_.rank() == 0);
|
||||
return params_.verbose_ && (comm_.rank() == 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -521,7 +505,7 @@ protected:
|
||||
{
|
||||
numIterations_ = 0;
|
||||
|
||||
if (Parameters::Get<Parameters::NewtonWriteConvergence>()) {
|
||||
if (params_.writeConvergence_) {
|
||||
convergenceWriter_.beginTimeStep();
|
||||
}
|
||||
}
|
||||
@@ -574,7 +558,7 @@ protected:
|
||||
{
|
||||
const auto& constraintsMap = model().linearizer().constraintsMap();
|
||||
lastError_ = error_;
|
||||
Scalar newtonMaxError = Parameters::Get<Parameters::NewtonMaxError<Scalar>>();
|
||||
Scalar newtonMaxError = params_.maxError_;
|
||||
|
||||
// calculate the error as the maximum weighted tolerance of
|
||||
// the solution's residual
|
||||
@@ -739,7 +723,7 @@ protected:
|
||||
void writeConvergence_(const SolutionVector& currentSolution,
|
||||
const GlobalEqVector& solutionUpdate)
|
||||
{
|
||||
if (Parameters::Get<Parameters::NewtonWriteConvergence>()) {
|
||||
if (params_.writeConvergence_) {
|
||||
convergenceWriter_.beginIteration();
|
||||
convergenceWriter_.writeFields(currentSolution, solutionUpdate);
|
||||
convergenceWriter_.endIteration();
|
||||
@@ -794,7 +778,7 @@ protected:
|
||||
// do more iterations
|
||||
return false;
|
||||
}
|
||||
else if (asImp_().numIterations() >= asImp_().maxIterations_()) {
|
||||
else if (asImp_().numIterations() >= params_.maxIterations_) {
|
||||
// we have exceeded the allowed number of steps. If the
|
||||
// error was reduced by a factor of at least 4,
|
||||
// in the last iterations we proceed even if we are above
|
||||
@@ -811,7 +795,7 @@ protected:
|
||||
*/
|
||||
void end_()
|
||||
{
|
||||
if (Parameters::Get<Parameters::NewtonWriteConvergence>()) {
|
||||
if (params_.writeConvergence_) {
|
||||
convergenceWriter_.endTimeStep();
|
||||
}
|
||||
}
|
||||
@@ -822,7 +806,7 @@ protected:
|
||||
* This method is called _after_ end_()
|
||||
*/
|
||||
void failed_()
|
||||
{ numIterations_ = targetIterations_() * 2; }
|
||||
{ numIterations_ = params_.targetIterations_ * 2; }
|
||||
|
||||
/*!
|
||||
* \brief Called if the Newton method was successful.
|
||||
@@ -832,13 +816,6 @@ protected:
|
||||
void succeeded_()
|
||||
{}
|
||||
|
||||
// optimal number of iterations we want to achieve
|
||||
int targetIterations_() const
|
||||
{ return Parameters::Get<Parameters::NewtonTargetIterations>(); }
|
||||
// maximum number of iterations we do before giving up
|
||||
int maxIterations_() const
|
||||
{ return Parameters::Get<Parameters::NewtonMaxIterations>(); }
|
||||
|
||||
static bool enableConstraints_()
|
||||
{ return getPropValue<TypeTag, Properties::EnableConstraints>(); }
|
||||
|
||||
@@ -853,7 +830,7 @@ protected:
|
||||
|
||||
Scalar error_;
|
||||
Scalar lastError_;
|
||||
Scalar tolerance_;
|
||||
NewtonMethodParams<Scalar> params_;
|
||||
|
||||
// actual number of iterations done so far
|
||||
int numIterations_;
|
||||
|
||||
77
opm/models/nonlinear/newtonmethodparams.cpp
Normal file
77
opm/models/nonlinear/newtonmethodparams.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
#if HAVE_QUAD
|
||||
#include <opm/material/common/quad.hpp>
|
||||
#endif
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
void NewtonMethodParams<Scalar>::registerParameters()
|
||||
{
|
||||
Parameters::Register<Parameters::NewtonVerbose>
|
||||
("Specify whether the Newton method should inform "
|
||||
"the user about its progress or not");
|
||||
Parameters::Register<Parameters::NewtonWriteConvergence>
|
||||
("Write the convergence behaviour of the Newton "
|
||||
"method to a VTK file");
|
||||
Parameters::Register<Parameters::NewtonTargetIterations>
|
||||
("The 'optimum' number of Newton iterations per time step");
|
||||
Parameters::Register<Parameters::NewtonMaxIterations>
|
||||
("The maximum number of Newton iterations per time step");
|
||||
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
|
||||
("The maximum raw error tolerated by the Newton"
|
||||
"method for considering a solution to be converged");
|
||||
Parameters::Register<Parameters::NewtonMaxError<Scalar>>
|
||||
("The maximum error tolerated by the Newton "
|
||||
"method to which does not cause an abort");
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void NewtonMethodParams<Scalar>::read()
|
||||
{
|
||||
verbose_ = Parameters::Get<Parameters::NewtonVerbose>();
|
||||
writeConvergence_ = Parameters::Get<Parameters::NewtonWriteConvergence>();
|
||||
targetIterations_ = Parameters::Get<Parameters::NewtonTargetIterations>();
|
||||
maxIterations_ = Parameters::Get<Parameters::NewtonMaxIterations>();
|
||||
tolerance_ = Parameters::Get<Parameters::NewtonTolerance<Scalar>>();
|
||||
maxError_ = Parameters::Get<Parameters::NewtonMaxError<Scalar>>();
|
||||
}
|
||||
|
||||
template struct NewtonMethodParams<double>;
|
||||
|
||||
#if FLOW_INSTANTIATE_FLOAT
|
||||
template struct NewtonMethodParams<float>;
|
||||
#endif
|
||||
|
||||
#if HAVE_QUAD
|
||||
template struct NewtonMethodParams<quad>;
|
||||
#endif
|
||||
|
||||
} // namespace Opm
|
||||
@@ -20,8 +20,8 @@
|
||||
module for the precise wording of the license and the list of
|
||||
copyright holders.
|
||||
*/
|
||||
#ifndef EWOMS_NEWTON_METHOD_PARAMETERS_HH
|
||||
#define EWOMS_NEWTON_METHOD_PARAMETERS_HH
|
||||
#ifndef OPM_NEWTON_METHOD_PARAMS_HPP
|
||||
#define OPM_NEWTON_METHOD_PARAMS_HPP
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
@@ -61,4 +61,28 @@ struct NewtonWriteConvergence { static constexpr bool value = false; };
|
||||
|
||||
} // end namespace Opm::Parameters
|
||||
|
||||
#endif
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief Struct holding the parameters for NewtonMethod.
|
||||
*/
|
||||
template<class Scalar>
|
||||
struct NewtonMethodParams
|
||||
{
|
||||
//! \brief Registers the parameters in parameter system.
|
||||
static void registerParameters();
|
||||
|
||||
//! \brief Reads the parameter values from the parameter system.
|
||||
void read();
|
||||
|
||||
bool verbose_;
|
||||
bool writeConvergence_;
|
||||
int targetIterations_; //!< Optimal number of iterations we want to achieve
|
||||
int maxIterations_; //!< Maximum number of iterations we do before giving up
|
||||
Scalar tolerance_;
|
||||
Scalar maxError_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_NEWTON_METHOD_PARAMS_HPP
|
||||
@@ -43,10 +43,10 @@
|
||||
#include <opm/models/flash/flashproperties.hh>
|
||||
#include <opm/models/flash/flashratevector.hh>
|
||||
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkptflashmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
#include <opm/models/io/vtkptflashmodule.hpp>
|
||||
|
||||
#include <opm/models/ptflash/flashindices.hh>
|
||||
#include <opm/models/ptflash/flashintensivequantities.hh>
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
|
||||
#include <opm/models/pvs/pvsboundaryratevector.hh>
|
||||
#include <opm/models/pvs/pvsextensivequantities.hh>
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/common/diffusionmodule.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkphasepresencemodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkenergymodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkphasepresencemodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
#include <opm/models/io/vtkenergymodule.hpp>
|
||||
|
||||
namespace Opm::Properties {
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <opm/simulators/flow/FlowProblemParameters.hpp>
|
||||
|
||||
#include <opm/models/common/multiphasebaseparameters.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparameters.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
#include <opm/simulators/flow/EclWriter.hpp>
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
|
||||
#include <opm/models/common/multiphasebaseparameters.hh>
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
#include <opm/models/io/vtkblackoilmodule.hh>
|
||||
#include <opm/models/io/vtkcompositionmodule.hh>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
#include <opm/models/io/vtkmultiphasemodule.hh>
|
||||
#include <opm/models/io/vtkprimaryvarsmodule.hh>
|
||||
#include <opm/models/io/vtktemperaturemodule.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparameters.hh>
|
||||
#include <opm/models/io/vtkblackoilmodule.hpp>
|
||||
#include <opm/models/io/vtkcompositionmodule.hpp>
|
||||
#include <opm/models/io/vtkdiffusionmodule.hpp>
|
||||
#include <opm/models/io/vtkmultiphasemodule.hpp>
|
||||
#include <opm/models/io/vtkprimaryvarsmodule.hpp>
|
||||
#include <opm/models/io/vtktemperaturemodule.hpp>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
#include <opm/models/utils/basicparameters.hh>
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/nonlinear/newtonmethodparameters.hh>
|
||||
#include <opm/models/nonlinear/newtonmethodparams.hpp>
|
||||
#include <opm/models/nonlinear/newtonmethodproperties.hh>
|
||||
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
|
||||
Reference in New Issue
Block a user