DALinearEqn.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6  Description:
7  Solve the linear euqation using Petsc
8 
9 \*---------------------------------------------------------------------------*/
10 
11 #ifndef DALinearEqn_H
12 #define DALinearEqn_H
13 
14 #include "fvOptions.H"
15 #include "surfaceFields.H"
16 #include "DAOption.H"
17 #include "DAUtility.H"
18 #include "DAStateInfo.H"
19 #include "DAModel.H"
20 #include "DAIndex.H"
21 
22 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
23 
24 namespace Foam
25 {
26 
27 /*---------------------------------------------------------------------------*\
28  Class DALinearEqn Declaration
29 \*---------------------------------------------------------------------------*/
30 
32 {
33 
34 private:
36  DALinearEqn(const DALinearEqn&);
37 
39  void operator=(const DALinearEqn&);
40 
41 protected:
43  const fvMesh& mesh_;
44 
47 
48 public:
51  const fvMesh& mesh,
52  const DAOption& daOption);
53 
55  virtual ~DALinearEqn()
56  {
57  }
58 
59  // Members
60 
62  void createMLRKSP(
63  const Mat jacMat,
64  const Mat jacPCMat,
65  KSP ksp);
66 
68  label solveLinearEqn(
69  const KSP ksp,
70  const Vec rhsVec,
71  Vec solVec);
72 
74  static PetscErrorCode myKSPMonitor(
75  KSP,
76  PetscInt,
77  PetscReal,
78  void*);
79 
81  label getRunTime();
82 
84  label getPrintInterval();
85 };
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 } // End namespace Foam
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 #endif
94 
95 // ************************************************************************* //
DAOption.H
Foam::DALinearEqn::~DALinearEqn
virtual ~DALinearEqn()
Destructor.
Definition: DALinearEqn.H:55
DAIndex.H
Foam::DALinearEqn::solveLinearEqn
label solveLinearEqn(const KSP ksp, const Vec rhsVec, Vec solVec)
solve the linear equation given a ksp and right-hand-side vector
Definition: DALinearEqn.C:335
Foam::DAOption
Definition: DAOption.H:29
DAUtility.H
daOption
DAOption daOption(mesh, pyOptions_)
DAModel.H
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::DALinearEqn::mesh_
const fvMesh & mesh_
Foam::fvMesh object.
Definition: DALinearEqn.H:43
Foam::DALinearEqn::getPrintInterval
label getPrintInterval()
return printInterval from DAOption
Definition: DALinearEqn.C:450
Foam::DALinearEqn::getRunTime
label getRunTime()
return the runtime for the adjoint solver
Definition: DALinearEqn.C:441
DAStateInfo.H
Foam::DALinearEqn
Definition: DALinearEqn.H:31
Foam::DALinearEqn::myKSPMonitor
static PetscErrorCode myKSPMonitor(KSP, PetscInt, PetscReal, void *)
ksp monitor function
Definition: DALinearEqn.C:408
Foam::DALinearEqn::daOption_
const DAOption & daOption_
Foam::DAOption object.
Definition: DALinearEqn.H:46
Foam::DALinearEqn::createMLRKSP
void createMLRKSP(const Mat jacMat, const Mat jacPCMat, KSP ksp)
create a multi-level, Richardson KSP object
Definition: DALinearEqn.C:27