diff --git a/dumux/boxmodels/2p/2pfluidstate.hh b/dumux/boxmodels/2p/2pfluidstate.hh index 2b9d3faef65c5607fa6438e0aef0d6ee0e1cb91f..9bf027d232f9c87d4d13081591033fddadaa807e 100644 --- a/dumux/boxmodels/2p/2pfluidstate.hh +++ b/dumux/boxmodels/2p/2pfluidstate.hh @@ -66,20 +66,17 @@ public: * \param pressN The pressure of the nonwetting phase * \param temperature The temperature */ - void update(Scalar Sn, Scalar pressW, Scalar pressN, Scalar temperature) + template <class ParameterCache> + void update(ParameterCache ¶mCache, Scalar Sn, Scalar pressW, Scalar pressN, Scalar temperature) { Sn_ = Sn; phasePressure_[wPhaseIdx] = pressW; phasePressure_[nPhaseIdx] = pressN; - temperature_=temperature; - density_[wPhaseIdx] = FluidSystem::phaseDensity(wPhaseIdx, - temperature, - pressW, - *this); - density_[nPhaseIdx] = FluidSystem::phaseDensity(nPhaseIdx, - temperature, - pressN, - *this); + temperature_ = temperature; + paramCache.updateAll(*this); + + density_[wPhaseIdx] = FluidSystem::density(*this, paramCache, wPhaseIdx); + density_[nPhaseIdx] = FluidSystem::density(*this, paramCache, nPhaseIdx); } /*! @@ -173,7 +170,7 @@ public: * * \param phaseIdx The index of the fluid phase */ - Scalar phasePressure(int phaseIdx) const + Scalar pressure(int phaseIdx) const { return phasePressure_[phaseIdx]; } /*! @@ -183,7 +180,13 @@ public: { return phasePressure_[nPhaseIdx] - phasePressure_[wPhaseIdx]; } /*! - * \brief Returns the temperature of the fluids \f$\mathrm{[K]}\f$. + * \brief Returns the temperature of a fluids \f$\mathrm{[K]}\f$. + */ + Scalar temperature(int phaseIdx) const + { return temperature_; }; + + /*! + * \brief Returns the temperature of all fluids \f$\mathrm{[K]}\f$. * * Note that we assume thermodynamic equilibrium, so all fluids * and the rock matrix exhibit the same temperature. diff --git a/dumux/boxmodels/2p/2pproperties.hh b/dumux/boxmodels/2p/2pproperties.hh index f3fbafaddb8e944770334b9c18580b0362a2523d..6f93ff70b2c71f6bed14e84d270f9bdedc027e3e 100644 --- a/dumux/boxmodels/2p/2pproperties.hh +++ b/dumux/boxmodels/2p/2pproperties.hh @@ -65,7 +65,7 @@ NEW_PROP_TAG(SpatialParameters); //!< The type of the spatial parameters object NEW_PROP_TAG(MaterialLaw); //!< The material law which ought to be used (extracted from the spatial parameters) NEW_PROP_TAG(MaterialLawParams); //!< The context material law (extracted from the spatial parameters) NEW_PROP_TAG(WettingPhase); //!< The wetting phase for two-phase models -NEW_PROP_TAG(NonwettingPhase); //!< The non-wetting phase for two-phase models +NEW_PROP_TAG(NonWettingPhase); //!< The non-wetting phase for two-phase models NEW_PROP_TAG(FluidSystem); //!<The fluid systems including the information about the phases NEW_PROP_TAG(FluidState); //!<The phases state NEW_PROP_TAG(EnableVelocityOutput); //!< Returns whether vertex velocity vectors are written into the vtk output diff --git a/dumux/boxmodels/2p/2ppropertydefaults.hh b/dumux/boxmodels/2p/2ppropertydefaults.hh index 531a4db5dff136e16f4274d699a70214a862cfa4..e8cd2408f3c7b0740aa50896fe50a26b897507c8 100644 --- a/dumux/boxmodels/2p/2ppropertydefaults.hh +++ b/dumux/boxmodels/2p/2ppropertydefaults.hh @@ -37,7 +37,7 @@ #include "2pvolumevariables.hh" #include "2pfluidstate.hh" #include "2pproperties.hh" -#include <dumux/material/fluidsystems/2p_system.hh> +#include <dumux/material/MpNcfluidsystems/2pimmisciblefluidsystem.hh> namespace Dumux { @@ -84,7 +84,17 @@ SET_TYPE_PROP(BoxTwoP, MaterialLawParams, typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLaw))::Params); -SET_TYPE_PROP(BoxTwoP, FluidSystem, FluidSystem2P<TypeTag>); +SET_PROP(BoxTwoP, FluidSystem) +{ private: + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(WettingPhase)) WettingPhase; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(NonWettingPhase)) NonWettingPhase; + +public: + typedef Dumux::TwoPImmiscibleFluidSystem<Scalar, + WettingPhase, + NonWettingPhase> type; +}; SET_TYPE_PROP(BoxTwoP, FluidState, TwoPFluidState<TypeTag>); diff --git a/dumux/boxmodels/2p/2pvolumevariables.hh b/dumux/boxmodels/2p/2pvolumevariables.hh index ed065a3895d1b7ea1c4a3e6ce6b62284a82ed432..c48a76dd86fb22e842d71dc97c87d41afe01b3d1 100644 --- a/dumux/boxmodels/2p/2pvolumevariables.hh +++ b/dumux/boxmodels/2p/2pvolumevariables.hh @@ -130,22 +130,18 @@ public: MaterialLaw::pC(materialParams, 1 - Sn); } - fluidState_.update(Sn, p[wPhaseIdx], p[nPhaseIdx], temperature_); - + typename FluidSystem::ParameterCache paramCache; + fluidState_.update(paramCache, Sn, p[wPhaseIdx], p[nPhaseIdx], temperature_); + mobility_[wPhaseIdx] = MaterialLaw::krw(materialParams, 1 - Sn) / - FluidSystem::phaseViscosity(wPhaseIdx, - temperature_, - p[wPhaseIdx], - fluidState_); + FluidSystem::viscosity(fluidState_, paramCache, wPhaseIdx); + mobility_[nPhaseIdx] = MaterialLaw::krn(materialParams, 1 - Sn) / - FluidSystem::phaseViscosity(nPhaseIdx, - temperature_, - p[nPhaseIdx], - fluidState_); + FluidSystem::viscosity(fluidState_, paramCache, wPhaseIdx); // porosity porosity_ = problem.spatialParameters().porosity(element, diff --git a/dumux/material/MpNcfluidsystems/2pimmisciblefluidsystem.hh b/dumux/material/MpNcfluidsystems/2pimmisciblefluidsystem.hh new file mode 100644 index 0000000000000000000000000000000000000000..eded3cea967399b907a8fee895c788986d659b52 --- /dev/null +++ b/dumux/material/MpNcfluidsystems/2pimmisciblefluidsystem.hh @@ -0,0 +1,405 @@ +/***************************************************************************** + * Copyright (C) 2009-2011 by Andreas Lauser * + * Copyright (C) 2009-2011 by Markus Wolff * + * Institute of Hydraulic Engineering * + * University of Stuttgart, Germany * + * email: <givenname>.<name>@iws.uni-stuttgart.de * + * * + * 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 <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief A fluid system for two-phase models assuming immiscibility and + * thermodynamic equilibrium + * + * The wetting and the non-wetting phase can be defined via their + * individual components. + */ +#ifndef DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH +#define DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH + +#include <dumux/material/fluidsystems/liquidphase.hh> +#include <dumux/material/fluidsystems/gasphase.hh> + +#include <dune/common/exceptions.hh> + +#include "nullparametercache.hh" + +namespace Dumux { + +/*! + * \ingroup Fluidsystems + * + * \brief A fluid system for two-phase models assuming immiscibility and + * thermodynamic equilibrium + * + * The wetting and the non-wetting phase can be defined individually + * via Dumux::LiquidPhase<Component> and + * Dumux::GasPhase<Component>. These phases consist of one pure + * component. With the help of this adapter class, the phase + * properties can be accessed. This is suitable for pure two-phase + * systems without compositional effects. + */ +template <class Scalar, class WettingPhase, class NonWettingPhase> +class TwoPImmiscibleFluidSystem +{ + typedef TwoPImmiscibleFluidSystem<Scalar, WettingPhase, NonWettingPhase> ThisType; + + // do not try to instanciate this class, it has only static members! + TwoPImmiscibleFluidSystem() + {} + +public: + //! The type of parameter cache objects + typedef Dumux::NullParameterCache ParameterCache; + + /**************************************** + * Fluid phase related static parameters + ****************************************/ + + //! Number of phases in the fluid system + static constexpr int numPhases = 2; + + //! Index of the wetting phase + static constexpr int wPhaseIdx = 0; + //! Index of the non-wetting phase + static constexpr int nPhaseIdx = 1; + + /*! + * \brief Return the human readable name of a fluid phase + */ + static const char *phaseName(int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + static const char *name[] = { + "w", + "n" + }; + return name[phaseIdx]; + } + + /*! + * \brief Return whether a phase is liquid + */ + static bool isLiquid(int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + if (phaseIdx == wPhaseIdx) + return WettingPhase::isLiquid(); + return NonWettingPhase::isLiquid(); + } + + /*! + * \brief Returns true if and only if a fluid phase is assumed to + * be an ideal mixture. + * + * We define an ideal mixture as a fluid phase where the fugacity + * coefficients of all components times the pressure of the phase + * are indepent on the fluid composition. This assumtion is true + * if immiscibility is assumed. If you are unsure what + * this function should return, it is safe to return false. The + * only damage done will be (slightly) increased computation times + * in some cases. + */ + static bool isIdealMixture(int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + // we assume immisibility + return true; + } + + /**************************************** + * Component related static parameters + ****************************************/ + + //! Number of components in the fluid system + static constexpr int numComponents = 2; + + //! Index of the wetting phase's component + static constexpr int wCompIdx = 0; + //! Index of the non-wetting phase's component + static constexpr int nCompIdx = 1; + + /*! + * \brief Return the human readable name of a component + * + * \param compIdx index of the component + */ + static const char *componentName(int compIdx) + { + assert(0 <= compIdx && compIdx < numComponents); + + if (compIdx == wCompIdx) + return WettingPhase::name(); + return NonWettingPhase::name(); + } + + /*! + * \brief Return the molar mass of a component in [kg/mol]. + * + * \param compIdx index of the component + */ + static Scalar molarMass(int compIdx) + { + assert(0 <= compIdx && compIdx < numComponents); + + if (compIdx == wCompIdx) + return WettingPhase::molarMass(); + return NonWettingPhase::molarMass(); + } + + /*! + * \brief Critical temperature of a component [K]. + */ + static Scalar criticalTemperature(int compIdx) + { + assert(0 <= compIdx && compIdx < numComponents); + + if (compIdx == wCompIdx) + return WettingPhase::criticalTemperature(); + return NonWettingPhase::criticalTemperature(); + }; + + /*! + * \brief Critical pressure of a component [Pa]. + */ + static Scalar criticalPressure(int compIdx) + { + assert(0 <= compIdx && compIdx < numComponents); + + if (compIdx == wCompIdx) + return WettingPhase::criticalPressure(); + return NonWettingPhase::criticalPressure(); + }; + + /*! + * \brief The acentric factor of a component []. + */ + static Scalar acentricFactor(int compIdx) + { + assert(0 <= compIdx && compIdx < numComponents); + + if (compIdx == wCompIdx) + return WettingPhase::acentricFactor(); + return NonWettingPhase::acentricFactor(); + }; + + /**************************************** + * thermodynamic relations + ****************************************/ + + /*! + * \brief Initialize the fluid system's static parameters + */ + static void init() + { + // two gaseous phases at once do not make sense physically! + // (But two liquids are fine) + assert(WettingPhase::isLiquid() || NonWettingPhase::isLiquid()); + } + + /*! + * \brief Return the density of a phase [kg/m^3]. + * + * \param fluidState The fluid state of the two-phase model + * \param paramCache The object which caches expensive parameters + * required by the fluid system. + * \param phaseIdx Index of the fluid phase + * + * \tparam FluidState the fluid state class of the two-phase model + */ + template <class FluidState> + static Scalar density(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + Scalar temperature = fluidState.temperature(phaseIdx); + Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + return WettingPhase::density(temperature, pressure); + return NonWettingPhase::density(temperature, pressure); + } + + /*! + * \brief Calculate the fugacity coefficient [Pa] of an individual + * component in a fluid phase + * + * The fugacity coefficient \f$\phi_\kappa\f$ is connected to the + * fugacity \f$f_\kappa\f$ and the component's molarity + * \f$x_\kappa\f$ by means of the relation + * + * \f[ f_\kappa = \phi_\kappa * x_{\kappa} \f] + */ + template <class FluidState> + static Scalar fugacityCoefficient(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx, + int compIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + assert(0 <= compIdx && compIdx < numComponents); + + if (phaseIdx == compIdx) + // TODO (?): calculate the real fugacity coefficient of + // the component in the fluid. Probably that's not worth + // the effort, since the fugacity coefficient of the other + // component is infinite anyway... + return 1.0; + return std::numeric_limits<Scalar>::infinity(); + } + + /*! + * \brief Return the viscosity of a phase [Pa*s]. + * + * \param phaseIdx index of the phase + * \param temperature phase temperature in [K] + * \param pressure phase pressure in [Pa] + * \param fluidState The fluid state of the two-phase model + * \tparam FluidState the fluid state class of the two-phase model + * \return returns the viscosity of the phase [Pa*s] + */ + template <class FluidState> + static Scalar viscosity(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + Scalar temperature = fluidState.temperature(phaseIdx); + Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + return WettingPhase::density(temperature, pressure); + return NonWettingPhase::density(temperature, pressure); + } + + /*! + * \brief Calculate the binary molecular diffusion coefficient for + * a component in a fluid phase [mol^2 * s / (kg*m^3)] + * + * Molecular diffusion of a compoent \f$\kappa\f$ is caused by a + * gradient of the chemical potential and follows the law + * + * \f[ J = - D \grad mu_\kappa \f] + * + * where \f$\mu_\kappa\f$ is the component's chemical potential, + * \f$D\f$ is the diffusion coefficient and \f$J\f$ is the + * diffusive flux. \f$mu_\kappa\f$ is connected to the component's + * fugacity \f$f_\kappa\f$ by the relation + * + * \f[ \mu_\kappa = R T_\alpha \mathrm{ln} \frac{f_\kappa}{p_\alpha} \f] + * + * where \f$p_\alpha\f$ and \f$T_\alpha\f$ are the fluid phase' + * pressure and temperature. + */ + template <class FluidState> + static Scalar diffusionCoefficient(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx, + int compIdx) + { + DUNE_THROW(Dune::InvalidStateException, + "Diffusion coefficients of components are meaningless if" + " immiscibility is assumed"); + }; + + /*! + * \brief Given a phase's composition, temperature and pressure, + * return the binary diffusion coefficient for components + * \f$i\f$ and \f$j\f$ in this phase. + */ + template <class FluidState> + static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx, + int compIIdx, + int compJIdx) + + { + DUNE_THROW(Dune::InvalidStateException, + "Binary diffusion coefficients of components are meaningless if" + " immiscibility is assumed"); + }; + + /*! + * \brief Return the specific internal of a fluid phase [J/kg]. + * + * \param phaseIdx index of the phase + * \param temperature phase temperature in [K] + * \param pressure phase pressure in [Pa] + * \param fluidState The fluid state of the two-phase model + * \tparam FluidState the fluid state class of the two-phase model + * \return returns the specific enthalpy of the phase [J/kg] + */ + template <class FluidState> + static Scalar internalEnergy(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + Scalar temperature = fluidState.temperature(phaseIdx); + Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + return WettingPhase::internalEnergy(temperature, pressure); + return NonWettingPhase::internalEnergy(temperature, pressure); + } + + /*! + * \brief Thermal conductivity of a fluid phase [W/(m^2 K/m)]. + */ + template <class FluidState> + static Scalar thermalConductivity(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + Scalar temperature = fluidState.temperature(phaseIdx); + Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + return WettingPhase::thermalConductivity(temperature, pressure); + return NonWettingPhase::thermalConductivity(temperature, pressure); + } + + /*! + * \brief Specific isobaric heat capacity of a fluid phase. + * \f$\mathrm{[J/kg]}\f$. + * + * \param params mutable parameters + * \param phaseIdx for which phase to give back the heat capacity + */ + template <class FluidState> + static Scalar heatCapacity(const FluidState &fluidState, + const ParameterCache ¶mCache, + int phaseIdx) + { + assert(0 <= phaseIdx && phaseIdx < numPhases); + + Scalar temperature = fluidState.temperature(phaseIdx); + Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + return WettingPhase::heatCapacity(temperature, pressure); + return NonWettingPhase::heatCapacity(temperature, pressure); + } +}; + +} // end namepace + +#endif diff --git a/dumux/material/MpNcfluidsystems/h2on2fluidsystem.hh b/dumux/material/MpNcfluidsystems/h2on2fluidsystem.hh index 283e9385a3557d5193c153bd29aa2acbe9eede98..328662b0a782017466f540231d6e790f7d2a94d1 100644 --- a/dumux/material/MpNcfluidsystems/h2on2fluidsystem.hh +++ b/dumux/material/MpNcfluidsystems/h2on2fluidsystem.hh @@ -99,7 +99,7 @@ public: /*! * \brief Return whether a phase is liquid */ - static bool phaseIsLiquid(int phaseIdx) + static bool isLiquid(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); return phaseIdx != gPhaseIdx; @@ -215,6 +215,10 @@ public: return accFac[compIdx]; }; + /**************************************** + * thermodynamic relations + ****************************************/ + /*! * \brief Initialize the fluid system's static parameters generically * @@ -256,7 +260,7 @@ public: const ParameterCache ¶mCache, int phaseIdx) { - assert(0 <= phaseIdx && phaseIdx <= numPhases); + assert(0 <= phaseIdx && phaseIdx < numPhases); Scalar T = fluidState.temperature(phaseIdx); Scalar p = fluidState.pressure(phaseIdx); @@ -292,8 +296,8 @@ public: int phaseIdx, int compIdx) { - assert(0 <= phaseIdx && phaseIdx <= numPhases); - assert(0 <= compIdx && compIdx <= numComponents); + assert(0 <= phaseIdx && phaseIdx < numPhases); + assert(0 <= compIdx && compIdx < numComponents); Scalar T = fluidState.temperature(phaseIdx); Scalar p = fluidState.pressure(phaseIdx); @@ -318,7 +322,7 @@ public: const ParameterCache ¶mCache, int phaseIdx) { - assert(0 <= phaseIdx && phaseIdx <= numPhases); + assert(0 <= phaseIdx && phaseIdx < numPhases); Scalar T = fluidState.temperature(phaseIdx); Scalar p = fluidState.pressure(phaseIdx); @@ -456,7 +460,7 @@ public: } /*! - * \brief Thermal conductivity of a fluid phase. + * \brief Thermal conductivity of a fluid phase [W/(m^2 K/m)]. * * Use the conductivity of air and water as a first approximation. * Source: diff --git a/dumux/material/components/component.hh b/dumux/material/components/component.hh index a162b46b3e4dfafc5d0a608b55117f57166ff25a..fe30167cd3b0795ca448e32c16d816497952a621 100644 --- a/dumux/material/components/component.hh +++ b/dumux/material/components/component.hh @@ -179,6 +179,29 @@ public: static Scalar liquidViscosity(Scalar temperature, Scalar pressure) { DUNE_THROW(Dune::NotImplemented, "Component::liquidViscosity()"); } + /*! + * \brief Thermal conductivity of the component [W/(m^2 K/m)] as a gas. + */ + static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure) + { DUNE_THROW(Dune::NotImplemented, "Component::gasThermalConductivity()"); } + + /*! + * \brief Thermal conductivity of the component [W/(m^2 K/m)] as a liquid. + */ + static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure) + { DUNE_THROW(Dune::NotImplemented, "Component::liquidThermalConductivity()"); } + + /*! + * \brief Specific isobaric heat capacity of the component [J/kg] as a gas. + */ + static Scalar gasHeatCapacity(Scalar temperature, Scalar pressure) + { DUNE_THROW(Dune::NotImplemented, "Component::gasHeatCapacity()"); } + + /*! + * \brief Specific isobaric heat capacity of the component [J/kg] as a liquid. + */ + static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure) + { DUNE_THROW(Dune::NotImplemented, "Component::liquidHeatCapacity()"); } }; } // end namepace diff --git a/dumux/material/fluidsystems/gasphase.hh b/dumux/material/fluidsystems/gasphase.hh index eb8c1487bac391ea1b97c1fd3ec692342c9fb1eb..7efa24e17e8775475ab7a7e5245e23ec039c1c4c 100644 --- a/dumux/material/fluidsystems/gasphase.hh +++ b/dumux/material/fluidsystems/gasphase.hh @@ -22,8 +22,8 @@ * * \brief A gaseous phase consisting of a single component. */ -#ifndef DUMUX_GASPHASE_HH -#define DUMUX_GASPHASE_HH +#ifndef DUMUX_GAS_PHASE_HH +#define DUMUX_GAS_PHASE_HH namespace Dumux { @@ -42,6 +42,12 @@ public: static const char *name() { return Component::name(); } + /*! + * \brief Returs whether the fluid is a liquid + */ + static bool isLiquid() + { return false; }; + /*! * \brief The mass in [kg] of one mole of the component. */ @@ -92,13 +98,13 @@ public: { return Component::gasPressure(temperature, density); } /*! - * \brief Specific enthalpy [J/kg] the pure component in gas. + * \brief Specific enthalpy [J/kg] the pure component as a gas. */ static const Scalar enthalpy(Scalar temperature, Scalar pressure) - { return Component::gasEnthalpy(temperature, pressure); } + { return Component::gasEnthalpy(temperature, pressure); } /*! - * \brief Specific internal energy [J/kg] the pure component in gas. + * \brief Specific internal energy [J/kg] the pure component as a gas. */ static const Scalar internalEnergy(Scalar temperature, Scalar pressure) { return Component::gasInternalEnergy(temperature, pressure); } @@ -108,7 +114,19 @@ public: */ static Scalar viscosity(Scalar temperature, Scalar pressure) { return Component::gasViscosity(temperature, pressure); } + + /*! + * \brief Thermal conductivity of the fluid [W/(m^2 K/m)]. + */ + static Scalar thermalConductivity(Scalar temperature, Scalar pressure) + { return Component::gasThermalConductivity(temperature, pressure); } + + /*! + * \brief Specific isobaric heat capacity of the fluid [J/kg]. + */ + static Scalar heatCapacity(Scalar temperature, Scalar pressure) + { return Component::gasHeatCapacity(temperature, pressure); } }; } // namespace -#endif /* DUMUX_AIRPHASE_HH */ +#endif diff --git a/dumux/material/fluidsystems/liquidphase.hh b/dumux/material/fluidsystems/liquidphase.hh index 1fdb8a6e408d8589da5730c5f5fd6365de738f00..24f009ddee480e16b5c3c30fcb116c55d2543f6e 100644 --- a/dumux/material/fluidsystems/liquidphase.hh +++ b/dumux/material/fluidsystems/liquidphase.hh @@ -22,8 +22,8 @@ * * \brief A liquid phase consisting of a single component. */ -#ifndef DUMUX_LIQUIDPHASE_HH -#define DUMUX_LIQUIDPHASE_HH +#ifndef DUMUX_LIQUID_PHASE_HH +#define DUMUX_LIQUID_PHASE_HH namespace Dumux { @@ -36,13 +36,19 @@ class LiquidPhase { public: typedef ComponentT Component; - + /*! * \brief A human readable name for the compoent. */ static const char *name() { return Component::name(); } + /*! + * \brief Returs whether the fluid is a liquid + */ + static bool isLiquid() + { return true; }; + /*! * \brief The mass in [kg] of one mole of the component. */ @@ -93,13 +99,13 @@ public: { return Component::liquidPressure(temperature, density); } /*! - * \brief Specific enthalpy [J/kg] the pure component in liquid. + * \brief Specific enthalpy [J/kg] the pure component as a liquid. */ static const Scalar enthalpy(Scalar temperature, Scalar pressure) { return Component::liquidEnthalpy(temperature, pressure); } /*! - * \brief Specific internal energy [J/kg] the pure component in gas. + * \brief Specific internal energy [J/kg] the pure component as a liquid. */ static const Scalar internalEnergy(Scalar temperature, Scalar pressure) { return Component::liquidInternalEnergy(temperature, pressure); } @@ -109,6 +115,19 @@ public: */ static Scalar viscosity(Scalar temperature, Scalar pressure) { return Component::liquidViscosity(temperature, pressure); } + + /*! + * \brief Thermal conductivity of the fluid [W/(m^2 K/m)]. + */ + static Scalar thermalConductivity(Scalar temperature, Scalar pressure) + { return Component::liquidThermalConductivity(temperature, pressure); } + + /*! + * \brief Specific isobaric heat capacity of the fluid [J/kg]. + */ + static Scalar heatCapacity(Scalar temperature, Scalar pressure) + { return Component::liquidHeatCapacity(temperature, pressure); } }; } // namespace -#endif /* DUMUX_LIQUIDPHASE_HH */ + +#endif diff --git a/test/boxmodels/2p/lensproblem.hh b/test/boxmodels/2p/lensproblem.hh index f80d1bacce4f02c975d82d05c07c698c42088d27..572974a7821a6e1417497f6fa6b027a23770b7e3 100644 --- a/test/boxmodels/2p/lensproblem.hh +++ b/test/boxmodels/2p/lensproblem.hh @@ -39,7 +39,6 @@ #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/components/simplednapl.hh> #include <dumux/material/fluidsystems/liquidphase.hh> - #include <dumux/boxmodels/2p/2pmodel.hh> #include "lensspatialparameters.hh" @@ -77,7 +76,7 @@ public: }; // Set the non-wetting phase -SET_PROP(LensProblem, NonwettingPhase) +SET_PROP(LensProblem, NonWettingPhase) { private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; @@ -152,6 +151,9 @@ class LensProblem : public TwoPProblem<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(WettingPhase)) WettingPhase; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(NonWettingPhase)) NonWettingPhase; + typedef TwoPFluidState<TypeTag> FluidState; enum { @@ -182,6 +184,7 @@ class LensProblem : public TwoPProblem<TypeTag> typedef typename GET_PROP_TYPE(TypeTag, PTAG(BoundaryTypes)) BoundaryTypes; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; + typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::template Codim<dim>::Entity Vertex; typedef typename GridView::Intersection Intersection; @@ -291,10 +294,7 @@ public: void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { - Scalar densityW = FluidSystem::componentDensity(wPhaseIdx, - wPhaseIdx, - temperature_, - 1e5); + Scalar densityW = WettingPhase::density(temperature_, /*pressure=*/1e5); if (onLeftBoundary_(globalPos)) { @@ -357,15 +357,11 @@ public: const GlobalPosition &globalPos) const { Scalar depth = this->bboxMax()[1] - globalPos[1]; - Scalar densityW = FluidSystem::componentDensity(wPhaseIdx, - wPhaseIdx, - temperature_, - 1e5); + Scalar densityW = WettingPhase::density(temperature_, /*pressure=*/1e5); // hydrostatic pressure values[pwIdx] = 1e5 - densityW*this->gravity()[1]*depth; values[SnIdx] = 0.0; - } // \}