The solve object is responsible for solving the adjoint version of a forward model. More...
#include <AdjointSolve.h>
Public Types | |
| typedef DataFileName | DataFileParameterType |
Public Member Functions | |
| AdjointSolve (Executioner &ex) | |
| virtual bool | solve () override |
| Solve the adjoint system with the following procedure: More... | |
| virtual void | initialSetup () |
| virtual void | setInnerSolve (SolveObject &solve) |
| virtual bool | enabled () const |
| std::shared_ptr< MooseObject > | getSharedPtr () |
| std::shared_ptr< const MooseObject > | getSharedPtr () const |
| bool | isKokkosObject (IsKokkosObjectKey &&) const |
| MooseApp & | getMooseApp () const |
| const std::string & | type () const |
| const std::string & | name () const |
| std::string | typeAndName () const |
| MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
| MooseObjectName | uniqueName () const |
| const InputParameters & | parameters () const |
| const hit::Node * | getHitNode () const |
| bool | hasBase () const |
| const std::string & | getBase () const |
| const T & | getParam (const std::string &name) const |
| std::vector< std::pair< T1, T2 > > | getParam (const std::string ¶m1, const std::string ¶m2) const |
| const T * | queryParam (const std::string &name) const |
| const T & | getRenamedParam (const std::string &old_name, const std::string &new_name) const |
| T | getCheckedPointerParam (const std::string &name, const std::string &error_string="") const |
| bool | isParamValid (const std::string &name) const |
| bool | isParamSetByUser (const std::string &name) const |
| void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
| void | paramError (const std::string ¶m, Args... args) const |
| void | paramWarning (const std::string ¶m, Args... args) const |
| void | paramWarning (const std::string ¶m, Args... args) const |
| void | paramInfo (const std::string ¶m, Args... args) const |
| std::string | messagePrefix (const bool hit_prefix=true) const |
| std::string | errorPrefix (const std::string &) const |
| void | mooseError (Args &&... args) const |
| void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
| void | mooseErrorNonPrefixed (Args &&... args) const |
| void | mooseWarning (Args &&... args) const |
| void | mooseWarning (Args &&... args) const |
| void | mooseWarningNonPrefixed (Args &&... args) const |
| void | mooseWarningNonPrefixed (Args &&... args) const |
| void | mooseDeprecated (Args &&... args) const |
| void | mooseDeprecated (Args &&... args) const |
| void | mooseInfo (Args &&... args) const |
| void | callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr) const |
| std::string | getDataFileName (const std::string ¶m) const |
| std::string | getDataFileNameByName (const std::string &relative_path) const |
| std::string | getDataFilePath (const std::string &relative_path) const |
| PerfGraph & | perfGraph () |
| bool | isDefaultPostprocessorValue (const std::string ¶m_name, const unsigned int index=0) const |
| bool | hasPostprocessor (const std::string ¶m_name, const unsigned int index=0) const |
| bool | hasPostprocessorByName (const PostprocessorName &name) const |
| std::size_t | coupledPostprocessors (const std::string ¶m_name) const |
| const PostprocessorName & | getPostprocessorName (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValue (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValue (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValueOld (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValueOld (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValueOlder (const std::string ¶m_name, const unsigned int index=0) const |
| const PostprocessorValue & | getPostprocessorValueOlder (const std::string ¶m_name, const unsigned int index=0) const |
| virtual const PostprocessorValue & | getPostprocessorValueByName (const PostprocessorName &name) const |
| virtual const PostprocessorValue & | getPostprocessorValueByName (const PostprocessorName &name) const |
| const PostprocessorValue & | getPostprocessorValueOldByName (const PostprocessorName &name) const |
| const PostprocessorValue & | getPostprocessorValueOldByName (const PostprocessorName &name) const |
| const PostprocessorValue & | getPostprocessorValueOlderByName (const PostprocessorName &name) const |
| const PostprocessorValue & | getPostprocessorValueOlderByName (const PostprocessorName &name) const |
| const Parallel::Communicator & | comm () const |
| processor_id_type | n_processors () const |
| processor_id_type | processor_id () const |
Static Public Member Functions | |
| static InputParameters | validParams () |
| static void | callMooseError (MooseApp *const app, const InputParameters ¶ms, std::string msg, const bool with_prefix, const hit::Node *node) |
Public Attributes | |
| usingCombinedWarningSolutionWarnings | |
| const ConsoleStream | _console |
Static Public Attributes | |
| static const std::string | type_param |
| static const std::string | name_param |
| static const std::string | unique_name_param |
| static const std::string | app_param |
| static const std::string | moose_base_param |
| static const std::string | kokkos_object_param |
Protected Member Functions | |
| void | checkIntegrity () |
| Checks whether the forward and adjoint systems are consistent. More... | |
| virtual void | assembleAdjointSystem (SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs) |
| Assembles adjoint system. More... | |
| void | applyNodalBCs (SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs) |
| Helper function for applying nodal BCs to the adjoint matrix and RHS. More... | |
| void | flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const |
| InvalidSolutionID | registerInvalidSolutionInternal (const std::string &message, const bool warning) const |
| PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
| PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
| std::string | timedSectionName (const std::string §ion_name) const |
| virtual void | addPostprocessorDependencyHelper (const PostprocessorName &) const |
Protected Attributes | |
| const unsigned int | _forward_sys_num |
| The number of the nonlinear system representing the forward model. More... | |
| const unsigned int | _adjoint_sys_num |
| The number of the nonlinear system representing the adjoint model. More... | |
| NonlinearSystemBase & | _nl_forward |
| The nonlinear system representing the forward model. More... | |
| NonlinearSystemBase & | _nl_adjoint |
| The nonlinear system representing the adjoint model. More... | |
| Executioner & | _executioner |
| FEProblemBase & | _problem |
| DisplacedProblem * | _displaced_problem |
| MooseMesh & | _mesh |
| MooseMesh * | _displaced_mesh |
| SystemBase & | _solver_sys |
| AuxiliarySystem & | _aux |
| SolveObject * | _inner_solve |
| const bool & | _enabled |
| MooseApp & | _app |
| Factory & | _factory |
| ActionFactory & | _action_factory |
| const std::string & | _type |
| const std::string & | _name |
| const InputParameters & | _pars |
| MooseApp & | _pg_moose_app |
| const std::string | _prefix |
| const Parallel::Communicator & | _communicator |
The solve object is responsible for solving the adjoint version of a forward model.
It does this by solving a linear system with a transposed matrix and a source. The matrix is evaluated from the forward model's Jacobian, using the converged solution. The source is computed by evaluating the residual of a secondary nonlinear-system representing the adjoint system, in which the adjoint solution is 0.
Definition at line 31 of file AdjointSolve.h.
| AdjointSolve::AdjointSolve | ( | Executioner & | ex | ) |
Definition at line 39 of file AdjointSolve.C.
|
protected |
Helper function for applying nodal BCs to the adjoint matrix and RHS.
Say there is a BC setting the d-th DoF to a dirichlet condition on the forward problem. This basically sets the d-th column of the matrix to zero, the d-th entry of the matrix diagonal to one, and the d-th entry of the RHS to the solution passed in.
| matrix | The matrix whose columns are set to 0 |
| solution | The solution to replace the entries of the RHS |
| rhs | The RHS to to replace with the solution |
Definition at line 159 of file AdjointSolve.C.
Referenced by solve().
|
protectedvirtual |
Assembles adjoint system.
| matrix | Un-transposed matrix (will be transposed later in solver) |
| solution | Adjoint solution (basically the initial guess for the solver) |
| rhs | The adjoint source (i.e. -residual) |
Reimplemented in AdjointTransientSolve.
Definition at line 145 of file AdjointSolve.C.
Referenced by AdjointTransientSolve::assembleAdjointSystem(), and solve().
|
protected |
Checks whether the forward and adjoint systems are consistent.
Definition at line 200 of file AdjointSolve.C.
Referenced by solve().
|
overridevirtual |
Solve the adjoint system with the following procedure:
Implements SolveObject.
Reimplemented in AdjointTransientSolve.
Definition at line 79 of file AdjointSolve.C.
Referenced by SteadyAndAdjoint::execute(), and AdjointTransientSolve::solve().
|
static |
Definition at line 27 of file AdjointSolve.C.
Referenced by SteadyAndAdjoint::validParams(), and AdjointTransientSolve::validParams().
|
protected |
The number of the nonlinear system representing the adjoint model.
Definition at line 88 of file AdjointSolve.h.
Referenced by assembleAdjointSystem().
|
protected |
The number of the nonlinear system representing the forward model.
Definition at line 86 of file AdjointSolve.h.
Referenced by applyNodalBCs(), assembleAdjointSystem(), and AdjointTransientSolve::evaluateTimeResidual().
|
protected |
The nonlinear system representing the adjoint model.
Definition at line 92 of file AdjointSolve.h.
Referenced by AdjointSolve(), assembleAdjointSystem(), checkIntegrity(), AdjointTransientSolve::evaluateTimeResidual(), AdjointTransientSolve::insertForwardSolution(), AdjointTransientSolve::setForwardSolution(), AdjointTransientSolve::solve(), and solve().
|
protected |
The nonlinear system representing the forward model.
Definition at line 90 of file AdjointSolve.h.
Referenced by AdjointSolve(), applyNodalBCs(), assembleAdjointSystem(), checkIntegrity(), AdjointTransientSolve::evaluateTimeResidual(), AdjointTransientSolve::insertForwardSolution(), AdjointTransientSolve::setForwardSolution(), and solve().
1.8.14