www.mooseframework.org
FunctionMaterialPropertyDescriptor.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
18 class MooseObject;
19 
25 {
26 public:
27  /*
28  * The descriptor is constructed with an expression that describes the
29  * material property.
30  * Examples:
31  * 'F' A material property called 'F' with no declared variable
32  * dependencies (i.e. vanishing derivatives)
33  * 'F(c,phi)' A material property called 'F' with declared dependence
34  * on 'c' and 'phi' (uses DerivativeFunctionMaterial rules to
35  * look up the derivatives)
36  * 'a:=D[x(t),t,t]' The second time derivative of the t-dependent material property 'x'
37  * which will be referred to as 'a' in the function expression.
38  */
39  FunctionMaterialPropertyDescriptor(const std::string &, MooseObject *);
40 
43 
46 
49 
51  static std::vector<FunctionMaterialPropertyDescriptor>
52  parseVector(const std::vector<std::string> &, MooseObject *);
53 
55  const std::string & getSymbolName() const { return _fparser_name; };
56 
58  void setSymbolName(const std::string & n) { _fparser_name = n; };
59 
61  const std::string getPropertyName() const
62  {
64  };
65 
67  const MaterialProperty<Real> & value() const;
68 
70  void addDerivative(const VariableName & var);
71 
77  bool dependsOn(const std::string & var) const;
78 
80  std::vector<VariableName> getDependentVariables();
81 
82  // output the internal state of this descriptor for debugging purposes
83  void printDebug();
84 
85 private:
86  void parseDerivative(const std::string &);
87  void parseDependentVariables(const std::string &);
88 
90  std::string _fparser_name;
91 
93  std::string _base_name;
94 
95  std::vector<VariableName> _dependent_vars;
96  std::vector<VariableName> _derivative_vars;
97 
99  mutable const MaterialProperty<Real> * _value;
100 
103 };
104 
bool dependsOn(const std::string &var) const
Check if a material property depends on a given variable.
const MaterialProperty< Real > & value() const
get the property reference
const std::string getPropertyName() const
get the property name
Material properties get fully described using this structure, including their dependent variables and...
void addDerivative(const VariableName &var)
take another derivative
static std::vector< FunctionMaterialPropertyDescriptor > parseVector(const std::vector< std::string > &, MooseObject *)
construct a vector of FunctionMaterialPropertyDescriptors from a vector of strings ...
std::string _base_name
function material property base name
MooseObject * _parent
material object that owns this descriptor
std::vector< VariableName > getDependentVariables()
builds a list of dependent variables (exactly all variabled for which depends on returns true) ...
const std::string & getSymbolName() const
get the fparser symbol name
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
std::string _fparser_name
name used in function expression
void setSymbolName(const std::string &n)
set the fparser symbol name
PetscInt n
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.
const MaterialProperty< Real > * _value
material property value (this is lazily updated and cached when read through value()) ...