mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
vtkenergymodule: move parameters to dedicated struct with a translation unit
This commit is contained in:
@@ -70,6 +70,7 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
opm/models/io/vtkcompositionparams.cpp
|
opm/models/io/vtkcompositionparams.cpp
|
||||||
opm/models/io/vtkdiffusionparams.cpp
|
opm/models/io/vtkdiffusionparams.cpp
|
||||||
opm/models/io/vtkdiscretefractureparams.cpp
|
opm/models/io/vtkdiscretefractureparams.cpp
|
||||||
|
opm/models/io/vtkenergyparams.cpp
|
||||||
opm/models/io/restart.cpp
|
opm/models/io/restart.cpp
|
||||||
opm/models/parallel/mpiutil.cpp
|
opm/models/parallel/mpiutil.cpp
|
||||||
opm/models/parallel/tasklets.cpp
|
opm/models/parallel/tasklets.cpp
|
||||||
@@ -674,6 +675,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/models/io/vtkdiscretefracturemodule.hpp
|
opm/models/io/vtkdiscretefracturemodule.hpp
|
||||||
opm/models/io/vtkdiscretefractureparams.hpp
|
opm/models/io/vtkdiscretefractureparams.hpp
|
||||||
opm/models/io/vtkenergymodule.hpp
|
opm/models/io/vtkenergymodule.hpp
|
||||||
|
opm/models/io/vtkenergyparams.hpp
|
||||||
opm/models/io/vtkmultiphasemodule.hh
|
opm/models/io/vtkmultiphasemodule.hh
|
||||||
opm/models/io/vtkmultiwriter.hh
|
opm/models/io/vtkmultiwriter.hh
|
||||||
opm/models/io/vtkphasepresencemodule.hh
|
opm/models/io/vtkphasepresencemodule.hh
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <opm/material/common/MathToolbox.hpp>
|
#include <opm/material/common/MathToolbox.hpp>
|
||||||
|
|
||||||
#include <opm/models/io/baseoutputmodule.hh>
|
#include <opm/models/io/baseoutputmodule.hh>
|
||||||
|
#include <opm/models/io/vtkenergyparams.hpp>
|
||||||
#include <opm/models/io/vtkmultiwriter.hh>
|
#include <opm/models/io/vtkmultiwriter.hh>
|
||||||
|
|
||||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||||
@@ -37,16 +38,6 @@
|
|||||||
#include <opm/models/utils/parametersystem.hpp>
|
#include <opm/models/utils/parametersystem.hpp>
|
||||||
#include <opm/models/utils/propertysystem.hh>
|
#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 {
|
namespace Opm {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -86,6 +77,7 @@ public:
|
|||||||
VtkEnergyModule(const Simulator& simulator)
|
VtkEnergyModule(const Simulator& simulator)
|
||||||
: ParentType(simulator)
|
: ParentType(simulator)
|
||||||
{
|
{
|
||||||
|
params_.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -93,18 +85,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void registerParameters()
|
static void registerParameters()
|
||||||
{
|
{
|
||||||
Parameters::Register<Parameters::VtkWriteSolidInternalEnergy>
|
VtkEnergyParams::registerParameters();
|
||||||
("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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -113,16 +94,20 @@ public:
|
|||||||
*/
|
*/
|
||||||
void allocBuffers()
|
void allocBuffers()
|
||||||
{
|
{
|
||||||
if (enthalpyOutput_())
|
if (params_.enthalpyOutput_) {
|
||||||
this->resizePhaseBuffer_(enthalpy_);
|
this->resizePhaseBuffer_(enthalpy_);
|
||||||
if (internalEnergyOutput_())
|
}
|
||||||
|
if (params_.internalEnergyOutput_) {
|
||||||
this->resizePhaseBuffer_(internalEnergy_);
|
this->resizePhaseBuffer_(internalEnergy_);
|
||||||
|
}
|
||||||
|
|
||||||
if (solidInternalEnergyOutput_())
|
if (params_.solidInternalEnergyOutput_) {
|
||||||
this->resizeScalarBuffer_(solidInternalEnergy_);
|
this->resizeScalarBuffer_(solidInternalEnergy_);
|
||||||
if (thermalConductivityOutput_())
|
}
|
||||||
|
if (params_.thermalConductivityOutput_) {
|
||||||
this->resizeScalarBuffer_(thermalConductivity_);
|
this->resizeScalarBuffer_(thermalConductivity_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Modify the internal buffers according to the intensive quanties relevant
|
* \brief Modify the internal buffers according to the intensive quanties relevant
|
||||||
@@ -139,19 +124,23 @@ public:
|
|||||||
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
const auto& intQuants = elemCtx.intensiveQuantities(i, /*timeIdx=*/0);
|
||||||
const auto& fs = intQuants.fluidState();
|
const auto& fs = intQuants.fluidState();
|
||||||
|
|
||||||
if (solidInternalEnergyOutput_())
|
if (params_.solidInternalEnergyOutput_) {
|
||||||
solidInternalEnergy_[I] = Toolbox::value(intQuants.solidInternalEnergy());
|
solidInternalEnergy_[I] = Toolbox::value(intQuants.solidInternalEnergy());
|
||||||
if (thermalConductivityOutput_())
|
}
|
||||||
|
if (params_.thermalConductivityOutput_) {
|
||||||
thermalConductivity_[I] = Toolbox::value(intQuants.thermalConductivity());
|
thermalConductivity_[I] = Toolbox::value(intQuants.thermalConductivity());
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
if (enthalpyOutput_())
|
if (params_.enthalpyOutput_) {
|
||||||
enthalpy_[phaseIdx][I] = Toolbox::value(fs.enthalpy(phaseIdx));
|
enthalpy_[phaseIdx][I] = Toolbox::value(fs.enthalpy(phaseIdx));
|
||||||
if (internalEnergyOutput_())
|
}
|
||||||
|
if (params_.internalEnergyOutput_) {
|
||||||
internalEnergy_[phaseIdx][I] = Toolbox::value(fs.internalEnergy(phaseIdx));
|
internalEnergy_[phaseIdx][I] = Toolbox::value(fs.internalEnergy(phaseIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Add all buffers to the VTK output writer.
|
* \brief Add all buffers to the VTK output writer.
|
||||||
@@ -163,47 +152,28 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (solidInternalEnergyOutput_())
|
if (params_.solidInternalEnergyOutput_) {
|
||||||
this->commitScalarBuffer_(baseWriter, "internalEnergySolid", solidInternalEnergy_);
|
this->commitScalarBuffer_(baseWriter, "internalEnergySolid", solidInternalEnergy_);
|
||||||
if (thermalConductivityOutput_())
|
}
|
||||||
|
if (params_.thermalConductivityOutput_) {
|
||||||
this->commitScalarBuffer_(baseWriter, "thermalConductivity", thermalConductivity_);
|
this->commitScalarBuffer_(baseWriter, "thermalConductivity", thermalConductivity_);
|
||||||
|
}
|
||||||
|
|
||||||
if (enthalpyOutput_())
|
if (params_.enthalpyOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "enthalpy_%s", enthalpy_);
|
this->commitPhaseBuffer_(baseWriter, "enthalpy_%s", enthalpy_);
|
||||||
if (internalEnergyOutput_())
|
}
|
||||||
|
if (params_.internalEnergyOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "internalEnergy_%s", internalEnergy_);
|
this->commitPhaseBuffer_(baseWriter, "internalEnergy_%s", internalEnergy_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool solidInternalEnergyOutput_()
|
VtkEnergyParams params_{};
|
||||||
{
|
PhaseBuffer enthalpy_{};
|
||||||
static bool val = Parameters::Get<Parameters::VtkWriteSolidInternalEnergy>();
|
PhaseBuffer internalEnergy_{};
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool thermalConductivityOutput_()
|
ScalarBuffer thermalConductivity_{};
|
||||||
{
|
ScalarBuffer solidInternalEnergy_{};
|
||||||
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_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|||||||
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
|
||||||
Reference in New Issue
Block a user