https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVFunctionIC.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 "FVFunctionIC.h"
11#include "Function.h"
12
14
17{
19 params.addRequiredParam<FunctionName>("function", "The initial condition function.");
20
21 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 params.addParam<Real>("scaling_factor", 1, "Scaling factor to apply on the function");
24
25 return params;
26}
27
29 : FVInitialCondition(parameters),
30 _func(getFunction("function")),
31 _scaling(getParam<Real>("scaling_factor"))
32{
33}
34
35Real
36FVFunctionIC::value(const Point & p)
37{
38 return _scaling * _func.value(_t, p);
39}
40
41const FunctionName
43{
44 return _func.name();
45}
registerMooseObject("MooseApp", FVFunctionIC)
Defines a boundary condition that forces the value to be a user specified function at the boundary.
static InputParameters validParams()
const FunctionName functionName() const
virtual Real value(const Point &p) override
The value of the variable at a point.
const Function & _func
Function to evaluate to form the initial condition.
const Real _scaling
Scaling factor, to be able to use a function with multiple ICs.
FVFunctionIC(const InputParameters &parameters)
This is a template class that implements the workhorse compute and computeNodal methods.
static InputParameters validParams()
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition Function.C:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103