Skip to content
Snippets Groups Projects
Commit 0e0cd12c authored by Tom Fischer's avatar Tom Fischer
Browse files

[T/MaterialPropertyLib] Test for LinearProperties.

parent ea316b34
No related branches found
No related tags found
No related merge requests found
/**
* \file
*
* \copyright
* Copyright (c) 2012-2019, 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 "MaterialLib/MPL/Properties/LinearProperty.h"
TEST(MaterialPropertyLib, LinearProperty)
{
double const y_ref = 1.0;
double const m = 1.0;
double const x_ref = 293.15;
MaterialPropertyLib::IndependentVariable const iv{
MaterialPropertyLib::Variables::temperature, x_ref, m};
MaterialPropertyLib::LinearProperty linear_property{y_ref, iv};
MaterialPropertyLib::VariableArray variable_array;
variable_array[MaterialPropertyLib::Variables::temperature] = 303.15;
ASSERT_NEAR(
boost::get<double>(linear_property.value(variable_array)),
y_ref + m * (boost::get<double>(
variable_array
[MaterialPropertyLib::Variables::temperature]) -
x_ref),
1.e-10);
ASSERT_EQ(
boost::get<double>(linear_property.dValue(
variable_array, MaterialPropertyLib::Variables::phase_pressure)),
0.0);
ASSERT_EQ(boost::get<double>(linear_property.dValue(
variable_array, MaterialPropertyLib::Variables::temperature)),
m);
ASSERT_EQ(boost::get<double>(linear_property.d2Value(
variable_array,
MaterialPropertyLib::Variables::temperature,
MaterialPropertyLib::Variables::temperature)),
0.0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment