https://mooseframework.inl.gov
ProjectedStatefulMaterialAux.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 "NodalPatchRecoveryBase.h"
12 #include "SerialAccess.h"
13 #include "MaterialBase.h"
14 #include "Assembly.h"
15 
24 
25 template <typename T, bool is_ad>
28 {
29  auto params = AuxKernel::validParams();
30  params.addClassDescription(
31  "Picks a component of an indexable material property to get projected on an elemental "
32  "Auxvariable. For use by ProjectedStatefulMaterialStorageAction.");
33  params.addRequiredParam<MaterialPropertyName>(
34  "prop", "material property to project onto an elemental aux variable");
35  params.addRequiredParam<unsigned int>("component", "scalar component of the property to fetch");
36  return params;
37 }
38 
39 template <typename T, bool is_ad>
41  const InputParameters & parameters)
42  : AuxKernel(parameters),
43  _current_subdomain_id(_assembly.currentSubdomainID()),
44  _prop(getGenericMaterialProperty<T, is_ad>("prop")),
45  _component(getParam<unsigned int>("component"))
46 {
47 }
48 
49 template <typename T, bool is_ad>
50 void
52 {
53  // get all material classes that provide properties for this object
54  _required_materials = buildRequiredMaterials();
55 }
56 
57 template <typename T, bool is_ad>
58 Real
60 {
61  if (_t_step == 0)
62  for (const auto & mat : _required_materials[_current_subdomain_id])
63  mat->initStatefulProperties(_qrule->size());
64 
65  return MetaPhysicL::raw_value(Moose::serialAccess(_prop[_qp])[_component]);
66 }
67 
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
ProjectedStatefulMaterialAuxTempl(const InputParameters &parameters)
virtual Real computeValue() override
Compute and return the value of the aux variable.
SerialAccessRange< T > serialAccess(T &obj)
Definition: SerialAccess.h:151
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
Definition: AuxKernel.C:27
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:36
void ErrorVector unsigned int
registerMooseObject("MooseApp", ProjectedStatefulMaterialRealAux)