mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
vtkblackoilpolymermodule: move parameters to dedicated struct with a translation unit
This commit is contained in:
@@ -64,6 +64,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
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/restart.cpp
|
||||
opm/models/parallel/mpiutil.cpp
|
||||
@@ -659,6 +660,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/io/vtkblackoilmodule.hpp
|
||||
opm/models/io/vtkblackoilparams.hpp
|
||||
opm/models/io/vtkblackoilpolymermodule.hpp
|
||||
opm/models/io/vtkblackoilpolymerparams.hpp
|
||||
opm/models/io/vtkblackoilsolventmodule.hh
|
||||
opm/models/io/vtkcompositionmodule.hh
|
||||
opm/models/io/vtkdiffusionmodule.hh
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#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>
|
||||
@@ -48,18 +49,6 @@ 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 {
|
||||
|
||||
/*!
|
||||
@@ -88,7 +77,11 @@ class VtkBlackOilPolymerModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkBlackOilPolymerModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
@@ -96,27 +89,9 @@ public:
|
||||
*/
|
||||
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");
|
||||
if constexpr (enablePolymer) {
|
||||
VtkBlackoilPolymerParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -125,26 +100,31 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
if (polymerConcentrationOutput_())
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
this->resizeScalarBuffer_(polymerConcentration_);
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
}
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
this->resizeScalarBuffer_(polymerDeadPoreVolume_);
|
||||
if (polymerRockDensityOutput_())
|
||||
}
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
this->resizeScalarBuffer_(polymerRockDensity_);
|
||||
if (polymerAdsorptionOutput_())
|
||||
}
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
this->resizeScalarBuffer_(polymerAdsorption_);
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
}
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
this->resizeScalarBuffer_(polymerViscosityCorrection_);
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
}
|
||||
if (params_.waterViscosityCorrectionOutput_) {
|
||||
this->resizeScalarBuffer_(waterViscosityCorrection_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Modify the internal buffers according to the intensive quantities relevant for
|
||||
@@ -152,117 +132,93 @@ public:
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if constexpr (enablePolymer) {
|
||||
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_())
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
polymerConcentration_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerConcentration());
|
||||
}
|
||||
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
polymerDeadPoreVolume_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerDeadPoreVolume());
|
||||
}
|
||||
|
||||
if (polymerRockDensityOutput_())
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
polymerRockDensity_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerRockDensity());
|
||||
}
|
||||
|
||||
if (polymerAdsorptionOutput_())
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
polymerAdsorption_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerAdsorption());
|
||||
}
|
||||
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
polymerViscosityCorrection_[globalDofIdx] =
|
||||
scalarValue(intQuants.polymerViscosityCorrection());
|
||||
}
|
||||
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
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)
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enablePolymer)
|
||||
return;
|
||||
|
||||
if (polymerConcentrationOutput_())
|
||||
if (params_.polymerConcentrationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer concentration", polymerConcentration_);
|
||||
}
|
||||
|
||||
if (polymerDeadPoreVolumeOutput_())
|
||||
if (params_.polymerDeadPoreVolumeOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "dead pore volume fraction", polymerDeadPoreVolume_);
|
||||
}
|
||||
|
||||
if (polymerRockDensityOutput_())
|
||||
if (params_.polymerRockDensityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer rock density", polymerRockDensity_);
|
||||
}
|
||||
|
||||
if (polymerAdsorptionOutput_())
|
||||
if (params_.polymerAdsorptionOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer adsorption", polymerAdsorption_);
|
||||
}
|
||||
|
||||
if (polymerViscosityCorrectionOutput_())
|
||||
if (params_.polymerViscosityCorrectionOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "polymer viscosity correction", polymerViscosityCorrection_);
|
||||
}
|
||||
|
||||
if (waterViscosityCorrectionOutput_())
|
||||
if (params_.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_;
|
||||
VtkBlackoilPolymerParams params_{};
|
||||
ScalarBuffer polymerConcentration_{};
|
||||
ScalarBuffer polymerDeadPoreVolume_{};
|
||||
ScalarBuffer polymerRockDensity_{};
|
||||
ScalarBuffer polymerAdsorption_{};
|
||||
ScalarBuffer polymerViscosityCorrection_{};
|
||||
ScalarBuffer waterViscosityCorrection_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user