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 |
MooseApp & | getMooseApp () const |
const std::string & | type () const |
virtual const std::string & | name () const |
std::string | typeAndName () const |
std::string | errorPrefix (const std::string &error_type) const |
void | callMooseError (std::string msg, const bool with_prefix) const |
MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
const InputParameters & | parameters () const |
MooseObjectName | uniqueName () 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 &nm) const |
void | paramError (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 |
void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
void | mooseError (Args &&... args) const |
void | mooseErrorNonPrefixed (Args &&... args) const |
void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
void | mooseWarning (Args &&... args) const |
void | mooseWarningNonPrefixed (Args &&... args) const |
void | mooseDeprecated (Args &&... args) const |
void | mooseInfo (Args &&... args) 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 () |
Public Attributes | |
const ConsoleStream | _console |
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... | |
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 |
const std::string | _type |
const std::string | _name |
const InputParameters & | _pars |
Factory & | _factory |
ActionFactory & | _action_factory |
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().