https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DerivativeParsedMaterialHelper.h
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
10#pragma once
11
14
15#include "libmesh/fparser_ad.hh"
16
17#define usingDerivativeParsedMaterialHelperMembers(T) \
18 usingParsedMaterialHelperMembers(T); \
19 using typename DerivativeParsedMaterialHelperTempl<T>::Derivative; \
20 using typename DerivativeParsedMaterialHelperTempl<T>::MaterialPropertyDerivativeRule; \
21 using DerivativeParsedMaterialHelperTempl<T>::_derivative_order; \
22 using DerivativeParsedMaterialHelperTempl<T>::_derivatives
23
27template <bool is_ad>
29{
30protected:
32
33public:
35
38 const VariableNameMappingMode map_mode = VariableNameMappingMode::USE_PARAM_NAMES,
39 const std::optional<std::string> & function_param_name = {});
40
42
43protected:
44 struct Derivative;
45 struct MaterialPropertyDerivativeRule;
46
47 void initQpStatefulProperties() override;
48 void computeQpProperties() override;
49
50 void functionsPostParse() override;
52
53 void
54 recurseMatProps(unsigned int var, unsigned int order, const MatPropDescriptorList & parent_mpd);
55
56 void
57 recurseDerivative(unsigned int var, unsigned int order, const Derivative & parent_derivative);
58
60 unsigned int _derivative_order;
61
63 std::vector<Derivative> _derivatives;
64
66 const std::string _dmatvar_base;
67
69 unsigned int _dmatvar_index;
70
75 std::vector<std::size_t> _derivative_symbol_table;
76
77private:
78 // for bulk registration of material property derivatives
79 std::vector<MaterialPropertyDerivativeRule> _bulk_rules;
80};
81
82template <bool is_ad>
89
90template <bool is_ad>
92{
93 MaterialPropertyDerivativeRule(std::string p, std::string v, std::string c)
94 : _parent(p), _var(v), _child(c)
95 {
96 }
97
98 std::string _parent;
99 std::string _var;
100 std::string _child;
101};
102
DerivativeParsedMaterialHelperTempl< true > ADDerivativeParsedMaterialHelper
DerivativeParsedMaterialHelperTempl< false > DerivativeParsedMaterialHelper
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
const ParallelParamObject & _parent
Helper class to perform the auto derivative taking.
DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
std::vector< std::size_t > _derivative_symbol_table
list of all indices into _variable_names to take derivatives, w.r.t.
void computeQpProperties() override
Users must override this method.
unsigned int _derivative_order
maximum derivative order
void recurseMatProps(unsigned int var, unsigned int order, const MatPropDescriptorList &parent_mpd)
void recurseDerivative(unsigned int var, unsigned int order, const Derivative &parent_derivative)
std::vector< Derivative > _derivatives
The requested derivatives of the free energy (sorted by order)
std::vector< MaterialPropertyDerivativeRule > _bulk_rules
unsigned int _dmatvar_index
next available variable number for automatically created material property derivative variables
void assembleDerivatives()
Perform construction of all requested derivatives.
const std::string _dmatvar_base
variable base name for the dynamically material property derivatives
void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
std::shared_ptr< SymFunction > SymFunctionPtr
Shorthand for an smart pointer to an autodiff function parser object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Helper class to perform the parsing and optimization of the function expression.
std::vector< FunctionMaterialPropertyDescriptor< is_ad > > MatPropDescriptorList
convenience typedef for the material property descriptors