DerivativeParsedMaterial

Parsed Function Material with automatic derivatives.

This material class does everything the ParsedMaterial does, plus automatic symbolic differentiation of the function expression. The function material property derivatives follow a naming scheme defined in DerivativeMaterialPropertyNameInterface. The maximum order of derivatives generated is set using the derivative_order parameter.

Only required derivatives will be evaluated (e.g. the split operator kernel does not require third order derivatives. Second-order derivatives are only required for the Jacobian, as discussed here).

Non linear and auxiliary variables declared in the "args" parameter, constants declared in "constant_names" and "constant_expressions", material properties declared in "material_property_names", and postprocessors ("postprocessor_names") may be used in the parsed function expression. Note that the constants can be defined using parsed expressions as long as these expressions only use numbers and/or constants already defined to the left of the current constant, line in this example:


    constant_names       = 'T    kB         E'
    constant_expressions = '300  8.6173e-5  T*kB'

where E can be defined in terms of T and kB, as those constants are to the left of E.

If a material property M is listed in "material_property_names" a special syntax (M(c1,c2) where c1 and c2 are variables) can be used to declare variable dependencies as well as selecting derivatives of material properties (for example, d2M:=D[M(c1,c2),c2,c2] would make the second derivative of M with respect to c2 available as d2M in the parsed function expression). If variable dependencies are declared, the necessary derivatives of the coupled material properties will be automatically pulled in when constructing the derivatives of the parsed function.

In phase field, an application would be the definition of a mobility term

containing the second derivative of a function , or a custom switching function derivative in a Grand potential model

[./coupled_eta_function]
  type = DerivativeParsedMaterial
  function = '(cs - cl) * dh'
  args = 'eta w'
  f_name = ft
  material_property_names = 'cs cl dh:=D[h,eta]'
  derivative_order = 1
  outputs = exodus
[../]
(../../../SoftwareDownloads/moose/modules/phase_field/test/tests/GrandPotentialPFM/GrandPotentialPFM.i)

The ft defined above would have accurately constructed automatic derivatives w.r.t. (eta), which contain second and higher derivatives of (make sure to set the derivative_order of high enough!).

The "material_property_names" are parsed by the FunctionMaterialPropertyDescriptor class, which understands the following syntax:

ExpressionDescription
FA material property called F with no declared variable dependencies (i.e. vanishing derivatives)
F(c,phi)A material property called F with declared dependence on 'c' and 'phi' (uses DerivativeFunctionMaterial rules to look up the derivatives) using the round-bracket-notation
d3x:=D[x(a,b),a,a,b]The third derivative of the a,b-dependent material property x, which will be referred to as d3x in the function expression
dF:=D[F,c]Derivative of F w.r.t. c. Although the c-dependence of F is not explicitly declared using the round-bracket-notation it is implicitly assumed as a derivative w.r.t. c is requested

Add outputs=exodus to the material block to automatically write all derivatives and the function to the exodus output.

Input Parameters

  • functionFParser function expression for the parsed material

    C++ Type:FunctionExpression

    Controllable:No

    Description:FParser function expression for the parsed material

Required Parameters

  • additional_derivative_symbolsA list of additional (non-variable) symbols (such as material property or postprocessor names) to take derivatives w.r.t.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:A list of additional (non-variable) symbols (such as material property or postprocessor names) to take derivatives w.r.t.

  • argsArguments of F() - use vector coupling

    C++ Type:std::vector<VariableName>

    Controllable:No

    Description:Arguments of F() - use vector coupling

  • blockThe list of blocks (ids or names) that this object will be applied

    C++ Type:std::vector<SubdomainName>

    Controllable:No

    Description:The list of blocks (ids or names) that this object will be applied

  • boundaryThe list of boundaries (ids or names) from the mesh where this boundary condition applies

    C++ Type:std::vector<BoundaryName>

    Controllable:No

    Description:The list of boundaries (ids or names) from the mesh where this boundary condition applies

  • computeTrueWhen false, MOOSE will not call compute methods on this material. The user must call computeProperties() after retrieving the MaterialBase via MaterialBasePropertyInterface::getMaterialBase(). Non-computed MaterialBases are not sorted for dependencies.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:When false, MOOSE will not call compute methods on this material. The user must call computeProperties() after retrieving the MaterialBase via MaterialBasePropertyInterface::getMaterialBase(). Non-computed MaterialBases are not sorted for dependencies.

  • constant_expressionsVector of values for the constants in constant_names (can be an FParser expression)

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of values for the constants in constant_names (can be an FParser expression)

  • constant_namesVector of constants used in the parsed function (use this for kB etc.)

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of constants used in the parsed function (use this for kB etc.)

  • constant_onNONEWhen ELEMENT, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps.When SUBDOMAIN, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps. Evaluations on element qps will be skipped

    Default:NONE

    C++ Type:MooseEnum

    Options:NONE, ELEMENT, SUBDOMAIN

    Controllable:No

    Description:When ELEMENT, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps.When SUBDOMAIN, MOOSE will only call computeQpProperties() for the 0th quadrature point, and then copy that value to the other qps. Evaluations on element qps will be skipped

  • declare_suffixAn optional suffix parameter that can be appended to any declared properties. The suffix will be prepended with a '_' character.

    C++ Type:MaterialPropertyName

    Controllable:No

    Description:An optional suffix parameter that can be appended to any declared properties. The suffix will be prepended with a '_' character.

  • derivative_order3Maximum order of derivatives taken

    Default:3

    C++ Type:unsigned int

    Controllable:No

    Description:Maximum order of derivatives taken

  • error_on_missing_material_propertiesTrueThrow an error if any explicitly requested material property does not exist. Otherwise assume it to be zero.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Throw an error if any explicitly requested material property does not exist. Otherwise assume it to be zero.

  • f_nameFBase name of the free energy function (used to name the material properties)

    Default:F

    C++ Type:std::string

    Controllable:No

    Description:Base name of the free energy function (used to name the material properties)

  • material_property_namesVector of material properties used in the parsed function

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of material properties used in the parsed function

  • postprocessor_namesVector of postprocessor names used in the parsed function

    C++ Type:std::vector<PostprocessorName>

    Controllable:No

    Description:Vector of postprocessor names used in the parsed function

  • prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

    C++ Type:MaterialPropertyName

    Controllable:No

    Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

  • tol_namesVector of variable names to be protected from being 0 or 1 within a tolerance (needed for log(c) and log(1-c) terms)

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of variable names to be protected from being 0 or 1 within a tolerance (needed for log(c) and log(1-c) terms)

  • tol_valuesVector of tolerance values for the variables in tol_names

    C++ Type:std::vector<double>

    Controllable:No

    Description:Vector of tolerance values for the variables in tol_names

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • disable_fpoptimizerFalseDisable the function parser algebraic optimizer

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Disable the function parser algebraic optimizer

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • enable_ad_cacheTrueEnable cacheing of function derivatives for faster startup time

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable cacheing of function derivatives for faster startup time

  • enable_auto_optimizeTrueEnable automatic immediate optimization of derivatives

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable automatic immediate optimization of derivatives

  • enable_jitTrueEnable just-in-time compilation of function expressions for faster evaluation

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable just-in-time compilation of function expressions for faster evaluation

  • evalerror_behaviornanWhat to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

    Default:nan

    C++ Type:MooseEnum

    Options:nan, nan_warning, error, exception

    Controllable:No

    Description:What to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

  • implicitTrueDetermines whether this object is calculated using an implicit or explicit form

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Determines whether this object is calculated using an implicit or explicit form

  • seed0The seed for the master random number generator

    Default:0

    C++ Type:unsigned int

    Controllable:No

    Description:The seed for the master random number generator

  • use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

Advanced Parameters

  • output_propertiesList of material properties, from this material, to output (outputs must also be defined to an output type)

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:List of material properties, from this material, to output (outputs must also be defined to an output type)

  • outputsnone Vector of output names were you would like to restrict the output of variables(s) associated with this object

    Default:none

    C++ Type:std::vector<OutputName>

    Controllable:No

    Description:Vector of output names were you would like to restrict the output of variables(s) associated with this object

Outputs Parameters