https://mooseframework.inl.gov
TimeRampFunctionTest.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 
10 #include "TimeRampFunctionTest.h"
11 #include "THMTestUtils.h"
12 #include "Function.h"
13 
15 {
16  const Function & fn = _fe_problem->getFunction(_fn_name);
17  const Point p(0, 0, 0);
18 
19  // during ramp
20  {
21  const Real test_time = 3.0;
22  const Real slope = (_final_value - _initial_value) / _ramp_duration;
23  const Real elapsed_time = test_time - _initial_time;
24  const Real test_value = _initial_value + slope * elapsed_time;
25 
26  ABS_TEST(fn.value(test_time, p), test_value, ABS_TOL_ROUNDOFF);
27  }
28 
29  // after ramp
30  {
31  const Real test_time = 10.0;
32  ABS_TEST(fn.value(test_time, p), _final_value, ABS_TOL_ROUNDOFF);
33  }
34 }
TEST_F(TimeRampFunctionTest, test)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real value(Real t, const Point &p) const