# 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 and material properties declared in material_property_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 dependences 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

M = \frac D{\frac{\partial2 F}{\partial c2}}

containing the second derivative of a free energy as


  [./mob]
    type = DerivativeParsedMaterial
    args = c
    f_name = M
    material_property_names = 'd2F:=D[F(c),c,c]'
    constant_names = D
    constant_expressions = 1e-3
    function = D/d2F
  [../]

The mobility defined above would have accurately constructed automatic derivatives w.r.t. , which contain third and higher derivatives of (make sure to set the derivative_order of F 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 \frac{\partial3x}{\partial2a\partial b} 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 free energy to the exodus output.

Input Parameters

  • functionFParser function expression for the phase free energy

    C++ Type:std::string

    Description:FParser function expression for the phase free energy

Required Parameters

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

    C++ Type:std::vector

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

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

    Default:True

    C++ Type:bool

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

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

    Default:F

    C++ Type:std::string

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

  • argsArguments of F() - use vector coupling

    C++ Type:std::vector

    Description:Arguments of F() - use vector coupling

  • derivative_order3Maximum order of derivatives taken

    Default:3

    C++ Type:unsigned int

    Description:Maximum order of derivatives taken

  • material_property_namesVector of material properties used in the parsed function

    C++ Type:std::vector

    Description:Vector of material properties used in the parsed function

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

    C++ Type:std::vector

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

  • tol_valuesVector of tolerance values for the variables in tol_names

    C++ Type:std::vector

    Description:Vector of tolerance values for the variables in tol_names

  • 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

    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)

  • boundaryThe list of boundary IDs from the mesh where this boundary condition applies

    C++ Type:std::vector

    Description:The list of boundary IDs from the mesh where this boundary condition applies

  • blockThe list of block ids (SubdomainID) that this object will be applied

    C++ Type:std::vector

    Description:The list of block ids (SubdomainID) that this object will be applied

Optional Parameters

  • fail_on_evalerrorFalseFail fatally if a function evaluation returns an error code (otherwise just pass on NaN)

    Default:False

    C++ Type:bool

    Description:Fail fatally if a function evaluation returns an error code (otherwise just pass on NaN)

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Description:Set the enabled status of the MooseObject.

  • 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

    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.

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

    Default:True

    C++ Type:bool

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

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

    C++ Type:std::vector

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

  • seed0The seed for the master random number generator

    Default:0

    C++ Type:unsigned int

    Description:The seed for the master random number generator

  • enable_auto_optimizeTrueEnable automatic immediate optimization of derivatives

    Default:True

    C++ Type:bool

    Description:Enable automatic immediate optimization of derivatives

  • disable_fpoptimizerFalseDisable the function parser algebraic optimizer

    Default:False

    C++ Type:bool

    Description:Disable the function parser algebraic optimizer

  • enable_ad_cacheTrueEnable cacheing of function derivatives for faster startup time

    Default:True

    C++ Type:bool

    Description:Enable cacheing of function derivatives for faster startup time

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

    Default:True

    C++ Type:bool

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

  • 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 computeSubdomainProperties() 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

    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 computeSubdomainProperties() for the 0th quadrature point, and then copy that value to the other qps. Evaluations on element qps will be skipped

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

    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

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

Outputs Parameters