Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
PiecewiseByBlockFunctorMaterial.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 
17  FVPropValPerSubdomainMaterial,
18  "06/30/2022 24:00",
21  FVADPropValPerSubdomainMaterial,
22  "06/30/2022 24:00",
24 
25 template <typename T>
28 {
29  auto params = FunctorMaterial::validParams();
30  params.addClassDescription("Computes a property value on a per-subdomain basis");
31  // Somehow min gcc doesn't know the typename of params here
32  params.template addRequiredParam<MooseFunctorName>("prop_name",
33  "The name of the property to declare");
34  params.template addRequiredParam<std::map<std::string, std::string>>(
35  "subdomain_to_prop_value",
36  "Map from subdomain to property value. The value may be a constant"
37  " or any kind of functor (functions, variables, functor material properties)");
38  return params;
39 }
40 
41 template <typename T>
43  const InputParameters & params)
44  : FunctorMaterial(params)
45 {
46  // Ultimately this can impose more caching than the original functors, but not less
47  const std::set<ExecFlagType> clearance_schedule(_execute_enum.begin(), _execute_enum.end());
48  for (const auto & map_pr :
49  getParam<std::map<std::string, std::string>>("subdomain_to_prop_value"))
50  {
51  const auto & name = map_pr.second;
52  const auto & functor = getFunctor<T>(name);
53  addFunctorPropertyByBlocks<T>(
54  "prop_name",
55  [&functor](const auto & r, const auto & t) -> T { return functor(r, t); },
56  std::set<SubdomainID>({_mesh.getSubdomainID(map_pr.first)}),
57  clearance_schedule);
58  }
59 }
60 
static InputParameters validParams()
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MooseEnumIterator end() const
PiecewiseByBlockFunctorMaterialTempl(const InputParameters &parameters)
registerMooseObjectRenamed("MooseApp", FVPropValPerSubdomainMaterial, "06/30/2022 24:00", PiecewiseByBlockFunctorMaterial)
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
Defines a functor material property by another functor (possibly constant) on each block...
FunctorMaterials compute functor material properties.
MooseMesh & _mesh
Definition: MaterialBase.h:326
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
const ExecFlagEnum & _execute_enum
Execute settings for this object.
registerMooseObject("MooseApp", PiecewiseByBlockFunctorMaterial)
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition: MooseMesh.C:1728