Commit 6deeddf0 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

New DiffusivityConstant class

* Reduce number of template arguments
* Rename property from tau to TauTortuosity
parent 87b86437
......@@ -12,6 +12,8 @@ Differences Between DuMuX 2.9 and DuMuX 2.10
* IMPROVEMENTS and ENHANCEMENTS:
- Integrated geostatistical tool gstat for generating random fields
- multidomain should now work with all compilers (optimzed) without segfaults
- The computation of the tortuosity tau with the Millington Quirk model
was optimized. Tests show an speedup of up to 5% for a 2p2c simulation.
* IMMEDIATE INTERFACE CHANGES not allowing/requiring a deprecation period:
- The problem class interface needs to provide the method maxTimeStepSize().
......@@ -23,8 +25,13 @@ Differences Between DuMuX 2.9 and DuMuX 2.10
compiler will not print any warning if a deprecated property or parameter name
is used. However, a run-time warning should appear in the summary lines after
the corresponding run.
- The property tau was renamed to TauTortuosity to make the name more telling.
For the models 1p2c, 2p2c, 3p3c it got the default value 0.5.
* Deprecated CLASSES/FILES, to be removed after 2.10:
- The class `DiffusivityConstantTau<TypeTag, Scalar>` was renamed to
`DiffusivityConstant<TypeTag>` and is located in a according new header. The
old class, its header and the property `tau` are deprecated.
* Deprecated MEMBER FUNCTIONS, to be removed after 2.10:
......
......@@ -193,6 +193,15 @@
year = {2007}
}
@BOOK{BEAR1972,
title = {Dynamics of Fluids in Porous Media},
author = {Bear, Jacob},
isbn = {9780486656755},
series = {Dover Civil and Mechanical Engineering Series},
year = {1972},
publisher = {Dover}
}
@BOOK{BASTIAN1999,
title = {{Numerical Computation of Multiphase Flows in Porous Media}},
publisher = {Habilitationsschrift, University of Kiel},
......@@ -339,6 +348,18 @@
publisher = {Springer}
}
@ARTICLE{CARMAN1937,
author = {Carman, Philip C.},
title = {Fluid flow through granular beds},
journal = {Transactions, Institution of Chemical Engineers},
year = {1937},
volume = {15},
pages = {150--166},
number = {},
doi = {10.1016/S0263-8762(97)80003-2},
note = {reprinted in \emph{Chemical Engineering Research and Design}, 75:S32--S48, 1997}
}
@ARTICLE{Chen2000,
author = {Z. Chen and Q. Guan and R. E. Ewing},
title = {{Analysis of a compositional model for fluid flow in porous media},
......@@ -347,20 +368,7 @@
volume = {60},
pages = {747-777},
number = {3},
owner = {faigle},
review = {3phase model derivation finite element discretizattion Beschreibung
des sequenziellen numerischen L\"osungsschemas verwendete ELLAM methode
Trangenstein + pC
assumpt: no mass transfer between water and gas/oil (black oil)
rho_w = const
s(p, ...) und nicht s(p+pc, ...)},
timestamp = {2011.11.29}
owner = {faigle}
}
@BOOK{CLASS2007,
......@@ -862,6 +870,18 @@
url={https://www.osti.gov/scitech/biblio/6760030}
}
@Article{MILLINGTON1961,
author ={Millington, R. J. and Quirk, J. P.},
title ={Permeability of porous solids},
journal ={Trans. Faraday Soc.},
year ={1961},
volume ={57},
issue ={0},
pages ={1200--1207},
doi ={10.1039/TF9615701200}
}
@ARTICLE{MUALEM1976,
author = {Y. Mualem},
title = {{A new model for predicting the hydraulic conductivity of unsaturated
......
......@@ -6,6 +6,7 @@ add_subdirectory("mp")
#install headers
install(FILES
diffusivityconstant.hh
diffusivityconstanttau.hh
diffusivitymillingtonquirk.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/material/fluidmatrixinteractions)
// -*- 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 Relation for the saturation-dependent effective diffusion coefficient
*/
#ifndef DIFFUSIVITY_CONSTANT_HH
#define DIFFUSIVITY_CONSTANT_HH
#include <dumux/common/parameters.hh>
#include <dumux/common/basicproperties.hh>
namespace Dumux
{
/*!
* \ingroup fluidmatrixinteractionslaws
*
* \brief Relation for the saturation-dependent effective diffusion coefficient
*
* The material law is:
* \f[
* D_\text{eff,pm} = \phi * S_w * \tau * D
* \f]
*
* with a constant tau.
*
* The default value is 0.5, empirically obtained in Carman 1937:
* <i>Fluid flow through granular beds</i> \cite carman1937
* Additionally, Bear 1972 \cite bear1972 mentions values 0.4 and in the
* range of 0.56 to 0.8.
*/
template<class TypeTag>
class DiffusivityConstant
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
public:
/*!
* \brief Returns the effective diffusion coefficient \f$\mathrm{[m^2/s]}\f$ based
* on a constant tortuosity value
*
* \param porosity The porosity
* \param saturation The saturation of the wetting phase
* \param diffCoeff The diffusion coefficient of the phase in \f$\mathrm{[m^2/s]}\f$
*/
static Scalar effectiveDiffusivity(const Scalar porosity,
const Scalar saturation,
const Scalar diffCoeff)
{
Scalar tau = GET_PARAM(TypeTag, Scalar, TauTortuosity);
return porosity * saturation * tau * diffCoeff;
}
};
}
#endif // DIFFUSIVITY_CONSTANT_HH
......@@ -44,6 +44,9 @@ namespace Dumux
* \tau = \frac{1}{\phi^2} * \left(\phi S_w\right)^{7/3}
* \f]
*
* after Millington and Quirk 1961: <i>Permeability of porous solids</i> \cite millington1961
* and Helmig 1997: <i>Multiphase Flow and Transport Processes in the Subsurface: A Contribution
* to the Modeling of Hydrosystems</i>, page 129 \cite helmig1997
*/
template<class Scalar>
class DiffusivityMillingtonQuirk
......
......@@ -72,6 +72,7 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i
NEW_PROP_TAG(UseMoles); //!< Defines whether mole (true) or mass (false) fractions are used
NEW_PROP_TAG(Scaling); //!< Defines Scaling of the model
NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
NEW_PROP_TAG(TauTortuosity); //!< Tortuosity value (tau) used in macroscopic diffusion
NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
}
......
......@@ -120,6 +120,14 @@ SET_BOOL_PROP(OnePTwoC, ProblemEnableGravity, true);
// (Nield, Bejan, Convection in porous media, 2006, p. 10)
SET_SCALAR_PROP(OnePTwoC, SpatialParamsForchCoeff, 0.55);
/*!
* \brief default value for tortuosity value (tau) used in macroscopic diffusion
*
* Value is 0.5 according to Carman 1937: <i>Fluid flow through granular beds</i>
* \cite carman1937
*/
SET_SCALAR_PROP(OnePTwoC, TauTortuosity, 0.5);
//! average is used as default model to compute the effective thermal heat conductivity
SET_PROP(OnePTwoCNI, ThermalConductivityModel)
{ private :
......
......@@ -79,6 +79,7 @@ NEW_PROP_TAG(ReplaceCompEqIdx); //!< The index of the total mass balance equatio
NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the VTK output
NEW_PROP_TAG(BaseFluxVariables); //!< The base flux variables
NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
NEW_PROP_TAG(TauTortuosity); //!< Tortuosity value (tau) used in macroscopic diffusion
}
}
......
......@@ -184,6 +184,14 @@ SET_BOOL_PROP(TwoPTwoC, UseConstraintSolver, true);
// (Nield, Bejan, Convection in porous media, 2006, p. 10)
SET_SCALAR_PROP(TwoPTwoC, SpatialParamsForchCoeff, 0.55);
/*!
* \brief default value for tortuosity value (tau) used in macroscopic diffusion
*
* Value is 0.5 according to Carman 1937: <i>Fluid flow through granular beds</i>
* \cite carman1937
*/
SET_SCALAR_PROP(TwoPTwoC, TauTortuosity, 0.5);
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_PROP(TwoPTwoCNI, ThermalConductivityModel)
{
......
......@@ -75,6 +75,7 @@ NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility
NEW_PROP_TAG(UseConstraintSolver); //!< Determines whether a constraint solver should be used explicitly
NEW_PROP_TAG(BaseFluxVariables); //! The base flux variables
NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
NEW_PROP_TAG(TauTortuosity); //!< Tortuosity value (tau) used in macroscopic diffusion
NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
}
}
......
......@@ -163,6 +163,14 @@ SET_BOOL_PROP(ThreePThreeC, ProblemEnableGravity, true);
// (Nield, Bejan, Convection in porous media, 2006, p. 10)
SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
/*!
* \brief default value for tortuosity value (tau) used in macroscopic diffusion
*
* Value is 0.5 according to Carman 1937: <i>Fluid flow through granular beds</i>
* \cite carman1937
*/
SET_SCALAR_PROP(ThreePThreeC, TauTortuosity, 0.5);
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_PROP(ThreePThreeCNI, ThermalConductivityModel)
{
......
......@@ -9,6 +9,13 @@ add_dumux_test(test_effectivediffusivitymillingtonquirk test_effectivediffusivit
${CMAKE_CURRENT_BINARY_DIR}/millingtonquirk_d_eff.dat
--command "${CMAKE_CURRENT_BINARY_DIR}/test_effectivediffusivitymillingtonquirk")
add_dumux_test(test_effectivediffusivityconstant test_effectivediffusivityconstant test_effectivediffusivityconstant.cc
python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
--script exact
--files ${CMAKE_SOURCE_DIR}/test/references/effectivediffusivityconstanttau-reference.dat
${CMAKE_CURRENT_BINARY_DIR}/constant_d_eff.dat
--command "${CMAKE_CURRENT_BINARY_DIR}/test_effectivediffusivityconstant")
add_dumux_test(test_effectivediffusivityconstanttau test_effectivediffusivityconstanttau test_effectivediffusivityconstanttau.cc
python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
--script exact
......
// -*- 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();
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);
}
//! \copydoc InjectionProblem::initialPhasePresence()
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
// -*- 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
*/
#include <config.h>
#include "effectivediffusivityconstantproblem.hh"
#include <dumux/common/start.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
* reading in parameters.
*
* \param progName The name of the program, that was tried to be started.
* \param errorMsg The error message that was issued by the start function.
* Comprises the thing that went wrong and a general help message.
*/
void usage(const char *progName, const std::string &errorMsg)
{
if (errorMsg.size() > 0) {
std::string errorMessageOut = "\nUsage: ";
errorMessageOut += progName;
errorMessageOut += " [options]\n";
errorMessageOut += errorMsg;
errorMessageOut += "\n\nThe list of mandatory options for this program is:\n"
"\t-TimeManager.TEnd End of the simulation [s] \n"
"\t-TimeManager.DtInitial Initial timestep size [s] \n"
"\t definition in DGF format\n";
std::cout << errorMessageOut
<< "\n";
}
}
int main(int argc, char** argv)
{
return Dumux::start<TTAG(EffectiveDiffusivityConstantProblem)>(argc, argv, usage);
}
[TimeManager]
DtInitial = 1 # [s]
TEnd = 2 # [s]
[Grid]
UpperRight = 6 4
Cells = 48 32
[Diffusivity]
File = constant
[]
TauTortuosity = 0.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment