mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
vtkblackoilsolventmodule: move parameters to dedicated struct with a translation unit
This commit is contained in:
@@ -66,6 +66,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/models/io/vtkblackoilmicpparams.cpp
|
||||
opm/models/io/vtkblackoilpolymerparams.cpp
|
||||
opm/models/io/vtkblackoilparams.cpp
|
||||
opm/models/io/vtkblackoilsolventparams.cpp
|
||||
opm/models/io/restart.cpp
|
||||
opm/models/parallel/mpiutil.cpp
|
||||
opm/models/parallel/tasklets.cpp
|
||||
@@ -662,6 +663,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/io/vtkblackoilpolymermodule.hpp
|
||||
opm/models/io/vtkblackoilpolymerparams.hpp
|
||||
opm/models/io/vtkblackoilsolventmodule.hpp
|
||||
opm/models/io/vtkblackoilsolventparams.hpp
|
||||
opm/models/io/vtkcompositionmodule.hh
|
||||
opm/models/io/vtkdiffusionmodule.hh
|
||||
opm/models/io/vtkdiscretefracturemodule.hh
|
||||
|
||||
@@ -36,22 +36,12 @@
|
||||
#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::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 {
|
||||
|
||||
/*!
|
||||
@@ -80,7 +70,11 @@ class VtkBlackOilSolventModule : public BaseOutputModule<TypeTag>
|
||||
public:
|
||||
VtkBlackOilSolventModule(const Simulator& simulator)
|
||||
: ParentType(simulator)
|
||||
{ }
|
||||
{
|
||||
if constexpr (enableSolvent) {
|
||||
params_.read();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Register all run-time parameters for the multi-phase VTK output
|
||||
@@ -88,24 +82,9 @@ public:
|
||||
*/
|
||||
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");
|
||||
if constexpr (enableSolvent) {
|
||||
VtkBlackOilSolventParams::registerParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -114,23 +93,27 @@ public:
|
||||
*/
|
||||
void allocBuffers()
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
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_);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -139,37 +122,41 @@ public:
|
||||
*/
|
||||
void processElement(const ElementContext& elemCtx)
|
||||
{
|
||||
if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
|
||||
return;
|
||||
}
|
||||
if constexpr (enableSolvent) {
|
||||
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);
|
||||
|
||||
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 (solventSaturationOutput_())
|
||||
solventSaturation_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventSaturation());
|
||||
if (params_.solventRswOutput_) {
|
||||
solventRsw_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.rsSolw());
|
||||
}
|
||||
|
||||
if (solventRswOutput_())
|
||||
solventRsw_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.rsSolw());
|
||||
if (params_.solventDensityOutput_) {
|
||||
solventDensity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventDensity());
|
||||
}
|
||||
|
||||
if (solventDensityOutput_())
|
||||
solventDensity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventDensity());
|
||||
if (params_.solventViscosityOutput_) {
|
||||
solventViscosity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventViscosity());
|
||||
}
|
||||
|
||||
if (solventViscosityOutput_())
|
||||
solventViscosity_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventViscosity());
|
||||
|
||||
if (solventMobilityOutput_())
|
||||
solventMobility_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventMobility());
|
||||
if (params_.solventMobilityOutput_) {
|
||||
solventMobility_[globalDofIdx] =
|
||||
Toolbox::scalarValue(intQuants.solventMobility());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,65 +165,41 @@ public:
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter)
|
||||
return;
|
||||
if constexpr (enableSolvent) {
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enableSolvent)
|
||||
return;
|
||||
if (params_.solventSaturationOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "saturation_solvent", solventSaturation_);
|
||||
}
|
||||
|
||||
if (solventSaturationOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "saturation_solvent", solventSaturation_);
|
||||
if (params_.solventRswOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "dissolved_solvent", solventRsw_);
|
||||
}
|
||||
|
||||
if (solventRswOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "dissolved_solvent", solventRsw_);
|
||||
if (params_.solventDensityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "density_solvent", solventDensity_);
|
||||
}
|
||||
|
||||
if (solventDensityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "density_solvent", solventDensity_);
|
||||
if (params_.solventViscosityOutput_) {
|
||||
this->commitScalarBuffer_(baseWriter, "viscosity_solvent", solventViscosity_);
|
||||
}
|
||||
|
||||
if (solventViscosityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "viscosity_solvent", solventViscosity_);
|
||||
|
||||
if (solventMobilityOutput_())
|
||||
this->commitScalarBuffer_(baseWriter, "mobility_solvent", solventMobility_);
|
||||
if (params_.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_;
|
||||
VtkBlackOilSolventParams params_{};
|
||||
ScalarBuffer solventSaturation_{};
|
||||
ScalarBuffer solventRsw_{};
|
||||
ScalarBuffer solventDensity_{};
|
||||
ScalarBuffer solventViscosity_{};
|
||||
ScalarBuffer solventMobility_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user