DAField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
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 pointVec2OFMesh(const Vec xvVec) const;
88 
90  void point2OFMesh(const scalar* volCoords) const;
91 
93  void resetOFSeeds();
94 
96  void ofMesh2PointVec(Vec xvVec) const;
97 
99  void resVec2OFResField(const Vec resVec) const;
100 
102  void ofResField2ResVec(Vec resVec) const;
103 
105  void ofField2List(
106  scalarList& stateList,
107  scalarList& stateBoundaryList) const;
108 
110  void list2OFField(
111  const scalarList& stateList,
112  const scalarList& stateBounaryList,
113  const label oldTimeLevel) const;
114 
116  void setPrimalBoundaryConditions(const label printInfo = 1);
117 
119  void specialBCTreatment();
120 
122  void checkSpecialBCs();
123 
125  wordList specialBCs;
126 };
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
DAOption.H
Foam::DAField::list2OFField
void list2OFField(const scalarList &stateList, const scalarList &stateBounaryList, const label oldTimeLevel) const
assign the fields in OpenFOAM based on the scalar list of states
Definition: DAField.C:1552
Foam::DAField::daIndex_
const DAIndex & daIndex_
DAIndex object.
Definition: DAField.H:57
DAIndex.H
Foam::DAField::setPrimalBoundaryConditions
void setPrimalBoundaryConditions(const label printInfo=1)
set the boundary conditions based on parameters defined in DAOption
Definition: DAField.C:837
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:288
daOption
DAOption daOption(mesh, pyOptions_)
Foam::DAField::specialBCs
wordList specialBCs
a list that contains the names of detected special boundary conditions
Definition: DAField.H:125
Foam::DAField::checkSpecialBCs
void checkSpecialBCs()
check if we need to do special treatment for boundary conditions
Definition: DAField.C:772
Foam::DAField::resetOFSeeds
void resetOFSeeds()
reset the seeds for both state and mesh variables in OpenFOAM by setting their gradient() to zeros
Definition: DAField.C:36
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:198
Foam::DAField::ofMesh2PointVec
void ofMesh2PointVec(Vec xvVec) const
assign the point vector based on the points in fvMesh of OpenFOAM
Definition: DAField.C:552
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:465
Foam::DAField::daOption_
const DAOption & daOption_
Foam::DAOption object.
Definition: DAField.H:51
Foam::DAField
Definition: DAField.H:36
Foam::DAModel
Definition: DAModel.H:59
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::DAField::ofField2List
void ofField2List(scalarList &stateList, scalarList &stateBoundaryList) const
set the scalar list of states based on the latest fields in OpenFOAM
Definition: DAField.C:1420
Foam::DAField::stateVec2OFField
void stateVec2OFField(const Vec stateVec) const
assign the fields in OpenFOAM based on the state vector
Definition: DAField.C:375
Foam::DAField::resVec2OFResField
void resVec2OFResField(const Vec resVec) const
assign the residual field in OpenFOAM based on the residual vector
Definition: DAField.C:682
Foam::DAField::ofResField2ResVec
void ofResField2ResVec(Vec resVec) const
assign the residual vector based on the residual field in OpenFOAM
Definition: DAField.C:591
DAStateInfo.H
daModel
DAModel daModel(mesh, daOption)
Foam::DAField::pointVec2OFMesh
void pointVec2OFMesh(const Vec xvVec) const
assign the points in fvMesh of OpenFOAM based on the point vector
Definition: DAField.C:506
daIndex
DAIndex daIndex(mesh, daOption, daModel)
Foam::DAField::~DAField
virtual ~DAField()
Destructor.
Definition: DAField.H:71
Foam::DAField::specialBCTreatment
void specialBCTreatment()
apply special treatment for boundary conditions
Definition: DAField.C:812
Foam::DAField::stateInfo_
HashTable< wordList > stateInfo_
the StateInfo_ list from DAStateInfo object
Definition: DAField.H:60