2013-12-02 09:31:53 -06:00
|
|
|
/*
|
|
|
|
Copyright (C) 2011-2013 by Andreas Lauser
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
2013-05-30 11:44:10 -05:00
|
|
|
/*!
|
|
|
|
* \file
|
|
|
|
*
|
|
|
|
* \brief This test makes sure that the programming interface is
|
2013-12-03 04:56:45 -06:00
|
|
|
* observed by all fluid systems
|
2013-05-30 11:44:10 -05:00
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
#include <opm/material/localad/Evaluation.hpp>
|
|
|
|
#include <opm/material/localad/Math.hpp>
|
|
|
|
|
2013-09-10 07:55:59 -05:00
|
|
|
#include "checkFluidSystem.hpp"
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// include all fluid systems in opm-material
|
2014-05-08 09:53:53 -05:00
|
|
|
#include <opm/material/fluidsystems/SinglePhaseFluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
|
2013-09-10 07:55:59 -05:00
|
|
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/BrineCO2FluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/H2ON2FluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/H2OAirFluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp>
|
|
|
|
#include <opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp>
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// include all fluid states
|
2013-09-10 07:55:59 -05:00
|
|
|
#include <opm/material/fluidstates/PressureOverlayFluidState.hpp>
|
|
|
|
#include <opm/material/fluidstates/SaturationOverlayFluidState.hpp>
|
|
|
|
#include <opm/material/fluidstates/TemperatureOverlayFluidState.hpp>
|
|
|
|
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
|
|
|
#include <opm/material/fluidstates/NonEquilibriumFluidState.hpp>
|
|
|
|
#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// include the tables for CO2 which are delivered with opm-material by default
|
2015-04-27 09:34:36 -05:00
|
|
|
#include <opm/material/common/UniformTabulated2DFunction.hpp>
|
2013-09-10 07:55:59 -05:00
|
|
|
|
2013-05-30 11:44:10 -05:00
|
|
|
namespace Opm {
|
|
|
|
namespace FluidSystemsTest {
|
|
|
|
#include <opm/material/components/co2tables.inc>
|
|
|
|
} }
|
|
|
|
|
2013-09-24 03:25:45 -05:00
|
|
|
// include the MPI header if available
|
|
|
|
#if HAVE_MPI
|
|
|
|
#include <mpi.h>
|
|
|
|
#endif // HAVE_MPI
|
|
|
|
|
|
|
|
class MyMpiHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MyMpiHelper(int &argc, char **&argv)
|
|
|
|
{
|
|
|
|
#if HAVE_MPI
|
|
|
|
MPI_Init(&argc, &argv);
|
|
|
|
#endif // HAVE_MPI
|
|
|
|
};
|
|
|
|
|
|
|
|
~MyMpiHelper()
|
|
|
|
{
|
|
|
|
#if HAVE_MPI
|
|
|
|
MPI_Finalize();
|
|
|
|
#endif // HAVE_MPI
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// check the API of all fluid states
|
|
|
|
template <class Scalar>
|
|
|
|
void testAllFluidStates()
|
2013-05-30 11:44:10 -05:00
|
|
|
{
|
2015-05-21 08:33:16 -05:00
|
|
|
typedef Opm::FluidSystems::H2ON2<Scalar, /*enableComplexRelations=*/false> FluidSystem;
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// CompositionalFluidState
|
|
|
|
{ Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
|
|
|
|
checkFluidState<Scalar>(fs); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// NonEquilibriumFluidState
|
|
|
|
{ Opm::NonEquilibriumFluidState<Scalar, FluidSystem> fs;
|
|
|
|
checkFluidState<Scalar>(fs); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// ImmiscibleFluidState
|
|
|
|
{ Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
|
|
|
|
checkFluidState<Scalar>(fs); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
typedef Opm::CompositionalFluidState<Scalar, FluidSystem> BaseFluidState;
|
|
|
|
BaseFluidState baseFs;
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// TemperatureOverlayFluidState
|
|
|
|
{ Opm::TemperatureOverlayFluidState<BaseFluidState> fs(baseFs);
|
|
|
|
checkFluidState<Scalar>(fs); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// PressureOverlayFluidState
|
|
|
|
{ Opm::PressureOverlayFluidState<BaseFluidState> fs(baseFs);
|
|
|
|
checkFluidState<Scalar>(fs); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
// SaturationOverlayFluidState
|
|
|
|
{ Opm::SaturationOverlayFluidState<BaseFluidState> fs(baseFs);
|
|
|
|
checkFluidState<Scalar>(fs); }
|
|
|
|
}
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
template <class Scalar, class Evaluation, class LhsEval = Evaluation>
|
|
|
|
void testAllFluidSystems()
|
|
|
|
{
|
|
|
|
typedef Opm::H2O<Scalar> H2O;
|
|
|
|
typedef Opm::N2<Scalar> N2;
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2015-05-21 08:33:16 -05:00
|
|
|
typedef Opm::LiquidPhase<Scalar, H2O> Liquid;
|
|
|
|
typedef Opm::GasPhase<Scalar, N2> Gas;
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// black-oil
|
2015-05-21 08:33:16 -05:00
|
|
|
{ typedef Opm::FluidSystems::BlackOil<Scalar, Evaluation> FluidSystem;
|
|
|
|
if (false) checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// Brine -- CO2
|
|
|
|
{ typedef Opm::FluidSystems::BrineCO2<Scalar, Opm::FluidSystemsTest::CO2Tables> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// H2O -- N2
|
|
|
|
{ typedef Opm::FluidSystems::H2ON2<Scalar, /*enableComplexRelations=*/false> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
{ typedef Opm::FluidSystems::H2ON2<Scalar, /*enableComplexRelations=*/true> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// H2O -- N2 -- liquid phase
|
|
|
|
{ typedef Opm::FluidSystems::H2ON2LiquidPhase<Scalar, /*enableComplexRelations=*/false> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
{ typedef Opm::FluidSystems::H2ON2LiquidPhase<Scalar, /*enableComplexRelations=*/true> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// H2O -- Air
|
|
|
|
{ typedef Opm::SimpleH2O<Scalar> H2O;
|
|
|
|
const bool enableComplexRelations=false;
|
|
|
|
typedef Opm::FluidSystems::H2OAir<Scalar, H2O, enableComplexRelations> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
{ typedef Opm::SimpleH2O<Scalar> H2O;
|
|
|
|
const bool enableComplexRelations=true;
|
|
|
|
typedef Opm::FluidSystems::H2OAir<Scalar, H2O, enableComplexRelations> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
{ typedef Opm::H2O<Scalar> H2O;
|
|
|
|
const bool enableComplexRelations=false;
|
|
|
|
typedef Opm::FluidSystems::H2OAir<Scalar, H2O, enableComplexRelations> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
{ typedef Opm::H2O<Scalar> H2O;
|
|
|
|
const bool enableComplexRelations=true;
|
|
|
|
typedef Opm::FluidSystems::H2OAir<Scalar, H2O, enableComplexRelations> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// H2O -- Air -- Mesitylene
|
|
|
|
{ typedef Opm::FluidSystems::H2OAirMesitylene<Scalar> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// H2O -- Air -- Xylene
|
|
|
|
{ typedef Opm::FluidSystems::H2OAirXylene<Scalar> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// 2p-immiscible
|
2014-05-08 09:53:53 -05:00
|
|
|
{ typedef Opm::FluidSystems::TwoPhaseImmiscible<Scalar, Liquid, Liquid> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2014-05-08 09:53:53 -05:00
|
|
|
{ typedef Opm::FluidSystems::TwoPhaseImmiscible<Scalar, Liquid, Gas> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2014-05-08 09:53:53 -05:00
|
|
|
{ typedef Opm::FluidSystems::TwoPhaseImmiscible<Scalar, Gas, Liquid> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
// 1p
|
2014-05-08 09:53:53 -05:00
|
|
|
{ typedef Opm::FluidSystems::SinglePhase<Scalar, Liquid> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
2013-05-30 11:44:10 -05:00
|
|
|
|
2014-05-08 09:53:53 -05:00
|
|
|
{ typedef Opm::FluidSystems::SinglePhase<Scalar, Gas> FluidSystem;
|
2015-05-21 08:33:16 -05:00
|
|
|
checkFluidSystem<Scalar, FluidSystem, Evaluation, LhsEval>(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
class TestAdTag;
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
typedef double Scalar;
|
|
|
|
typedef Opm::LocalAd::Evaluation<Scalar, TestAdTag, 3> Evaluation;
|
|
|
|
|
|
|
|
MyMpiHelper mpiHelper(argc, argv);
|
|
|
|
|
|
|
|
// ensure that all fluid states are API-compliant
|
|
|
|
testAllFluidStates<Scalar>();
|
|
|
|
testAllFluidStates<Evaluation>();
|
|
|
|
|
|
|
|
// ensure that all fluid systems are API-compliant: Each fluid system must be usable
|
|
|
|
// for both, scalars and function evaluations. The fluid systems for function
|
|
|
|
// evaluations must also be usable for scalars.
|
|
|
|
testAllFluidSystems<Scalar, Scalar>();
|
|
|
|
testAllFluidSystems<Scalar, Evaluation>();
|
|
|
|
testAllFluidSystems<Scalar, Evaluation, Scalar>();
|
2013-05-30 11:44:10 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|