https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
12#include "SerialAccess.h"
13#include "MaterialBase.h"
14#include "Assembly.h"
15
24
25template <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
39template <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
49template <typename T, bool is_ad>
50void
52{
54
55 // get all material classes that provide properties for this object
56 _required_materials = buildRequiredMaterials();
57}
58
59template <typename T, bool is_ad>
60Real
62{
63 if (_t_step == 0)
64 for (const auto & mat : _required_materials[_current_subdomain_id])
65 mat->initStatefulProperties(_qrule->size());
66
67 return MetaPhysicL::raw_value(Moose::serialAccess(_prop[_qp])[_component]);
68}
69
registerMooseObject("MooseApp", ProjectedStatefulMaterialRealAux)
void ErrorVector unsigned int
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
static InputParameters validParams()
Definition AuxKernel.C:27
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
virtual Real computeValue() override
Compute and return the value of the aux variable.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
ProjectedStatefulMaterialAuxTempl(const InputParameters &parameters)
auto raw_value(const Eigen::Map< T > &in)
SerialAccessRange< T > serialAccess(T &obj)