moved the components to opm/material/components, and made subsequent changes for checking of the components

This commit is contained in:
Trine Mykkeltvedt 2022-06-22 14:35:55 +02:00
parent 7c4f2bdcc3
commit afad4d23ad
13 changed files with 261 additions and 305 deletions

View File

@ -97,6 +97,18 @@ public:
static Scalar criticalPressure()
{ return H2O::criticalPressure(); /* [N/m^2] */ }
/*!
* \copydoc H2O::criticalVolume
*/
static Scalar criticalVolume()
{ return H2O::criticalVolume(); /* [m3/kmol] */ }
/*!
* \copydoc H20::acentricFactor
*/
static Scalar acentricFactor()
{ return H2O::acentricFactor(); }
/*!
* \copydoc H2O::tripleTemperature
*/

View File

@ -0,0 +1,96 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
* \copydoc Opm::C1
*/
#ifndef OPM_C1_HPP
#define OPM_C1_HPP
#include "Component.hpp"
#include <opm/material/IdealGas.hpp>
#include <opm/material/common/MathToolbox.hpp>
#include <opm/material/common/Unused.hpp>
#include <cmath>
namespace Opm
{
/*!
* \ingroup Components
*
* \brief Properties of pure molecular methane \f$C_1\f$.
*
* \tparam Scalar The type used for scalar values
*/
template <class Scalar>
class C1 : public Component<Scalar, C1<Scalar> >
{
typedef ::Opm::IdealGas<Scalar> IdealGas;
public:
/*!
* \brief A human readable name for NDecane.
*/
static const char* name()
{ return "C1"; }
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular methane.
*/
static Scalar molarMass()
{ return 0.0160;}
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of molecular methane
*/
static Scalar criticalTemperature()
{ return 190.6; /* [K] */ }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of molecular methane.
*/
static Scalar criticalPressure()
{ return 4.60e6; /* [N/m^2] */ }
/*!
* \brief Critical volume of \f$C_1\f$ [m2/kmol].
*/
static Scalar criticalVolume() {return 9.863e-5; }
/*!
* \brief Acentric factor of \f$C_1\f$.
*/
static Scalar acentricFactor() { return 0.011; }
};
} // namespace Opm
#endif

View File

@ -0,0 +1,94 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
* \copydoc Opm::C10
*/
#ifndef OPM_C10_HPP
#define OPM_C10_HPP
#include "Component.hpp"
#include <opm/material/IdealGas.hpp>
#include <opm/material/common/MathToolbox.hpp>
#include <opm/material/common/Unused.hpp>
#include <cmath>
namespace Opm
{
/*!
* \ingroup Components
*
* \brief Properties of pure molecular n-Decane \f$C_10\f$.
*
* \tparam Scalar The type used for scalar values
*/
template <class Scalar>
class C10 : public Component<Scalar, C10<Scalar> >
{
typedef ::Opm::IdealGas<Scalar> IdealGas;
public:
/*!
* \brief A human readable name for NDecane.
*/
static const char* name()
{ return "C10"; }
/*!
* \brief The molar mass in \f$\mathrm{[kg/mol]}\f$ of molecular n-Decane.
*/
static Scalar molarMass()
{ return 0.0142;}
/*!
* \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of molecular n-Decane.
*/
static Scalar criticalTemperature()
{ return 617.7; /* [K] */ }
/*!
* \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of molecular n-Decane.
*/
static Scalar criticalPressure()
{ return 2.10e6; /* [N/m^2] */ }
/*!
* \brief Critical volume of \f$C_10\f$ [m2/kmol].
*/
static Scalar criticalVolume() {return 6.098e-4; }
/*!
* \brief Acentric factor of \f$C_10\f$.
*/
static Scalar acentricFactor() { return 0.488; }
};
} // namespace Opm
#endif

View File

@ -98,6 +98,12 @@ public:
static const Scalar criticalPressure()
{ return Common::criticalPressure; }
/*!
* \brief Returns the critical volume \f$\mathrm{[m^3/kmol]}\f$ of water.
*/
static const Scalar criticalVolume()
{ return Common::criticalVolume; }
/*!
* \brief Returns the molar volume \f$\mathrm{[m^3/mol]}\f$ of water at the critical point
*/

View File

@ -76,6 +76,16 @@ public:
static Scalar criticalPressure()
{ return 3.39858e6; /* [N/m^2] */ }
/*!
* \brief Critical volume of \f$N_2\f$ [m2/kmol].
*/
static Scalar criticalVolume() {return 8.94e-2; }
/*!
* \brief Acentric factor of \f$N_2\f$.
*/
static Scalar acentricFactor() { return 0.039; }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at molecular nitrogen's triple point.
*/

View File

@ -82,6 +82,17 @@ public:
static Scalar tripleTemperature()
{ return 273.15 - 56.35; /* [K] */ }
/*!
* \brief Acentric factor of \f$CO_2\f$.
*/
static Scalar acentricFactor() { return 0.224; }
/*!
* \brief Critical volume of \f$CO_2\f$ [m2/kmol].
*/
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 9.412e-5; }
/*!
* \brief Returns the pressure \f$\mathrm{[Pa]}\f$ at the triple point of \f$CO_2\f$.
*/

View File

@ -69,6 +69,9 @@ public:
//! Density of water at the critical point \f$\mathrm{[kg/m^3]}\f$
static const Scalar criticalDensity;
//! Critical volume of water \f$\mathrm{[m^3/kmol]}\f$
static const Scalar criticalVolume;
//! Critical molar volume of water \f$\mathrm{[m^3/mol]}\f$
static const Scalar criticalMolarVolume;
@ -242,6 +245,8 @@ const Scalar Common<Scalar>::criticalDensity = 322.0;
template <class Scalar>
const Scalar Common<Scalar>::criticalMolarVolume = molarMass/criticalDensity;
template <class Scalar>
const Scalar Common<Scalar>::criticalVolume = 5.595e-2;
template <class Scalar>
const Scalar Common<Scalar>::acentricFactor = 0.344;
template <class Scalar>
const Scalar Common<Scalar>::tripleTemperature = 273.16;

View File

@ -150,6 +150,16 @@ public:
throw std::runtime_error("Not implemented: The fluid system '"+Dune::className<Implementation>()+"' does not provide a molarMass() method!");
}
/*!
* \brief Return the acetntric factor of a component.
*
* \copydoc Doxygen::compIdxParam
*/
static Scalar acentricFactor(unsigned /*compIdx*/)
{
throw std::runtime_error("Not implemented: The fluid system '"+Dune::className<Implementation>()+"' does not provide a acentricFactor() method!");
}
/*!
* \brief Initialize the fluid system's static parameters
*/

View File

@ -2,7 +2,9 @@
#define OPM_CO2BRINEFLUIDSYSTEM_HH
#include <opm/material/fluidsystems/BaseFluidSystem.hpp>
#include <opm/material/fluidsystems/chifluid/components.hh>
#include <opm/material/components/SimpleCO2.hpp>
#include <opm/material/components/H2O.hpp>
#include <opm/material/components/Brine.hpp>
#include "ChiParameterCache.hpp"
#include "LBCviscosity.hpp"
@ -23,18 +25,14 @@ namespace Opm {
static constexpr int numComponents = 2;
static constexpr int numMisciblePhases=2;
static constexpr int numMiscibleComponents = 2;
// TODO: phase location should be more general
static constexpr int oilPhaseIdx = 0;
static constexpr int gasPhaseIdx = 1;
static constexpr int Comp0Idx = 0;
static constexpr int Comp1Idx = 1;
//static constexpr int Comp2Idx = 2;
// TODO: needs to be more general
using Comp0 = Opm::JuliaCO2<Scalar>;
using Comp1 = Opm::ChiwomsBrine<Scalar>;
//using Comp2 = Opm::JuliaC10<Scalar>;
using Comp0 = Opm::SimpleCO2<Scalar>;
using Comp1 = Opm::Brine<Scalar, Opm::H2O<Scalar>>;
template <class ValueType>
using ParameterCache = Opm::ChiParameterCache<ValueType, Co2BrineFluidSystem<Scalar>>;
@ -51,7 +49,6 @@ namespace Opm {
switch (compIdx) {
case Comp0Idx: return Comp0::acentricFactor();
case Comp1Idx: return Comp1::acentricFactor();
// case Comp2Idx: return Comp2::acentricFactor();
default: throw std::runtime_error("Illegal component index for acentricFactor");
}
}
@ -65,7 +62,6 @@ namespace Opm {
switch (compIdx) {
case Comp0Idx: return Comp0::criticalTemperature();
case Comp1Idx: return Comp1::criticalTemperature();
// case Comp2Idx: return Comp2::criticalTemperature();
default: throw std::runtime_error("Illegal component index for criticalTemperature");
}
}
@ -78,7 +74,6 @@ namespace Opm {
switch (compIdx) {
case Comp0Idx: return Comp0::criticalPressure();
case Comp1Idx: return Comp1::criticalPressure();
// case Comp2Idx: return Comp2::criticalPressure();
default: throw std::runtime_error("Illegal component index for criticalPressure");
}
}

View File

@ -1,292 +0,0 @@
#ifndef COMPONENTS_HH
#define COMPONENTS_HH
#include <opm/material/IdealGas.hpp>
#include <opm/material/components/Component.hpp>
#include <opm/material/components/SimpleCO2.hpp>
#include <opm/material/components/CO2.hpp>
#include <opm/material/components/H2O.hpp>
namespace Opm {
/*!
* \ingroup Components
*
* \brief A simple representation of linear octane
*
* \tparam Scalar The type used for scalar values
*/
template <class Scalar>
class Octane : public Opm::Component<Scalar, Octane<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "C8"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.11423; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 568.7; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 2.49e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.398; }
// Critical volume [m3/kmol] (same as [L/mol])
static Scalar criticalVolume() {return 4.92e-1; }
};
template <class Scalar>
class NDekane : public Opm::Component<Scalar, NDekane<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "C10"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.1423; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 617.7; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 2.103e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.4884; }
// Critical volume [m3/kmol] (same as [L/mol])
static Scalar criticalVolume() {return 6.0976e-1; }
};
template <class Scalar>
class Methane : public Opm::Component<Scalar, Methane<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "CH4"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0160; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 190.5640; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 4.599e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.0114; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 9.8628e-2; }
};
template <class Scalar>
class Hydrogen : public Opm::Component<Scalar, Hydrogen<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "H2"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0020156; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 33.2; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 1.297e6; }
/// Acentric factor
static Scalar acentricFactor() { return -0.22; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 6.45e-2; }
};
template <class Scalar>
class Nitrogen : public Opm::Component<Scalar, Nitrogen<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "N2"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0280134; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 126.192; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 3.3958e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.039; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 8.94e-2; }
};
template <class Scalar>
class Water : public Opm::Component<Scalar, Water<Scalar> >
{
public:
/// Chemical name
static const char* name() { return "H20"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.01801528; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 647; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 22.064e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.344; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 5.595e-2; }
};
template <class Scalar>
class ChiwomsCO2 : public Opm::SimpleCO2<Scalar>
{
public:
/// Chemical name
static const char* name() { return "CO2"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0440095; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 304.1; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 7.38e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.225; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 9.4118e-2; }
};
template <class Scalar>
class ChiwomsBrine : public Opm::H2O<Scalar>
{
public:
/// Chemical name
static const char* name() { return "H20-NaCl"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0180158; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 647.096; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 2.21e7; }
/// Acentric factor
static Scalar acentricFactor() { return 0.344; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 5.595e-2; }
};
// TODO: creating some fluid components to debugging against the examples from the Julia test
// TODO: to make the parameter exactly same, we create some temporary component here
template <class Scalar>
class JuliaCO2 : public Opm::Component<Scalar, JuliaCO2<Scalar>>
{
public:
/// Chemical name
static const char* name() { return "CO2"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0440; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 304.1; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 7.38e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.224; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 9.412e-5; }
// OLD :static Scalar criticalVolume() {return 9.4118e-2; }
};
template <class Scalar>
class JuliaC1: public Opm::Component<Scalar, JuliaC1<Scalar>>
{
public:
/// Chemical name
static const char* name() { return "C1"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0160; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 190.6; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 4.60e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.011; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 9.863e-5; }
};
template <class Scalar>
class JuliaC10: public Opm::Component<Scalar, JuliaC10<Scalar>>
{
public:
/// Chemical name
static const char* name() { return "C10"; }
/// Molar mass in \f$\mathrm{[kg/mol]}\f$
static Scalar molarMass() { return 0.0142; }
/// Critical temperature in \f$\mathrm[K]}\f$
static Scalar criticalTemperature() { return 617.7; }
/// Critical pressure in \f$\mathrm[Pa]}\f$
static Scalar criticalPressure() { return 2.10e6; }
/// Acentric factor
static Scalar acentricFactor() { return 0.488; }
// Critical volume [m3/kmol]
static Scalar criticalVolume() {return 6.098e-4; }
};
struct EOS
{
template<typename LhsEval>
static LhsEval oleic_enthalpy(LhsEval T, LhsEval p, LhsEval x) {
return 0;
}
template<typename LhsEval>
static LhsEval aqueous_enthalpy(LhsEval T, LhsEval p, LhsEval x) {
return 0;
}
};
} // namespace opm
#endif // COMPONENTS_HH

View File

@ -3,6 +3,10 @@
#include <opm/material/fluidsystems/BaseFluidSystem.hpp>
#include <opm/material/fluidsystems/chifluid/components.hh>
#include <opm/material/components/SimpleCO2.hpp>
#include <opm/material/components/C10.hpp>
#include <opm/material/components/C1.hpp>
// TODO: this is something else need to check
#include "ChiParameterCache.hpp"
@ -34,9 +38,9 @@ namespace Opm {
static constexpr int Comp2Idx = 2;
// TODO: needs to be more general
using Comp0 = Opm::JuliaCO2<Scalar>;
using Comp1 = Opm::JuliaC1<Scalar>;
using Comp2 = Opm::JuliaC10<Scalar>;
using Comp0 = Opm::SimpleCO2<Scalar>;
using Comp1 = Opm::C1<Scalar>;
using Comp2 = Opm::C10<Scalar>;
template <class ValueType>
using ParameterCache = Opm::ChiParameterCache<ValueType, ThreeComponentFluidSystem<Scalar>>;

View File

@ -60,8 +60,10 @@ void checkComponent()
{ Scalar M OPM_UNUSED = Component::molarMass(); }
{ Scalar Tc OPM_UNUSED = Component::criticalTemperature(); }
{ Scalar pc OPM_UNUSED = Component::criticalPressure(); }
{ Scalar Vc OPM_UNUSED = Component::criticalVolume(); }
{ Scalar Tt OPM_UNUSED = Component::tripleTemperature(); }
{ Scalar pt OPM_UNUSED = Component::triplePressure(); }
{ Evaluation omega OPM_UNUSED = Component::acentricFactor(); }
{ Evaluation pv OPM_UNUSED = Component::vaporPressure(T); }
{ Evaluation rho OPM_UNUSED = Component::gasDensity(T, p); }
{ Evaluation rho OPM_UNUSED = Component::liquidDensity(T, p); }

View File

@ -101,8 +101,11 @@ void testAllComponents()
checkComponent<Opm::Air<Scalar>, Evaluation>();
checkComponent<Opm::Brine<Scalar, H2O>, Evaluation>();
checkComponent<Opm::CO2<Scalar, Opm::ComponentsTest::CO2Tables>, Evaluation>();
checkComponent<Opm::C1<Scalar>, Evaluation>();
checkComponent<Opm::C10<Scalar>, Evaluation>();
checkComponent<Opm::DNAPL<Scalar>, Evaluation>();
checkComponent<Opm::H2O<Scalar>, Evaluation>();
checkComponent<Opm::H2<Scalar>, Evaluation>();
checkComponent<Opm::LNAPL<Scalar>, Evaluation>();
checkComponent<Opm::Mesitylene<Scalar>, Evaluation>();
checkComponent<Opm::N2<Scalar>, Evaluation>();