diff --git a/dumux/discretization/staggered/freeflow/velocityoutput.hh b/dumux/discretization/staggered/freeflow/velocityoutput.hh index 05ed28c28bde9c98f83afc9e84437d9524b62cd2..1d8683a4f6a569f1edc20168d76e64ca0a7ee4da 100644 --- a/dumux/discretization/staggered/freeflow/velocityoutput.hh +++ b/dumux/discretization/staggered/freeflow/velocityoutput.hh @@ -78,6 +78,10 @@ public: bool enableOutput() { return velocityOutput_; } + // returns the name of the phase for a given index + static std::string phaseName(int phaseIdx) + { return GET_PROP_TYPE(TypeTag, FluidSystem)::phaseName(phaseIdx); } + //! Return the problem boundary types auto problemBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const { return problem_.boundaryTypes(element, scvf); } diff --git a/dumux/io/vtkoutputmodule.hh b/dumux/io/vtkoutputmodule.hh index 708d5406bd1f5f72be137d8f49722b8ae1ec9514..63522f9d8970d18a6406abf6d4a311e42dc062d4 100644 --- a/dumux/io/vtkoutputmodule.hh +++ b/dumux/io/vtkoutputmodule.hh @@ -72,7 +72,6 @@ class VtkOutputModule static constexpr int numPhases = ModelTraits::numPhases(); using VV = typename GridVariables::VolumeVariables; - using FluidSystem = typename VV::FluidSystem; using Scalar = typename GridVariables::Scalar; using GridView = typename FVGridGeometry::GridView; @@ -381,7 +380,7 @@ private: { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) sequenceWriter_.addVertexData( Field(gridGeom_.gridView(), gridGeom_.vertexMapper(), velocity[phaseIdx], - "velocity_" + std::string(FluidSystem::phaseName(phaseIdx+phaseIdxOffset)) + " (m/s)", + "velocity_" + velocityOutput.phaseName(phaseIdx+phaseIdxOffset) + " (m/s)", /*numComp*/dimWorld, /*codim*/dim).get() ); } // cell-centered models @@ -389,7 +388,7 @@ private: { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) sequenceWriter_.addCellData( Field(gridGeom_.gridView(), gridGeom_.elementMapper(), velocity[phaseIdx], - "velocity_" + std::string(FluidSystem::phaseName(phaseIdx+phaseIdxOffset)) + " (m/s)", + "velocity_" + velocityOutput.phaseName(phaseIdx+phaseIdxOffset) + " (m/s)", /*numComp*/dimWorld, /*codim*/0).get() ); } } @@ -549,14 +548,14 @@ private: if (dim > 1) for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) sequenceWriter_.addVertexData( Field(gridGeom_.gridView(), gridGeom_.vertexMapper(), velocity[phaseIdx], - "velocity_" + std::string(FluidSystem::phaseName(phaseIdx+phaseIdxOffset)) + " (m/s)", + "velocity_" + velocityOutput.phaseName(phaseIdx+phaseIdxOffset) + " (m/s)", /*numComp*/dimWorld, /*codim*/dim).get() ); // cell-wise velocities else for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) sequenceWriter_.addCellData( Field(gridGeom_.gridView(), gridGeom_.elementMapper(), velocity[phaseIdx], - "velocity_" + std::string(FluidSystem::phaseName(phaseIdx+phaseIdxOffset)) + " (m/s)", + "velocity_" + velocityOutput.phaseName(phaseIdx+phaseIdxOffset) + " (m/s)", /*numComp*/dimWorld, /*codim*/0).get() ); } diff --git a/dumux/porousmediumflow/velocityoutput.hh b/dumux/porousmediumflow/velocityoutput.hh index 65101339f5871303d31219f993f61ad94eadceab..b7877c5e2a07e59ef446f7b3fb1bde92ee238ed4 100644 --- a/dumux/porousmediumflow/velocityoutput.hh +++ b/dumux/porousmediumflow/velocityoutput.hh @@ -48,6 +48,7 @@ class PorousMediumFlowVelocityOutput using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); @@ -106,6 +107,10 @@ public: bool enableOutput() { return velocityOutput_; } + // returns the name of the phase for a given index + static std::string phaseName(int phaseIdx) + { return FluidSystem::phaseName(phaseIdx); } + // The following SFINAE enable_if usage allows compilation, even if only a // // boundaryTypes(const Element&, const scv&)