https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CosineHumpFunctionTest.C
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
11#include "THMTestUtils.h"
12#include "Function.h"
13
15{
16 const Function & fn = _fe_problem->getFunction(_fn_name_positive);
17
18 const Real x = 3.0;
19 const Real z = 6.0;
20 const Real abs_tol = 1e-13;
21
22 // center
23 {
24 const Point p(x, _hump_center_position, z);
25 ABS_TEST(fn.value(0, p), _hump_center_value_positive, abs_tol);
26 }
27
28 // left
29 {
30 const Point p(x, _hump_center_position - 0.7 * _hump_width, z);
31 ABS_TEST(fn.value(0, p), _hump_begin_value, abs_tol);
32 }
33
34 // right
35 {
36 const Point p(x, _hump_center_position + 0.7 * _hump_width, z);
37 ABS_TEST(fn.value(0, p), _hump_begin_value, abs_tol);
38 }
39
40 // halfway between left end of hump and center of hump
41 {
42 const Point p(x, _hump_center_position - 0.25 * _hump_width, z);
43 ABS_TEST(fn.value(0, p), 0.5 * (_hump_begin_value + _hump_center_value_positive), abs_tol);
44 }
45}
46
48{
49 const Function & fn = _fe_problem->getFunction(_fn_name_negative);
50
51 const Real x = 3.0;
52 const Real z = 6.0;
53 const Real abs_tol = 1e-13;
54
55 // center
56 {
57 const Point p(x, _hump_center_position, z);
58 ABS_TEST(fn.value(0, p), _hump_center_value_negative, abs_tol);
59 }
60
61 // left
62 {
63 const Point p(x, _hump_center_position - 0.7 * _hump_width, z);
64 ABS_TEST(fn.value(0, p), _hump_begin_value, abs_tol);
65 }
66
67 // right
68 {
69 const Point p(x, _hump_center_position + 0.7 * _hump_width, z);
70 ABS_TEST(fn.value(0, p), _hump_begin_value, abs_tol);
71 }
72
73 // halfway between left end of hump and center of hump
74 {
75 const Point p(x, _hump_center_position - 0.25 * _hump_width, z);
76 ABS_TEST(fn.value(0, p), 0.5 * (_hump_begin_value + _hump_center_value_negative), abs_tol);
77 }
78}
TEST_F(CosineHumpFunctionTest, testPositiveHump)
const std::vector< double > x
const Real p
virtual Real value(Real t, const Point &p) const