// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: /* 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 . */ /*! * \file * * \brief This test makes sure that the programming interface is * observed by all fluid systems */ #include "config.h" #include #include #include "checkFluidSystem.hpp" // include all fluid systems in opm-material #include #include #include #include #include #include #include #include #include // include all fluid states #include #include #include #include #include #include #include // include the tables for CO2 which are delivered with opm-material by default #include namespace Opm { namespace FluidSystemsTest { #include } } // include the MPI header if available #if HAVE_MPI #include #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 }; }; // check the API of all fluid states template void testAllFluidStates() { typedef Opm::FluidSystems::H2ON2 FluidSystem; // SimpleModularFluidState { Opm::SimpleModularFluidState fs; checkFluidState(fs); } { Opm::SimpleModularFluidState fs; checkFluidState(fs); } // CompositionalFluidState { Opm::CompositionalFluidState fs; checkFluidState(fs); } // NonEquilibriumFluidState { Opm::NonEquilibriumFluidState fs; checkFluidState(fs); } // ImmiscibleFluidState { Opm::ImmiscibleFluidState fs; checkFluidState(fs); } typedef Opm::CompositionalFluidState BaseFluidState; BaseFluidState baseFs; // TemperatureOverlayFluidState { Opm::TemperatureOverlayFluidState fs(baseFs); checkFluidState(fs); } // PressureOverlayFluidState { Opm::PressureOverlayFluidState fs(baseFs); checkFluidState(fs); } // SaturationOverlayFluidState { Opm::SaturationOverlayFluidState fs(baseFs); checkFluidState(fs); } } template void testAllFluidSystems() { typedef Opm::H2O H2O; typedef Opm::N2 N2; typedef Opm::LiquidPhase Liquid; typedef Opm::GasPhase Gas; // black-oil { typedef Opm::FluidSystems::BlackOil FluidSystem; if (false) checkFluidSystem(); } // Brine -- CO2 { typedef Opm::FluidSystems::BrineCO2 FluidSystem; checkFluidSystem(); } // H2O -- N2 { typedef Opm::FluidSystems::H2ON2 FluidSystem; checkFluidSystem(); } { typedef Opm::FluidSystems::H2ON2 FluidSystem; checkFluidSystem(); } // H2O -- N2 -- liquid phase { typedef Opm::FluidSystems::H2ON2LiquidPhase FluidSystem; checkFluidSystem(); } { typedef Opm::FluidSystems::H2ON2LiquidPhase FluidSystem; checkFluidSystem(); } // H2O -- Air { typedef Opm::SimpleH2O H2O; const bool enableComplexRelations=false; typedef Opm::FluidSystems::H2OAir FluidSystem; checkFluidSystem(); } { typedef Opm::SimpleH2O H2O; const bool enableComplexRelations=true; typedef Opm::FluidSystems::H2OAir FluidSystem; checkFluidSystem(); } { typedef Opm::H2O H2O; const bool enableComplexRelations=false; typedef Opm::FluidSystems::H2OAir FluidSystem; checkFluidSystem(); } { typedef Opm::H2O H2O; const bool enableComplexRelations=true; typedef Opm::FluidSystems::H2OAir FluidSystem; checkFluidSystem(); } // H2O -- Air -- Mesitylene { typedef Opm::FluidSystems::H2OAirMesitylene FluidSystem; checkFluidSystem(); } // H2O -- Air -- Xylene { typedef Opm::FluidSystems::H2OAirXylene FluidSystem; checkFluidSystem(); } // 2p-immiscible { typedef Opm::FluidSystems::TwoPhaseImmiscible FluidSystem; checkFluidSystem(); } { typedef Opm::FluidSystems::TwoPhaseImmiscible FluidSystem; checkFluidSystem(); } { typedef Opm::FluidSystems::TwoPhaseImmiscible FluidSystem; checkFluidSystem(); } // 1p { typedef Opm::FluidSystems::SinglePhase FluidSystem; checkFluidSystem(); } { typedef Opm::FluidSystems::SinglePhase FluidSystem; checkFluidSystem(); } } class TestAdTag; int main(int argc, char **argv) { typedef double Scalar; typedef Opm::LocalAd::Evaluation Evaluation; MyMpiHelper mpiHelper(argc, argv); // ensure that all fluid states are API-compliant testAllFluidStates(); testAllFluidStates(); // 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(); testAllFluidSystems(); testAllFluidSystems(); return 0; }