www.mooseframework.org
FluidPropertiesTestUtils.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 // Relative tolerance to be used when comparing to a value from external fluid
13 // property packages, which might be using different underlying models
14 #define REL_TOL_EXTERNAL_VALUE 1e-3
15 
16 // Relative tolerance to be used when comparing to a value computed directly
17 // from the code at an earlier date, to ensure that implementations are not
18 // inadvertently changed
19 #define REL_TOL_SAVED_VALUE 1e-12
20 
21 // Relative tolerance to be used for consistency checks - computing properties
22 // in different ways at the same state
23 #define REL_TOL_CONSISTENCY 1e-10
24 
25 // Relative tolerance to be used when comparing a derivative value to a finite
26 // difference approximation
27 #define REL_TOL_DERIVATIVE 1e-6
28 
29 // Macro for computing relative error
30 #define REL_TEST(value, ref_value, tol) \
31  if (std::abs(ref_value) < 1e-15) \
32  ABS_TEST(value, ref_value, tol); \
33  else \
34  EXPECT_LE(std::abs(((value) - (ref_value)) / (ref_value)), tol);
35 
36 // Macro for computing absolute error
37 #define ABS_TEST(value, ref_value, tol) EXPECT_LE(std::abs(((value) - (ref_value))), (tol))
38