move VtkMultiphaseModule parameters to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent ee578104a6
commit 26114b7e06
6 changed files with 68 additions and 170 deletions

View File

@ -206,10 +206,6 @@ template <class TypeTag>
struct VtkWriteEquilibriumConstants<TypeTag, Properties::TTag::CO2PTBaseProblem> struct VtkWriteEquilibriumConstants<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
template <class TypeTag>
struct VtkWriteFilterVelocities<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; };
template <class TypeTag> template <class TypeTag>
struct VtkWriteFugacityCoeffs<TypeTag, Properties::TTag::CO2PTBaseProblem> struct VtkWriteFugacityCoeffs<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
@ -218,10 +214,6 @@ template <class TypeTag>
struct VtkWriteLiquidMoleFractions<TypeTag, Properties::TTag::CO2PTBaseProblem> struct VtkWriteLiquidMoleFractions<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
template <class TypeTag>
struct VtkWritePotentialGradients<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; };
template <class TypeTag> template <class TypeTag>
struct VtkWriteTotalMassFractions<TypeTag, Properties::TTag::CO2PTBaseProblem> struct VtkWriteTotalMassFractions<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
@ -365,6 +357,8 @@ public:
Parameters::SetDefault<Parameters::NewtonMaxIterations>(30); Parameters::SetDefault<Parameters::NewtonMaxIterations>(30);
Parameters::SetDefault<Parameters::NewtonTargetIterations>(6); Parameters::SetDefault<Parameters::NewtonTargetIterations>(6);
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-3); Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-3);
Parameters::SetDefault<Parameters::VtkWriteFilterVelocities>(true);
Parameters::SetDefault<Parameters::VtkWritePotentialGradients>(true);
} }
/*! /*!

View File

@ -28,27 +28,32 @@
#ifndef EWOMS_LENS_PROBLEM_HH #ifndef EWOMS_LENS_PROBLEM_HH
#define EWOMS_LENS_PROBLEM_HH #define EWOMS_LENS_PROBLEM_HH
#include <opm/models/io/structuredgridvanguard.hh> #include <dune/common/fmatrix.hh>
#include <opm/models/immiscible/immiscibleproperties.hh> #include <dune/common/fvector.hh>
#include <opm/models/discretization/common/fvbaseadlocallinearizer.hh> #include <dune/common/version.hh>
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
#include <opm/models/common/transfluxmodule.hh> #include <opm/material/components/Dnapl.hpp>
#include <opm/material/components/SimpleH2O.hpp>
#include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp> #include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp> #include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp> #include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp> #include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp> #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
#include <opm/material/components/SimpleH2O.hpp> #include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
#include <opm/material/components/Dnapl.hpp>
#include <dune/common/version.hh> #include <opm/models/common/transfluxmodule.hh>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <opm/models/discretization/common/fvbaseadlocallinearizer.hh>
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
#include <opm/models/immiscible/immiscibleproperties.hh>
#include <opm/models/io/structuredgridvanguard.hh>
#include <opm/models/io/vtkmultiphasemodule.hh>
#include <iostream>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <iostream>
namespace Opm { namespace Opm {
template <class TypeTag> template <class TypeTag>
@ -186,11 +191,6 @@ struct LensUpperRightZ<TypeTag, Properties::TTag::LensBaseProblem>
static constexpr type value = 1.0; static constexpr type value = 1.0;
}; };
// By default, include the intrinsic permeability tensor to the VTK output files
template<class TypeTag>
struct VtkWriteIntrinsicPermeabilities<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -357,6 +357,7 @@ public:
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(true); Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(true);
Parameters::SetDefault<Parameters::EnableStorageCache>(true); Parameters::SetDefault<Parameters::EnableStorageCache>(true);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0); Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
Parameters::SetDefault<Parameters::VtkWriteIntrinsicPermeabilities>(true);
} }
/*! /*!

View File

@ -128,11 +128,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// Write out the filter velocities for this problem
template<class TypeTag>
struct VtkWriteFilterVelocities<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -241,6 +236,7 @@ public:
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0); Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3); Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3);
Parameters::SetDefault<Parameters::VtkWriteFilterVelocities>(true);
} }
/*! /*!

View File

@ -57,7 +57,7 @@ namespace Opm::Properties {
//! The generic type tag for problems using the immiscible multi-phase model //! The generic type tag for problems using the immiscible multi-phase model
// Create new type tags // Create new type tags
namespace TTag { namespace TTag {
struct MultiPhaseBaseModel { using InheritsFrom = std::tuple<VtkTemperature, VtkMultiPhase>; }; struct MultiPhaseBaseModel { using InheritsFrom = std::tuple<VtkTemperature>; };
} // end namespace TTag } // end namespace TTag
//! Specify the splices of the MultiPhaseBaseModel type tag //! Specify the splices of the MultiPhaseBaseModel type tag

View File

@ -166,24 +166,6 @@ public:
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm::Parameters {
// disable output of a few quantities which make sense in a
// multi-phase but not in a single-phase context
template<class TypeTag>
struct VtkWriteSaturations<TypeTag, Properties::TTag::ImmiscibleSinglePhaseModel>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWriteMobilities<TypeTag, Properties::TTag::ImmiscibleSinglePhaseModel>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWriteRelativePermeabilities<TypeTag, Properties::TTag::ImmiscibleSinglePhaseModel>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
/*! /*!
@ -257,6 +239,10 @@ public:
if (enableEnergy) if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters(); Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::SetDefault<Parameters::VtkWriteSaturations>(false);
Parameters::SetDefault<Parameters::VtkWriteMobilities>(false);
Parameters::SetDefault<Parameters::VtkWriteRelativePermeabilities>(false);
} }
/*! /*!

View File

@ -27,117 +27,38 @@
#ifndef EWOMS_VTK_MULTI_PHASE_MODULE_HH #ifndef EWOMS_VTK_MULTI_PHASE_MODULE_HH
#define EWOMS_VTK_MULTI_PHASE_MODULE_HH #define EWOMS_VTK_MULTI_PHASE_MODULE_HH
#include "vtkmultiwriter.hh" #include <dune/common/fvector.hh>
#include "baseoutputmodule.hh"
#include <opm/material/common/MathToolbox.hpp> #include <opm/material/common/MathToolbox.hpp>
#include <opm/material/common/Valgrind.hpp> #include <opm/material/common/Valgrind.hpp>
#include <opm/models/discretization/common/fvbaseparameters.hh> #include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/utils/propertysystem.hh> #include <opm/models/io/baseoutputmodule.hh>
#include <opm/models/utils/parametersystem.hh> #include <opm/models/io/vtkmultiwriter.hh>
#include <dune/common/fvector.hh> #include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
#include <cstdio> #include <cstdio>
namespace Opm::Properties::TTag {
// create new type tag for the VTK multi-phase output
struct VtkMultiPhase {};
} // namespace Opm::Properties::TTag
namespace Opm::Parameters { namespace Opm::Parameters {
// create the property tags needed for the multi phase module
template<class TypeTag, class MyTypeTag>
struct VtkWriteExtrusionFactor { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWritePressures { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteDensities { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteSaturations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteMobilities { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteRelativePermeabilities { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteViscosities { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteAverageMolarMasses { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWritePorosity { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteIntrinsicPermeabilities { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWritePotentialGradients { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct VtkWriteFilterVelocities { using type = Properties::UndefinedProperty; };
// set default values for what quantities to output // set default values for what quantities to output
template<class TypeTag> struct VtkWriteExtrusionFactor { static constexpr bool value = false; };
struct VtkWriteExtrusionFactor<TypeTag, Properties::TTag::VtkMultiPhase> struct VtkWritePressures { static constexpr bool value = true; };
{ static constexpr bool value = false; }; 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; };
template<class TypeTag> } // namespace Opm::Parameters
struct VtkWritePressures<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = true; };
template<class TypeTag>
struct VtkWriteDensities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = true; };
template<class TypeTag>
struct VtkWriteSaturations<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = true; };
template<class TypeTag>
struct VtkWriteMobilities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWriteRelativePermeabilities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = true; };
template<class TypeTag>
struct VtkWriteViscosities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWriteAverageMolarMasses<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWritePorosity<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = true; };
template<class TypeTag>
struct VtkWriteIntrinsicPermeabilities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWritePotentialGradients<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
template<class TypeTag>
struct VtkWriteFilterVelocities<TypeTag, Properties::TTag::VtkMultiPhase>
{ static constexpr bool value = false; };
} // namespace Opm::Properties
namespace Opm { namespace Opm {
@ -197,29 +118,29 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
Parameters::registerParam<TypeTag, Parameters::VtkWriteExtrusionFactor> Parameters::Register<Parameters::VtkWriteExtrusionFactor>
("Include the extrusion factor of the degrees of freedom into the VTK output files"); ("Include the extrusion factor of the degrees of freedom into the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWritePressures> Parameters::Register<Parameters::VtkWritePressures>
("Include the phase pressures in the VTK output files"); ("Include the phase pressures in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteDensities> Parameters::Register<Parameters::VtkWriteDensities>
("Include the phase densities in the VTK output files"); ("Include the phase densities in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteSaturations> Parameters::Register<Parameters::VtkWriteSaturations>
("Include the phase saturations in the VTK output files"); ("Include the phase saturations in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteMobilities> Parameters::Register<Parameters::VtkWriteMobilities>
("Include the phase mobilities in the VTK output files"); ("Include the phase mobilities in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteRelativePermeabilities> Parameters::Register<Parameters::VtkWriteRelativePermeabilities>
("Include the phase relative permeabilities in the VTK output files"); ("Include the phase relative permeabilities in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteViscosities> Parameters::Register<Parameters::VtkWriteViscosities>
("Include component phase viscosities in the VTK output files"); ("Include component phase viscosities in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteAverageMolarMasses> Parameters::Register<Parameters::VtkWriteAverageMolarMasses>
("Include the average phase mass in the VTK output files"); ("Include the average phase mass in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWritePorosity> Parameters::Register<Parameters::VtkWritePorosity>
("Include the porosity in the VTK output files"); ("Include the porosity in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteIntrinsicPermeabilities> Parameters::Register<Parameters::VtkWriteIntrinsicPermeabilities>
("Include the intrinsic permeability in the VTK output files"); ("Include the intrinsic permeability in the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWriteFilterVelocities> Parameters::Register<Parameters::VtkWriteFilterVelocities>
("Include in the filter velocities of the phases the VTK output files"); ("Include in the filter velocities of the phases the VTK output files");
Parameters::registerParam<TypeTag, Parameters::VtkWritePotentialGradients> Parameters::Register<Parameters::VtkWritePotentialGradients>
("Include the phase pressure potential gradients in the VTK output files"); ("Include the phase pressure potential gradients in the VTK output files");
} }
@ -454,73 +375,73 @@ public:
private: private:
static bool extrusionFactorOutput_() static bool extrusionFactorOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteExtrusionFactor>(); static bool val = Parameters::Get<Parameters::VtkWriteExtrusionFactor>();
return val; return val;
} }
static bool pressureOutput_() static bool pressureOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWritePressures>(); static bool val = Parameters::Get<Parameters::VtkWritePressures>();
return val; return val;
} }
static bool densityOutput_() static bool densityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteDensities>(); static bool val = Parameters::Get<Parameters::VtkWriteDensities>();
return val; return val;
} }
static bool saturationOutput_() static bool saturationOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteSaturations>(); static bool val = Parameters::Get<Parameters::VtkWriteSaturations>();
return val; return val;
} }
static bool mobilityOutput_() static bool mobilityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteMobilities>(); static bool val = Parameters::Get<Parameters::VtkWriteMobilities>();
return val; return val;
} }
static bool relativePermeabilityOutput_() static bool relativePermeabilityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteRelativePermeabilities>(); static bool val = Parameters::Get<Parameters::VtkWriteRelativePermeabilities>();
return val; return val;
} }
static bool viscosityOutput_() static bool viscosityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteViscosities>(); static bool val = Parameters::Get<Parameters::VtkWriteViscosities>();
return val; return val;
} }
static bool averageMolarMassOutput_() static bool averageMolarMassOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteAverageMolarMasses>(); static bool val = Parameters::Get<Parameters::VtkWriteAverageMolarMasses>();
return val; return val;
} }
static bool porosityOutput_() static bool porosityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWritePorosity>(); static bool val = Parameters::Get<Parameters::VtkWritePorosity>();
return val; return val;
} }
static bool intrinsicPermeabilityOutput_() static bool intrinsicPermeabilityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteIntrinsicPermeabilities>(); static bool val = Parameters::Get<Parameters::VtkWriteIntrinsicPermeabilities>();
return val; return val;
} }
static bool velocityOutput_() static bool velocityOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteFilterVelocities>(); static bool val = Parameters::Get<Parameters::VtkWriteFilterVelocities>();
return val; return val;
} }
static bool potentialGradientOutput_() static bool potentialGradientOutput_()
{ {
static bool val = Parameters::get<TypeTag, Parameters::VtkWritePotentialGradients>(); static bool val = Parameters::Get<Parameters::VtkWritePotentialGradients>();
return val; return val;
} }