From 6f801baf0799ab5221339733b1dc95426f5d4dde Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 6 Sep 2018 18:10:09 +0200 Subject: [PATCH] [freeflow][iofields] Add pVNames --- dumux/freeflow/compositional/iofields.hh | 4 ++-- dumux/freeflow/navierstokes/iofields.hh | 8 +++----- dumux/freeflow/nonisothermal/iofields.hh | 4 ++-- dumux/freeflow/rans/iofields.hh | 7 +++++++ dumux/freeflow/rans/oneeq/iofields.hh | 10 ++++++++++ dumux/freeflow/rans/twoeq/kepsilon/iofields.hh | 13 +++++++++++++ dumux/freeflow/rans/twoeq/komega/iofields.hh | 12 ++++++++++++ dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh | 12 ++++++++++++ 8 files changed, 61 insertions(+), 9 deletions(-) diff --git a/dumux/freeflow/compositional/iofields.hh b/dumux/freeflow/compositional/iofields.hh index 514afc43cd..ebed53abf2 100644 --- a/dumux/freeflow/compositional/iofields.hh +++ b/dumux/freeflow/compositional/iofields.hh @@ -74,7 +74,7 @@ public: } //! return the names of the primary variables - template <class FluidSystem> + template <class ModelTraits, class FluidSystem> static std::string primaryVariableName(int pvIdx = 0, int state = 0) { // priVars: v_0, ..., v_dim-1, p, x_0, ..., x_numComp-1, otherPv ..., T @@ -82,7 +82,7 @@ public: return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(0, pvIdx - ModelTraits::dim()) : IOName::massFraction<FluidSystem>(0, pvIdx - ModelTraits::dim()); else - return BaseOutputFields::template primaryVariableName<FluidSystem>(pvIdx, state); + return BaseOutputFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); } }; diff --git a/dumux/freeflow/navierstokes/iofields.hh b/dumux/freeflow/navierstokes/iofields.hh index 0d1fa6f3e9..fae9c6fa83 100644 --- a/dumux/freeflow/navierstokes/iofields.hh +++ b/dumux/freeflow/navierstokes/iofields.hh @@ -67,13 +67,11 @@ public: } //! return the names of the primary variables - template <class FluidSystem = void> + template <class ModelTraits, class FluidSystem = void> static std::string primaryVariableName(int pvIdx = 0, int state = 0) { - const std::array<std::string, 3> velocities = {"v_x", "v_y", "v_z"}; - - if (pvIdx < FVGridGeometry::Grid::dimension) - return velocities[pvIdx]; + if (pvIdx < ModelTraits::dim()) + return "v"; else return IOName::pressure(); } diff --git a/dumux/freeflow/nonisothermal/iofields.hh b/dumux/freeflow/nonisothermal/iofields.hh index aab75f7562..c8044fdb1d 100644 --- a/dumux/freeflow/nonisothermal/iofields.hh +++ b/dumux/freeflow/nonisothermal/iofields.hh @@ -62,11 +62,11 @@ public: } //! return the names of the primary variables - template <class FluidSystem = void> + template<class ModelTraits, class FluidSystem = void> static std::string primaryVariableName(int pvIdx, int state = 0) { if (pvIdx < ModelTraits::numEq() - 1) - return IsothermalIOFields::template primaryVariableName<FluidSystem>(pvIdx, state); + return IsothermalIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); else return IOName::temperature(); } diff --git a/dumux/freeflow/rans/iofields.hh b/dumux/freeflow/rans/iofields.hh index 3cf03af53a..d14609bc55 100644 --- a/dumux/freeflow/rans/iofields.hh +++ b/dumux/freeflow/rans/iofields.hh @@ -67,6 +67,13 @@ public: out.addVolumeVariable([](const auto& v){ return v.yPlus(); }, "y^+"); out.addVolumeVariable([](const auto& v){ return v.uPlus(); }, "u^+"); } + + //! return the names of the primary variables + template <class ModelTraits, class FluidSystem> + static std::string primaryVariableName(int pvIdx = 0, int state = 0) + { + return NavierStokesIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); + } }; } // end namespace Dumux diff --git a/dumux/freeflow/rans/oneeq/iofields.hh b/dumux/freeflow/rans/oneeq/iofields.hh index 24adbfd3d9..090195661b 100644 --- a/dumux/freeflow/rans/oneeq/iofields.hh +++ b/dumux/freeflow/rans/oneeq/iofields.hh @@ -53,6 +53,16 @@ public: RANSIOFields<FVGridGeometry>::initOutputModule(out); out.addVolumeVariable([](const auto& v){ return v.viscosityTilde(); }, "nu_tilde"); } + + //! return the names of the primary variables + template <class ModelTraits, class FluidSystem> + static std::string primaryVariableName(int pvIdx = 0, int state = 0) + { + if (pvIdx < ModelTraits::dim() + 1) + return RANSIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); + else + return "nu_tilde"; + } }; } // end namespace Dumux diff --git a/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh b/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh index c05d2de1b5..4fd4cab951 100644 --- a/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh +++ b/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh @@ -61,6 +61,19 @@ public: out.addVolumeVariable([](const auto& v){ return v.inNearWallRegion(); }, "inNearWallRegion"); out.addVolumeVariable([](const auto& v){ return v.isMatchingPoint(); }, "isMatchingPoint"); } + + //! return the names of the primary variables + template <class ModelTraits, class FluidSystem> + static std::string primaryVariableName(int pvIdx = 0, int state = 0) + { + std::cout << "kepsi called with " << pvIdx << std::endl; + if (pvIdx < ModelTraits::dim() + ModelTraits::numComponents()) + return RANSIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); + else if (pvIdx == ModelTraits::dim() + ModelTraits::numComponents()) + return "k"; + else + return "epsilon"; + } }; } // end namespace Dumux diff --git a/dumux/freeflow/rans/twoeq/komega/iofields.hh b/dumux/freeflow/rans/twoeq/komega/iofields.hh index ea1c338bac..689745676f 100644 --- a/dumux/freeflow/rans/twoeq/komega/iofields.hh +++ b/dumux/freeflow/rans/twoeq/komega/iofields.hh @@ -57,6 +57,18 @@ public: out.addVolumeVariable([](const auto& v){ return v.turbulentKineticEnergy(); }, "k"); out.addVolumeVariable([](const auto& v){ return v.dissipation(); }, "omega"); } + + //! return the names of the primary variables + template <class ModelTraits, class FluidSystem> + static std::string primaryVariableName(int pvIdx = 0, int state = 0) + { + if (pvIdx < ModelTraits::dim() + ModelTraits::numComponents()) + return RANSIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); + else if (pvIdx == ModelTraits::dim() + ModelTraits::numComponents()) + return "k"; + else + return "omega"; + } }; } // end namespace Dumux diff --git a/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh b/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh index 289777bf00..de2ffd8ad8 100644 --- a/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh +++ b/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh @@ -56,6 +56,18 @@ public: out.addVolumeVariable([](const auto& v){ return v.turbulentKineticEnergy(); }, "k"); out.addVolumeVariable([](const auto& v){ return v.dissipationTilde(); }, "epsilon"); } + + //! return the names of the primary variables + template <class ModelTraits, class FluidSystem> + static std::string primaryVariableName(int pvIdx = 0, int state = 0) + { + if (pvIdx < ModelTraits::dim() + ModelTraits::numComponents()) + return RANSIOFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state); + else if (pvIdx == ModelTraits::dim() + ModelTraits::numComponents()) + return "k"; + else + return "epsilon"; + } }; } // end namespace Dumux -- GitLab