Commit 1885effc authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Kilian Weishaupt
Browse files

[io] adapt all porousmediumflow and geomechanics models

Rename `VtkOutputFields` to `IOFields`. Add `primaryVariableName`
functions, don't use centralized names yet. Add required template
parameters. Adapt properties correspondingly.
parent a5402fac
......@@ -174,7 +174,7 @@ NEW_PROP_TAG(PressureFormulation); //! the formulation of the pressure e.g most
NEW_PROP_TAG(EquilibriumModelTraits);
NEW_PROP_TAG(EquilibriumLocalResidual);
NEW_PROP_TAG(EquilibriumIndices);
NEW_PROP_TAG(EquilibriumVtkOutputFields);
NEW_PROP_TAG(EquilibriumIOFields);
NEW_PROP_TAG(NumEqBalance);
NEW_PROP_TAG(EnableThermalNonEquilibrium);
NEW_PROP_TAG(EnableChemicalNonEquilibrium);
......
......@@ -19,25 +19,32 @@
/*!
* \file
* \ingroup PoroElastic
* \brief Adds vtk output fields specific to the poro-elastic model
* \brief Adds I/O fields specific to the poro-elastic model
*/
#ifndef DUMUX_POROELASTIC_VTK_OUTPUT_FIELDS_HH
#define DUMUX_POROELASTIC_VTK_OUTPUT_FIELDS_HH
#ifndef DUMUX_POROELASTIC_IO_FIELDS_HH
#define DUMUX_POROELASTIC_IO_FIELDS_HH
namespace Dumux {
/*!
* \ingroup PoroElastic
* \brief Adds vtk output fields specific to the poro-elastic model
* \brief Adds I/O fields specific to the poro-elastic model
*/
class PoroElasticVtkOutputFields
class PoroElasticIOFields
{
public:
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
template <class OutputModule>
static void initOutputModule(OutputModule& out)
{
vtk.addVolumeVariable([](const auto& volVars){ return volVars.displacement(); }, "u");
vtk.addVolumeVariable([](const auto& volVars){ return volVars.porosity(); }, "porosity");
out.addVolumeVariable([](const auto& volVars){ return volVars.displacement(); }, "u");
out.addVolumeVariable([](const auto& volVars){ return volVars.porosity(); }, "porosity");
}
template <class OutputModule>
DUNE_DEPRECATED_MSG("use initOutputModule instead")
static void init(OutputModule& out)
{
initOutputModule(out);
}
};
......
......@@ -37,7 +37,7 @@
#include "localresidual.hh"
#include "volumevariables.hh"
#include "vtkoutputfields.hh"
#include "iofields.hh"
namespace Dumux {
......@@ -73,7 +73,7 @@ NEW_TYPE_TAG(PoroElastic, INHERITS_FROM(Elastic));
SET_TYPE_PROP(PoroElastic, LocalResidual, PoroElasticLocalResidual<TypeTag>);
//! default vtk output fields specific to this model
SET_TYPE_PROP(PoroElastic, VtkOutputFields, PoroElasticVtkOutputFields);
SET_TYPE_PROP(PoroElastic, IOFields, PoroElasticIOFields);
//! The deault model traits of the poro-elastic model
SET_PROP(PoroElastic, ModelTraits)
......
......@@ -19,7 +19,7 @@
/*!
* \file
* \ingroup OnePModel
* \brief Adds vtk output fields specific to the one phase model
* \brief Adds I/O fields specific to the one phase model
*/
#ifndef DUMUX_ONEP_IO_FIELDS_HH
#define DUMUX_ONEP_IO_FIELDS_HH
......
......@@ -50,7 +50,7 @@
#include <dumux/porousmediumflow/properties.hh>
#include <dumux/porousmediumflow/immiscible/localresidual.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include "indices.hh"
#include "volumevariables.hh"
......@@ -160,7 +160,11 @@ public:
///////////////////////////////////////////////////////////////////////////
//! Add temperature to the output
SET_TYPE_PROP(OnePNI, VtkOutputFields, EnergyVtkOutputFields<OnePIOFields>);
SET_PROP(OnePNI, IOFields)
{
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using type = EnergyIOFields<OnePIOFields, ModelTraits>;
};
//! The model traits of the non-isothermal model
SET_TYPE_PROP(OnePNI, ModelTraits, PorousMediumFlowNIModelTraits<OnePModelTraits>);
......
......@@ -19,10 +19,10 @@
/*!
* \file
* \ingroup OnePNCModel
* \brief Adds vtk output fields specific to the OnePNC model
* \brief Adds I/O fields specific to the OnePNC model
*/
#ifndef DUMUX_ONEPNC_VTK_OUTPUT_FIELDS_HH
#define DUMUX_ONEPNC_VTK_OUTPUT_FIELDS_HH
#ifndef DUMUX_ONEPNC_IO_FIELDS_HH
#define DUMUX_ONEPNC_IO_FIELDS_HH
#include <string>
......@@ -30,30 +30,49 @@ namespace Dumux {
/*!
* \ingroup OnePNCModel
* \brief Adds vtk output fields specific to the OnePNC model
* \brief Adds I/O fields specific to the OnePNC model
*/
class OnePNCVtkOutputFields
template <bool useMoles>
class OnePNCIOFields
{
public:
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
template <class OutputModule>
static void initOutputModule(OutputModule& out)
{
using VolumeVariables = typename VtkOutputModule::VolumeVariables;
using VolumeVariables = typename OutputModule::VolumeVariables;
using FluidSystem = typename VolumeVariables::FluidSystem;
vtk.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0); }, "p");
vtk.addVolumeVariable([](const auto& volVars){ return volVars.density(0); }, "rho");
vtk.addVolumeVariable([](const auto& volVars){ return volVars.viscosity(0); }, "mu");
vtk.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0) - 1e5; }, "delp");
out.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0); }, "p");
out.addVolumeVariable([](const auto& volVars){ return volVars.density(0); }, "rho");
out.addVolumeVariable([](const auto& volVars){ return volVars.viscosity(0); }, "mu");
out.addVolumeVariable([](const auto& volVars){ return volVars.pressure(0) - 1e5; }, "delp");
for (int i = 0; i < VolumeVariables::numComponents(); ++i)
vtk.addVolumeVariable([i](const auto& volVars){ return volVars.moleFraction(0, i); },
out.addVolumeVariable([i](const auto& volVars){ return volVars.moleFraction(0, i); },
"x^" + std::string(FluidSystem::componentName(i)) + "_" + std::string(FluidSystem::phaseName(0)));
for (int i = 0; i < VolumeVariables::numComponents(); ++i)
vtk.addVolumeVariable([i](const auto& volVars){ return volVars.massFraction(0, i); },
out.addVolumeVariable([i](const auto& volVars){ return volVars.massFraction(0, i); },
"X^" + std::string(FluidSystem::componentName(i))+ "_" + std::string(FluidSystem::phaseName(0)));
}
template <class OutputModule>
DUNE_DEPRECATED_MSG("use initOutputModule instead")
static void init(OutputModule& out)
{
initOutputModule(out);
}
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
const std::string xString = useMoles ? "x" : "X";
if (pvIdx == 0)
return "p";
else
return xString + "^" + FluidSystem::componentName(pvIdx)
+ "_" + FluidSystem::phaseName(0);
}
};
} // end namespace Dumux
......
......@@ -67,12 +67,12 @@
#include <dumux/porousmediumflow/compositional/localresidual.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
#include <dumux/porousmediumflow/nonisothermal/indices.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include <dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh>
#include "indices.hh"
#include "volumevariables.hh"
#include "vtkoutputfields.hh"
#include "iofields.hh"
namespace Dumux {
......@@ -207,14 +207,19 @@ public:
};
//! Set the vtk output fields specific to this model
SET_TYPE_PROP(OnePNC, VtkOutputFields, OnePNCVtkOutputFields);
SET_TYPE_PROP(OnePNC, IOFields, OnePNCIOFields<GET_PROP_VALUE(TypeTag, UseMoles)>);
///////////////////////////////////////////////////////////////////////////
// properties for the non-isothermal single phase model
///////////////////////////////////////////////////////////////////////////
//! the non-isothermal vtk output fields
SET_TYPE_PROP(OnePNCNI, VtkOutputFields, EnergyVtkOutputFields<OnePNCVtkOutputFields>);
SET_PROP(OnePNCNI, IOFields)
{
using OnePNCIOF = OnePNCIOFields<GET_PROP_VALUE(TypeTag, UseMoles)>;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using type = EnergyIOFields<OnePNCIOF, ModelTraits>;
};
//! Use the average for effective conductivities
SET_TYPE_PROP(OnePNCNI,
......
......@@ -76,10 +76,10 @@ v = - \frac{k_{r}}{\mu} \mbox{\bf K}
#include <dumux/porousmediumflow/mineralization/model.hh>
#include <dumux/porousmediumflow/mineralization/localresidual.hh>
#include <dumux/porousmediumflow/mineralization/volumevariables.hh>
#include <dumux/porousmediumflow/mineralization/vtkoutputfields.hh>
#include <dumux/porousmediumflow/mineralization/iofields.hh>
#include <dumux/porousmediumflow/nonisothermal/indices.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh>
namespace Dumux {
......@@ -142,15 +142,26 @@ public:
};
//! Use the mineralization vtk output fields
SET_TYPE_PROP(OnePNCMin, VtkOutputFields, MineralizationVtkOutputFields<OnePNCVtkOutputFields>);
SET_PROP(OnePNCMin, IOFields)
{
using OnePNCIOF = OnePNCIOFields<GET_PROP_VALUE(TypeTag, UseMoles)>;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using type = MineralizationIOFields<OnePNCIOF, FluidSystem::numComponents>;
};
//////////////////////////////////////////////////////////////////
// Properties for the non-isothermal 2pncmin model
//////////////////////////////////////////////////////////////////
//! non-isothermal vtk output
//! non-isothermal vtk output
SET_TYPE_PROP(OnePNCMinNI, VtkOutputFields, EnergyVtkOutputFields<MineralizationVtkOutputFields<OnePNCVtkOutputFields>>);
SET_PROP(OnePNCMinNI, IOFields)
{
using OnePNCIOF = OnePNCIOFields<GET_PROP_VALUE(TypeTag, UseMoles)>;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using MineralizationIOF = MineralizationIOFields<OnePNCIOF, FluidSystem::numComponents>;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using type = EnergyIOFields<MineralizationIOF, ModelTraits>;
};
//! The non-isothermal model traits
SET_PROP(OnePNCMinNI, ModelTraits)
......
......@@ -19,37 +19,60 @@
/*!
* \file
* \ingroup TwoPModel
* \brief Adds vtk output fields specific to the two-phase model
* \brief Adds I/O fields specific to the two-phase model
*/
#ifndef DUMUX_TWOP_VTK_OUTPUT_FIELDS_HH
#define DUMUX_TWOP_VTK_OUTPUT_FIELDS_HH
#ifndef DUMUX_TWOP_IO_FIELDS_HH
#define DUMUX_TWOP_IO_FIELDS_HH
#include <dune/common/deprecated.hh>
#include <dumux/io/name.hh>
#include "model.hh"
namespace Dumux {
/*!
* \ingroup TwoPModel
* \brief Adds vtk output fields specific to the two-phase model
* \brief Adds I/O fields specific to the two-phase model
*/
class TwoPVtkOutputFields
template <TwoPFormulation priVarFormulation>
class TwoPIOFields
{
public:
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
template <class OutputModule>
static void initOutputModule(OutputModule& out)
{
using VolumeVariables = typename VtkOutputModule::VolumeVariables;
using FluidSystem = typename VolumeVariables::FluidSystem;
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(FluidSystem::phase0Idx); }, "S_"+FluidSystem::phaseName(FluidSystem::phase0Idx));
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(FluidSystem::phase1Idx); }, "S_"+FluidSystem::phaseName(FluidSystem::phase1Idx));
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(FluidSystem::phase0Idx); }, "p_"+FluidSystem::phaseName(FluidSystem::phase0Idx));
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(FluidSystem::phase1Idx); }, "p_"+FluidSystem::phaseName(FluidSystem::phase1Idx));
vtk.addVolumeVariable([](const auto& v){ return v.capillaryPressure(); }, "pc");
vtk.addVolumeVariable([](const auto& v){ return v.density(FluidSystem::phase0Idx); }, "rho_"+FluidSystem::phaseName(FluidSystem::phase0Idx));
vtk.addVolumeVariable([](const auto& v){ return v.density(FluidSystem::phase1Idx); }, "rho_"+FluidSystem::phaseName(FluidSystem::phase1Idx));
vtk.addVolumeVariable([](const auto& v){ return v.mobility(FluidSystem::phase0Idx); },"mob_"+ FluidSystem::phaseName(FluidSystem::phase0Idx));
vtk.addVolumeVariable([](const auto& v){ return v.mobility(FluidSystem::phase1Idx); },"mob_"+ FluidSystem::phaseName(FluidSystem::phase1Idx));
vtk.addVolumeVariable([](const auto& v){ return v.porosity(); }, "porosity");
using FS = typename VolumeVariables::FluidSystem;
out.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(FS::phase0Idx); }, "S_"+FS::phaseName(FS::phase0Idx));
out.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(FS::phase1Idx); }, "S_"+FS::phaseName(FS::phase1Idx));
out.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(FS::phase0Idx); }, "p_"+FS::phaseName(FS::phase0Idx));
out.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(FS::phase1Idx); }, "p_"+FS::phaseName(FS::phase1Idx));
out.addVolumeVariable([](const auto& v){ return v.capillaryPressure(); }, "pc");
out.addVolumeVariable([](const auto& v){ return v.density(FS::phase0Idx); }, "rho_"+FS::phaseName(FS::phase0Idx));
out.addVolumeVariable([](const auto& v){ return v.density(FS::phase1Idx); }, "rho_"+FS::phaseName(FS::phase1Idx));
out.addVolumeVariable([](const auto& v){ return v.mobility(FS::phase0Idx); },"mob_"+ FS::phaseName(FS::phase0Idx));
out.addVolumeVariable([](const auto& v){ return v.mobility(FS::phase1Idx); },"mob_"+ FS::phaseName(FS::phase1Idx));
out.addVolumeVariable([](const auto& v){ return v.porosity(); }, "porosity");
}
template <class OutputModule>
DUNE_DEPRECATED_MSG("use initOutputModule instead")
static void init(OutputModule& out)
{
initOutputModule(out);
}
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (priVarFormulation == TwoPFormulation::p0s1)
return pvIdx == 0 ? "p_w" : "S_n";
else
return pvIdx == 0 ? "p_n" : "S_w";
}
};
......
......@@ -69,12 +69,12 @@
#include <dumux/porousmediumflow/immiscible/localresidual.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
#include <dumux/porousmediumflow/nonisothermal/indices.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include "formulation.hh"
#include "indices.hh"
#include "volumevariables.hh"
#include "vtkoutputfields.hh"
#include "iofields.hh"
#include "saturationreconstruction.hh"
namespace Dumux
......@@ -138,6 +138,10 @@ struct TwoPVolumeVariablesTraits
using SaturationReconstruction = SR;
};
// forward declaration
template <TwoPFormulation priVarFormulation>
class TwoPIOFields;
////////////////////////////////
// properties
////////////////////////////////
......@@ -166,7 +170,7 @@ SET_TYPE_PROP(TwoP, LocalResidual, ImmiscibleLocalResidual<TypeTag>); //
SET_TYPE_PROP(TwoP, ModelTraits, TwoPModelTraits<GET_PROP_VALUE(TypeTag, Formulation)>);
//! Set the vtk output fields specific to the twop model
SET_TYPE_PROP(TwoP, VtkOutputFields, TwoPVtkOutputFields);
SET_TYPE_PROP(TwoP, IOFields, TwoPIOFields<GET_PROP_VALUE(TypeTag, Formulation)>);
//! Set the volume variables property
SET_PROP(TwoP, VolumeVariables)
......@@ -208,7 +212,12 @@ public:
SET_TYPE_PROP(TwoPNI, ModelTraits, PorousMediumFlowNIModelTraits<TwoPModelTraits<GET_PROP_VALUE(TypeTag, Formulation)>>);
//! Set the vtk output fields specific to the non-isothermal twop model
SET_TYPE_PROP(TwoPNI, VtkOutputFields, EnergyVtkOutputFields<TwoPVtkOutputFields>);
SET_PROP(TwoPNI, IOFields)
{
using TwoPIOF = TwoPIOFields<GET_PROP_VALUE(TypeTag, Formulation)>;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using type = EnergyIOFields<TwoPIOF, ModelTraits>;
};
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_PROP(TwoPNI, ThermalConductivityModel)
......
......@@ -19,30 +19,49 @@
/*!
* \file
* \ingroup TwoPOneCModel
* \copydoc Dumux::TwoPOneCVtkOutputFields
* \copydoc Dumux::TwoPOneCIOFields
*/
#ifndef DUMUX_TWOP_ONEC_VTK_OUTPUT_FIELDS_HH
#define DUMUX_TWOP_ONEC_VTK_OUTPUT_FIELDS_HH
#ifndef DUMUX_TWOP_ONEC_IO_FIELDS_HH
#define DUMUX_TWOP_ONEC_IO_FIELDS_HH
#include <dumux/porousmediumflow/2p/vtkoutputfields.hh>
#include <dumux/porousmediumflow/2p/iofields.hh>
namespace Dumux {
/*!
* \ingroup TwoPOneCModel
* \brief Adds vtk output fields specific to two-phase one-component model.
* \brief Adds I/O fields specific to two-phase one-component model.
*/
class TwoPOneCVtkOutputFields
template <TwoPFormulation priVarFormulation, class Indices>
class TwoPOneCIOFields
{
public:
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
template <class OutputModule>
static void initOutputModule(OutputModule& out)
{
// use default fields from the 2p model
TwoPVtkOutputFields::init(vtk);
TwoPIOFields<priVarFormulation>::initOutputModule(out);
// output additional to TwoP output:
vtk.addVolumeVariable([](const auto& v){ return v.priVars().state(); }, "phase presence");
out.addVolumeVariable([](const auto& v){ return v.priVars().state(); }, "phase presence");
}
template <class OutputModule>
DUNE_DEPRECATED_MSG("use initOutputModule instead")
static void init(OutputModule& out)
{
initOutputModule(out);
}
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
if (priVarFormulation == TwoPFormulation::p0s1)
return (pvIdx == 0) ? "p_w" :
(state == Indices::twoPhases) ? "S_n" : "T";
else
return (pvIdx == 0) ? "p_n" :
(state == Indices::twoPhases) ? "S_w" : "T";
}
};
......
......@@ -69,10 +69,10 @@
#include <dumux/porousmediumflow/compositional/switchableprimaryvariables.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
#include <dumux/porousmediumflow/nonisothermal/indices.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include "darcyslaw.hh"
#include "vtkoutputfields.hh"
#include "iofields.hh"
#include "localresidual.hh"
#include "indices.hh"
#include "volumevariables.hh"
......@@ -217,7 +217,12 @@ SET_TYPE_PROP(TwoPOneCNI, ThermalConductivityModel, ThermalConductivitySomerton<
SET_TYPE_PROP(TwoPOneCNI, ModelTraits, TwoPOneCNIModelTraits<GET_PROP_VALUE(TypeTag, Formulation)>);
//! The non-isothermal vtk output fields.
SET_TYPE_PROP(TwoPOneCNI, VtkOutputFields, EnergyVtkOutputFields<TwoPOneCVtkOutputFields>);
SET_PROP(TwoPOneCNI, IOFields)
{
using TwoPOneCIOF = TwoPOneCIOFields<GET_PROP_VALUE(TypeTag, Formulation), TwoPOneCIndices>;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using type = EnergyIOFields<TwoPOneCIOF, ModelTraits>;
};
} // end namespace Properties
} // end namespace Dumux
......
......@@ -85,7 +85,7 @@
#include <dumux/porousmediumflow/2pnc/model.hh>
#include <dumux/porousmediumflow/2p/formulation.hh>
#include <dumux/porousmediumflow/nonisothermal/model.hh>
#include <dumux/porousmediumflow/nonisothermal/vtkoutputfields.hh>
#include <dumux/porousmediumflow/nonisothermal/iofields.hh>
#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh>
#include "volumevariables.hh"
......@@ -199,7 +199,16 @@ public:
};
//! Set non-isothermal output fields
SET_TYPE_PROP(TwoPTwoCNI, VtkOutputFields, EnergyVtkOutputFields<TwoPNCVtkOutputFields>);
SET_PROP(TwoPTwoCNI, IOFields)
{
static constexpr auto formulation = GET_PROP_VALUE(TypeTag, Formulation);
using Indices = TwoPNCIndices;
static constexpr auto useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
static constexpr auto setMoleFractionsForFirstPhase = true;
using TwoPNCIOF = TwoPNCIOFields<formulation, Indices, useMoles, setMoleFractionsForFirstPhase>;
using type = EnergyIOFields<TwoPNCIOF, ModelTraits>;
};
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_TYPE_PROP(TwoPTwoCNI, ThermalConductivityModel, ThermalConductivitySomerton<typename GET_PROP_TYPE(TypeTag, Scalar)>);
......
......@@ -19,50 +19,92 @@
/*!
* \file
* \ingroup TwoPNCModel
* \brief Adds vtk output fields specific to the twop-nc model
* \brief Adds I/O fields specific to the twop-nc model
*/
#ifndef DUMUX_TWOP_NC_VTK_OUTPUT_FIELDS_HH
#define DUMUX_TWOP_NC_VTK_OUTPUT_FIELDS_HH
#ifndef DUMUX_TWOP_NC_IO_FIELDS_HH
#define DUMUX_TWOP_NC_IO_FIELDS_HH
#include <dumux/porousmediumflow/2p/vtkoutputfields.hh>
#include <dumux/porousmediumflow/2p/iofields.hh>
namespace Dumux
{
/*!
* \ingroup TwoPNCModel
* \brief Adds vtk output fields specific to the TwoPNC model
* \brief Adds I/O fields specific to the TwoPNC model
*/
class TwoPNCVtkOutputFields
template <TwoPFormulation priVarFormulation, class Indices, bool useMoles, bool setMoleFractionsForFirstPhase>
class TwoPNCIOFields
{
public:
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
template <class OutputModule>
static void initOutputModule(OutputModule& out)
{
using VolumeVariables = typename VtkOutputModule::VolumeVariables;
using VolumeVariables = typename OutputModule::VolumeVariables;
using FluidSystem = typename VolumeVariables::FluidSystem;
// use default fields from the 2p model
TwoPVtkOutputFields::init(vtk);
TwoPIOFields<priVarFormulation>::initOutputModule(out);
//output additional to TwoP output:
for (int i = 0; i < VolumeVariables::numPhases(); ++i)
for (int j = 0; j < VolumeVariables::numComponents(); ++j)
vtk.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },
out.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },
"x^"+ FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(i));
for (int i = 0; i < VolumeVariables::numPhases(); ++i)
vtk.addVolumeVariable([i](const auto& v){ return v.molarDensity(i); },
out.addVolumeVariable([i](const auto& v){ return v.molarDensity(i); },
"rhoMolar_" + FluidSystem::phaseName(i));
if (VolumeVariables::numComponents() < 3){
for (int i = 0; i < VolumeVariables::numPhases(); ++i)
for (int j = 0; j < VolumeVariables::numComponents(); ++j)
vtk.addVolumeVariable([i,j](const auto& v){ return v.massFraction(i,j); },
out.addVolumeVariable([i,j](const auto& v){ return v.massFraction(i,j); },
"X^"+ FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(i));
}
vtk.addVolumeVariable([](const auto& v){ return v.priVars().state(); }, "phase presence");
out.addVolumeVariable([](const auto& v){ return v.priVars().state(); }, "phase presence");
}
template <class OutputModule>
DUNE_DEPRECATED_MSG("use initOutputModule instead")
static void init(OutputModule& out)
{
initOutputModule(out);
}
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
const std::string xString = useMoles ? "x" : "X";
std::string phaseNameSecComps;
if (state == Indices::firstPhaseOnly
|| (state == Indices::bothPhases && setMoleFractionsForFirstPhase))
phaseNameSecComps = FluidSystem::phaseName(FluidSystem::phase0Idx);
else
phaseNameSecComps = FluidSystem::phaseName(FluidSystem::phase1Idx);