mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
vtkdiscretefracturemodule: move parameters to dedicated struct with a translation unit
This commit is contained in:
parent
ca56913816
commit
b1afd79cd9
@ -69,6 +69,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/models/io/vtkblackoilsolventparams.cpp
|
||||
opm/models/io/vtkcompositionparams.cpp
|
||||
opm/models/io/vtkdiffusionparams.cpp
|
||||
opm/models/io/vtkdiscretefractureparams.cpp
|
||||
opm/models/io/restart.cpp
|
||||
opm/models/parallel/mpiutil.cpp
|
||||
opm/models/parallel/tasklets.cpp
|
||||
@ -671,6 +672,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/models/io/vtkdiffusionmodule.hpp
|
||||
opm/models/io/vtkdiffusionparams.hpp
|
||||
opm/models/io/vtkdiscretefracturemodule.hpp
|
||||
opm/models/io/vtkdiscretefractureparams.hpp
|
||||
opm/models/io/vtkenergymodule.hh
|
||||
opm/models/io/vtkmultiphasemodule.hh
|
||||
opm/models/io/vtkmultiwriter.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,19 +42,6 @@
|
||||
|
||||
#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 {
|
||||
|
||||
/*!
|
||||
@ -98,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();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -129,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);
|
||||
@ -170,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);
|
||||
@ -217,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 =
|
||||
@ -247,38 +230,45 @@ public:
|
||||
*/
|
||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||
{
|
||||
VtkMultiWriter *vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||
if (!vtkWriter) {
|
||||
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());
|
||||
@ -289,61 +279,20 @@ 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
|
||||
|
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
|
Loading…
Reference in New Issue
Block a user