https://mooseframework.inl.gov
AdjointSolve.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "SolveObject.h"
13 
14 // Forward declarations
16 namespace libMesh
17 {
18 template <typename T>
19 class SparseMatrix;
20 template <typename T>
21 class NumericVector;
22 }
23 
31 class AdjointSolve : public SolveObject
32 {
33 public:
35 
37 
51  virtual bool solve() override;
52 
53 protected:
57  void checkIntegrity();
58 
66  virtual void assembleAdjointSystem(SparseMatrix<Number> & matrix,
67  const NumericVector<Number> & solution,
68  NumericVector<Number> & rhs);
69 
81  void applyNodalBCs(SparseMatrix<Number> & matrix,
82  const NumericVector<Number> & solution,
83  NumericVector<Number> & rhs);
84 
86  const unsigned int _forward_sys_num;
88  const unsigned int _adjoint_sys_num;
93 };
const unsigned int _forward_sys_num
The number of the nonlinear system representing the forward model.
Definition: AdjointSolve.h:86
static InputParameters validParams()
Definition: AdjointSolve.C:27
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void applyNodalBCs(SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs)
Helper function for applying nodal BCs to the adjoint matrix and RHS.
Definition: AdjointSolve.C:159
The solve object is responsible for solving the adjoint version of a forward model.
Definition: AdjointSolve.h:31
void checkIntegrity()
Checks whether the forward and adjoint systems are consistent.
Definition: AdjointSolve.C:200
virtual bool solve() override
Solve the adjoint system with the following procedure:
Definition: AdjointSolve.C:79
AdjointSolve(Executioner &ex)
Definition: AdjointSolve.C:39
const unsigned int _adjoint_sys_num
The number of the nonlinear system representing the adjoint model.
Definition: AdjointSolve.h:88
virtual void assembleAdjointSystem(SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs)
Assembles adjoint system.
Definition: AdjointSolve.C:145
NonlinearSystemBase & _nl_adjoint
The nonlinear system representing the adjoint model.
Definition: AdjointSolve.h:92
NonlinearSystemBase & _nl_forward
The nonlinear system representing the forward model.
Definition: AdjointSolve.h:90