Line data Source code
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 "FVFunctionIC.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", FVFunctionIC); 14 : 15 : InputParameters 16 14586 : FVFunctionIC::validParams() 17 : { 18 14586 : InputParameters params = FVInitialCondition::validParams(); 19 14586 : params.addRequiredParam<FunctionName>("function", "The initial condition function."); 20 : 21 14586 : params.addClassDescription("An initial condition that uses a normal function of x, y, z to " 22 : "produce values (and optionally gradients) for a field variable."); 23 14586 : params.addParam<Real>("scaling_factor", 1, "Scaling factor to apply on the function"); 24 : 25 14586 : return params; 26 0 : } 27 : 28 167 : FVFunctionIC::FVFunctionIC(const InputParameters & parameters) 29 : : FVInitialCondition(parameters), 30 167 : _func(getFunction("function")), 31 334 : _scaling(getParam<Real>("scaling_factor")) 32 : { 33 167 : } 34 : 35 : Real 36 25462 : FVFunctionIC::value(const Point & p) 37 : { 38 25462 : return _scaling * _func.value(_t, p); 39 : } 40 : 41 : const FunctionName 42 0 : FVFunctionIC::functionName() const 43 : { 44 0 : return _func.name(); 45 : }