diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh index 3434a8f68a4379b7103dee42db2e8797ee4088f0..7b6ee9af6367b493588e3ec35f4dc2099e03165d 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh @@ -75,7 +75,7 @@ public: * \param spatialParams spatial parameters * \param element element (to be passed to spatialParams) * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scvIdx scvIdx (to be passed to spatialParams) + * \param scv the sub control volume (to be passed to spatialParams) * * \return Effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Johansen (1975) \cite johansen1977 <BR> * @@ -88,19 +88,19 @@ public: * of Sci. and Technol., Trondheim. (Draft Transl. 637. 1977. U.S. Army * Corps of Eng., Cold Regions Res. and Eng. Lab., Hanover, NH.) \cite johansen1977 */ - template<class VolumeVariables, class SpatialParams, class Element, class FVGeometry> + template<class VolumeVariables, class SpatialParams, class Element, class FVGeometry, class SubControlVolume> static Scalar effectiveThermalConductivity(const VolumeVariables& volVars, const SpatialParams& spatialParams, const Element& element, const FVGeometry& fvGeometry, - int scvIdx) + const SubControlVolume& scv) { - Scalar sw = volVars.saturation(Indices::wPhaseIdx); - Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); - Scalar lambdaN = volVars.fluidThermalConductivity(Indices::nPhaseIdx); - Scalar lambdaSolid = volVars.solidThermalConductivity(); - Scalar porosity = volVars.porosity(); - Scalar rhoSolid = spatialParams.solidDensity(element, fvGeometry, scvIdx); + const Scalar sw = volVars.saturation(Indices::wPhaseIdx); + const Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); + const Scalar lambdaN = volVars.fluidThermalConductivity(Indices::nPhaseIdx); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); + const Scalar porosity = volVars.porosity(); + const Scalar rhoSolid = volVars.solidDensity(); return effectiveThermalConductivity(sw, lambdaW, lambdaN, lambdaSolid, porosity, rhoSolid); } diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh index dc4ee7c86f513a92de2cd3f8a4e30459cb5f3c37..90ec0d581fee394f1157090c8344effd5f53fc29 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh @@ -73,7 +73,7 @@ public: * \param spatialParams spatial parameters * \param element element (to be passed to spatialParams) * \param fvGeometry fvGeometry (to be passed to spatialParams) - * \param scvIdx scvIdx (to be passed to spatialParams) + * \param scv the sub control volume (to be passed to spatialParams) * * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$ after Somerton (1974) \cite somerton1974 <BR> * @@ -90,11 +90,11 @@ public: const FVGeometry& fvGeometry, const SubControlVolume& scv) { - Scalar sw = volVars.saturation(Indices::wPhaseIdx); - Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); - Scalar lambdaN = volVars.fluidThermalConductivity(Indices::nPhaseIdx); - Scalar lambdaSolid = volVars.solidThermalConductivity(); - Scalar porosity = volVars.porosity(); + const Scalar sw = volVars.saturation(Indices::wPhaseIdx); + const Scalar lambdaW = volVars.fluidThermalConductivity(Indices::wPhaseIdx); + const Scalar lambdaN = volVars.fluidThermalConductivity(Indices::nPhaseIdx); + const Scalar lambdaSolid = volVars.solidThermalConductivity(); + const Scalar porosity = volVars.porosity(); return effectiveThermalConductivity(sw, lambdaW, lambdaN, lambdaSolid, porosity); } diff --git a/test/material/fluidmatrixinteractions/2p/CMakeLists.txt b/test/material/fluidmatrixinteractions/2p/CMakeLists.txt index 54fdffabecfbf948846e6236f3383e12fcc55f31..8d8889f726a7d15e07c0874c48899e49b1194fb8 100644 --- a/test/material/fluidmatrixinteractions/2p/CMakeLists.txt +++ b/test/material/fluidmatrixinteractions/2p/CMakeLists.txt @@ -16,9 +16,7 @@ add_dumux_test(test_thermalconductivitysomerton test_thermalconductivitysomerton #install sources install(FILES +thermalconductivityspatialparams.hh test_thermalconductivityjohansen.cc test_thermalconductivitysomerton.cc -thermalconductivityjohansenproblem.hh -thermalconductivitysomertonproblem.hh -thermalconductivityspatialparams.hh DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/material/fluidmatrixinteractions/2p) diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.cc b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.cc index acca01b2a9b93ac29588278cc518d3f98098e767..ddf5b48978510a94c7d5c6ad557b2afc16bfcac2 100644 --- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.cc +++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.cc @@ -22,8 +22,23 @@ * \brief Test for the Johansen thermal conductivity law */ #include <config.h> -#include "thermalconductivityjohansenproblem.hh" + +#include "../testproblem.hh" +#include "thermalconductivityspatialparams.hh" + #include <dumux/common/start.hh> +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh> + +namespace Dumux +{ +namespace Properties +{ +// Set thermal conductivity law +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, ThermalConductivityModel, + ThermalConductivityJohansen<typename GET_PROP_TYPE(TypeTag, Scalar)>); +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, SpatialParams, ThermalConductivityTestSpatialParamsTwoP<TypeTag>); +} +} /*! * \brief Provides an interface for customizing error messages associated with @@ -53,6 +68,5 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - typedef TTAG(ThermalConductivityJohansenProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); + return Dumux::start<TTAG(FluidMatrixInteractionTestProblem)>(argc, argv, usage); } diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input index 52dcaeb559b3eda9f5180c2ee23181770562982e..d8c29b2b4d8bd6b3883035990aa43215dceba2b6 100644 --- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input +++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivityjohansen.input @@ -2,10 +2,13 @@ DtInitial = 1 # [s] TEnd = 2 # [s] +[Problem] +Name = test_thermalconductivityjohansen + [Grid] LowerLeft = 0 0 UpperRight = 6 4 Cells = 48 32 -[Conductivity] +[Output] File = johansen_lambda_eff diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.cc b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.cc index 3edb9c0af3cfb259384365f770471a9822678545..3b077580ed4ee89f068ce5a1f50fb2e26954b432 100644 --- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.cc +++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.cc @@ -22,8 +22,23 @@ * \brief Test for the Somerton thermal conductivity law */ #include <config.h> -#include "thermalconductivitysomertonproblem.hh" + +#include "../testproblem.hh" +#include "thermalconductivityspatialparams.hh" + #include <dumux/common/start.hh> +#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh> + +namespace Dumux +{ +namespace Properties +{ +// Set thermal conductivity law +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, ThermalConductivityModel, + ThermalConductivitySomerton<typename GET_PROP_TYPE(TypeTag, Scalar)>); +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, SpatialParams, ThermalConductivityTestSpatialParamsTwoP<TypeTag>); +} +} /*! * \brief Provides an interface for customizing error messages associated with @@ -53,6 +68,5 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - typedef TTAG(ThermalConductivitySomertonProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); + return Dumux::start<TTAG(FluidMatrixInteractionTestProblem)>(argc, argv, usage); } diff --git a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input index d90b9fd49b581ef004dccbaa505f8b7589d395fc..4b6c794d9a99ce6ca1cdd22a02a0a5387fae8f8a 100644 --- a/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input +++ b/test/material/fluidmatrixinteractions/2p/test_thermalconductivitysomerton.input @@ -2,10 +2,13 @@ DtInitial = 1 # [s] TEnd = 2 # [s] +[Problem] +Name = test_thermalconductivitysomerton + [Grid] LowerLeft = 0 0 UpperRight = 6 4 Cells = 48 32 -[Conductivity] +[Output] File = somerton_lambda_eff diff --git a/test/material/fluidmatrixinteractions/2p/thermalconductivityjohansenproblem.hh b/test/material/fluidmatrixinteractions/2p/thermalconductivityjohansenproblem.hh deleted file mode 100644 index d4445d09dcc438f61a1e9d0245eb3a3970bf97e0..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/2p/thermalconductivityjohansenproblem.hh +++ /dev/null @@ -1,222 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Simple test problem for the Johansen thermal conductivity law - */ -#ifndef DUMUX_THERMAL_CONDUCTIVITY_JOHANSEN_PROBLEM_HH -#define DUMUX_THERMAL_CONDUCTIVITY_JOHANSEN_PROBLEM_HH - -#include <dumux/material/fluidsystems/h2on2.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh> - -#include "thermalconductivityspatialparams.hh" - -#define ISOTHERMAL 0 - -namespace Dumux -{ -template <class TypeTag> -class ThermalConductivityJohansenProblem; - -namespace Properties -{ -NEW_TYPE_TAG(ThermalConductivityJohansenProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, ThermalConductivitySpatialParams)); - -// Set the grid type -SET_TYPE_PROP(ThermalConductivityJohansenProblem, Grid, Dune::YaspGrid<2>); - -// Set the problem property -SET_TYPE_PROP(ThermalConductivityJohansenProblem, Problem, ThermalConductivityJohansenProblem<TypeTag>); - -// Set the wetting phase -SET_TYPE_PROP(ThermalConductivityJohansenProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); - -// Set thermal conductivity law -SET_TYPE_PROP(ThermalConductivityJohansenProblem, ThermalConductivityModel, - ThermalConductivityJohansen<typename GET_PROP_TYPE(TypeTag, Scalar)>); -} - - -/*! - * \ingroup MaterialTestProblems - * - * \brief Simple test problem for the Johansen thermal conductivity law - * - * To run the test execute the following line in shell: - * <tt>./test_thermalconductivityjohansen</tt> - * - */ -template <class TypeTag > -class ThermalConductivityJohansenProblem : public ImplicitPorousMediaProblem<TypeTag> -{ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; - - typedef ImplicitPorousMediaProblem<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - - // copy some indices for convenience - typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; - enum { - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - temperatureIdx = Indices::temperatureIdx, - - // Phase State - wPhaseOnly = Indices::wPhaseOnly, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::Intersection Intersection; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; - - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - -public: - /*! - * \brief The constructor. - * - * \param timeManager The time manager - * \param gridView The grid view - */ - ThermalConductivityJohansenProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) - { - FluidSystem::init(273.15, 298.15, 5, 0.99e5, 1.11e5 , 3); - this->spatialParams().plotMaterialLaw(); - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return "test_thermalconductivityjohansen"; } - - - //! \copydoc ImplicitProblem::sourceAtPos() - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - values = 0; - } - - // \} - - /*! - * \name Boundary conditions - */ - // \{ - - - //! \copydoc ImplicitProblem::boundaryTypesAtPos() - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &globalPos) const - { - values.setAllDirichlet(); - } - - - //! \copydoc ImplicitProblem::dirichletAtPos() - void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - //! \copydoc ImplicitProblem::neumann() - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &intersection, - const int scvIdx, - const int boundaryFaceIdx) const - { - values = 0; - } - - // \} - - /*! - * \name Volume terms - */ - // \{ - - - //! \copydoc ImplicitProblem::initialAtPos() - void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - /*! - * \brief Returns the initial phase state for a control volume. - * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex - * \param globalPos The position of the center of the element - */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const - { - return wPhaseOnly; - } - -private: - // internal method for the initial condition (reused for the - // dirichlet conditions!) - void initial_(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - Scalar densityW = 1000.0; - values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; - values[switchIdx] = 0.0; - values[temperatureIdx] = 283.0 + globalPos[1]*0.03; - } -}; -} //end namespace - -#endif diff --git a/test/material/fluidmatrixinteractions/2p/thermalconductivitysomertonproblem.hh b/test/material/fluidmatrixinteractions/2p/thermalconductivitysomertonproblem.hh deleted file mode 100644 index b24e34303cdc48201ff6ff7d5d498ddacf98d468..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/2p/thermalconductivitysomertonproblem.hh +++ /dev/null @@ -1,222 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Simple test problem for the Somerton thermal conductivity law - */ -#ifndef DUMUX_THERMAL_CONDUCTIVITY_SOMERTON_PROBLEM_HH -#define DUMUX_THERMAL_CONDUCTIVITY_SOMERTON_PROBLEM_HH - -#include <dumux/material/fluidsystems/h2on2.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh> - -#include "thermalconductivityspatialparams.hh" - -#define ISOTHERMAL 0 - -namespace Dumux -{ -template <class TypeTag> -class ThermalConductivitySomertonProblem; - -namespace Properties -{ -NEW_TYPE_TAG(ThermalConductivitySomertonProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, ThermalConductivitySpatialParams)); - -// Set the grid type -SET_TYPE_PROP(ThermalConductivitySomertonProblem, Grid, Dune::YaspGrid<2>); - -// Set the problem property -SET_TYPE_PROP(ThermalConductivitySomertonProblem, Problem, ThermalConductivitySomertonProblem<TypeTag>); - -// Set the wetting phase -SET_TYPE_PROP(ThermalConductivitySomertonProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); - -// Set thermal conductivity law -SET_TYPE_PROP(ThermalConductivitySomertonProblem, ThermalConductivityModel, - ThermalConductivitySomerton<typename GET_PROP_TYPE(TypeTag, Scalar)>); -} - - -/*! - * \ingroup MaterialTestProblems - * - * \brief Simple test problem for the Somerton thermal conductivity law - * - * To run the test execute the following line in shell: - * <tt>./test_thermalconductivitysomerton</tt> - * - */ -template <class TypeTag > -class ThermalConductivitySomertonProblem : public ImplicitPorousMediaProblem<TypeTag> -{ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; - - typedef ImplicitPorousMediaProblem<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - - // copy some indices for convenience - typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; - enum { - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - temperatureIdx = Indices::temperatureIdx, - - // Phase State - wPhaseOnly = Indices::wPhaseOnly, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::Intersection Intersection; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; - - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - -public: - /*! - * \brief The constructor. - * - * \param timeManager The time manager - * \param gridView The grid view - */ - ThermalConductivitySomertonProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) - { - FluidSystem::init(273.15, 298.15, 5, 0.99e5, 1.11e5 , 3); - this->spatialParams().plotMaterialLaw(); - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return "test_thermalconductivitysomerton"; } - - - //! \copydoc ImplicitProblem::sourceAtPos() - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - values = 0; - } - - // \} - - /*! - * \name Boundary conditions - */ - // \{ - - - //! \copydoc ImplicitProblem::boundaryTypesAtPos() - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &globalPos) const - { - values.setAllDirichlet(); - } - - - //! \copydoc ImplicitProblem::dirichletAtPos() - void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - //! \copydoc ImplicitProblem::neumann() - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &intersection, - const int scvIdx, - const int boundaryFaceIdx) const - { - values = 0; - } - - // \} - - /*! - * \name Volume terms - */ - // \{ - - - //! \copydoc ImplicitProblem::initialAtPos() - void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - /*! - * \brief Returns the initial phase state for a control volume. - * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex - * \param globalPos The position of the center of the element - */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const - { - return wPhaseOnly; - } - -private: - // internal method for the initial condition (reused for the - // dirichlet conditions!) - void initial_(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - Scalar densityW = 1000.0; - values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; - values[switchIdx] = 0.0; - values[temperatureIdx] = 283.0 + globalPos[1]*0.03; - } -}; -} //end namespace - -#endif diff --git a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh index 90ba3d58d7b711d9935728aaef6433c623e8e953..46452b12e1fa08e913c7cd1341c4d94ecfac197b 100644 --- a/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh +++ b/test/material/fluidmatrixinteractions/2p/thermalconductivityspatialparams.hh @@ -19,91 +19,30 @@ /*! * \file * - * \brief Definition of the spatial parameters for the thermal conductivity tests. + * \brief Definition of the spatial parameters for the effective diffusivity tests. */ -#ifndef DUMUX_THERMAL_CONDUCTIVITY_SPATIAL_PARAMS_HH -#define DUMUX_THERMAL_CONDUCTIVITY_SPATIAL_PARAMS_HH +#ifndef DUMUX_FLUIDMATRIXINTERACTION_TEST_SPATIAL_PARAMS_TWOP_HH +#define DUMUX_FLUIDMATRIXINTERACTION_TEST_SPATIAL_PARAMS_TWOP_HH +#include <dumux/io/gnuplotinterface.hh> #include <dumux/io/plotthermalconductivitymodel.hh> -#include <dumux/material/spatialparams/implicit.hh> -#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> -#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> +#include "../fluidmatrixinteractionsspatialparams.hh" namespace Dumux { -//forward declaration template<class TypeTag> -class ThermalConductivitySpatialParams; - -namespace Properties +class ThermalConductivityTestSpatialParamsTwoP + : public FluidMatrixInteractionTestSpatialParams<TypeTag> { -// The spatial parameters TypeTag -NEW_TYPE_TAG(ThermalConductivitySpatialParams); - -// Set the spatial parameters -SET_TYPE_PROP(ThermalConductivitySpatialParams, SpatialParams, ThermalConductivitySpatialParams<TypeTag>); - -// Set the material law parameterized by absolute saturations -SET_TYPE_PROP(ThermalConductivitySpatialParams, - MaterialLaw, - EffToAbsLaw<RegularizedBrooksCorey<typename GET_PROP_TYPE(TypeTag, Scalar)> >); - -// Define whether to open a gnuplot window -NEW_PROP_TAG(OutputOpenPlotWindow); -SET_BOOL_PROP(ThermalConductivitySpatialParams, OutputOpenPlotWindow, false); -} - -/*! - * \ingroup MaterialTestProblems - * \brief Definition of the spatial parameters for the thermal conductivity tests. - */ -template<class TypeTag> -class ThermalConductivitySpatialParams : public ImplicitSpatialParams<TypeTag> -{ - typedef ImplicitSpatialParams<TypeTag> ParentType; - - typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename Grid::ctype CoordScalar; - enum { - dim=GridView::dimension, - dimWorld=GridView::dimensionworld - }; - - typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GridView::template Codim<0>::Entity Element; - + using ParentType = FluidMatrixInteractionTestSpatialParams<TypeTag>; + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); public: - typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; - typedef typename MaterialLaw::Params MaterialLawParams; - - /*! - * \brief The constructor - * - * \param gridView The grid view - */ - ThermalConductivitySpatialParams(const GridView &gridView) - : ParentType(gridView) - { - porosity_ = 0.3; - rhoSolid_ = 2700.0; - lambdaSolid_ = 2.8; - - // residual saturations - materialParams_.setSwr(0.2); - materialParams_.setSnr(0.0); - - // parameters for the Brooks-Corey law - materialParams_.setPe(1e4); - materialParams_.setLambda(2.0); - } - + ThermalConductivityTestSpatialParamsTwoP(const Problem& problem, const GridView &gridView) + : ParentType(problem, gridView) {} /*! * \brief This is called from the problem and creates a gnuplot output * of e.g the pc-Sw curve @@ -113,100 +52,13 @@ public: GnuplotInterface<Scalar> gnuplot; gnuplot.setOpenPlotWindow(GET_PARAM_FROM_GROUP(TypeTag, bool, Output, OpenPlotWindow)); PlotThermalConductivityModel<TypeTag> plotThermalConductivityModel_(293.15, 1e5); - std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Conductivity, File); - plotThermalConductivityModel_.addlambdaeffcurve(gnuplot, porosity_, rhoSolid_, lambdaSolid_, + std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Output, File); + plotThermalConductivityModel_.addlambdaeffcurve(gnuplot, this->porosity_, this->rhoSolid_, this->lambdaSolid_, 0.0, 1.0, fileName); gnuplot.plot("lambda_eff"); } - - /*! - * \brief Apply the intrinsic permeability tensor to a pressure - * potential gradient. - * - * \param element The current finite element - * \param fvGeometry The current finite volume geometry of the element - * \param scvIdx The index of the sub-control volume - */ - const Scalar intrinsicPermeability(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return 1e-10; } - - /*! - * \brief Define the porosity \f$[-]\f$ of the spatial parameters - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume where - * the porosity needs to be defined - */ - Scalar porosity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return porosity_; } - - - /*! - * \brief return the parameter object for the Brooks-Corey material law which depends on the position - * - * \param element The current finite element - * \param fvGeometry The current finite volume geometry of the element - * \param scvIdx The index of the sub-control volume - */ - const MaterialLawParams& materialLawParams(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return materialParams_; } - - /*! - * \brief Returns the heat capacity \f$[J / (kg K)]\f$ of the rock matrix. - * - * This is only required for non-isothermal models. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume - */ - Scalar solidHeatCapacity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return 790; /* specific heat capacity of granite [J / (kg K)] */ } - - /*! - * \brief Returns the mass density \f$[kg / m^3]\f$ of the rock matrix. - * - * This is only required for non-isothermal models. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume - */ - Scalar solidDensity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return rhoSolid_; /* density of granite [kg/m^3] */ } - - /*! - * \brief Returns the thermal conductivity \f$\mathrm{[W/(m K)]}\f$ of the porous material. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume where - * the heat capacity needs to be defined - */ - Scalar solidThermalConductivity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return lambdaSolid_; /* [W/(m K) */ } - -private: - Scalar porosity_; - Scalar lambdaSolid_; - Scalar rhoSolid_; - - MaterialLawParams materialParams_; }; -} +} // end namespace Dumux #endif diff --git a/test/material/fluidmatrixinteractions/CMakeLists.txt b/test/material/fluidmatrixinteractions/CMakeLists.txt index 59815434cd1311c0c63618b7bed02ee2f0bffe36..8bccac69f4f0a5076231d06380f09303785011df 100644 --- a/test/material/fluidmatrixinteractions/CMakeLists.txt +++ b/test/material/fluidmatrixinteractions/CMakeLists.txt @@ -25,9 +25,10 @@ add_dumux_test(test_effectivediffusivityconstanttau test_effectivediffusivitycon #install sources install(FILES -effectivediffusivityconstanttauproblem.hh -effectivediffusivitymillingtonquirkproblem.hh -effectivediffusivityspatialparams.hh +testproblem.hh +diffusivityspatialparams.hh +fluidmatrixinteractionsspatialparams.hh +test_effectivediffusivityconstant.cc test_effectivediffusivityconstanttau.cc test_effectivediffusivitymillingtonquirk.cc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/material/fluidmatrixinteractions) diff --git a/test/material/fluidmatrixinteractions/diffusivityspatialparams.hh b/test/material/fluidmatrixinteractions/diffusivityspatialparams.hh new file mode 100644 index 0000000000000000000000000000000000000000..983a9e7b5150099ff89180541348839076e6bd1c --- /dev/null +++ b/test/material/fluidmatrixinteractions/diffusivityspatialparams.hh @@ -0,0 +1,64 @@ +// -*- 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 <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief Definition of the spatial parameters for the effective diffusivity tests. + */ +#ifndef DUMUX_DIFFUSIVITY_SPATIAL_PARAMS_HH +#define DUMUX_DIFFUSIVITY_SPATIAL_PARAMS_HH + +#include <dumux/io/gnuplotinterface.hh> +#include <dumux/io/ploteffectivediffusivitymodel.hh> + +#include "fluidmatrixinteractionsspatialparams.hh" + +namespace Dumux +{ + +template<class TypeTag> +class DiffusivityTestSpatialParams + : public FluidMatrixInteractionTestSpatialParams<TypeTag> +{ + using ParentType = FluidMatrixInteractionTestSpatialParams<TypeTag>; + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); +public: + DiffusivityTestSpatialParams(const Problem& problem, const GridView &gridView) + : ParentType(problem, gridView) {} + + /*! + * \brief This is called from the problem and creates a gnuplot output + * of e.g the pc-Sw curve + */ + void plotMaterialLaw() + { + GnuplotInterface<Scalar> gnuplot; + gnuplot.setOpenPlotWindow(GET_PARAM_FROM_GROUP(TypeTag, bool, Output, OpenPlotWindow)); + PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel; + std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Output, File); + plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, this->porosity_, 0.0, 1.0, fileName); + gnuplot.plot("d_eff"); + } +}; + +} // end namespace Dumux + +#endif diff --git a/test/material/fluidmatrixinteractions/effectivediffusivityconstantproblem.hh b/test/material/fluidmatrixinteractions/effectivediffusivityconstantproblem.hh deleted file mode 100644 index be5b5a09a38062b96219214e3f3542ca1303c2a4..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/effectivediffusivityconstantproblem.hh +++ /dev/null @@ -1,222 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Test for the constant tau effective diffusivity model - */ -#ifndef DUMUX_EFFECTIVE_DIFFUSIVITY_CONSTANT_PROBLEM_HH -#define DUMUX_EFFECTIVE_DIFFUSIVITY_CONSTANT_PROBLEM_HH - -#include <dumux/material/fluidsystems/h2on2.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/fluidmatrixinteractions/diffusivityconstant.hh> - -#include "effectivediffusivityspatialparams.hh" - -#define ISOTHERMAL 0 - -namespace Dumux -{ -template <class TypeTag> -class EffectiveDiffusivityConstantProblem; - -namespace Properties -{ -NEW_TYPE_TAG(EffectiveDiffusivityConstantProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, EffectiveDiffusivitySpatialParams)); - -// Set the grid type -SET_TYPE_PROP(EffectiveDiffusivityConstantProblem, Grid, Dune::YaspGrid<2>); - -// Set the problem property -SET_TYPE_PROP(EffectiveDiffusivityConstantProblem, Problem, EffectiveDiffusivityConstantProblem<TypeTag>); - -// Set the wetting phase -SET_TYPE_PROP(EffectiveDiffusivityConstantProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); - -// Set thermal conductivity law -SET_TYPE_PROP(EffectiveDiffusivityConstantProblem, EffectiveDiffusivityModel, - DiffusivityConstant<TypeTag>); -} - - -/*! - * \ingroup MaterialTestProblems - * - * \brief Test for the constant tau effective diffusivity model - * - * To run the test execute the following line in shell: - * <tt>./test_effectivediffusivityconstant</tt> - * - */ -template <class TypeTag > -class EffectiveDiffusivityConstantProblem : public ImplicitPorousMediaProblem<TypeTag> -{ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; - - typedef ImplicitPorousMediaProblem<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - - // copy some indices for convenience - typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; - enum { - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - temperatureIdx = Indices::temperatureIdx, - - // Phase State - wPhaseOnly = Indices::wPhaseOnly, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::Intersection Intersection; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; - - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - -public: - /*! - * \brief The constructor. - * - * \param timeManager The time manager - * \param gridView The grid view - */ - EffectiveDiffusivityConstantProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) - { - FluidSystem::init(273.15, 298.15, 5, 9e4, 5e5, 5); - this->spatialParams().plotMaterialLaw(); - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return "test_effectivediffusivity_ct"; } - - - //! \copydoc ImplicitProblem::sourceAtPos() - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - values = 0; - } - - // \} - - /*! - * \name Boundary conditions - */ - // \{ - - - //! \copydoc ImplicitProblem::boundaryTypesAtPos() - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &globalPos) const - { - values.setAllDirichlet(); - } - - - //! \copydoc ImplicitProblem::dirichletAtPos() - void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - //! \copydoc ImplicitProblem::neumann() - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &intersection, - const int scvIdx, - const int boundaryFaceIdx) const - { - values = 0; - } - - // \} - - /*! - * \name Volume terms - */ - // \{ - - - //! \copydoc ImplicitProblem::initialAtPos() - void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - /*! - * \brief Returns the initial phase state for a control volume. - * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex - * \param globalPos The position of the center of the element - */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const - { - return wPhaseOnly; - } - -private: - // internal method for the initial condition (reused for the - // dirichlet conditions!) - void initial_(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - Scalar densityW = 1000.0; - values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; - values[switchIdx] = 0.0; - values[temperatureIdx] = 283.0 + globalPos[1]*0.03; - } -}; -} //end namespace - -#endif diff --git a/test/material/fluidmatrixinteractions/effectivediffusivityconstanttauproblem.hh b/test/material/fluidmatrixinteractions/effectivediffusivityconstanttauproblem.hh deleted file mode 100644 index 12e89d7f26173c3b0aa41e6d8b688e0b199debb4..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/effectivediffusivityconstanttauproblem.hh +++ /dev/null @@ -1,222 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Test for the constant tau effective diffusivity model - */ -#ifndef DUMUX_EFFECTIVE_DIFFUSIVITY_CONSTANT_TAU_PROBLEM_HH -#define DUMUX_EFFECTIVE_DIFFUSIVITY_CONSTANT_TAU_PROBLEM_HH - -#include <dumux/material/fluidsystems/h2on2.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/fluidmatrixinteractions/diffusivityconstanttau.hh> - -#include "effectivediffusivityspatialparams.hh" - -#define ISOTHERMAL 0 - -namespace Dumux -{ -template <class TypeTag> -class EffectiveDiffusivityConstantTauProblem; - -namespace Properties -{ -NEW_TYPE_TAG(EffectiveDiffusivityConstantTauProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, EffectiveDiffusivitySpatialParams)); - -// Set the grid type -SET_TYPE_PROP(EffectiveDiffusivityConstantTauProblem, Grid, Dune::YaspGrid<2>); - -// Set the problem property -SET_TYPE_PROP(EffectiveDiffusivityConstantTauProblem, Problem, EffectiveDiffusivityConstantTauProblem<TypeTag>); - -// Set the wetting phase -SET_TYPE_PROP(EffectiveDiffusivityConstantTauProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); - -// Set thermal conductivity law -SET_TYPE_PROP(EffectiveDiffusivityConstantTauProblem, EffectiveDiffusivityModel, - DiffusivityConstantTau<TypeTag, typename GET_PROP_TYPE(TypeTag, Scalar)>); -} - - -/*! - * \ingroup MaterialTestProblems - * - * \brief Test for the constant tau effective diffusivity model - * - * To run the test execute the following line in shell: - * <tt>./test_effectivediffusivityconstanttau</tt> - * - */ -template <class TypeTag > -class EffectiveDiffusivityConstantTauProblem : public ImplicitPorousMediaProblem<TypeTag> -{ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; - - typedef ImplicitPorousMediaProblem<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - - // copy some indices for convenience - typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; - enum { - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - temperatureIdx = Indices::temperatureIdx, - - // Phase State - wPhaseOnly = Indices::wPhaseOnly, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::Intersection Intersection; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; - - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - -public: - /*! - * \brief The constructor. - * - * \param timeManager The time manager - * \param gridView The grid view - */ - EffectiveDiffusivityConstantTauProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) - { - FluidSystem::init(273.15, 298.15, 5, 9e4, 5e5, 5); - this->spatialParams().plotMaterialLaw(); - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return "test_effectivediffusivity_ct"; } - - - //! \copydoc ImplicitProblem::sourceAtPos() - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - values = 0; - } - - // \} - - /*! - * \name Boundary conditions - */ - // \{ - - - //! \copydoc ImplicitProblem::boundaryTypesAtPos() - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &globalPos) const - { - values.setAllDirichlet(); - } - - - //! \copydoc ImplicitProblem::dirichletAtPos() - void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - //! \copydoc ImplicitProblem::neumann() - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &intersection, - const int scvIdx, - const int boundaryFaceIdx) const - { - values = 0; - } - - // \} - - /*! - * \name Volume terms - */ - // \{ - - - //! \copydoc ImplicitProblem::initialAtPos() - void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - /*! - * \brief Returns the initial phase state for a control volume. - * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex - * \param globalPos The position of the center of the element - */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const - { - return wPhaseOnly; - } - -private: - // internal method for the initial condition (reused for the - // dirichlet conditions!) - void initial_(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - Scalar densityW = 1000.0; - values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; - values[switchIdx] = 0.0; - values[temperatureIdx] = 283.0 + globalPos[1]*0.03; - } -}; -} //end namespace - -#endif diff --git a/test/material/fluidmatrixinteractions/effectivediffusivitymillingtonquirkproblem.hh b/test/material/fluidmatrixinteractions/effectivediffusivitymillingtonquirkproblem.hh deleted file mode 100644 index 4b298e1e13b39bed896f2ac788ce108ca56017f3..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/effectivediffusivitymillingtonquirkproblem.hh +++ /dev/null @@ -1,222 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Test for the Millington and Quirk effective diffusivity model - */ -#ifndef DUMUX_EFFECTIVE_DIFFUSIVITY_MILLINGTON_QUIRK_PROBLEM_HH -#define DUMUX_EFFECTIVE_DIFFUSIVITY_MILLINGTON_QUIRK_PROBLEM_HH - -#include <dumux/material/fluidsystems/h2on2.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> -#include <dumux/porousmediumflow/implicit/problem.hh> -#include <dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh> - -#include "effectivediffusivityspatialparams.hh" - -#define ISOTHERMAL 0 - -namespace Dumux -{ -template <class TypeTag> -class EffectiveDiffusivityMillingtonQuirkProblem; - -namespace Properties -{ -NEW_TYPE_TAG(EffectiveDiffusivityMillingtonQuirkProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, EffectiveDiffusivitySpatialParams)); - -// Set the grid type -SET_TYPE_PROP(EffectiveDiffusivityMillingtonQuirkProblem, Grid, Dune::YaspGrid<2>); - -// Set the problem property -SET_TYPE_PROP(EffectiveDiffusivityMillingtonQuirkProblem, Problem, EffectiveDiffusivityMillingtonQuirkProblem<TypeTag>); - -// Set the wetting phase -SET_TYPE_PROP(EffectiveDiffusivityMillingtonQuirkProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); - -// Set thermal conductivity law -SET_TYPE_PROP(EffectiveDiffusivityMillingtonQuirkProblem, EffectiveDiffusivityModel, - DiffusivityMillingtonQuirk<typename GET_PROP_TYPE(TypeTag, Scalar)>); -} - - -/*! - * \ingroup MaterialTestProblems - * - * \brief Test for the Millington and Quirk effective diffusivity model - * - * To run the test execute the following line in shell: - * <tt>./test_effectivediffusivitymillingtonquirk</tt> - * - */ -template <class TypeTag > -class EffectiveDiffusivityMillingtonQuirkProblem : public ImplicitPorousMediaProblem<TypeTag> -{ - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; - - typedef ImplicitPorousMediaProblem<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - - // copy some indices for convenience - typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; - enum { - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - temperatureIdx = Indices::temperatureIdx, - - // Phase State - wPhaseOnly = Indices::wPhaseOnly, - - // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; - - typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; - - typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<dim>::Entity Vertex; - typedef typename GridView::Intersection Intersection; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - - typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; - - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - -public: - /*! - * \brief The constructor. - * - * \param timeManager The time manager - * \param gridView The grid view - */ - EffectiveDiffusivityMillingtonQuirkProblem(TimeManager &timeManager, const GridView &gridView) - : ParentType(timeManager, gridView) - { - FluidSystem::init(273.15, 298.15, 5, 9e4, 5e5, 5); - this->spatialParams().plotMaterialLaw(); - } - - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief The problem name. - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return "test_effectivediffusivity_mq"; } - - - //! \copydoc ImplicitProblem::sourceAtPos() - void sourceAtPos(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - values = 0; - } - - // \} - - /*! - * \name Boundary conditions - */ - // \{ - - - //! \copydoc ImplicitProblem::boundaryTypesAtPos() - void boundaryTypesAtPos(BoundaryTypes &values, - const GlobalPosition &globalPos) const - { - values.setAllDirichlet(); - } - - - //! \copydoc ImplicitProblem::dirichletAtPos() - void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - //! \copydoc ImplicitProblem::neumann() - void neumann(PrimaryVariables &values, - const Element &element, - const FVElementGeometry &fvGeometry, - const Intersection &intersection, - const int scvIdx, - const int boundaryFaceIdx) const - { - values = 0; - } - - // \} - - /*! - * \name Volume terms - */ - // \{ - - - //! \copydoc ImplicitProblem::initialAtPos() - void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const - { - initial_(values, globalPos); - } - - - /*! - * \brief Returns the initial phase state for a control volume. - * - * \param vertex The vertex - * \param vIdxGlobal The global index of the vertex - * \param globalPos The position of the center of the element - */ - int initialPhasePresence(const Vertex &vertex, - int &vIdxGlobal, - const GlobalPosition &globalPos) const - { - return wPhaseOnly; - } - -private: - // internal method for the initial condition (reused for the - // dirichlet conditions!) - void initial_(PrimaryVariables &values, - const GlobalPosition &globalPos) const - { - Scalar densityW = 1000.0; - values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; - values[switchIdx] = 0.0; - values[temperatureIdx] = 283.0 + globalPos[1]*0.03; - } -}; -} //end namespace - -#endif diff --git a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh b/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh deleted file mode 100644 index 038449e6bb5873071e5745c9b9f4f7fb19b76d9f..0000000000000000000000000000000000000000 --- a/test/material/fluidmatrixinteractions/effectivediffusivityspatialparams.hh +++ /dev/null @@ -1,211 +0,0 @@ -// -*- 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 <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Definition of the spatial parameters for the effective diffusivity tests. - */ -#ifndef DUMUX_EFFECTIVE_DIFFUSIVITY_SPATIAL_PARAMS_HH -#define DUMUX_EFFECTIVE_DIFFUSIVITY_SPATIAL_PARAMS_HH - -#include <dumux/io/ploteffectivediffusivitymodel.hh> -#include <dumux/material/spatialparams/implicit.hh> -#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> -#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> - -#include <dumux/porousmediumflow/2p2c/implicit/model.hh> - -namespace Dumux -{ - -//forward declaration -template<class TypeTag> -class EffectiveDiffusivitySpatialParams; - -namespace Properties -{ -// The spatial parameters TypeTag -NEW_TYPE_TAG(EffectiveDiffusivitySpatialParams); - -// Set the spatial parameters -SET_TYPE_PROP(EffectiveDiffusivitySpatialParams, SpatialParams, EffectiveDiffusivitySpatialParams<TypeTag>); - -// Set the material law parameterized by absolute saturations -SET_TYPE_PROP(EffectiveDiffusivitySpatialParams, - MaterialLaw, - EffToAbsLaw<RegularizedBrooksCorey<typename GET_PROP_TYPE(TypeTag, Scalar)> >); - -// Define whether to open a gnuplot window -NEW_PROP_TAG(OutputOpenPlotWindow); -SET_BOOL_PROP(EffectiveDiffusivitySpatialParams, OutputOpenPlotWindow, false); -} - -/*! - * \ingroup MaterialTestProblems - * \brief Definition of the spatial parameters for the effective diffusivity tests. - */ -template<class TypeTag> -class EffectiveDiffusivitySpatialParams : public ImplicitSpatialParams<TypeTag> -{ - typedef ImplicitSpatialParams<TypeTag> ParentType; - - typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; - typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef typename Grid::ctype CoordScalar; - enum { - dim=GridView::dimension, - dimWorld=GridView::dimensionworld - }; - - typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; - - typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; - typedef typename GridView::template Codim<0>::Entity Element; - -public: - typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; - typedef typename MaterialLaw::Params MaterialLawParams; - - /*! - * \brief The constructor - * - * \param gridView The grid view - */ - EffectiveDiffusivitySpatialParams(const GridView &gridView) - : ParentType(gridView) - { - porosity_ = 0.3; - rhoSolid_ = 2700.0; - lambdaSolid_ = 2.8; - - // residual saturations - materialParams_.setSwr(0.2); - materialParams_.setSnr(0.0); - - // parameters for the Brooks-Corey law - materialParams_.setPe(1e4); - materialParams_.setLambda(2.0); - } - - /*! - * \brief This is called from the problem and creates a gnuplot output - * of e.g the pc-Sw curve - */ - void plotMaterialLaw() - { - GnuplotInterface<Scalar> gnuplot; - gnuplot.setOpenPlotWindow(GET_PARAM_FROM_GROUP(TypeTag, bool, Output, OpenPlotWindow)); - PlotEffectiveDiffusivityModel<TypeTag> plotEffectiveDiffusivityModel; - std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Diffusivity, File); - plotEffectiveDiffusivityModel.adddeffcurve(gnuplot, porosity_, 0.0, 1.0, fileName); - gnuplot.plot("d_eff"); - } - - /*! - * \brief Apply the intrinsic permeability tensor to a pressure - * potential gradient. - * - * \param element The current finite element - * \param fvGeometry The current finite volume geometry of the element - * \param scvIdx The index of the sub-control volume - */ - const Scalar intrinsicPermeability(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return 1e-10; } - - /*! - * \brief Define the porosity \f$[-]\f$ of the spatial parameters - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume where - * the porosity needs to be defined - */ - Scalar porosity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return porosity_; } - - - /*! - * \brief return the parameter object for the Brooks-Corey material law which depends on the position - * - * \param element The current finite element - * \param fvGeometry The current finite volume geometry of the element - * \param scvIdx The index of the sub-control volume - */ - const MaterialLawParams& materialLawParams(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return materialParams_; } - - /*! - * \brief Returns the heat capacity \f$[J / (kg K)]\f$ of the rock matrix. - * - * This is only required for non-isothermal models. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume - */ - Scalar solidHeatCapacity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return 790; /* specific heat capacity of granite [J / (kg K)] */ } - - /*! - * \brief Returns the mass density \f$[kg / m^3]\f$ of the rock matrix. - * - * This is only required for non-isothermal models. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume - */ - Scalar solidDensity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return rhoSolid_; /* density of granite [kg/m^3] */ } - - /*! - * \brief Returns the thermal conductivity \f$\mathrm{[W/(m K)]}\f$ of the porous material. - * - * \param element The finite element - * \param fvGeometry The finite volume geometry - * \param scvIdx The local index of the sub-control volume where - * the heat capacity needs to be defined - */ - Scalar solidThermalConductivity(const Element &element, - const FVElementGeometry &fvGeometry, - const int scvIdx) const - { return lambdaSolid_; /* [W/(m K) */ } - -private: - Scalar porosity_; - Scalar lambdaSolid_; - Scalar rhoSolid_; - - MaterialLawParams materialParams_; -}; - -} - -#endif diff --git a/test/material/fluidmatrixinteractions/fluidmatrixinteractionsspatialparams.hh b/test/material/fluidmatrixinteractions/fluidmatrixinteractionsspatialparams.hh new file mode 100644 index 0000000000000000000000000000000000000000..d3c0aaf66f615d0259bd9d0d79ca15a48d911308 --- /dev/null +++ b/test/material/fluidmatrixinteractions/fluidmatrixinteractionsspatialparams.hh @@ -0,0 +1,134 @@ +// -*- 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 <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief Definition of the spatial parameters for the effective diffusivity tests. + */ +#ifndef DUMUX_FLUIDMATRIXINTERACTION_TEST_SPATIAL_PARAMS_HH +#define DUMUX_FLUIDMATRIXINTERACTION_TEST_SPATIAL_PARAMS_HH + +#include <dumux/material/spatialparams/implicit.hh> +#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> +#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> + +#include <dumux/porousmediumflow/2p2c/implicit/model.hh> + +namespace Dumux +{ + +//forward declaration +template<class TypeTag> +class FluidMatrixInteractionTestSpatialParams; + +namespace Properties +{ +// The spatial parameters TypeTag +NEW_TYPE_TAG(FluidMatrixInteractionTestSpatialParams); + +// Set the material law parameterized by absolute saturations +SET_TYPE_PROP(FluidMatrixInteractionTestSpatialParams, + MaterialLaw, + EffToAbsLaw<RegularizedBrooksCorey<typename GET_PROP_TYPE(TypeTag, Scalar)> >); + +// Define whether to open a gnuplot window +NEW_PROP_TAG(OutputOpenPlotWindow); +SET_BOOL_PROP(FluidMatrixInteractionTestSpatialParams, OutputOpenPlotWindow, false); +} + +/*! + * \ingroup MaterialTestProblems + * \brief Definition of the spatial parameters for the effective diffusivity tests. + */ +template<class TypeTag> +class FluidMatrixInteractionTestSpatialParams : public ImplicitSpatialParams<TypeTag> +{ + using ParentType = ImplicitSpatialParams<TypeTag>; + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + enum { + dim=GridView::dimension, + dimWorld=GridView::dimensionworld + }; + using GlobalPosition = Dune::FieldVector<Scalar,dimWorld>; + using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); + using MaterialLawParams = typename MaterialLaw::Params; + +public: + + //! exort permeability type + using PermeabilityType = Scalar; + + /*! + * \brief The constructor + * + * \param gridView The grid view + */ + FluidMatrixInteractionTestSpatialParams(const Problem& problem, const GridView &gridView) + : ParentType(problem, gridView) + { + porosity_ = 0.3; + rhoSolid_ = 2700.0; + lambdaSolid_ = 2.8; + + // residual saturations + materialParams_.setSwr(0.2); + materialParams_.setSnr(0.0); + + // parameters for the Brooks-Corey law + materialParams_.setPe(1e4); + materialParams_.setLambda(2.0); + } + + //! \copydoc ImplicitProblem::permeabilityAtPos() + PermeabilityType permeabilityAtPos(const GlobalPosition &globalPos) const + { return 1e-10; } + + //! \copydoc ImplicitProblem::porosityAtPos() + Scalar porosityAtPos(const GlobalPosition &globalPos) const + { return porosity_; } + + //! \copydoc ImplicitProblem::materialLawParamsAtPos() + const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition &globalPos) const + { return materialParams_; } + + //! \copydoc ImplicitProblem::solidHeatCapacityAtPos() + Scalar solidHeatCapacityAtPos(const GlobalPosition &globalPos) const + { return 790; /* specific heat capacity of granite [J / (kg K)] */ } + + //! \copydoc ImplicitProblem::solidDensityAtPos() + Scalar solidDensityAtPos(const GlobalPosition &globalPos) const + { return rhoSolid_; /* density of granite [kg/m^3] */ } + + //! \copydoc ImplicitProblem::solidThermalConductivityAtPos() + Scalar solidThermalConductivityAtPos(const GlobalPosition &globalPos) const + { return lambdaSolid_; /* [W/(m K) */ } + +protected: + Scalar porosity_; + Scalar lambdaSolid_; + Scalar rhoSolid_; + + MaterialLawParams materialParams_; +}; + +} // end namespace Dumux + +#endif diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.cc b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.cc index c24548f156a5c66dc7951bb2512f2c84e57b1532..2c0ff0d2ebe8339e33310f14e9abb734ddc1edab 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.cc +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.cc @@ -22,8 +22,22 @@ * \brief Test for the constant tau effective diffusivity model */ #include <config.h> -#include "effectivediffusivityconstantproblem.hh" + +#include "testproblem.hh" +#include "diffusivityspatialparams.hh" + #include <dumux/common/start.hh> +#include <dumux/material/fluidmatrixinteractions/diffusivityconstant.hh> + +namespace Dumux +{ +namespace Properties +{ +// Set thermal conductivity law +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, EffectiveDiffusivityModel, DiffusivityConstant<TypeTag>); +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, SpatialParams, DiffusivityTestSpatialParams<TypeTag>); +} +} /*! * \brief Provides an interface for customizing error messages associated with @@ -52,5 +66,5 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - return Dumux::start<TTAG(EffectiveDiffusivityConstantProblem)>(argc, argv, usage); + return Dumux::start<TTAG(FluidMatrixInteractionTestProblem)>(argc, argv, usage); } diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input index 5ace3f3b5712a066a2e6c9822f80e3d7f53645a6..58e8e377d238e05c4c20cf05dd7f9580b9660d9d 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstant.input @@ -2,11 +2,14 @@ DtInitial = 1 # [s] TEnd = 2 # [s] +[Problem] +Name = test_effectivediffusivity_const + [Grid] UpperRight = 6 4 Cells = 48 32 -[Diffusivity] +[Output] File = constant_d_eff [] diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.cc b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.cc index e5df12a36d8c31e1789f5bcd4909ca50a9008019..820ecabf6f25cd46e5490e471c4f717a079059a1 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.cc +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.cc @@ -22,8 +22,21 @@ * \brief Test for the constant tau effective diffusivity model */ #include <config.h> -#include "effectivediffusivityconstanttauproblem.hh" +#include "testproblem.hh" +#include "diffusivityspatialparams.hh" + #include <dumux/common/start.hh> +#include <dumux/material/fluidmatrixinteractions/diffusivityconstanttau.hh> + +namespace Dumux +{ +namespace Properties +{ +// Set thermal conductivity law +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, EffectiveDiffusivityModel, DiffusivityConstantTau<TypeTag, double>); +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, SpatialParams, DiffusivityTestSpatialParams<TypeTag>); +} +} /*! * \brief Provides an interface for customizing error messages associated with @@ -53,6 +66,5 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - typedef TTAG(EffectiveDiffusivityConstantTauProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); + return Dumux::start<TTAG(FluidMatrixInteractionTestProblem)>(argc, argv, usage); } diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input index f759f333bb535a4c7fcc1d07890d3e27f36ea0c1..99a8d9d3657cc317b7e8c94dd8a92c6addcd7733 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivityconstanttau.input @@ -4,10 +4,13 @@ tau = 0.3 DtInitial = 1 # [s] TEnd = 2 # [s] +[Problem] +Name = test_effectivediffusivity_consttau + [Grid] LowerLeft = 0 0 UpperRight = 6 4 Cells = 48 32 -[Diffusivity] +[Output] File = constanttau_d_eff diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.cc b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.cc index 2ed830232f64140f09f899fa8049bfb9ed753638..8c83edc3c0e3142076eaaa91f998ae1958697f59 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.cc +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.cc @@ -22,8 +22,21 @@ * \brief Test for the Millington and Quirk effective diffusivity model */ #include <config.h> -#include "effectivediffusivitymillingtonquirkproblem.hh" +#include "testproblem.hh" +#include "diffusivityspatialparams.hh" + #include <dumux/common/start.hh> +#include <dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh> + +namespace Dumux +{ +namespace Properties +{ +// Set thermal conductivity law +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, EffectiveDiffusivityModel, DiffusivityMillingtonQuirk<double>); +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, SpatialParams, DiffusivityTestSpatialParams<TypeTag>); +} +} /*! * \brief Provides an interface for customizing error messages associated with @@ -53,6 +66,5 @@ void usage(const char *progName, const std::string &errorMsg) int main(int argc, char** argv) { - typedef TTAG(EffectiveDiffusivityMillingtonQuirkProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); + return Dumux::start<TTAG(FluidMatrixInteractionTestProblem)>(argc, argv, usage); } diff --git a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input index 4e445a6fe43fe956f5cfc9e58bee4424f463bc0a..73671cc6b6b3a63a1aad0937c30f707443e844ca 100644 --- a/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input +++ b/test/material/fluidmatrixinteractions/test_effectivediffusivitymillingtonquirk.input @@ -2,10 +2,13 @@ DtInitial = 1 # [s] TEnd = 2 # [s] +[Problem] +Name = test_effectivediffusivity_mq + [Grid] LowerLeft = 0 0 UpperRight = 6 4 Cells = 48 32 -[Diffusivity] +[Output] File = millingtonquirk_d_eff diff --git a/test/material/fluidmatrixinteractions/testproblem.hh b/test/material/fluidmatrixinteractions/testproblem.hh new file mode 100644 index 0000000000000000000000000000000000000000..1c935b82edd0b371f6e2566a4df4b89111f6f271 --- /dev/null +++ b/test/material/fluidmatrixinteractions/testproblem.hh @@ -0,0 +1,170 @@ +// -*- 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 <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief Test for the constant tau effective diffusivity model + */ +#ifndef DUMUX_FLUIDMATRIXINTERACTION_TEST_PROBLEM_HH +#define DUMUX_FLUIDMATRIXINTERACTION_TEST_PROBLEM_HH + +#include <dumux/material/fluidsystems/h2on2.hh> + +#include <dumux/porousmediumflow/2p2c/implicit/model.hh> +#include <dumux/porousmediumflow/implicit/problem.hh> + +#include "fluidmatrixinteractionsspatialparams.hh" + +#define ISOTHERMAL 0 + +namespace Dumux +{ +template <class TypeTag> +class FluidMatrixInteractionTestProblem; + +namespace Properties +{ +NEW_TYPE_TAG(FluidMatrixInteractionTestProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, FluidMatrixInteractionTestSpatialParams)); + +// Set the grid type +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, Grid, Dune::YaspGrid<2>); + +// Set the problem property +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, Problem, FluidMatrixInteractionTestProblem<TypeTag>); + +// Set the wetting phase +SET_TYPE_PROP(FluidMatrixInteractionTestProblem, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>); +} + + +/*! + * \ingroup MaterialTestProblems + * \brief Test for the effective diffusivity models + */ +template <class TypeTag > +class FluidMatrixInteractionTestProblem : public ImplicitPorousMediaProblem<TypeTag> +{ + using ParentType = ImplicitPorousMediaProblem<TypeTag>; + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + enum { + pressureIdx = Indices::pressureIdx, + switchIdx = Indices::switchIdx, + temperatureIdx = Indices::temperatureIdx, + + // Phase State + wPhaseOnly = Indices::wPhaseOnly, + + // Grid and world dimension + dim = GridView::dimension, + dimWorld = GridView::dimensionworld + }; + + using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); + using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); + using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager); + using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; + +public: + /*! + * \brief The constructor. + * + * \param timeManager The time manager + * \param gridView The grid view + */ + FluidMatrixInteractionTestProblem(TimeManager &timeManager, const GridView &gridView) + : ParentType(timeManager, gridView) + { + FluidSystem::init(273.15, 298.15, 5, 9e4, 5e5, 5); + this->spatialParams().plotMaterialLaw(); + } + + /*! + * \name Problem parameters + */ + // \{ + + /*! + * \brief The problem name. + * + * This is used as a prefix for files generated by the simulation. + */ + std::string name() const + { return GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Problem, Name); } + + // \} + + /*! + * \name Boundary conditions + */ + // \{ + + //! \copydoc ImplicitProblem::boundaryTypesAtPos() + BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const + { + BoundaryTypes bcTypes; + bcTypes.setAllDirichlet(); + return bcTypes; + } + + //! \copydoc ImplicitProblem::dirichletAtPos() + PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const + { + return initial_(globalPos); + } + + // \} + + /*! + * \name Volume terms + */ + // \{ + + //! \copydoc ImplicitProblem::initialAtPos() + PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + { + return initial_(globalPos); + } + + //! \copydoc ImplicitProblem::initialPhasePresence() + int initialPhasePresence(const SubControlVolume& scv) const + { return wPhaseOnly; } + + // \} + +private: + // internal method for the initial condition (reused for the + // dirichlet conditions!) + PrimaryVariables initial_(const GlobalPosition &globalPos) const + { + PrimaryVariables values(0.0); + Scalar densityW = 1000.0; + values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81; + values[switchIdx] = 0.0; + values[temperatureIdx] = 283.0 + globalPos[1]*0.03; + return values; + } +}; + +} //end namespace Dumux + +#endif