Revision 7f8d24a6d3d1e277300e118db7925769cae38e21 authored by Thomas Fischer on 06 April 2023, 08:02:11 UTC, committed by Thomas Fischer on 26 April 2023, 04:41:49 UTC
1 parent 748c483
Raw File
TestMPLWaterDensityIAPWSIF97Region4.cpp
/*!
   \file
   \brief Test classes for water saturated density 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/Density/CreateWaterLiquidDensityIAPWSIF97Region4.h"
#include "TestMPL.h"

TEST(Material, checkWaterLiquidDensityIAPWSIF97Region4)
{
    const char xml[] =
        "<property>"
        "   <name>density</name>"
        "   <type>WaterLiquidDensityIAPWSIF97Region4</type>"
        "</property>";

    std::unique_ptr<MaterialPropertyLib::Property> const property_ptr =
        Tests::createTestProperty(
            xml, MaterialPropertyLib::createWaterLiquidDensityIAPWSIF97Region4);
    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_rho[] = {999.84000051382395, 887.16909718765328,
                                   688.44365003037342};

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