Revision 79783351d5bf44294ebef69ac8d7b5e4fa228966 authored by Lars Bilke on 12 April 2023, 12:03:57 UTC, committed by Lars Bilke on 14 April 2023, 06:00:47 UTC
1 parent a8efa86
Raw File
TestFluidSpecificHeatCapacityModel.cpp
/**
 *  \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
 *
 *   \file
 *
 */

#include <gtest/gtest.h>

#include <memory>

#include "BaseLib/ConfigTree.h"
#include "MaterialLib/Fluid/ConstantFluidProperty.h"
#include "MaterialLib/Fluid/FluidProperty.h"
#include "MaterialLib/Fluid/SpecificHeatCapacity/CreateSpecificFluidHeatCapacityModel.h"
#include "MaterialLib/PhysicalConstant.h"
#include "Tests/TestTools.h"

using namespace MaterialLib;
using namespace MaterialLib::Fluid;

using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;

std::unique_ptr<FluidProperty> createSpecificFluidHeatCapacityModel(
    const char xml[])
{
    auto ptree = Tests::readXml(xml);
    BaseLib::ConfigTree conf(std::move(ptree), "", BaseLib::ConfigTree::onerror,
                             BaseLib::ConfigTree::onwarning);
    auto const& sub_config = conf.getConfigSubtree("specific_heat_capacity");
    return createSpecificFluidHeatCapacityModel(sub_config);
}

TEST(MaterialFluid, checkConstantSpecificFluidHeatCapacityModel)
{
    const char xml[] =
        "<specific_heat_capacity>"
        "   <type>Constant</type>"
        "   <value> 900. </value> "
        "</specific_heat_capacity>";
    const auto cp = createSpecificFluidHeatCapacityModel(xml);

    ArrayType dummy;
    ASSERT_EQ(900., cp->getValue(dummy));
}
back to top