From 2f3871323cb454728cda645e6b17cb88a14d0148 Mon Sep 17 00:00:00 2001 From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de> Date: Thu, 8 Mar 2018 14:50:54 +0100 Subject: [PATCH] [test] mpnc 2p2c- comparison: remove typetag from vtkoutput --- .../mpnccomparison/2p2c_comparison_problem.hh | 10 ++++- .../mpnccomparison/vtkoutputfields.hh | 38 ++++++++----------- .../2p2ccomparison/mpnc_comparison_problem.hh | 11 +++++- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/test/porousmediumflow/2p2c/implicit/mpnccomparison/2p2c_comparison_problem.hh b/test/porousmediumflow/2p2c/implicit/mpnccomparison/2p2c_comparison_problem.hh index 8110281fd9..42c8ca38b5 100644 --- a/test/porousmediumflow/2p2c/implicit/mpnccomparison/2p2c_comparison_problem.hh +++ b/test/porousmediumflow/2p2c/implicit/mpnccomparison/2p2c_comparison_problem.hh @@ -72,7 +72,15 @@ SET_INT_PROP(TwoPTwoCComparisonTypeTag, Formulation, TwoPTwoCFormulation::pnsw); SET_BOOL_PROP(TwoPTwoCComparisonTypeTag, UseMoles, true); -SET_TYPE_PROP(TwoPTwoCComparisonTypeTag, VtkOutputFields, TwoPTwoCMPNCVtkOutputFields<TypeTag>); +SET_PROP(TwoPTwoCComparisonTypeTag, VtkOutputFields) +{ +private: + using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + +public: + using type = TwoPTwoCMPNCVtkOutputFields<FluidSystem, Indices>; +}; } diff --git a/test/porousmediumflow/2p2c/implicit/mpnccomparison/vtkoutputfields.hh b/test/porousmediumflow/2p2c/implicit/mpnccomparison/vtkoutputfields.hh index 1964868b4f..25bfdc159c 100644 --- a/test/porousmediumflow/2p2c/implicit/mpnccomparison/vtkoutputfields.hh +++ b/test/porousmediumflow/2p2c/implicit/mpnccomparison/vtkoutputfields.hh @@ -33,40 +33,34 @@ namespace Dumux * \ingroup TwoPTwoCModel * \brief Adds vtk output fields specific to the two-phase two-component model */ -template<class TypeTag> +template<class FluidSystem, class Indices> class TwoPTwoCMPNCVtkOutputFields { - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - - static constexpr int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); - static constexpr int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); public: template <class VtkOutputModule> static void init(VtkOutputModule& vtk) { // register standardized vtk output fields - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(Indices::nPhaseIdx); }, "Sn"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.saturation(Indices::wPhaseIdx); }, "Sw"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(Indices::nPhaseIdx); }, "pn"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(Indices::wPhaseIdx); }, "pw"); + vtk.addVolumeVariable([](const auto& v){ return v.saturation(Indices::nPhaseIdx); }, "Sn"); + vtk.addVolumeVariable([](const auto& v){ return v.saturation(Indices::wPhaseIdx); }, "Sw"); + vtk.addVolumeVariable([](const auto& v){ return v.pressure(Indices::nPhaseIdx); }, "pn"); + vtk.addVolumeVariable([](const auto& v){ return v.pressure(Indices::wPhaseIdx); }, "pw"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(Indices::wPhaseIdx); }, "rhoW"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(Indices::nPhaseIdx); }, "rhoN"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.mobility(Indices::wPhaseIdx); }, "mobW"); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.mobility(Indices::nPhaseIdx); }, "mobN"); + vtk.addVolumeVariable([](const auto& v){ return v.density(Indices::wPhaseIdx); }, "rhoW"); + vtk.addVolumeVariable([](const auto& v){ return v.density(Indices::nPhaseIdx); }, "rhoN"); + vtk.addVolumeVariable([](const auto& v){ return v.mobility(Indices::wPhaseIdx); }, "mobW"); + vtk.addVolumeVariable([](const auto& v){ return v.mobility(Indices::nPhaseIdx); }, "mobN"); - for (int i = 0; i < numPhases; ++i) - for (int j = 0; j < numComponents; ++j) - vtk.addVolumeVariable([i,j](const VolumeVariables& v){ return v.massFraction(i,j); },"X_"+ FluidSystem::phaseName(i) + "^" + FluidSystem::componentName(j)); + for (int i = 0; i < FluidSystem::numPhases; ++i) + for (int j = 0; j < FluidSystem::numComponents; ++j) + vtk.addVolumeVariable([i,j](const auto& v){ return v.massFraction(i,j); },"X_"+ FluidSystem::phaseName(i) + "^" + FluidSystem::componentName(j)); - for (int i = 0; i < numPhases; ++i) - for (int j = 0; j < numComponents; ++j) - vtk.addVolumeVariable([i,j](const VolumeVariables& v){ return v.moleFraction(i,j); },"x_"+ FluidSystem::phaseName(i) + "^" + FluidSystem::componentName(j)); + for (int i = 0; i < FluidSystem::numPhases; ++i) + for (int j = 0; j < FluidSystem::numComponents; ++j) + vtk.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },"x_"+ FluidSystem::phaseName(i) + "^" + FluidSystem::componentName(j)); - vtk.addVolumeVariable([](const VolumeVariables& v){ return v.porosity(); }, "porosity"); + vtk.addVolumeVariable([](const auto& v){ return v.porosity(); }, "porosity"); } }; diff --git a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh index 729f97da15..c9799fbd22 100644 --- a/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh +++ b/test/porousmediumflow/mpnc/implicit/2p2ccomparison/mpnc_comparison_problem.hh @@ -73,7 +73,16 @@ SET_TYPE_PROP(MPNCComparisonTypeTag, Scalar, double); SET_BOOL_PROP(MPNCComparisonTypeTag, EnableMolecularDiffusion, true); SET_BOOL_PROP(MPNCComparisonTypeTag, UseMoles, true); -SET_TYPE_PROP(MPNCComparisonTypeTag, VtkOutputFields, TwoPTwoCMPNCVtkOutputFields<TypeTag>); + +SET_PROP(MPNCComparisonTypeTag, VtkOutputFields) +{ +private: + using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + +public: + using type = TwoPTwoCMPNCVtkOutputFields<FluidSystem, Indices>; +}; } -- GitLab