Commit b88703e0 authored by Simon Scholz's avatar Simon Scholz Committed by Katharina Heck
Browse files

[fluidsystem][test] add forgotten fluidsystems to test, fix fluidsystems

H2OHeavyOil and 3pImmiscible with minor fixes or restructuring of
binary/diffusionCoefficient according to @bernd 's wishes.
parent 55f31ec1
......@@ -455,7 +455,7 @@ public:
return std::numeric_limits<Scalar>::infinity();
}
// using Base::diffusionCoefficient;
using Base::diffusionCoefficient;
/*!
* \brief Calculate the binary molecular diffusion coefficient for
* a component in a fluid phase \f$\mathrm{[mol^2 * s / (kg*m^3)]}\f$
......
......@@ -345,10 +345,27 @@ public:
+ mu[NAPLIdx]*fluidState.moleFraction(gPhaseIdx, NAPLIdx);
}
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.
*
* Be aware that in this case there are only two components in three phases.
* Therefore, we assume the diffusion to simply be the binary diffusion coefficients.
* This was previously implemented in diffusionCoefficient(), but is now moved.
*
* \param fluidState The fluid state
* \param phaseIdx Index of the fluid phase
* \param compIIdx Index of the component i
* \param compJIdx Index of the component j
*/
template <class FluidState>
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx)
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
int phaseIdx,
int compIIdx,
int compJIdx)
{
const Scalar T = fluidState.temperature(phaseIdx);
const Scalar p = fluidState.pressure(phaseIdx);
......@@ -360,9 +377,48 @@ public:
// gas phase
else if (phaseIdx == gPhaseIdx)
return BinaryCoeff::H2O_HeavyOil::gasDiffCoeff(T, p);
else
DUNE_THROW(Dune::InvalidStateException,
"Non-existent binary diffusion coefficient for phase index "
<< phaseIdx);
}
using Base::diffusionCoefficient;
/*!
* \brief Calculate the binary molecular diffusion coefficient for
* a component in a fluid phase \f$\mathrm{[mol^2 * s / (kg*m^3)]}\f$
* \param fluidState The fluid state
* \param paramCache mutable parameters
* \param phaseIdx Index of the fluid phase
* \param compIdx Index of the component
* Molecular diffusion of a component \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.
*/
template <class FluidState>
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx)
{
// liquid phase
if (phaseIdx == wPhaseIdx)
return binaryDiffusionCoefficient(fluidState, phaseIdx, H2OIdx, NAPLIdx);
// gas phase
else if (phaseIdx == gPhaseIdx)
return binaryDiffusionCoefficient(fluidState, phaseIdx, NAPLIdx, H2OIdx);
else
DUNE_THROW(Dune::InvalidStateException, "non-existent diffusion coefficient for phase index " << phaseIdx);
DUNE_THROW(Dune::InvalidStateException,
"Non-existent diffusion coefficient for phase index "<< phaseIdx);
}
/*!
......
......@@ -33,6 +33,9 @@
#include <dumux/material/fluidsystems/1padapter.hh>
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/fluidsystems/2p1c.hh>
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/fluidsystems/3pimmiscible.hh>
#include <dumux/material/fluidsystems/base.hh>
#include <dumux/material/fluidsystems/brine.hh>
#include <dumux/material/fluidsystems/brineair.hh>
......@@ -40,9 +43,11 @@
#include <dumux/material/fluidsystems/h2oair.hh>
#include <dumux/material/fluidsystems/h2oairmesitylene.hh>
#include <dumux/material/fluidsystems/h2oairxylene.hh>
#include <dumux/material/fluidsystems/h2oheavyoil.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include <dumux/material/fluidsystems/h2on2kinetic.hh>
#include <dumux/material/fluidsystems/h2on2o2.hh>
#include <dumux/material/fluidsystems/liquidphase2c.hh>
#include <dumux/material/fluidsystems/spe5.hh>
// include all fluid states
......@@ -117,6 +122,10 @@ int main()
//////////////////////////
// check all fluid systems
// 2p1c
{ using FluidSystem = FluidSystems::TwoPOneC<Scalar, H2O >;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// 2p-immiscible
{ using FluidSystem = FluidSystems::TwoPImmiscible<Scalar, Liquid, Liquid>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
......@@ -125,6 +134,10 @@ int main()
{ using FluidSystem = FluidSystems::TwoPImmiscible<Scalar, Gas, Liquid>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// 3p-immiscible
{ using FluidSystem = FluidSystems::ThreePImmiscible<Scalar, Liquid, Liquid, Gas>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// base
// Brine
......@@ -216,6 +229,10 @@ int main()
{ using FluidSystem = FluidSystems::H2OAirXylene<Scalar>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// H2O -- Heavyoil
{ using FluidSystem = FluidSystems::H2OHeavyOil<Scalar>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// H2O -- N2
{ using FluidSystem = FluidSystems::H2ON2<Scalar, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true>>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
......@@ -238,6 +255,12 @@ int main()
{ using FluidSystem = FluidSystems::OnePLiquid<Scalar, H2O>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
// liquid phase 2c
{
using FluidSystem = FluidSystems::LiquidPhaseTwoC<Scalar, H2O, Components::Constant<1, Scalar>>;
Parameters::init([](auto& params){ params["Component.MolarMass"] = "1.0";});
success += checkFluidSystem<Scalar, FluidSystem>(); }
// spe5
{ using FluidSystem = FluidSystems::Spe5<Scalar>;
success += checkFluidSystem<Scalar, FluidSystem>(); }
......
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