https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FunctionMaterialPropertyDescriptor.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
13#include "Material.h"
14
15#include <string>
16#include <vector>
17
18class MooseObject;
19
24template <bool is_ad>
26{
27public:
28 /*
29 * The descriptor is constructed with an expression that describes the
30 * material property.
31 * Examples:
32 * 'F' A material property called 'F' with no declared variable
33 * dependencies (i.e. vanishing derivatives)
34 * 'F(c,phi)' A material property called 'F' with declared dependence
35 * on 'c' and 'phi' (uses DerivativeFunctionMaterial rules to
36 * look up the derivatives)
37 * 'a:=D[x(t),t,t]' The second time derivative of the t-dependent material property 'x'
38 * which will be referred to as 'a' in the function expression.
39 * 'x_old:=Old[x]' The previous time step value of x
40 * 'x_older:=Older[x]' The value of x two time steps ago
41 */
42 FunctionMaterialPropertyDescriptor(const std::string &, MooseObject *, bool required = false);
43
46
49
52
53 // copy assignment operator
56
58 static std::vector<FunctionMaterialPropertyDescriptor>
59 parseVector(const std::vector<std::string> &, MooseObject *);
60
62 const std::string & getSymbolName() const { return _fparser_name; };
63
65 void setSymbolName(const std::string & n) { _fparser_name = n; };
66
68 const std::string & getPropertyName() const { return _property_name; };
69
71 GenericReal<is_ad> value(unsigned int qp = libMesh::invalid_uint) const;
72
74 void addDerivative(const SymbolName & symbol);
75
81 bool dependsOn(const SymbolName & symbol) const;
82
84 std::vector<SymbolName> getDependentSymbols();
85
87 void printDebug();
88
90 void updatePropertyName();
91
92private:
93 void parseDerivative(const std::string &);
94 void parseDependentSymbols(const std::string &);
95
97 enum class PropertyState
98 {
99 CURRENT,
100 OLD,
101 OLDER
103
105 std::string _fparser_name;
106
108 std::string _base_name;
109
110 std::vector<SymbolName> _dependent_symbols;
111 std::vector<SymbolName> _derivative_symbols;
112
115
118
121
123 std::string _property_name;
124
127};
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
Material properties get fully described using this structure, including their dependent variables and...
const MaterialProperty< Real > * _old_older_value
old/older material property value (this is lazily updated and cached when read through value())
enum FunctionMaterialPropertyDescriptor::PropertyState _state
std::string _base_name
function material property base name
void setSymbolName(const std::string &n)
set the fparser symbol name
bool dependsOn(const SymbolName &symbol) const
Check if a material property depends on a given FParser symbol.
FunctionMaterialPropertyDescriptor()=delete
no default constructor
void printDebug()
output the internal state of this descriptor for debugging purposes
const GenericMaterialProperty< Real, is_ad > * _value
material property value (this is lazily updated and cached when read through value())
std::string _property_name
cache the final property name of the derivative
std::string _fparser_name
name used in function expression
static std::vector< FunctionMaterialPropertyDescriptor > parseVector(const std::vector< std::string > &, MooseObject *)
construct a vector of FunctionMaterialPropertyDescriptors from a vector of strings
void updatePropertyName()
update the cached _property_name member
const std::string & getSymbolName() const
get the fparser symbol name
std::vector< SymbolName > getDependentSymbols()
builds a list of dependent symbols (exactly all symbols for which depends on returns true)
bool _required
is this a property that was directly specified by the user? Then it must exist.
const std::string & getPropertyName() const
get the property name
FunctionMaterialPropertyDescriptor & operator=(const FunctionMaterialPropertyDescriptor &)=default
MooseObject * _parent
material object that owns this descriptor
void addDerivative(const SymbolName &symbol)
take another derivative
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
const unsigned int invalid_uint