diff --git a/dumux/porousmediumflow/2pnc/iofields.hh b/dumux/porousmediumflow/2pnc/iofields.hh index c04b98110529cef4362ab479bd29bb020ece385e..aee9f5cc2334f14c72f55983f8e233c9d314ac4e 100644 --- a/dumux/porousmediumflow/2pnc/iofields.hh +++ b/dumux/porousmediumflow/2pnc/iofields.hh @@ -77,6 +77,8 @@ public: static std::string primaryVariableName(int pvIdx, int state) { using Indices = typename ModelTraits::Indices; + static constexpr auto numStates = 3; + using StringVec = std::array<std::string, numStates>; int idxSecComps; if (state == Indices::firstPhaseOnly @@ -89,14 +91,14 @@ public: return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(idxSecComps, pvIdx) : IOName::massFraction<FluidSystem>(idxSecComps, pvIdx); - const std::vector<std::string> p0s1SwitchedPvNames = { + static const StringVec p0s1SwitchedPvNames = { ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx) : IOName::massFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx), ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx) : IOName::massFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx), IOName::saturation<FluidSystem>(FluidSystem::phase1Idx)}; - const std::vector<std::string> p1s0SwitchedPvNames = { + static const StringVec p1s0SwitchedPvNames = { ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx) : IOName::massFraction<FluidSystem>(FluidSystem::phase0Idx, FluidSystem::comp1Idx), ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(FluidSystem::phase1Idx, FluidSystem::comp0Idx) diff --git a/dumux/porousmediumflow/3p3c/iofields.hh b/dumux/porousmediumflow/3p3c/iofields.hh index 5f0b3206acd41265f089b2c231ed21ed72c16c0c..9b24517a1ec7284f017dbf1e03070f7649bdaf9c 100644 --- a/dumux/porousmediumflow/3p3c/iofields.hh +++ b/dumux/porousmediumflow/3p3c/iofields.hh @@ -75,49 +75,51 @@ public: static std::string primaryVariableName(int pvIdx, int state) { using Indices = typename ModelTraits::Indices; + static constexpr auto numEq = ModelTraits::numEq(); + using StringVec = std::array<std::string, numEq>; switch (state) { case Indices::threePhases: { - const std::vector<std::string> s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; + static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; return s1[pvIdx]; } case Indices::wPhaseOnly: { - const std::vector<std::string> s2 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)}; return s2[pvIdx]; } case Indices::gnPhaseOnly: { - const std::vector<std::string> s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; + static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; return s3[pvIdx]; } case Indices::wnPhaseOnly: { - const std::vector<std::string> s4 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; + static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::gCompIdx), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; return s4[pvIdx]; } case Indices::gPhaseOnly: { - const std::vector<std::string> s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::wCompIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; return s5[pvIdx]; } case Indices::wgPhaseOnly: { - const std::vector<std::string> s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; return s6[pvIdx]; } } diff --git a/dumux/porousmediumflow/3pwateroil/iofields.hh b/dumux/porousmediumflow/3pwateroil/iofields.hh index 90ed23fe9908dc85962d4be6a8a91bc7ded8b0e9..1da1f5382e67874293b8be2f05d820e4bf9e3c02 100644 --- a/dumux/porousmediumflow/3pwateroil/iofields.hh +++ b/dumux/porousmediumflow/3pwateroil/iofields.hh @@ -81,49 +81,51 @@ public: static std::string primaryVariableName(int pvIdx, int state) { using Indices = typename ModelTraits::Indices; + static constexpr auto numEq = ModelTraits::numEq(); + using StringVec = std::array<std::string, numEq>; switch (state) { case Indices::threePhases: { - const std::vector<std::string> s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; + static const StringVec s1 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; return s1[pvIdx]; } case Indices::wPhaseOnly: { - const std::vector<std::string> s2 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::temperature(), - IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s2 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::temperature(), + IOName::moleFraction<FluidSystem>(FluidSystem::wPhaseIdx, FluidSystem::nCompIdx)}; return s2[pvIdx]; } case Indices::gnPhaseOnly: { - const std::vector<std::string> s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::nPhaseIdx, FluidSystem::wCompIdx)}; + static const StringVec s3 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::nPhaseIdx, FluidSystem::wCompIdx)}; return s3[pvIdx]; } case Indices::wnPhaseOnly: { - const std::vector<std::string> s4 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::temperature(), - IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; + static const StringVec s4 = {IOName::pressure<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::temperature(), + IOName::saturation<FluidSystem>(FluidSystem::nPhaseIdx)}; return s4[pvIdx]; } case Indices::gPhaseOnly: { - const std::vector<std::string> s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::temperature(), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s5 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::temperature(), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; return s5[pvIdx]; } case Indices::wgPhaseOnly: { - const std::vector<std::string> s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), - IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), - IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; + static const StringVec s6 = {IOName::pressure<FluidSystem>(FluidSystem::gPhaseIdx), + IOName::saturation<FluidSystem>(FluidSystem::wPhaseIdx), + IOName::moleFraction<FluidSystem>(FluidSystem::gPhaseIdx, FluidSystem::nCompIdx)}; return s6[pvIdx]; } }