DAStateInfoLaplacianFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6 \*---------------------------------------------------------------------------*/
7 
9 
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11 
12 namespace Foam
13 {
14 
15 defineTypeNameAndDebug(DAStateInfoLaplacianFoam, 0);
16 addToRunTimeSelectionTable(DAStateInfo, DAStateInfoLaplacianFoam, dictionary);
17 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
18 
20  const word modelType,
21  const fvMesh& mesh,
22  const DAOption& daOption,
23  const DAModel& daModel)
24  : DAStateInfo(modelType, mesh, daOption, daModel)
25 {
26  /*
27  Description:
28  Register the names of state variables
29  NOTE:
30  For model variables, such as turbulence model, register specific names
31  For example, register "nut" to modelStates for RANS turbulence models,
32  Then, we will call correctModelStates(stateInfo_["modelStates"]) to modify
33  "nut" based on the selected turbulence model. For example, for SA model,
34  correctModelStates will just replace "nut" with "nuTilda", for SST model,
35  it will replace "nut" with "k" and append "omega" to modelStates.
36  In other words, the model variables will be modified based on the selected
37  models at runtime.
38  */
39 
40  stateInfo_["volScalarStates"].append("T");
41 
42  /*
43  Description:
44  Adjoint state connectivity info, numbers denote the level of connectivity
45  N/A means this state does not connect to the corrsponding residual
46 
47  D
48  DRes 2
49 
50  ******************************** NOTE 1 **********************************
51  One does not need to specify connectivity for each physical model, set the
52  connectivity for original variables instead. For example, for turbulence models,
53  set nut. Then, how is nut connected to the other turbulence states will be
54  set in the DAModel class. This is done by calling correctStateResidualModelCon.
55  For example, for SA model we just replace nut with nuTilda, for SST model, we need
56  to add extract connectivity since nut depends on grad(U), k, and omega. We need
57  to do this for other pyhsical models such as radiation models.
58  **************************************************************************
59 
60  ******************************** NOTE 2 **********************************
61  Do not specify physical model connectivity here, because they will be added
62  by calling addModelResidualCon. For example, for the SA turbulence
63  model, it will add the nuTildaRes to stateResConInfo_ and setup
64  its connectivity automatically.
65  **************************************************************************
66 
67  */
68 
69  stateResConInfo_.set(
70  "TRes",
71  {
72  {"T"}, // lv0
73  {"T"}, // lv1
74  {"T"} // lv2
75  });
76 }
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 } // End namespace Foam
80 
81 // ************************************************************************* //
Foam::DAOption
Definition: DAOption.H:29
daOption
DAOption daOption(mesh, pyOptions_)
Foam::DAStateInfoLaplacianFoam::DAStateInfoLaplacianFoam
DAStateInfoLaplacianFoam(const word modelType, const fvMesh &mesh, const DAOption &daOption, const DAModel &daModel)
Definition: DAStateInfoLaplacianFoam.C:19
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAModel
Definition: DAModel.H:59
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::DAStateInfo::stateResConInfo_
HashTable< List< List< word > > > stateResConInfo_
table to specify how the states are connected to the residuals for a given solver
Definition: DAStateInfo.H:54
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFvSource, 0)
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(DAFvSource, DAFvSourceActuatorDisk, dictionary)
daModel
DAModel daModel(mesh, daOption)
Foam::DAStateInfo
Definition: DAStateInfo.H:30
DAStateInfoLaplacianFoam.H
Foam::DAStateInfo::stateInfo_
HashTable< wordList > stateInfo_
registered states 1st hash: solverName, 2nd hash: fieldType, 3nd list, stateNames
Definition: DAStateInfo.H:51