https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16namespace libMesh
17{
18template <typename T>
19class SparseMatrix;
20template <typename T>
21class NumericVector;
22}
23
32{
33public:
35
37
51 virtual bool solve() override;
52
53protected:
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};
The solve object is responsible for solving the adjoint version of a forward model.
void applyNodalBCs(SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs)
Helper function for applying nodal BCs to the adjoint matrix and RHS.
virtual bool solve() override
Solve the adjoint system with the following procedure:
const unsigned int _forward_sys_num
The number of the nonlinear system representing the forward model.
NonlinearSystemBase & _nl_forward
The nonlinear system representing the forward model.
const unsigned int _adjoint_sys_num
The number of the nonlinear system representing the adjoint model.
virtual void assembleAdjointSystem(SparseMatrix< Number > &matrix, const NumericVector< Number > &solution, NumericVector< Number > &rhs)
Assembles adjoint system.
NonlinearSystemBase & _nl_adjoint
The nonlinear system representing the adjoint model.
void checkIntegrity()
Checks whether the forward and adjoint systems are consistent.
static InputParameters validParams()
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...