diff --git a/appl/lecture/msm/1p2cvs2p/watercontaminantfluidsystem.hh b/appl/lecture/msm/1p2cvs2p/watercontaminantfluidsystem.hh index decbf731dcad846f99dc41aa84a8b858b8ccaca0..92e286ac50d8b6bf900694418627b20fd20c52eb 100644 --- a/appl/lecture/msm/1p2cvs2p/watercontaminantfluidsystem.hh +++ b/appl/lecture/msm/1p2cvs2p/watercontaminantfluidsystem.hh @@ -41,7 +41,7 @@ #include <dumux/common/exceptions.hh> #include <dumux/material/fluidsystems/basefluidsystem.hh> - +#include <dumux/common/basicproperties.hh> #include <assert.h> namespace Dumux @@ -50,7 +50,7 @@ namespace FluidSystems { /*! - * \brief A fluid system with one phase and an arbitrary number of components. + * \brief A fluid system with one phase and two components. */ template <class Scalar> class WaterContaminant @@ -357,6 +357,18 @@ public: }; } // end namepace + +/*! + * \brief A pure single-phase fluid system. + * + * This is an adapter to use Dumux::WaterContaminantFluidSystem<TypeTag>, as is + * done with most other classes in Dumux and all template parameters + * are usually defined in the property system anyhow. + */ +template<class TypeTag> +class WaterContaminantFluidSystem +: public FluidSystems::WaterContaminant<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar))> +{}; } // end namepace #endif diff --git a/dumux/boxmodels/1p/1ppropertydefaults.hh b/dumux/boxmodels/1p/1ppropertydefaults.hh index 0cf6625df77e7601a091919acaf5d51938a1d456..6be85e0116361dbacce60db266d98f4c392dcca2 100644 --- a/dumux/boxmodels/1p/1ppropertydefaults.hh +++ b/dumux/boxmodels/1p/1ppropertydefaults.hh @@ -78,14 +78,7 @@ SET_TYPE_PROP(BoxOneP, OnePIndices, OnePIndices); SET_SCALAR_PROP(BoxOneP, UpwindWeight, 0.5); //! The fluid system to use by default -SET_PROP(BoxOneP, FluidSystem) -{ private: - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Fluid)) Fluid; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; - -public: - typedef FluidSystems::OneP<Scalar, Fluid> type; -}; +SET_TYPE_PROP(BoxOneP, FluidSystem, OneP<TypeTag>); SET_PROP(BoxOneP, Fluid) { private: diff --git a/dumux/material/fluidsystems/1pfluidsystem.hh b/dumux/material/fluidsystems/1pfluidsystem.hh index 611a8dccdf2b0419bc79b83b42755430719d0d76..4d60e223a6cddd283fa4e1ae8b093be53ca5fc2d 100644 --- a/dumux/material/fluidsystems/1pfluidsystem.hh +++ b/dumux/material/fluidsystems/1pfluidsystem.hh @@ -33,7 +33,7 @@ #include <dune/common/exceptions.hh> #include "basefluidsystem.hh" - +#include <dumux/common/basicproperties.hh> #include <limits> #include <assert.h> @@ -385,6 +385,23 @@ public: }; } // end namepace + +namespace Properties +{ +NEW_PROP_TAG(Fluid); +}; +/*! + * \brief A pure single-phase fluid system. + * + * This is an adapter to use Dumux::TwoPImmiscible<TypeTag>, as is + * done with most other classes in Dumux and all template parameters + * are usually defined in the property system anyhow. + */ +template<class TypeTag> +class OnePFluidSystem +: public FluidSystems::OneP<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)), + typename GET_PROP_TYPE(TypeTag, PTAG(Fluid))> +{}; } // end namepace #endif diff --git a/dumux/material/fluidsystems/2pimmisciblefluidsystem.hh b/dumux/material/fluidsystems/2pimmisciblefluidsystem.hh index 2c4e60fa2d7fa32ed45de0f096bfb35585f2f164..859a716bed7e1992df1a5f27a7ff746b2aa0ee19 100644 --- a/dumux/material/fluidsystems/2pimmisciblefluidsystem.hh +++ b/dumux/material/fluidsystems/2pimmisciblefluidsystem.hh @@ -39,6 +39,7 @@ #include <dune/common/exceptions.hh> #include "basefluidsystem.hh" +#include <dumux/common/propertysystem.hh> #include <limits> @@ -59,6 +60,8 @@ namespace FluidSystems { * 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. + * An adapter class using Dumux::FluidSystem<TypeTag> is also provided + * at the end of this file. */ template <class Scalar, class WettingPhase, class NonWettingPhase> class TwoPImmiscible @@ -410,7 +413,28 @@ public: } }; -} // end namepace +} // end namepace FluidSystems + +// forward defintions of the property tags +namespace Properties { +NEW_PROP_TAG(Scalar); +NEW_PROP_TAG(WettingPhase); +NEW_PROP_TAG(NonWettingPhase); +}; +/*! + * \brief A non-compositional twophase fluid system. + * + * This is an adapter to use Dumux::TwoPImmiscible<TypeTag>, as is + * done with most other classes in Dumux and all template parameters + * are usually defined in the property system anyhow. + */ +template<class TypeTag> +class TwoPImmiscibleFluidSystem +: public FluidSystems::TwoPImmiscible<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)), + typename GET_PROP_TYPE(TypeTag, PTAG(WettingPhase)), + typename GET_PROP_TYPE(TypeTag, PTAG(NonWettingPhase))> +{}; + } // end namepace #endif diff --git a/dumux/material/old_fluidsystems/defaultcomponents.hh b/dumux/material/fluidsystems/defaultcomponents.hh similarity index 100% rename from dumux/material/old_fluidsystems/defaultcomponents.hh rename to dumux/material/fluidsystems/defaultcomponents.hh diff --git a/dumux/material/fluidsystems/h2on2fluidsystem.hh b/dumux/material/fluidsystems/h2on2fluidsystem.hh index 16fdb8c1fea0726f5b5aeb7a3a44854a04d39202..f0e941ee65ba32ebe81cef8d65f4b1c095209245 100644 --- a/dumux/material/fluidsystems/h2on2fluidsystem.hh +++ b/dumux/material/fluidsystems/h2on2fluidsystem.hh @@ -27,13 +27,12 @@ #ifndef DUMUX_H2O_N2_FLUID_SYSTEM_HH #define DUMUX_H2O_N2_FLUID_SYSTEM_HH -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/components/h2o.hh> -#include <dumux/material/components/n2.hh> -#include <dumux/material/components/tabulatedcomponent.hh> +#include <dumux/material/fluidsystems/defaultcomponents.hh> + #include <dumux/material/idealgas.hh> #include <dumux/material/binarycoefficients/h2o_n2.hh> +#include <dumux/common/basicproperties.hh> #include <dumux/common/valgrind.hh> #include <dumux/common/exceptions.hh> @@ -49,6 +48,12 @@ namespace FluidSystems /*! * \brief A twophase fluid system with water and nitrogen as components. + * + * This FluidSystem can be used without the PropertySystem that is applied in Dumux, + * as all Parameters are defined via template parameters. Hence it is in an + * additional namespace Dumux::FluidSystem::. + * An adapter class using Dumux::FluidSystem<TypeTag> is also provided + * at the end of this file. */ template <class Scalar, bool useComplexRelations = true> class H2ON2 @@ -77,8 +82,10 @@ public: //! Index of the liquid phase static constexpr int lPhaseIdx = 0; + static constexpr int wPhaseIdx = lPhaseIdx; //! Index of the gas phase static constexpr int gPhaseIdx = 1; + static constexpr int nPhaseIdx = gPhaseIdx; //! The components for pure water typedef TabulatedH2O H2O; @@ -425,11 +432,12 @@ public: * \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 + * The fugacity coefficient \f$\phi^\kappa_{\alpha}\f$ is connected to the + * fugacity \f$f^\kappa\f$ and the component's molarity + * \f$x^{\kappa}_{\alpha}\f$ by means of the relation * - * \f[ f_\kappa = \phi_\kappa * x_{\kappa} \f] + * \f[ f^\kappa_{\alpha} = \phi^\kappa_{\alpha} + \cdot x^{\kappa}_{\alpha} p_{\alpha} \f] * * \param fluidState An abitrary fluid state * \param phaseIdx The index of the fluid phase to consider @@ -449,39 +457,15 @@ public: if (phaseIdx == lPhaseIdx) { if (compIdx == H2OIdx) return H2O::vaporPressure(T)/p; - return BinaryCoeff::H2O_N2::henry(T)/p; + return Dumux::BinaryCoeff::H2O_N2::henry(T)/p; } // gas phase -#if 1 return 1.0; // ideal gas -#else - if (!useComplexRelations) - { - return 1.0; // ideal gas - } - else - { - // this code is invalid: isIdealMixture() states that the - // fugacity coefficient for the gas phase does not depend - // on the composition (-> valgrind complains). If we would - // not assume an ideal mixture, the 2p2c model in its - // current form could not be used with this fluid system... - Scalar fugH2O = std::max(1e-3, fluidState.molFraction(gPhaseIdx, H2OIdx) - *fluidState.pressure(gPhaseIdx)); - Scalar fugN2 = std::max(1e-3, fluidState.moleFraction(gPhaseIdx, N2Idx) - *fluidState.pressure(gPhaseIdx)); - Scalar cH2O = H2O::gasDensity(T, fugH2O) / H2O::molarMass(); - Scalar cN2 = N2::gasDensity(T, fugN2) / N2::molarMass(); - - Scalar alpha = (fugH2O + fugN2); - - if (compIdx == H2OIdx) - return fugH2O/(alpha*cH2O/(cH2O + cN2)); - else // (compIdx == N2Idx) - return fugN2/(alpha*cN2/(cH2O + cN2)); - } -#endif + // For ideal gases, the fugacity of the component is equivalent to + // the gas partial pressure (i.e. phi = 1), in real gases it + // would be the gas pressure times the component's fugacity + // coefficient (=> activity). } @@ -662,6 +646,19 @@ public: }; } // end namepace FluidSystems -} // end namepace Dumux + +/*! + * \brief A twophase fluid system with water and nitrogen as components. + * + * This is an adapter to use Dumux::H2ON2FluidSystem<TypeTag>, as is + * done with most other classes in Dumux. + */ +template<class TypeTag> +class H2ON2FluidSystem +: public FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)), + GET_PROP_VALUE(TypeTag, PTAG(EnableComplicatedFluidSystem))> +{}; + +} // end namepace #endif diff --git a/dumux/material/old_fluidsystems/2p_system.hh b/dumux/material/old_fluidsystems/2p_system.hh index ee2f0ded5010fdd1e69b68ec445525d1385735a4..42745d671d9e9651f5afa873d4917e0b73eb9fca 100644 --- a/dumux/material/old_fluidsystems/2p_system.hh +++ b/dumux/material/old_fluidsystems/2p_system.hh @@ -32,7 +32,6 @@ #include <dumux/material/fluidsystems/gasphase.hh> #include <dune/common/exceptions.hh> -#include "defaultcomponents.hh" #include <dumux/common/propertysystem.hh> diff --git a/test/boxmodels/1p2c/interstitialfluidtrailfluidsystem.hh b/test/boxmodels/1p2c/interstitialfluidtrailfluidsystem.hh index e94463575a2d0e99ddd44564e82ebf32815ac91c..15c0342441882ea40001c8a675df29b498e7c9cb 100644 --- a/test/boxmodels/1p2c/interstitialfluidtrailfluidsystem.hh +++ b/test/boxmodels/1p2c/interstitialfluidtrailfluidsystem.hh @@ -33,6 +33,7 @@ #include <dune/common/exceptions.hh> #include <dumux/material/fluidsystems/basefluidsystem.hh> +#include <dumux/common/basicproperties.hh> #include <assert.h> @@ -360,6 +361,18 @@ public: }; } // end namepace + +/*! + * \brief A pure single-phase fluid system. + * + * This is an adapter to use Dumux::InterstitialFluidTrailFluidSystem<TypeTag>, as is + * done with most other classes in Dumux and all template parameters + * are usually defined in the property system anyhow. + */ +template<class TypeTag> +class InterstitialFluidTrailFluidSystem +: public FluidSystems::InterstitialFluidTrail<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar))> +{}; } // end namepace #endif diff --git a/test/boxmodels/2p/lensproblem.hh b/test/boxmodels/2p/lensproblem.hh index 036b2b979ae51c90a7becf549deeb7b833b2cbba..db8a1ced5054e30ec7e3378ddc2af10a9f554ea7 100644 --- a/test/boxmodels/2p/lensproblem.hh +++ b/test/boxmodels/2p/lensproblem.hh @@ -69,7 +69,7 @@ SET_TYPE_PROP(LensProblem, Grid, Dune::YaspGrid<2>); // Set the problem property SET_TYPE_PROP(LensProblem, Problem, Dumux::LensProblem<TypeTag>); -#if 1 +#if 0 // Set the wetting phase SET_PROP(LensProblem, WettingPhase) { diff --git a/test/decoupled/2p2c/test_dec2p2cproblem.hh b/test/decoupled/2p2c/test_dec2p2cproblem.hh index 898a78ba8bd7f64b19e9b96f432dd544b9dc1345..0b4c0ab1559badf91ffdfa24212a976cdff4c2f2 100644 --- a/test/decoupled/2p2c/test_dec2p2cproblem.hh +++ b/test/decoupled/2p2c/test_dec2p2cproblem.hh @@ -38,7 +38,7 @@ // fluid properties //#include <dumux/material/old_fluidsystems/simple_h2o_n2_system.hh> -#include <dumux/material/old_fluidsystems/h2o_n2_system.hh> +#include <dumux/material/fluidsystems/h2on2fluidsystem.hh> #include <dumux/decoupled/2p2c/2p2cproblem.hh> #include <dumux/decoupled/2p2c/fvpressure2p2c.hh> @@ -87,7 +87,7 @@ SET_INT_PROP(TestDecTwoPTwoCProblem, PressureFormulation, // Select fluid system SET_PROP(TestDecTwoPTwoCProblem, FluidSystem) { - typedef Dumux::H2O_N2_System<TypeTag> type; + typedef Dumux::H2ON2FluidSystem<TypeTag> type; }; // Select fluid system SET_BOOL_PROP(TestDecTwoPTwoCProblem, EnableComplicatedFluidSystem, true); diff --git a/tutorial/tutorialproblem_coupled.hh b/tutorial/tutorialproblem_coupled.hh index 67ae05a8eb9b0c35f43b5a00790297c4bb59eb22..a86aed85e9bd06cc82a927ab351ff5705c246cee 100644 --- a/tutorial/tutorialproblem_coupled.hh +++ b/tutorial/tutorialproblem_coupled.hh @@ -91,6 +91,7 @@ private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; public: typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-coupled:nonwettingPhase}@*/ }; /*@\label{tutorial-coupled:2p-system-end}@*/ +SET_TYPE_PROP(TutorialProblemCoupled, FluidSystem, Dumux::TwoPImmiscibleFluidSystem<TypeTag>); // Disable gravity SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-coupled:gravity}@*/ }