DAPartDeriv.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  Description:
7  Compute partial derivatives using the finite-difference method
8  with coloring
9 
10 \*---------------------------------------------------------------------------*/
11 
12 #ifndef DAPartDeriv_H
13 #define DAPartDeriv_H
14 
15 #include "runTimeSelectionTables.H"
16 #include "fvOptions.H"
17 #include "DAUtility.H"
18 #include "DAOption.H"
19 #include "DAIndex.H"
20 #include "DAModel.H"
21 #include "DAStateInfo.H"
22 #include "syncTools.H"
23 #include "DAJacCon.H"
24 #include "DAResidual.H"
25 
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 namespace Foam
29 {
30 
31 /*---------------------------------------------------------------------------*\
32  Class DAPartDeriv Declaration
33 \*---------------------------------------------------------------------------*/
34 
36 {
37 
38 private:
40  DAPartDeriv(const DAPartDeriv&);
41 
43  void operator=(const DAPartDeriv&);
44 
45 protected:
47  const word modelType_;
48 
50  const fvMesh& mesh_;
51 
54 
56  const DAModel& daModel_;
57 
59  const DAIndex& daIndex_;
60 
63 
66 
68  const dictionary& allOptions_;
69 
71  HashTable<wordList> stateInfo_;
72 
74  void perturbStates(
75  const Vec jacConColors,
76  const Vec normStatePerturbVec,
77  const label colorI,
78  const scalar delta,
79  Vec wVec);
80 
82  void setPartDerivMat(
83  const Vec resVec,
84  const Vec coloredColumn,
85  const label transposed,
86  Mat jacMat,
87  const scalar jacLowerBound = 1e-30) const;
88 
89 public:
90  // Constructors
92  const word modelType,
93  const fvMesh& mesh,
94  const DAOption& daOption,
95  const DAModel& daModel,
96  const DAIndex& daIndex,
97  const DAJacCon& daJacCon,
98  const DAResidual& daResidual);
99 
100  //- Destructor
101  virtual ~DAPartDeriv()
102  {
103  }
104 
105  // Member functions
106 
108  void clear()
109  {
110  }
111 
114  const dictionary& options,
115  Mat jacMat);
116 
118  void calcPartDerivMat(
119  const dictionary& options,
120  const Vec xvVec,
121  const Vec wVec,
122  Mat jacMat);
123 
125  void setNormStatePerturbVec(Vec* normStatePerturbVec);
126 };
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
Foam::DAJacCon
Definition: DAJacCon.H:35
DAOption.H
Foam::DAPartDeriv::clear
void clear()
clear members in parent and child objects
Definition: DAPartDeriv.H:108
DAIndex.H
Foam::DAOption
Definition: DAOption.H:29
DAUtility.H
Foam::DAPartDeriv::daIndex_
const DAIndex & daIndex_
DAIndex object.
Definition: DAPartDeriv.H:59
Foam::DAPartDeriv::setPartDerivMat
void setPartDerivMat(const Vec resVec, const Vec coloredColumn, const label transposed, Mat jacMat, const scalar jacLowerBound=1e-30) const
set values for the partial derivative matrix
Definition: DAPartDeriv.C:109
Foam::DAPartDeriv::daJacCon_
const DAJacCon & daJacCon_
DAJacCon object.
Definition: DAPartDeriv.H:62
Foam::DAPartDeriv::initializePartDerivMat
void initializePartDerivMat(const dictionary &options, Mat jacMat)
initialize partial derivative matrix
Definition: DAPartDeriv.C:317
Foam::DAPartDeriv::daOption_
const DAOption & daOption_
DAOption object.
Definition: DAPartDeriv.H:53
DAJacCon.H
Foam::DAPartDeriv::mesh_
const fvMesh & mesh_
fvMesh
Definition: DAPartDeriv.H:50
DAResidual.H
DAModel.H
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAPartDeriv::stateInfo_
HashTable< wordList > stateInfo_
the stateInfo_ list from DAStateInfo object
Definition: DAPartDeriv.H:71
Foam::DAIndex
Definition: DAIndex.H:32
Foam::DAPartDeriv::~DAPartDeriv
virtual ~DAPartDeriv()
Definition: DAPartDeriv.H:101
Foam::DAModel
Definition: DAModel.H:57
Foam
Definition: checkGeometry.C:32
Foam::DAResidual
Definition: DAResidual.H:36
Foam::DAPartDeriv::calcPartDerivMat
void calcPartDerivMat(const dictionary &options, const Vec xvVec, const Vec wVec, Mat jacMat)
compute the partial derivative matrix
Definition: DAPartDeriv.C:350
DAStateInfo.H
Foam::DAPartDeriv::modelType_
const word modelType_
the name of the jacCon matrix
Definition: DAPartDeriv.H:47
Foam::DAPartDeriv
Definition: DAPartDeriv.H:35
Foam::DAPartDeriv::daResidual_
const DAResidual & daResidual_
DAResidual object.
Definition: DAPartDeriv.H:65
Foam::DAPartDeriv::perturbStates
void perturbStates(const Vec jacConColors, const Vec normStatePerturbVec, const label colorI, const scalar delta, Vec wVec)
perturb state variables given a color index
Definition: DAPartDeriv.C:42
Foam::DAPartDeriv::setNormStatePerturbVec
void setNormStatePerturbVec(Vec *normStatePerturbVec)
setup the state normalization vector
Definition: DAPartDeriv.C:210
Foam::DAPartDeriv::allOptions_
const dictionary & allOptions_
all the DAFoam option
Definition: DAPartDeriv.H:68
Foam::DAPartDeriv::daModel_
const DAModel & daModel_
DAModel object.
Definition: DAPartDeriv.H:56