https://mooseframework.inl.gov
CoupledVariableValueMaterial.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 
12 #include "metaphysicl/raw_type.h"
13 
14 registerMooseObject("ThermalHydraulicsApp", CoupledVariableValueMaterial);
16 
17 template <bool is_ad>
20 {
22  params.addRequiredParam<MaterialPropertyName>(
23  "prop_name", "The name of the material property where we store the variable values.");
24  params.addRequiredCoupledVar(
25  "coupled_variable", "The coupled variable that will be stored into the material property");
26  params.addClassDescription("Stores values of a variable into material properties");
27  return params;
28 }
29 
30 template <bool is_ad>
32  const InputParameters & parameters)
33  : Material(parameters),
34  _prop_name(getParam<MaterialPropertyName>("prop_name")),
35  _prop(declareGenericProperty<Real, is_ad>(_prop_name)),
36  _value((!is_ad) ? coupledValue("coupled_variable") : _zero),
37  _ad_value((is_ad) ? adCoupledValue("coupled_variable") : _ad_zero)
38 {
39 }
40 
41 template <bool is_ad>
42 void
44 {
45  if (is_ad)
46  _prop[_qp] = MetaPhysicL::raw_value(_ad_value[_qp]);
47  else
48  _prop[_qp] = _value[_qp];
49 }
50 
CoupledVariableValueMaterialTempl(const InputParameters &parameters)
Stores values of a variable into material properties.
auto raw_value(const Eigen::Map< T > &in)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
registerMooseObject("ThermalHydraulicsApp", CoupledVariableValueMaterial)