nonequilibriummass.hh 5.75 KB
 Bernd Flemisch committed Jan 22, 2016 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: /***************************************************************************** * See the file COPYING for full copying permissions. * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *****************************************************************************/ /*! * \file  Simon Scholz committed Dec 20, 2017 21  * \ingroup FluidStates  Bernd Flemisch committed Jan 22, 2016 22 23 24 25 26 27 28 29 30 31  * \brief Represents all relevant thermodynamic quantities of a * multi-phase, multi-component fluid system without using * any assumptions. */ #ifndef DUMUX_NONEQUILIBRIUM_MASS_FLUID_STATE_HH #define DUMUX_NONEQUILIBRIUM_MASS_FLUID_STATE_HH #include #include  Timo Koch committed Dec 21, 2017 32 #include  Bernd Flemisch committed Jan 22, 2016 33   Timo Koch committed Dec 08, 2017 34 35 36 37 #include #include #include  Bernd Flemisch committed Jan 22, 2016 38 39 40 41 42 43 44 45 46 47 48 49 namespace Dumux { /*! * \ingroup FluidStates * \brief Represents all relevant thermodynamic quantities of a * multi-phase, multi-component fluid system * * This fluidstate ought to be used for the case of: * - local thermal equilibrium * - local chemical non-equilibrium */  Timo Koch committed Dec 08, 2017 50 51 52 53 template class NonEquilibriumMassFluidState : public NonEquilibriumFluidState {  Bernd Flemisch committed Jan 22, 2016 54  public:  Bernd Flemisch committed Dec 16, 2017 55  using ParentType = NonEquilibriumFluidState;  Bernd Flemisch committed Jan 22, 2016 56   Timo Koch committed Dec 08, 2017 57 58  enum { numPhases = FluidSystem::numPhases }; enum { numComponents = FluidSystem::numComponents };  Bernd Flemisch committed Jan 22, 2016 59   Timo Koch committed Dec 08, 2017 60 61 62  NonEquilibriumMassFluidState() : NonEquilibriumFluidState() {}  Bernd Flemisch committed Jan 22, 2016 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109  /***************************************************** * Setter methods. Note that these are not part of the * generic FluidState interface but specific for each * implementation... *****************************************************/ /*! * \brief Set the temperature \f$\mathrm{[K]}\f$ of a fluid phase * Both versions of the function need to be here. * Otherwise the compiler gets confused. * Thus, this is just forwarding to the Parent * (unclear why this is necessary). */ void setTemperature(const int phaseIdx, const Scalar value) { // Unfortunately throw does not work when triggered from a constructor std::cout <<"file: "<< __FILE__ << ", line: " << __LINE__ <<". This is a fluidstate for *chemical* non-equilibrium, not thermal! \n" ; DUNE_THROW(Dune::NotImplemented, "This is a fluidstate for *chemical* non-equilibrium, not thermal!"); } /*! * \brief Set the temperature \f$\mathrm{[K]}\f$ of the fluid phases. * Both versions of the function need to be here. * Otherwise the compiler gets confused. * Thus, this is just presenting the signature to the compiler. */ void setTemperature(const Scalar value) { temperature_ = value; } /*! * \brief Get the temperature \f$\mathrm{[K]}\f$ of the fluid phases. */ Scalar temperature() const { return temperature_ ; } /*! * \brief Get the temperature \f$\mathrm{[K]}\f$ of the fluid phases. */ Scalar temperature(const int dummy) const { return temperature_ ; }  Simon Scholz committed Dec 20, 2017 110  /*!  Bernd Flemisch committed Jan 22, 2016 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144  * \brief Retrieve all parameters from an arbitrary fluid * state. The assign method from the parent class cannot be used, because here, we have only one temperature. * \param fs Fluidstate */ template void assign(const FluidState& fs) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { ParentType::averageMolarMass_[phaseIdx] = 0; ParentType::sumMoleFractions_[phaseIdx] = 0; for (int compIdx = 0; compIdx < numComponents; ++compIdx) { ParentType::moleFraction_[phaseIdx][compIdx] = fs.moleFraction(phaseIdx, compIdx); ParentType::fugacityCoefficient_[phaseIdx][compIdx] = fs.fugacityCoefficient(phaseIdx, compIdx); ParentType::averageMolarMass_[phaseIdx] += ParentType::moleFraction_[phaseIdx][compIdx]*FluidSystem::molarMass(compIdx); ParentType::sumMoleFractions_[phaseIdx] += ParentType::moleFraction_[phaseIdx][compIdx]; } ParentType::pressure_[phaseIdx] = fs.pressure(phaseIdx); ParentType::saturation_[phaseIdx] = fs.saturation(phaseIdx); ParentType::density_[phaseIdx] = fs.density(phaseIdx); ParentType::enthalpy_[phaseIdx] = fs.enthalpy(phaseIdx); ParentType::viscosity_[phaseIdx] = fs.viscosity(phaseIdx); } temperature_ = fs.temperature(/*phaseIdx=*/0); // in this fluidstate there is only one temperature. } private: Scalar temperature_; }; } // end namespace Dumux #endif