www.mooseframework.org
ParsedMaterialBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "ParsedMaterialBase.h"
11 
14 {
16  params.addCoupledVar("args", "Vector of variables used in the parsed function");
17  params.deprecateCoupledVar("args", "coupled_variables", "02/07/2024");
18 
19  // Constants and their values
20  params.addParam<std::vector<std::string>>(
21  "constant_names",
22  std::vector<std::string>(),
23  "Vector of constants used in the parsed function (use this for kB etc.)");
24  params.addParam<std::vector<std::string>>(
25  "constant_expressions",
26  std::vector<std::string>(),
27  "Vector of values for the constants in constant_names (can be an FParser expression)");
28 
29  // Variables with applied tolerances and their tolerance values
30  params.addParam<std::vector<std::string>>("tol_names",
31  std::vector<std::string>(),
32  "Vector of variable names to be protected from "
33  "being 0 or 1 within a tolerance (needed for log(c) "
34  "and log(1-c) terms)");
35  params.addParam<std::vector<Real>>("tol_values",
36  std::vector<Real>(),
37  "Vector of tolerance values for the variables in tol_names");
38 
39  // Material properties
40  params.addParam<std::vector<std::string>>(
41  "material_property_names",
42  std::vector<std::string>(),
43  "Vector of material properties used in the parsed function");
44 
45  // Postprocessors
46  params.addParam<std::vector<PostprocessorName>>(
47  "postprocessor_names",
48  std::vector<PostprocessorName>(),
49  "Vector of postprocessor names used in the parsed function");
50 
51  // Function expression
52  params.addDeprecatedCustomTypeParam<std::string>(
53  "function",
54  "FunctionExpression",
55  "Parsed function (see FParser) expression for the parsed material",
56  "'function' is deprecated, use 'expression' instead");
57  // TODO Make required once deprecation is handled, see #19119
58  params.addCustomTypeParam<std::string>(
59  "expression",
60  "FunctionExpression",
61  "Parsed function (see FParser) expression for the parsed material");
62 
63  return params;
64 }
65 
67 {
68  // get function expression
69  _function = parameters.isParamValid("function") ? parameters.get<std::string>("function")
70  : parameters.get<std::string>("expression");
71 
72  // get constant vectors
73  _constant_names = parameters.get<std::vector<std::string>>("constant_names");
74  _constant_expressions = parameters.get<std::vector<std::string>>("constant_expressions");
75 
76  // get tolerance vectors
77  _tol_names = parameters.get<std::vector<std::string>>("tol_names");
78  _tol_values = parameters.get<std::vector<Real>>("tol_values");
79 }
std::vector< std::string > _constant_expressions
std::vector< std::string > _constant_names
constant vectors
std::string _function
function expression
static InputParameters validParams()
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
void addCustomTypeParam(const std::string &name, const T &value, const std::string &custom_type, const std::string &doc_string)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
std::vector< std::string > _tol_names
tolerance vectors
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addDeprecatedCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string, const std::string &deprecation_msg)
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
ParsedMaterialBase(const InputParameters &parameters)
std::vector< Real > _tol_values
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.