Raw File
TestMPLWaterEnthalpyIAPWSIF97Region4.cpp
/*!
   \file
   \brief Test classes for water saturated enthalpy models.

   \author Chaofan Chen
   \date March 2023

   \copyright
    Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
               Distributed under a Modified BSD License.
               See accompanying file LICENSE.txt or
               http://www.opengeosys.org/project/license
*/
#include <gtest/gtest.h>

#include <memory>

#include "MaterialLib/MPL/Properties/Enthalpy/CreateWaterLiquidEnthalpyIAPWSIF97Region4.h"
#include "TestMPL.h"

TEST(Material, checkWaterLiquidEnthalpyIAPWSIF97Region4)
{
    const char xml[] =
        "<property>"
        "   <name>enthalpy</name>"
        "   <type>WaterLiquidEnthalpyIAPWSIF97Region4</type>"
        "</property>";

    std::unique_ptr<MaterialPropertyLib::Property> const property_ptr =
        Tests::createTestProperty(
            xml,
            MaterialPropertyLib::createWaterLiquidEnthalpyIAPWSIF97Region4);
    MaterialPropertyLib::Property const& property = *property_ptr;

    MaterialPropertyLib::VariableArray variable_array;
    ParameterLib::SpatialPosition const pos;
    double const t = std::numeric_limits<double>::quiet_NaN();
    double const dt = std::numeric_limits<double>::quiet_NaN();
    double const p[] = {611.213, 1.e+6, 10.e6};

    double const expected_h[] = {-41.555230442141529, 762647.04245918128,
                                 1407801.4124185159};

    for (int i = 0; i < 3; i++)
    {
        variable_array.phase_pressure = p[i];
        ASSERT_NEAR(expected_h[i],
                    property.template value<double>(variable_array, pos, t, dt),
                    1.e-8);
    }
}
back to top