FunctorADConverter

Converts regular functors to AD functors and AD functors to regular functors

Converting from AD to regular functors or vice versa can both lead to irremediable loss of derivative information when using the automatic differentiation system. Missing derivative information (from using a converted regular functor where a true AD functor should have been used) can lead to an imperfect Jacobian which can impact convergence properties of Newton solves.

Some examples of safe conversions:

  • Functions to ADFunctions and vice-versa are safe since functions do not hold derivative data

  • AuxVariables to regular functors is safe since auxiliary variables do not hold derivative data

Example input syntax

An example of some gymnastics with functor conversions is shown in this example. The reader should note that only the conversion to an AD functor from a regular functor (from a regular Function) was necessary.

[Materials]
  [converter_to_regular]
    type = FunctorADConverter
    ad_props_in = 'sink'
    reg_props_out = 'regular_sink_0'
  []
  # Just to change the name
  [functor]
    type = GenericFunctorMaterial
    prop_names = 'regular_sink_1'
    prop_values = 'regular_sink_0'
  []
  [converter_to_ad]
    type = FunctorADConverter
    reg_props_in = 'regular_sink_1'
    ad_props_out = 'ad_sink'
  []
[]
(../moose/test/tests/materials/functor_properties/ad_conversion/1d_dirichlet.i)

Input Parameters

  • ad_props_inThe names of the AD functors to convert to regular functors

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

    Controllable:No

    Description:The names of the AD functors to convert to regular functors

  • ad_props_outThe names of the output AD functors

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

    Controllable:No

    Description:The names of the output AD functors

  • 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 object applies

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

    Controllable:No

    Description:The list of boundaries (ids or names) from the mesh where this object 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_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.

  • 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.

  • reg_props_inThe names of the regular functors to convert to AD functors

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

    Controllable:No

    Description:The names of the regular functors to convert to AD functors

  • reg_props_outThe names of the output regular functors

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

    Controllable:No

    Description:The names of the output regular functors

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.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • 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 where 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 where you would like to restrict the output of variables(s) associated with this object

Outputs Parameters