https://mooseframework.inl.gov
fluid_properties
test
include
utils
FluidPropertiesTestUtils.h
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
3
//*
4
//* All rights reserved, see COPYRIGHT for full restrictions
5
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6
//*
7
//* Licensed under LGPL 2.1, please see LICENSE for details
8
//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10
#pragma once
11
12
#include "metaphysicl/raw_type.h"
13
14
// Relative tolerance to be used when comparing to a value from external fluid
15
// property packages, which might be using different underlying models
16
#define REL_TOL_EXTERNAL_VALUE 1e-3
17
18
// Relative tolerance to be used when comparing to a value computed directly
19
// from the code at an earlier date, to ensure that implementations are not
20
// inadvertently changed
21
#define REL_TOL_SAVED_VALUE 1e-12
22
23
// Relative tolerance to be used for consistency checks - computing properties
24
// in different ways at the same state
25
#define REL_TOL_CONSISTENCY 1e-10
26
27
// Relative tolerance to be used when comparing a derivative value to a finite
28
// difference approximation
29
#define REL_TOL_DERIVATIVE 1e-6
30
31
// Macro for performing relative error test
32
#define REL_TEST(value, ref_value, tol) \
33
{ \
34
using std::abs; \
35
if (abs(ref_value) < 1e-15) \
36
ABS_TEST(value, ref_value, tol); \
37
else \
38
EXPECT_LE(std::abs(((MetaPhysicL::raw_value(value)) - (MetaPhysicL::raw_value(ref_value))) / \
39
(MetaPhysicL::raw_value(ref_value))), \
40
tol); \
41
}
42
43
// Macro for performing relative or absolute error test
44
#define REL_ABS_TEST(value, ref_value, rel_tol, abs_tol) \
45
{ \
46
using std::abs; \
47
if (abs(ref_value - value) < abs_tol) \
48
EXPECT_TRUE(true); \
49
else \
50
EXPECT_LE(std::abs(((MetaPhysicL::raw_value(value)) - (MetaPhysicL::raw_value(ref_value))) / \
51
(MetaPhysicL::raw_value(ref_value))), \
52
rel_tol); \
53
}
54
55
// Macro for computing absolute error
56
#define ABS_TEST(value, ref_value, tol) \
57
EXPECT_LE(std::abs(((MetaPhysicL::raw_value(value)) - (MetaPhysicL::raw_value(ref_value)))), \
58
(tol))
Generated on Fri Nov 7 2025 20:18:35 for https://mooseframework.inl.gov by
1.8.14