https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16
17template <bool is_ad>
20{
22 params.addRequiredParam<MaterialPropertyName>(
23 "prop_name", "The name of the material property where we store the variable values.");
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
30template <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
41template <bool is_ad>
42void
44{
45 if (is_ad)
46 _prop[_qp] = MetaPhysicL::raw_value(_ad_value[_qp]);
47 else
48 _prop[_qp] = _value[_qp];
49}
50
registerMooseObject("ThermalHydraulicsApp", CoupledVariableValueMaterial)
Stores values of a variable into material properties.
CoupledVariableValueMaterialTempl(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)