AdjointSolutionUserObject

Reads a variable from a mesh in one simulation to another specifically for loading forward solution in adjoint simulation during inverse optimization.

Overview

This user-object is meant to be used for transient inverse optimization where the forward solution is needed to compute the adjoint and subsequent gradient (i.e. nonlinear problems and material inversion). The object acts similarly to SolutionUserObject and can be used by objects such as SolutionAux and SolutionFunction. The difference stems from the "reverse_time_end" parameter where the solution loaded is reversed in time. This is due to the reverse time-stepping required to evaluate the adjoint solution. Due to specificity of this object's application, only exodus files can be loaded.

Example Input File Syntax

Here is a material inversion example where the forward and adjoint models are defined as:

[MultiApps<<<{"href": "../../syntax/MultiApps/index.html"}>>>]
  [forward]
    type = FullSolveMultiApp<<<{"description": "Performs a complete simulation during each execution.", "href": "../multiapps/FullSolveMultiApp.html"}>>>
    input_files<<<{"description": "The input file for each App.  If this parameter only contains one input file it will be used for all of the Apps.  When using 'positions_from_file' it is also admissable to provide one input_file per file."}>>> = forward.i
    cli_args<<<{"description": "Additional command line arguments to pass to the sub apps. If one set is provided the arguments are applied to all, otherwise there must be a set for each sub app."}>>> = 'Outputs/csv=false;Outputs/console=false'
    execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = FORWARD
  []
  [adjoint]
    type = FullSolveMultiApp<<<{"description": "Performs a complete simulation during each execution.", "href": "../multiapps/FullSolveMultiApp.html"}>>>
    input_files<<<{"description": "The input file for each App.  If this parameter only contains one input file it will be used for all of the Apps.  When using 'positions_from_file' it is also admissable to provide one input_file per file."}>>> = gradient.i
    cli_args<<<{"description": "Additional command line arguments to pass to the sub apps. If one set is provided the arguments are applied to all, otherwise there must be a set for each sub app."}>>> = 'Outputs/console=false;UserObjects/load_u/mesh=optimize_grad_out_forward0.e'
    execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = ADJOINT
  []
[]
(moose/modules/optimization/examples/materialTransient/optimize_grad.i)

The forward app outputs using Exodus, which results in the file optimize_grad_out_forward0.e being generated:

[Outputs<<<{"href": "../../syntax/Outputs/index.html"}>>>]
  csv<<<{"description": "Output the scalar variable and postprocessors to a *.csv file using the default CSV output."}>>> = true
  exodus<<<{"description": "Output the results using the default settings for Exodus output."}>>> = true
[]
(moose/modules/optimization/examples/materialTransient/forward.i)

The adjoint app reads in this outputted file and a SolutionAux sets the u auxiliary variable to it's values, while reversing the time:

[UserObjects<<<{"href": "../../syntax/UserObjects/index.html"}>>>]
  [load_u]
    type = AdjointSolutionUserObject<<<{"description": "Reads a variable from a mesh in one simulation to another specifically for loading forward solution in adjoint simulation during inverse optimization.", "href": "AdjointSolutionUserObject.html"}>>>
    mesh<<<{"description": "The name of the mesh file (must be xda/xdr or exodusII file)."}>>> = optimize_grad_out_forward0.e
    system_variables<<<{"description": "The name of the nodal and elemental variables from the file you want to use for values"}>>> = 'u'
    reverse_time_end<<<{"description": "End time used for reversing the time integration when evaluating function derivative."}>>> = 1
    execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = 'timestep_begin'
  []
[]

[AuxKernels<<<{"href": "../../syntax/AuxKernels/index.html"}>>>]
  [u_aux]
    type = SolutionAux<<<{"description": "Creates fields by using information from a SolutionUserObject.", "href": "../auxkernels/SolutionAux.html"}>>>
    variable<<<{"description": "The name of the variable that this object applies to"}>>> = u
    solution<<<{"description": "The name of the SolutionUserObject"}>>> = load_u
    direct<<<{"description": "If true the meshes must be the same and then the values are simply copied over."}>>> = true
    execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = 'timestep_begin'
  []
[]
(moose/modules/optimization/examples/materialTransient/gradient.i)

Input Parameters

  • meshThe name of the mesh file (must be xda/xdr or exodusII file).

    C++ Type:MeshFileName

    Controllable:No

    Description:The name of the mesh file (must be xda/xdr or exodusII file).

  • reverse_time_endEnd time used for reversing the time integration when evaluating function derivative.

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:End time used for reversing the time integration when evaluating function derivative.

Required Parameters

  • nodal_variable_orderFIRSTSpecifies the order of the nodal solution data.

    Default:FIRST

    C++ Type:MooseEnum

    Options:FIRST, SECOND

    Controllable:No

    Description:Specifies the order of the nodal solution data.

  • rotation1_vector0 0 1Vector about which to rotate points of the simulation.

    Default:0 0 1

    C++ Type:libMesh::VectorValue<double>

    Unit:(no unit assumed)

    Controllable:No

    Description:Vector about which to rotate points of the simulation.

  • system_variablesThe name of the nodal and elemental variables from the file you want to use for values

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

    Controllable:No

    Description:The name of the nodal and elemental variables from the file you want to use for values

Optional Parameters

  • allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

    Default:False

    C++ Type:bool

    Controllable:No

    Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

  • execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

    Default:TIMESTEP_END

    C++ Type:ExecFlagEnum

    Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, LINEAR_CONVERGENCE, NONLINEAR, NONLINEAR_CONVERGENCE, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, MULTIAPP_FIXED_POINT_CONVERGENCE, FINAL, CUSTOM

    Controllable:No

    Description:The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

  • execution_order_group0Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

    Default:0

    C++ Type:int

    Controllable:No

    Description:Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

  • force_postauxFalseForces the UserObject to be executed in POSTAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in POSTAUX

  • force_preauxFalseForces the UserObject to be executed in PREAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREAUX

  • force_preicFalseForces the UserObject to be executed in PREIC during initial setup

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREIC during initial setup

Execution Scheduling 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.

  • 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

  • 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

    Unit:(no unit assumed)

    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.

  • use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

Material Property Retrieval Parameters

  • rotation0_angle0Anticlockwise rotation angle (in degrees) to use for rotation about rotation0_vector.

    Default:0

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Anticlockwise rotation angle (in degrees) to use for rotation about rotation0_vector.

  • rotation0_vector0 0 1Vector about which to rotate points of the simulation.

    Default:0 0 1

    C++ Type:libMesh::VectorValue<double>

    Unit:(no unit assumed)

    Controllable:No

    Description:Vector about which to rotate points of the simulation.

  • rotation1_angle0Anticlockwise rotation angle (in degrees) to use for rotation about rotation1_vector.

    Default:0

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Anticlockwise rotation angle (in degrees) to use for rotation about rotation1_vector.

  • scale1 1 1 Scale factor for points in the simulation

    Default:1 1 1

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Scale factor for points in the simulation

  • scale_multiplier1 1 1 Scale multiplying factor for points in the simulation

    Default:1 1 1

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Scale multiplying factor for points in the simulation

  • transformation_ordertranslation scaleThe order to perform the operations in. Define R0 to be the rotation matrix encoded by rotation0_vector and rotation0_angle. Similarly for R1. Denote the scale by s, the scale_multiplier by m, and the translation by t. Then, given a point x in the simulation, if transformation_order = 'rotation0 scale_multiplier translation scale rotation1' then form p = R1*(R0*x*m - t)/s. Then the values provided by the SolutionUserObjectBase at point x in the simulation are the variable values at point p in the mesh.

    Default:translation scale

    C++ Type:MultiMooseEnum

    Options:rotation0, translation, scale, rotation1, scale_multiplier

    Controllable:No

    Description:The order to perform the operations in. Define R0 to be the rotation matrix encoded by rotation0_vector and rotation0_angle. Similarly for R1. Denote the scale by s, the scale_multiplier by m, and the translation by t. Then, given a point x in the simulation, if transformation_order = 'rotation0 scale_multiplier translation scale rotation1' then form p = R1*(R0*x*m - t)/s. Then the values provided by the SolutionUserObjectBase at point x in the simulation are the variable values at point p in the mesh.

  • translation0 0 0 Translation factors for x,y,z coordinates of the simulation

    Default:0 0 0

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Translation factors for x,y,z coordinates of the simulation

Coordinate System Transformation Parameters