Commit edafe51f authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'feature/replace-1p-fluidsystem' into 'next'

Feature/replace 1p fluidsystem

See merge request !703
parents 06d6af88 455c425d
// -*- 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
* \ingroup Fluidsystems
* \brief @copybrief Dumux::FluidSystems::OneP
*/
#ifndef DUMUX_1P_FLUIDSYSTEM_HH
#define DUMUX_1P_FLUIDSYSTEM_HH
#warning "This header is deprecated! Use LiquidPhase (liquidphase.hh) or GasPhase (gasphase.hh) directly"
#include <limits>
#include <cassert>
#include <dune/common/deprecated.hh>
#include <dune/common/exceptions.hh>
#include "base.hh"
namespace Dumux {
namespace FluidSystems {
/*!
* \ingroup Fluidsystems
* \brief A fluid system for single phase models.
*
* \tparam Scalar the scalar type
* \tparam FluidType The fluid is defined as a template parameter. For existing
* fluids the FluidSystems::LiquidPhase<Component> and
* FluidSystems::GasPhase<Component> may be used.
*/
template <class Scalar, class FluidType>
class DUNE_DEPRECATED_MSG("OneP fluid system is deprecated! Use LiquidPhase or GasPhase directly") OneP
: public BaseFluidSystem<Scalar, OneP<Scalar, FluidType> >
{
using ThisType = OneP<Scalar, FluidType>;
using Base = BaseFluidSystem<Scalar, ThisType>;
public:
using Fluid = FluidType;
/****************************************
* Fluid phase related static parameters
****************************************/
//! Number of phases in the fluid system
static constexpr int numPhases = 1;
/*!
* \brief Return the human readable name of a fluid phase
*
* \param phaseIdx The index of the fluid phase to consider
*/
static std::string phaseName(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return Fluid::name();
}
/*!
* \brief Return whether a phase is liquid
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isLiquid(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return Fluid::isLiquid();
}
/*!
* \brief Returns true if and only if a fluid phase is assumed to
* be compressible.
*
* Compressible means that the partial derivative of the density
* to the fluid pressure is always larger than zero.
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isCompressible(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluid decide
return Fluid::isCompressible();
}
/*!
* \brief Returns true if the fluid viscosity is constant
*/
static constexpr bool viscosityIsConstant(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
return Fluid::viscosityIsConstant();
}
/*!
* \brief Returns true if and only if a fluid phase is assumed to
* be an ideal mixture.
*
* We define an ideal mixture as a fluid phase where the fugacity
* coefficients of all components times the pressure of the phase
* are independent on the fluid composition. This assumption is true
* if only a single component is involved. If you are unsure what
* this function should return, it is safe to return false. The
* only damage done will be (slightly) increased computation times
* in some cases.
*
* \param phaseIdx The index of the fluid phase to consider
*/
static bool isIdealMixture(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// we assume immisibility
return true;
}
/*!
* \brief Returns true if and only if a fluid phase is assumed to
* be an ideal gas.
*
* \param phaseIdx The index of the fluid phase to consider
*/
static constexpr bool isIdealGas(int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
// let the fluid decide
return Fluid::isIdealGas();
}
/****************************************
* Component related static parameters
****************************************/
//! Number of components in the fluid system
static constexpr int numComponents = 1;
/*!
* \brief Return the human readable name of a component
*
* \param compIdx The index of the component to consider
*/
static std::string componentName(int compIdx = 0)
{
assert(0 <= compIdx && compIdx < numComponents);
return Fluid::name();
}
/*!
* \brief Return the molar mass of a component in \f$\mathrm{[kg/mol]}\f$.
*
* \param compIdx index of the component
*/
static Scalar molarMass(int compIdx = 0)
{
assert(0 <= compIdx && compIdx < numComponents);
return Fluid::molarMass();
}
/*!
* \brief Critical temperature of a component \f$\mathrm{[K]}\f$.
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalTemperature(int compIdx = 0)
{
assert(0 <= compIdx && compIdx < numComponents);
return Fluid::criticalTemperature();
}
/*!
* \brief Critical pressure of a component \f$\mathrm{[Pa]}\f$.
*
* \param compIdx The index of the component to consider
*/
static Scalar criticalPressure(int compIdx = 0)
{
assert(0 <= compIdx && compIdx < numComponents);
return Fluid::criticalPressure();
}
/*!
* \brief The acentric factor of a component \f$\mathrm{[-]}\f$.
*
* \param compIdx The index of the component to consider
*/
static Scalar acentricFactor(int compIdx = 0)
{
assert(0 <= compIdx && compIdx < numComponents);
return Fluid::acentricFactor();
}
/****************************************
* thermodynamic relations
****************************************/
/*!
* \brief Initialize the fluid system's static parameters
*/
static void init()
{ }
using Base::density;
/*!
* \brief Calculate the density \f$\mathrm{[kg/m^3]}\f$ of a fluid phase
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
*/
template <class FluidState>
static Scalar density(const FluidState &fluidState,
int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
return Fluid::density(temperature, pressure);
}
using Base::viscosity;
/*!
* \brief Calculate the dynamic viscosity of a fluid phase \f$\mathrm{[Pa*s]}\f$
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
*/
template <class FluidState>
static Scalar viscosity(const FluidState &fluidState,
int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
return Fluid::viscosity(temperature, pressure);
}
using Base::fugacityCoefficient;
/*!
* \brief Calculate the fugacity coefficient \f$\mathrm{[Pa]}\f$ of an individual
* component in a fluid phase
*
* The fugacity coefficient \f$\mathrm{\phi_\kappa}\f$ is connected to the
* fugacity \f$\mathrm{f_\kappa}\f$ and the component's molarity
* \f$\mathrm{x_\kappa}\f$ by means of the relation
*
* \f[ f_\kappa = \phi_\kappa * x_{\kappa} \f]
*/
template <class FluidState>
static Scalar fugacityCoefficient(const FluidState &fluidState,
int phaseIdx = 0,
int compIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
assert(0 <= compIdx && compIdx < numComponents);
if (phaseIdx == compIdx)
// We could calculate the real fugacity coefficient of
// the component in the fluid. Probably that's not worth
// the effort, since the fugacity coefficient of the other
// component is infinite anyway...
return 1.0;
using std::numeric_limits;
return numeric_limits<Scalar>::infinity();
}
using Base::diffusionCoefficient;
/*!
* \brief Calculate the molecular diffusion coefficient for a
* component in a fluid phase \f$\mathrm{[mol^2 * s / (kg*m^3)]}\f$
*
* Molecular diffusion of a compoent \f$\mathrm{\kappa}\f$ is caused by a
* gradient of the chemical potential and follows the law
*
* \f[ J = - D \mathbf{grad} \mu_\kappa \f]
*
* where \f$\mathrm{\mu_\kappa}\f$ is the component's chemical potential,
* \f$\mathrm{D}\f$ is the diffusion coefficient and \f$\mathrm{J}\f$ is the
* diffusive flux. \f$\mathrm{\mu_\kappa}\f$ is connected to the component's
* fugacity \f$\mathrm{f_\kappa}\f$ by the relation
*
* \f[ \mu_\kappa = R T_\alpha \mathrm{ln} \frac{f_\kappa}{p_\alpha} \f]
*
* where \f$\mathrm{p_\alpha}\f$ and \f$\mathrm{T_\alpha}\f$ are the fluid phase'
* pressure and temperature.
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
* \param compIdx The index of the component to consider
*/
template <class FluidState>
static Scalar diffusionCoefficient(const FluidState &fluidState,
int phaseIdx = 0,
int compIdx = 0)
{
DUNE_THROW(Dune::InvalidStateException, "Not applicable: Diffusion coefficients");
}
using Base::binaryDiffusionCoefficient;
/*!
* \brief Given a phase's composition, temperature and pressure,
* return the binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for components
* \f$\mathrm{i}\f$ and \f$\mathrm{j}\f$ in this phase.
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
* \param compIIdx The index of the first component to consider
* \param compJIdx The index of the second component to consider
*/
template <class FluidState>
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
int phaseIdx,
int compIIdx,
int compJIdx)
{
DUNE_THROW(Dune::InvalidStateException, "Not applicable: Binary diffusion coefficients");
}
using Base::enthalpy;
/*!
* \brief Given a phase's composition, temperature, pressure and
* density, calculate its specific enthalpy \f$\mathrm{[J/kg]}\f$.
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
*/
template <class FluidState>
static Scalar enthalpy(const FluidState &fluidState,
int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
return Fluid::enthalpy(temperature, pressure);
}
using Base::thermalConductivity;
/*!
* \brief Thermal conductivity of a fluid phase \f$\mathrm{[W/(m K)]}\f$.
*
* Use the conductivity of air and water as a first approximation.
* Source:
* http://en.wikipedia.org/wiki/List_of_thermal_conductivities
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
*/
template <class FluidState>
static Scalar thermalConductivity(const FluidState &fluidState,
int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
return Fluid::thermalConductivity(temperature, pressure);
}
using Base::heatCapacity;
/*!
* \brief Specific isobaric heat capacity of a fluid phase.
* \f$\mathrm{[J/(kg*K)]}\f$.
*
* \param fluidState An arbitrary fluid state
* \param phaseIdx The index of the fluid phase to consider
*/
template <class FluidState>
static Scalar heatCapacity(const FluidState &fluidState,
int phaseIdx = 0)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
return Fluid::heatCapacity(temperature, pressure);
}
};
} // end namespace Properties
} // end namespace Dumux
#endif
install(FILES
1p.hh
2pimmiscible.hh
2pliquidvapor.hh
base.hh
......
......@@ -26,7 +26,6 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
......@@ -47,7 +46,7 @@ SET_PROP(AngeliTestProblem, FluidSystem)
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
public:
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> >;
};
// Set the grid type
......
......@@ -27,7 +27,6 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
......@@ -51,9 +50,9 @@ SET_PROP(ChannelTestProblem, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
#if NONISOTHERMAL
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, SimpleH2O<Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, SimpleH2O<Scalar> >;
#else
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> >;
#endif
};
......
......@@ -26,7 +26,6 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
......@@ -45,7 +44,7 @@ NEW_TYPE_TAG(ClosedSystemTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, Navi
SET_PROP(ClosedSystemTestProblem, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> >;
};
// Set the grid type
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
......@@ -28,7 +26,6 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
......@@ -48,7 +45,7 @@ NEW_TYPE_TAG(DoneaTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStoke
SET_PROP(DoneaTestProblem, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> >;
};
// Set the grid type
......
......@@ -26,7 +26,6 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/constant.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
......@@ -45,7 +44,7 @@ NEW_TYPE_TAG(KovasznayTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierS
SET_PROP(KovasznayTestProblem, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> >;
};
// Set the grid type
......
......@@ -31,7 +31,6 @@
#include <dune/common/classname.hh>
// include all fluid systems in dumux-stable
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/base.hh>
#include <dumux/material/fluidsystems/brineair.hh>
......
......@@ -27,7 +27,6 @@
#include "checkfluidsystem.hh"
// include all fluid systems in dumux-stable
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/base.hh>
#include <dumux/material/fluidsystems/brineair.hh>
......@@ -120,12 +119,6 @@ int main()
//////////////////////////
// check all fluid systems
// 1p
{ using FluidSystem = Dumux::FluidSystems::OneP<Scalar, Liquid>;
success += Dumux::checkFluidSystem<Scalar, FluidSystem>(); }
{ using FluidSystem = Dumux::FluidSystems::OneP<Scalar, Gas>;
success += Dumux::checkFluidSystem<Scalar, FluidSystem>(); }
// 2p-immiscible
{ using FluidSystem = Dumux::FluidSystems::TwoPImmiscible<Scalar, Liquid, Liquid>;
success += Dumux::checkFluidSystem<Scalar, FluidSystem>(); }
......
......@@ -34,7 +34,6 @@
#include <dumux/porousmediumflow/1p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh>
......@@ -62,9 +61,8 @@ SET_TYPE_PROP(OnePNIConductionProblem, Problem,
// Set the fluid system
SET_TYPE_PROP(OnePNIConductionProblem, FluidSystem,
FluidSystems::OneP<typename GET_PROP_TYPE(TypeTag, Scalar),
FluidSystems::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
H2O<typename GET_PROP_TYPE(TypeTag, Scalar)> > >);
FluidSystems::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
H2O<typename GET_PROP_TYPE(TypeTag, Scalar)> >);
// Set the spatial parameters
SET_TYPE_PROP(OnePNIConductionProblem,
SpatialParams,
......
......@@ -34,7 +34,6 @@
#include <dumux/porousmediumflow/1p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/h2o.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh>
#include "1pnispatialparams.hh"
......@@ -61,9 +60,8 @@ SET_TYPE_PROP(OnePNIConvectionProblem, Problem, OnePNIConvectionProblem<TypeTag>
// Set the fluid system
SET_TYPE_PROP(OnePNIConvectionProblem, FluidSystem,
FluidSystems::OneP<typename GET_PROP_TYPE(TypeTag, Scalar),
FluidSystems::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
H2O<typename GET_PROP_TYPE(TypeTag, Scalar)> > >);
FluidSystems::LiquidPhase<typename GET_PROP_TYPE(TypeTag, Scalar),
H2O<typename GET_PROP_TYPE(TypeTag, Scalar)> >);
// Set the spatial parameters
SET_TYPE_PROP(OnePNIConvectionProblem, SpatialParams, OnePNISpatialParams<TypeTag>);
......
......@@ -32,7 +32,6 @@
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include "1ptestspatialparams.hh"
......@@ -52,7 +51,7 @@ NEW_TYPE_TAG(OnePTestCCMpfaProblem, INHERITS_FROM(CCMpfaModel, OnePTestProblem))
SET_PROP(OnePTestProblem, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using type = FluidSystems::OneP<Scalar, FluidSystems::LiquidPhase<Scalar, SimpleH2O<Scalar> > >;
using type = FluidSystems::LiquidPhase<Scalar, SimpleH2O<Scalar> >;
};
// Set the grid type
......
......@@ -27,7 +27,6 @@
#define DUMUX_ONEP_FRACTURE_TEST_PROBLEM_HH
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/fluidsystems/1p.hh>
#include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/porousmediumflow/1p/model.hh>