https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CoupledValueFunctionIC.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 "Function.h"
12
14
17{
19 params.addClassDescription("Initialize the variable from a lookup function");
20 params.addRequiredParam<FunctionName>("function",
21 "Coupled function to evaluate with values from v");
22 params.addCoupledVar("v",
23 "List of up to four coupled variables that are substituted for x,y,z, and t "
24 "in the coupled function");
25 return params;
26}
27
29 : InitialCondition(parameters),
30 _func(getFunction("function")),
31 _var_num(coupledComponents("v")),
32 _vals(coupledValues("v"))
33{
34 if (_var_num > 4)
35 paramError("v", "You can couple at most four variables.");
36}
37
38Real
40{
41 Point p;
42 Real t = 0.0;
43
44 for (unsigned int i = 0; i < 3 && i < _var_num; ++i)
45 p(i) = (*_vals[i])[_qp];
46 if (_var_num == 4)
47 t = (*_vals[3])[_qp];
48
49 return _func.value(t, p);
50}
registerMooseObject("PhaseFieldApp", CoupledValueFunctionIC)
const Real p
const std::vector< const VariableValue * > _vals
virtual Real value(const Point &) override
static InputParameters validParams()
CoupledValueFunctionIC(const InputParameters &parameters)
virtual Real value(Real t, const Point &p) const
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void paramError(const std::string &param, Args... args) const