Commit 1121be74 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[material,naviersstokes]

- added "constant" component which reads its properties from the input file
- updated documention for the "unit" component
- updated test_navierstokes which now uses the "constant" component

reviewed by bernd


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15395 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 1b37b869
......@@ -16,63 +16,105 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef DUMUX_TEST_FREEFLOW_NAVIERSTOKES_N2CONSTVISCOSITY_HH
#define DUMUX_TEST_FREEFLOW_NAVIERSTOKES_N2CONSTVISCOSITY_HH
/*!
* \file
* \ingroup Components
*
* \brief Properties of pure molecular nitrogen \f$N_2\f$ with constant viscosity.
*
* The constant viscosity is useful to get a desired Reynolds number.
* \brief Setting constant fluid properties via the input file for testing purposes.
*/
#ifndef DUMUX_CONSTANT_HH
#define DUMUX_CONSTANT_HH
#include <dumux/common/parameters.hh>
#include <dumux/material/components/n2.hh>
#include "component.hh"
namespace Dumux
{
/**
* \ingroup BoxStokesModel
* \ingroup ImplicitTestProblems
*
* \brief Properties of pure molecular nitrogen \f$N_2\f$ with constant
* viscosity.
*
* The constant viscosity is useful to get a desired Reynolds number.
*
* \tparam Scalar The type used for scalar values
*/
template <class Scalar>
class N2ConstViscosity : public N2<Scalar>
{
typedef Dumux::IdealGas<Scalar> IdealGas;
/*!
* \ingroup Components
*
* \brief A component which returns run time specified values
* for all fluid properties.
*
* \tparam Scalar The type used for scalar values
*/
template<class TypeTag, class Scalar>
class Constant : public Component<Scalar, Constant<TypeTag, Scalar> >
{
public:
/**
* \brief A human readable name for nitrogen with fixed viscosity.
public:
/*!
* \brief A human readable name for the component.
*/
static const char *name()
{ return "Constant"; }
/*!
* \brief Returns true if the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
{ return false; }
/*!
* \brief Sets the liquid density in \f$\mathrm{[kg/m^3]}\f$.
*
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
return "N2constViscosity";
static const Scalar density
= GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Problem, LiquidDensity);
return density;
}
/**
* \brief The dynamic viscosity given by a fixed value to guarantee
* a Reynolds number.
/*!
* \brief Sets the liquid dynamic viscosity in \f$\mathrm{[Pa*s]}\f$.
*
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
static const Scalar viscosity
= GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Problem, LiquidKinematicViscosity);
return viscosity * liquidDensity(temperature, pressure);
}
/*!
* \brief Returns true if the gas phase is assumed to be compressible
*/
static bool gasIsCompressible()
{ return false; }
/*!
* \brief Sets the gas density in \f$\mathrm{[kg/m^3]}\f$.
*
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar gasDensity(Scalar temperature, Scalar pressure)
{
Scalar reynoldsNumber = 100.0;
Scalar characteristicLength = 1.0;
Scalar characteristicVelocity = 1.0;
// Density of N2 for pressure of 0.1 MPa,
// temperature of 283.15 degree Celsius (from NIST homepage)
Scalar characteristicDensity = 1.1903;
static const Scalar density
= GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Problem, GasDensity);
return density;
}
return characteristicLength * characteristicVelocity * characteristicDensity
/ reynoldsNumber;
/*!
* \brief Sets the gas dynamic viscosity in \f$\mathrm{[Pa*s]}\f$.
*
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
{
static const Scalar viscosity
= GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Problem, GasKinematicViscosity);
return viscosity * gasDensity(temperature, pressure);
}
};
};
} // end namespace
#endif // DUMUX_TEST_FREEFLOW_NAVIERSTOKES_N2CONSTVISCOSITY_HH
#endif // DUMUX_CONSTANT_HH
......@@ -19,12 +19,11 @@
/*!
* \file
* \ingroup Components
* \brief Rough estimate of water \f$H_2O\f$ for testing purposes.
* \brief A component using a value of 1 for all fluid properties.
*/
#ifndef DUMUX_UNIT_HH
#define DUMUX_UNIT_HH
#include "component.hh"
namespace Dumux
......@@ -32,9 +31,9 @@ namespace Dumux
/*!
* \ingroup Components
*
* \brief A component which returns one for all liquid properties.
* \brief A component using a value of one for all fluid properties.
*
* \tparam Scalar The type used for scalar values
* \tparam Scalar The type used for scalar values
*/
template <class Scalar>
class Unit : public Component<Scalar, Unit<Scalar> >
......@@ -48,16 +47,16 @@ public:
{ return "Unit"; }
/*!
* \brief Returns true iff the liquid phase is assumed to be compressible
* \brief Returns true if the liquid phase is assumed to be compressible
*/
static bool liquidIsCompressible()
{ return false; }
/*!
* \brief Sets the density to one \f$\mathrm{[kg/m^3]}\f$.
* \brief Sets the density to 1 \f$\mathrm{[kg/m^3]}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
{
......@@ -65,10 +64,10 @@ public:
}
/*!
* \brief Sets the viscosity to one \f$\mathrm{[Pa*s]}\f$.
* \brief Sets the viscosity to 1 \f$\mathrm{[Pa*s]}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
* \param temperature phase temperature in \f$\mathrm{[K]}\f$
* \param pressure phase pressure in \f$\mathrm{[Pa]}\f$
*/
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
{
......
......@@ -36,13 +36,11 @@
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser.hh>
#include <dumux/material/fluidsystems/h2on2fluidsystem.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/gasphase.hh>
#include <dumux/freeflow/stokes/stokesmodel.hh>
#include "n2constviscosity.hh"
namespace Dumux
{
template <class TypeTag>
......@@ -71,7 +69,7 @@ namespace Dumux
// Use nitrogen with a constant viscosity as gas phase
SET_TYPE_PROP(NavierStokesTestProblem, Fluid,
Dumux::GasPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
Dumux::N2ConstViscosity<typename GET_PROP_TYPE(TypeTag, Scalar)> >);
Dumux::Constant<TypeTag, typename GET_PROP_TYPE(TypeTag, Scalar)> >);
// Scalar is set to type double
SET_TYPE_PROP(BoxStokes, Scalar, double);
......
......@@ -8,4 +8,5 @@ File = ./grids/test_navierstokes.dgf
[Problem]
EnableGravity = 0 # Disable gravity
GasDensity = 1.1903
GasKinematicViscosity = 0.011903
This diff is collapsed.
Supports Markdown
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