mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
vtkmultiphasemodule: move parameters to dedicated struct with a translation unit
This commit is contained in:
parent
a895678c30
commit
f5e2b46c37
@ -71,6 +71,7 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
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/vtkenergyparams.cpp
|
||||||
|
opm/models/io/vtkmultiphaseparams.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
|
||||||
@ -677,6 +678,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/models/io/vtkenergymodule.hpp
|
opm/models/io/vtkenergymodule.hpp
|
||||||
opm/models/io/vtkenergyparams.hpp
|
opm/models/io/vtkenergyparams.hpp
|
||||||
opm/models/io/vtkmultiphasemodule.hpp
|
opm/models/io/vtkmultiphasemodule.hpp
|
||||||
|
opm/models/io/vtkmultiphaseparams.hpp
|
||||||
opm/models/io/vtkmultiwriter.hh
|
opm/models/io/vtkmultiwriter.hh
|
||||||
opm/models/io/vtkphasepresencemodule.hh
|
opm/models/io/vtkphasepresencemodule.hh
|
||||||
opm/models/io/vtkprimaryvarsmodule.hh
|
opm/models/io/vtkprimaryvarsmodule.hh
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||||
|
|
||||||
#include <opm/models/io/baseoutputmodule.hh>
|
#include <opm/models/io/baseoutputmodule.hh>
|
||||||
|
#include <opm/models/io/vtkmultiphaseparams.hpp>
|
||||||
#include <opm/models/io/vtkmultiwriter.hh>
|
#include <opm/models/io/vtkmultiwriter.hh>
|
||||||
|
|
||||||
#include <opm/models/utils/parametersystem.hpp>
|
#include <opm/models/utils/parametersystem.hpp>
|
||||||
@ -42,24 +43,6 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#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 {
|
namespace Opm {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -111,37 +94,16 @@ class VtkMultiPhaseModule : public BaseOutputModule<TypeTag>
|
|||||||
public:
|
public:
|
||||||
VtkMultiPhaseModule(const Simulator& simulator)
|
VtkMultiPhaseModule(const Simulator& simulator)
|
||||||
: ParentType(simulator)
|
: ParentType(simulator)
|
||||||
{}
|
{
|
||||||
|
params_.read();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register all run-time parameters for the multi-phase VTK output module.
|
* \brief Register all run-time parameters for the multi-phase VTK output module.
|
||||||
*/
|
*/
|
||||||
static void registerParameters()
|
static void registerParameters()
|
||||||
{
|
{
|
||||||
Parameters::Register<Parameters::VtkWriteExtrusionFactor>
|
VtkMultiPhaseParams::registerParameters();
|
||||||
("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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -150,19 +112,39 @@ public:
|
|||||||
*/
|
*/
|
||||||
void allocBuffers()
|
void allocBuffers()
|
||||||
{
|
{
|
||||||
if (extrusionFactorOutput_()) this->resizeScalarBuffer_(extrusionFactor_);
|
if (params_.extrusionFactorOutput_) {
|
||||||
if (pressureOutput_()) this->resizePhaseBuffer_(pressure_);
|
this->resizeScalarBuffer_(extrusionFactor_);
|
||||||
if (densityOutput_()) this->resizePhaseBuffer_(density_);
|
}
|
||||||
if (saturationOutput_()) this->resizePhaseBuffer_(saturation_);
|
if (params_.pressureOutput_) {
|
||||||
if (mobilityOutput_()) this->resizePhaseBuffer_(mobility_);
|
this->resizePhaseBuffer_(pressure_);
|
||||||
if (relativePermeabilityOutput_()) this->resizePhaseBuffer_(relativePermeability_);
|
}
|
||||||
if (viscosityOutput_()) this->resizePhaseBuffer_(viscosity_);
|
if (params_.densityOutput_) {
|
||||||
if (averageMolarMassOutput_()) this->resizePhaseBuffer_(averageMolarMass_);
|
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 (params_.porosityOutput_) {
|
||||||
if (intrinsicPermeabilityOutput_()) this->resizeTensorBuffer_(intrinsicPermeability_);
|
this->resizeScalarBuffer_(porosity_);
|
||||||
|
}
|
||||||
|
if (params_.intrinsicPermeabilityOutput_) {
|
||||||
|
this->resizeTensorBuffer_(intrinsicPermeability_);
|
||||||
|
}
|
||||||
|
|
||||||
if (velocityOutput_()) {
|
if (params_.velocityOutput_) {
|
||||||
size_t nDof = this->simulator_.model().numGridDof();
|
size_t nDof = this->simulator_.model().numGridDof();
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||||
velocity_[phaseIdx].resize(nDof);
|
velocity_[phaseIdx].resize(nDof);
|
||||||
@ -174,7 +156,7 @@ public:
|
|||||||
this->resizePhaseBuffer_(velocityWeight_);
|
this->resizePhaseBuffer_(velocityWeight_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (potentialGradientOutput_()) {
|
if (params_.potentialGradientOutput_) {
|
||||||
size_t nDof = this->simulator_.model().numGridDof();
|
size_t nDof = this->simulator_.model().numGridDof();
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||||
potentialGradient_[phaseIdx].resize(nDof);
|
potentialGradient_[phaseIdx].resize(nDof);
|
||||||
@ -204,38 +186,51 @@ 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 (extrusionFactorOutput_()) extrusionFactor_[I] = intQuants.extrusionFactor();
|
if (params_.extrusionFactorOutput_) {
|
||||||
if (porosityOutput_()) porosity_[I] = getValue(intQuants.porosity());
|
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);
|
const auto& K = problem.intrinsicPermeability(elemCtx, i, /*timeIdx=*/0);
|
||||||
for (unsigned rowIdx = 0; rowIdx < K.rows; ++rowIdx)
|
for (unsigned rowIdx = 0; rowIdx < K.rows; ++rowIdx) {
|
||||||
for (unsigned colIdx = 0; colIdx < K.cols; ++colIdx)
|
for (unsigned colIdx = 0; colIdx < K.cols; ++colIdx) {
|
||||||
intrinsicPermeability_[I][rowIdx][colIdx] = K[rowIdx][colIdx];
|
intrinsicPermeability_[I][rowIdx][colIdx] = K[rowIdx][colIdx];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pressureOutput_())
|
if (params_.pressureOutput_) {
|
||||||
pressure_[phaseIdx][I] = getValue(fs.pressure(phaseIdx));
|
pressure_[phaseIdx][I] = getValue(fs.pressure(phaseIdx));
|
||||||
if (densityOutput_())
|
}
|
||||||
|
if (params_.densityOutput_) {
|
||||||
density_[phaseIdx][I] = getValue(fs.density(phaseIdx));
|
density_[phaseIdx][I] = getValue(fs.density(phaseIdx));
|
||||||
if (saturationOutput_())
|
}
|
||||||
|
if (params_.saturationOutput_) {
|
||||||
saturation_[phaseIdx][I] = getValue(fs.saturation(phaseIdx));
|
saturation_[phaseIdx][I] = getValue(fs.saturation(phaseIdx));
|
||||||
if (mobilityOutput_())
|
}
|
||||||
|
if (params_.mobilityOutput_) {
|
||||||
mobility_[phaseIdx][I] = getValue(intQuants.mobility(phaseIdx));
|
mobility_[phaseIdx][I] = getValue(intQuants.mobility(phaseIdx));
|
||||||
if (relativePermeabilityOutput_())
|
}
|
||||||
|
if (params_.relativePermeabilityOutput_) {
|
||||||
relativePermeability_[phaseIdx][I] = getValue(intQuants.relativePermeability(phaseIdx));
|
relativePermeability_[phaseIdx][I] = getValue(intQuants.relativePermeability(phaseIdx));
|
||||||
if (viscosityOutput_())
|
}
|
||||||
|
if (params_.viscosityOutput_) {
|
||||||
viscosity_[phaseIdx][I] = getValue(fs.viscosity(phaseIdx));
|
viscosity_[phaseIdx][I] = getValue(fs.viscosity(phaseIdx));
|
||||||
if (averageMolarMassOutput_())
|
}
|
||||||
|
if (params_.averageMolarMassOutput_) {
|
||||||
averageMolarMass_[phaseIdx][I] = getValue(fs.averageMolarMass(phaseIdx));
|
averageMolarMass_[phaseIdx][I] = getValue(fs.averageMolarMass(phaseIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (potentialGradientOutput_()) {
|
if (params_.potentialGradientOutput_) {
|
||||||
// calculate velocities if requested
|
// calculate velocities if requested
|
||||||
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
||||||
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
||||||
@ -250,14 +245,15 @@ public:
|
|||||||
|
|
||||||
const auto& inputPGrad = extQuants.potentialGrad(phaseIdx);
|
const auto& inputPGrad = extQuants.potentialGrad(phaseIdx);
|
||||||
DimVector pGrad;
|
DimVector pGrad;
|
||||||
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
|
for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
|
||||||
pGrad[dimIdx] = getValue(inputPGrad[dimIdx])*weight;
|
pGrad[dimIdx] = getValue(inputPGrad[dimIdx])*weight;
|
||||||
|
}
|
||||||
potentialGradient_[phaseIdx][I] += pGrad;
|
potentialGradient_[phaseIdx][I] += pGrad;
|
||||||
} // end for all phases
|
} // end for all phases
|
||||||
} // end for all faces
|
} // end for all faces
|
||||||
}
|
}
|
||||||
|
|
||||||
if (velocityOutput_()) {
|
if (params_.velocityOutput_) {
|
||||||
// calculate velocities if requested
|
// calculate velocities if requested
|
||||||
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
for (unsigned faceIdx = 0; faceIdx < elemCtx.numInteriorFaces(/*timeIdx=*/0); ++ faceIdx) {
|
||||||
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
const auto& extQuants = elemCtx.extensiveQuantities(faceIdx, /*timeIdx=*/0);
|
||||||
@ -277,10 +273,12 @@ public:
|
|||||||
|
|
||||||
const auto& inputV = extQuants.filterVelocity(phaseIdx);
|
const auto& inputV = extQuants.filterVelocity(phaseIdx);
|
||||||
DimVector v;
|
DimVector v;
|
||||||
for (unsigned k = 0; k < dimWorld; ++k)
|
for (unsigned k = 0; k < dimWorld; ++k) {
|
||||||
v[k] = getValue(inputV[k]);
|
v[k] = getValue(inputV[k]);
|
||||||
if (v.two_norm() > 1e-20)
|
}
|
||||||
|
if (v.two_norm() > 1e-20) {
|
||||||
weight /= v.two_norm();
|
weight /= v.two_norm();
|
||||||
|
}
|
||||||
v *= weight;
|
v *= weight;
|
||||||
|
|
||||||
velocity_[phaseIdx][I] += v;
|
velocity_[phaseIdx][I] += v;
|
||||||
@ -299,39 +297,51 @@ public:
|
|||||||
void commitBuffers(BaseOutputWriter& baseWriter)
|
void commitBuffers(BaseOutputWriter& baseWriter)
|
||||||
{
|
{
|
||||||
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
|
||||||
if (!vtkWriter)
|
if (!vtkWriter) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (extrusionFactorOutput_())
|
if (params_.extrusionFactorOutput_) {
|
||||||
this->commitScalarBuffer_(baseWriter, "extrusionFactor", extrusionFactor_);
|
this->commitScalarBuffer_(baseWriter, "extrusionFactor", extrusionFactor_);
|
||||||
if (pressureOutput_())
|
}
|
||||||
|
if (params_.pressureOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "pressure_%s", pressure_);
|
this->commitPhaseBuffer_(baseWriter, "pressure_%s", pressure_);
|
||||||
if (densityOutput_())
|
}
|
||||||
|
if (params_.densityOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "density_%s", density_);
|
this->commitPhaseBuffer_(baseWriter, "density_%s", density_);
|
||||||
if (saturationOutput_())
|
}
|
||||||
|
if (params_.saturationOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "saturation_%s", saturation_);
|
this->commitPhaseBuffer_(baseWriter, "saturation_%s", saturation_);
|
||||||
if (mobilityOutput_())
|
}
|
||||||
|
if (params_.mobilityOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "mobility_%s", mobility_);
|
this->commitPhaseBuffer_(baseWriter, "mobility_%s", mobility_);
|
||||||
if (relativePermeabilityOutput_())
|
}
|
||||||
|
if (params_.relativePermeabilityOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "relativePerm_%s", relativePermeability_);
|
this->commitPhaseBuffer_(baseWriter, "relativePerm_%s", relativePermeability_);
|
||||||
if (viscosityOutput_())
|
}
|
||||||
|
if (params_.viscosityOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "viscosity_%s", viscosity_);
|
this->commitPhaseBuffer_(baseWriter, "viscosity_%s", viscosity_);
|
||||||
if (averageMolarMassOutput_())
|
}
|
||||||
|
if (params_.averageMolarMassOutput_) {
|
||||||
this->commitPhaseBuffer_(baseWriter, "averageMolarMass_%s", averageMolarMass_);
|
this->commitPhaseBuffer_(baseWriter, "averageMolarMass_%s", averageMolarMass_);
|
||||||
|
}
|
||||||
|
|
||||||
if (porosityOutput_())
|
if (params_.porosityOutput_) {
|
||||||
this->commitScalarBuffer_(baseWriter, "porosity", porosity_);
|
this->commitScalarBuffer_(baseWriter, "porosity", porosity_);
|
||||||
if (intrinsicPermeabilityOutput_())
|
}
|
||||||
|
if (params_.intrinsicPermeabilityOutput_) {
|
||||||
this->commitTensorBuffer_(baseWriter, "intrinsicPerm", intrinsicPermeability_);
|
this->commitTensorBuffer_(baseWriter, "intrinsicPerm", intrinsicPermeability_);
|
||||||
|
}
|
||||||
|
|
||||||
if (velocityOutput_()) {
|
if (params_.velocityOutput_) {
|
||||||
size_t numDof = this->simulator_.model().numGridDof();
|
size_t numDof = this->simulator_.model().numGridDof();
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
// first, divide the velocity field by the
|
// first, divide the velocity field by the
|
||||||
// respective finite volume's surface area
|
// 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];
|
velocity_[phaseIdx][i] /= velocityWeight_[phaseIdx][i];
|
||||||
|
}
|
||||||
// commit the phase velocity
|
// commit the phase velocity
|
||||||
char name[512];
|
char name[512];
|
||||||
snprintf(name, 512, "filterVelocity_%s", FluidSystem::phaseName(phaseIdx).data());
|
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();
|
size_t numDof = this->simulator_.model().numGridDof();
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
// first, divide the velocity field by the
|
// first, divide the velocity field by the
|
||||||
// respective finite volume's surface area
|
// 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];
|
potentialGradient_[phaseIdx][i] /= potentialWeight_[phaseIdx][i];
|
||||||
|
}
|
||||||
// commit the phase velocity
|
// commit the phase velocity
|
||||||
char name[512];
|
char name[512];
|
||||||
snprintf(name, 512, "gradP_%s", FluidSystem::phaseName(phaseIdx).data());
|
snprintf(name, 512, "gradP_%s", FluidSystem::phaseName(phaseIdx).data());
|
||||||
@ -367,101 +378,30 @@ public:
|
|||||||
* returning true here does not do any harm from the correctness perspective, but it
|
* returning true here does not do any harm from the correctness perspective, but it
|
||||||
* slows down writing the output fields.
|
* slows down writing the output fields.
|
||||||
*/
|
*/
|
||||||
virtual bool needExtensiveQuantities() const final
|
bool needExtensiveQuantities() const final
|
||||||
{
|
{
|
||||||
return velocityOutput_() || potentialGradientOutput_();
|
return params_.velocityOutput_ || params_.potentialGradientOutput_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool extrusionFactorOutput_()
|
VtkMultiPhaseParams params_{};
|
||||||
{
|
ScalarBuffer extrusionFactor_{};
|
||||||
static bool val = Parameters::Get<Parameters::VtkWriteExtrusionFactor>();
|
PhaseBuffer pressure_{};
|
||||||
return val;
|
PhaseBuffer density_{};
|
||||||
}
|
PhaseBuffer saturation_{};
|
||||||
|
PhaseBuffer mobility_{};
|
||||||
|
PhaseBuffer relativePermeability_{};
|
||||||
|
PhaseBuffer viscosity_{};
|
||||||
|
PhaseBuffer averageMolarMass_{};
|
||||||
|
|
||||||
static bool pressureOutput_()
|
ScalarBuffer porosity_{};
|
||||||
{
|
TensorBuffer intrinsicPermeability_{};
|
||||||
static bool val = Parameters::Get<Parameters::VtkWritePressures>();
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool densityOutput_()
|
PhaseVectorBuffer velocity_{};
|
||||||
{
|
PhaseBuffer velocityWeight_{};
|
||||||
static bool val = Parameters::Get<Parameters::VtkWriteDensities>();
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool saturationOutput_()
|
PhaseVectorBuffer potentialGradient_{};
|
||||||
{
|
PhaseBuffer potentialWeight_{};
|
||||||
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_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
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
|
Loading…
Reference in New Issue
Block a user