-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateFields.H
148 lines (129 loc) · 2.46 KB
/
createFields.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Info << "Reading physicalProperties\n" << endl;
IOdictionary physicalProperties
(
IOobject
(
"physicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar k(physicalProperties.lookup("k"));
dimensionedScalar c(physicalProperties.lookup("c"));
dimensionedScalar eps(physicalProperties.lookup("eps"));
dimensionedScalar beta1(physicalProperties.lookup("beta1"));
dimensionedScalar beta2(physicalProperties.lookup("beta2"));
dimensionedScalar beta3(physicalProperties.lookup("beta3"));
/***************************************************************************/
Info << "Reading numericalParameters\n" << endl;
IOdictionary numericalParameters
(
IOobject
(
"numericalParameters",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
scalar maxIter(numericalParameters.lookupOrDefault<scalar>("maxIter", 100));
scalar tol(numericalParameters.lookupOrDefault<scalar>("tol", 1e-5));
/****************************************************************************/
Info << "Reading target state\n" << endl;
volScalarField yd
(
IOobject
(
"yd",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
Info << "Reading target state at time T\n" << endl;
volScalarField Yd
(
IOobject
(
"Yd",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
Info << "Reading indicator function\n" << endl;
volScalarField omega
(
IOobject
(
"omega",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
/****************************************************************************/
Info << "Reading state variable y\n" << endl;
volScalarField y
(
IOobject
(
"y",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField y0 = y;
Info << "Reading control variable u\n" << endl;
volScalarField u
(
IOobject
(
"u",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
volScalarField u0 = u;
Info << "Reading adjoint field\n" << endl;
volScalarField lambda
(
IOobject
(
"lambda",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField lambda0 = lambda;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
lambda + beta1*u0
);
scalarField volField = mesh.V();