DAField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  Description:
7  Field manipulation such as correct boundary conditions
8 
9 \*---------------------------------------------------------------------------*/
10 
11 #ifndef DAField_H
12 #define DAField_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 #include "DAMacroFunctions.H"
22 #include "mixedFvPatchFields.H" // for setPrimalBoundaryCondition
23 #include "fixedGradientFvPatchField.H" // for setPrimalBoundaryCondition
24 #include "wordRe.H"
25 #include "wordRes.H"
26 
27 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
28 
29 namespace Foam
30 {
31 
32 /*---------------------------------------------------------------------------*\
33  Class DAField Declaration
34 \*---------------------------------------------------------------------------*/
35 
36 class DAField
37 {
38 
39 private:
41  DAField(const DAField&);
42 
44  void operator=(const DAField&);
45 
46 protected:
48  const fvMesh& mesh_;
49 
52 
54  const DAModel& daModel_;
55 
57  const DAIndex& daIndex_;
58 
60  HashTable<wordList> stateInfo_;
61 
62 public:
64  DAField(
65  const fvMesh& mesh,
66  const DAOption& daOption,
67  const DAModel& daModel,
68  const DAIndex& daIndex);
69 
71  virtual ~DAField()
72  {
73  }
74 
75  // Members
76 
78  void ofField2StateVec(Vec stateVec) const;
79 
81  void stateVec2OFField(const Vec stateVec) const;
82 
84  void state2OFField(const scalar* states) const;
85 
87  void ofField2State(scalar* states) const;
88 
90  void point2OFMesh(const scalar* volCoords) const;
91 
93  void ofMesh2PointVec(Vec xvVec) const;
94 
96  void ofResField2ResVec(Vec resVec) const;
97 
99  void setPrimalBoundaryConditions(const label printInfo = 1);
100 
102  void specialBCTreatment();
103 
105  void checkSpecialBCs();
106 
108  wordList specialBCs;
109 };
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #endif
118 
119 // ************************************************************************* //
DAOption.H
Foam::DAField::daIndex_
const DAIndex & daIndex_
DAIndex object.
Definition: DAField.H:57
Foam::DAField::ofField2State
void ofField2State(scalar *states) const
assign the openfoam fields to the states array
Definition: DAField.C:213
DAIndex.H
Foam::DAField::setPrimalBoundaryConditions
void setPrimalBoundaryConditions(const label printInfo=1)
set the boundary conditions based on parameters defined in DAOption
Definition: DAField.C:633
Foam::DAOption
Definition: DAOption.H:29
DAUtility.H
Foam::DAField::state2OFField
void state2OFField(const scalar *states) const
assign the fields in OpenFOAM based on the state array
Definition: DAField.C:126
Foam::DAField::specialBCs
wordList specialBCs
a list that contains the names of detected special boundary conditions
Definition: DAField.H:108
Foam::DAField::checkSpecialBCs
void checkSpecialBCs()
check if we need to do special treatment for boundary conditions
Definition: DAField.C:568
Foam::DAField::daModel_
const DAModel & daModel_
DAModel object.
Definition: DAField.H:54
Foam::DAField::mesh_
const fvMesh & mesh_
Foam::fvMesh object.
Definition: DAField.H:48
DAMacroFunctions.H
DAModel.H
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAField::ofField2StateVec
void ofField2StateVec(Vec stateVec) const
set the state vector based on the latest fields in OpenFOAM
Definition: DAField.C:36
Foam::DAField::ofMesh2PointVec
void ofMesh2PointVec(Vec xvVec) const
assign the point vector based on the points in fvMesh of OpenFOAM
Definition: DAField.C:438
Foam::DAIndex
Definition: DAIndex.H:32
Foam::DAField::point2OFMesh
void point2OFMesh(const scalar *volCoords) const
assign the points in fvMesh of OpenFOAM based on the point array
Definition: DAField.C:390
Foam::DAField::daOption_
const DAOption & daOption_
Foam::DAOption object.
Definition: DAField.H:51
Foam::DAField
Definition: DAField.H:36
Foam::DAModel
Definition: DAModel.H:57
Foam
Definition: checkGeometry.C:32
Foam::DAField::stateVec2OFField
void stateVec2OFField(const Vec stateVec) const
assign the fields in OpenFOAM based on the state vector
Definition: DAField.C:300
Foam::DAField::ofResField2ResVec
void ofResField2ResVec(Vec resVec) const
assign the residual vector based on the residual field in OpenFOAM
Definition: DAField.C:477
DAStateInfo.H
Foam::DAField::~DAField
virtual ~DAField()
Destructor.
Definition: DAField.H:71
Foam::DAField::specialBCTreatment
void specialBCTreatment()
apply special treatment for boundary conditions
Definition: DAField.C:608
Foam::DAField::stateInfo_
HashTable< wordList > stateInfo_
the StateInfo_ list from DAStateInfo object
Definition: DAField.H:60