-
Notifications
You must be signed in to change notification settings - Fork 0
/
ERF__AdvanceGeneralAD_8cpp.html
435 lines (429 loc) · 32.1 KB
/
ERF__AdvanceGeneralAD_8cpp.html
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ERF: Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ERF
</div>
<div id="projectbrief">Energy Research and Forecasting: An Atmospheric Modeling Code</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ERF__AdvanceGeneralAD_8cpp.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">ERF_AdvanceGeneralAD.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <<a class="el" href="ERF__GeneralAD_8H_source.html">ERF_GeneralAD.H</a>></code><br />
<code>#include <<a class="el" href="ERF__IndexDefines_8H_source.html">ERF_IndexDefines.H</a>></code><br />
<code>#include <<a class="el" href="ERF__Interpolation__1D_8H_source.html">ERF_Interpolation_1D.H</a>></code><br />
<code>#include <<a class="el" href="ERF__Constants_8H_source.html">ERF_Constants.H</a>></code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for ERF_AdvanceGeneralAD.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="ERF__AdvanceGeneralAD_8cpp__incl.png" border="0" usemap="#aSource_2WindFarmParametrization_2GeneralActuatorDisk_2ERF__AdvanceGeneralAD_8cpp" alt=""/></div>
<map name="aSource_2WindFarmParametrization_2GeneralActuatorDisk_2ERF__AdvanceGeneralAD_8cpp" id="aSource_2WindFarmParametrization_2GeneralActuatorDisk_2ERF__AdvanceGeneralAD_8cpp">
<area shape="rect" title=" " alt="" coords="166,5,517,47"/>
<area shape="rect" href="ERF__GeneralAD_8H.html" title=" " alt="" coords="71,95,210,121"/>
<area shape="rect" href="ERF__Constants_8H.html" title=" " alt="" coords="611,393,744,420"/>
<area shape="rect" href="ERF__IndexDefines_8H.html" title=" " alt="" coords="433,393,586,420"/>
<area shape="rect" href="ERF__Interpolation__1D_8H.html" title=" " alt="" coords="1016,169,1192,196"/>
<area shape="rect" title=" " alt="" coords="84,393,237,420"/>
<area shape="rect" title=" " alt="" coords="24,244,169,271"/>
<area shape="rect" href="ERF__NullWindFarm_8H.html" title=" " alt="" coords="120,169,278,196"/>
<area shape="rect" href="ERF__DataStruct_8H.html" title=" " alt="" coords="864,244,1001,271"/>
<area shape="rect" title=" " alt="" coords="769,393,885,420"/>
<area shape="rect" title=" " alt="" coords="1342,393,1400,420"/>
<area shape="rect" title=" " alt="" coords="1054,393,1134,420"/>
<area shape="rect" title=" " alt="" coords="1158,393,1317,420"/>
<area shape="rect" title=" " alt="" coords="910,393,1030,420"/>
<area shape="rect" href="ERF__AdvStruct_8H.html" title=" " alt="" coords="764,319,895,345"/>
<area shape="rect" href="ERF__DiffStruct_8H.html" title=" " alt="" coords="970,319,1100,345"/>
<area shape="rect" href="ERF__SpongeStruct_8H.html" title=" " alt="" coords="1175,319,1330,345"/>
<area shape="rect" href="ERF__TurbStruct_8H.html" title=" " alt="" coords="404,319,538,345"/>
<area shape="rect" href="ERF__TurbPertStruct_8H.html" title=" " alt="" coords="1456,319,1614,345"/>
<area shape="rect" title=" " alt="" coords="616,468,739,495"/>
<area shape="rect" title=" " alt="" coords="446,468,574,495"/>
<area shape="rect" href="ERF__MYNNStruct_8H.html" title=" " alt="" coords="262,393,408,420"/>
<area shape="rect" title=" " alt="" coords="1512,393,1680,420"/>
<area shape="rect" href="ERF__TileNoZ_8H.html" title=" " alt="" coords="1756,393,1874,420"/>
<area shape="rect" title=" " alt="" coords="1424,393,1488,420"/>
<area shape="rect" title=" " alt="" coords="1774,468,1856,495"/>
</map>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa029813f35aa6d2dd949f67fa313066d"><td class="memItemLeft" align="right" valign="top">AMREX_FORCE_INLINE AMREX_GPU_DEVICE int </td><td class="memItemRight" valign="bottom"><a class="el" href="ERF__AdvanceGeneralAD_8cpp.html#aa029813f35aa6d2dd949f67fa313066d">find_rad_loc_index</a> (const Real rad, const Real *bld_rad_loc, const int n_bld_sections)</td></tr>
<tr class="separator:aa029813f35aa6d2dd949f67fa313066d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afffd9801c692fcb424381db8ca2dc8f2"><td class="memItemLeft" align="right" valign="top">AMREX_FORCE_INLINE AMREX_GPU_DEVICE std::array< Real, 2 > </td><td class="memItemRight" valign="bottom"><a class="el" href="ERF__AdvanceGeneralAD_8cpp.html#afffd9801c692fcb424381db8ca2dc8f2">compute_source_terms_Fn_Ft</a> (const Real rad, const Real avg_vel, const Real *bld_rad_loc, const Real *bld_twist, const Real *bld_chord, int n_bld_sections, const Real *bld_airfoil_aoa, const Real *bld_airfoil_Cl, const Real *bld_airfoil_Cd, const int n_pts_airfoil, const Real *velocity, const Real *rotor_RPM, const Real *blade_pitch, const int n_spec_extra)</td></tr>
<tr class="separator:afffd9801c692fcb424381db8ca2dc8f2"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="afffd9801c692fcb424381db8ca2dc8f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afffd9801c692fcb424381db8ca2dc8f2">◆ </a></span>compute_source_terms_Fn_Ft()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">AMREX_FORCE_INLINE AMREX_GPU_DEVICE std::array<Real,2> compute_source_terms_Fn_Ft </td>
<td>(</td>
<td class="paramtype">const Real </td>
<td class="paramname"><em>rad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real </td>
<td class="paramname"><em>avg_vel</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_rad_loc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_twist</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_chord</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>n_bld_sections</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_airfoil_aoa</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_airfoil_Cl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_airfoil_Cd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int </td>
<td class="paramname"><em>n_pts_airfoil</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>velocity</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>rotor_RPM</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>blade_pitch</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int </td>
<td class="paramname"><em>n_spec_extra</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  Real rpm = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(velocity, rotor_RPM, avg_vel, n_spec_extra);</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  Real pitch = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(velocity, blade_pitch, avg_vel, n_spec_extra);</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  </div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  Real Omega = rpm/60.0*2.0*<a class="code" href="ERF__Constants_8H.html#a988c4efd6fd0d855e241e77a73191428">PI</a>;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  Real <a class="code" href="namespaceMicVar__Kess.html#ad6f84c7e649afdd998b2f37ba87476bea89de8c3bfc941080efb960e5119fbd61">rho</a> = 1.226;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  </div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  Real B = 3.0;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  Real rhub = 2.0;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  Real rtip = 63.5;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  </div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  Real twist = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(bld_rad_loc, bld_twist, rad, n_bld_sections);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  Real c = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(bld_rad_loc, bld_chord, rad, n_bld_sections);</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  </div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="comment">// Iteration procedure</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  </div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  Real s = 0.5*c*B/(<a class="code" href="ERF__Constants_8H.html#a988c4efd6fd0d855e241e77a73191428">PI</a>*rad);</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  </div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  Real at, an, V1, Vt, Vr, psi, L, D, Cn, Ct;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  Real ftip, fhub, <a class="code" href="classF.html">F</a>, Cl, Cd, at_new, an_new;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  </div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  at = 0.1;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  an = 0.1;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  </div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keywordtype">bool</span> is_converged = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  </div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<100;i++) {</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  V1 = avg_vel*(1-an);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  Vt = Omega*(1.0+at)*rad;</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  Vr = std::pow(V1*V1+Vt*Vt,0.5);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  </div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  psi = std::atan2(V1,Vt);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  </div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  Real aoa = psi*180.0/<a class="code" href="ERF__Constants_8H.html#a988c4efd6fd0d855e241e77a73191428">PI</a> - twist + pitch;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  </div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  Cl = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(bld_airfoil_aoa, bld_airfoil_Cl, aoa, n_pts_airfoil);</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  Cd = <a class="code" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a>(bld_airfoil_aoa, bld_airfoil_Cd, aoa, n_pts_airfoil);</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  </div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="comment">//Cl = 1.37;</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="comment">//Cd = 0.014;</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  </div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="comment">//printf("rad, aoa, Cl, Cd = %0.15g %0.15g %0.15g %0.15g\n", rad, aoa, Cl, Cd);</span></div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  </div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  Cn = Cl*std::cos(psi) + Cd*std::sin(psi);</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  Ct = Cl*std::sin(psi) - Cd*std::cos(psi);</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  </div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  ftip = B*(rtip-rad)/(2.0*rad*std::sin(psi)+1e-10);</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  fhub = B*(rad-rhub)/(2.0*rad*std::sin(psi)+1e-10);</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  </div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-fhub))<=1.0);</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-ftip))<=1.0);</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  </div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <a class="code" href="classF.html">F</a> = 2.0/<a class="code" href="ERF__Constants_8H.html#a988c4efd6fd0d855e241e77a73191428">PI</a>*(std::acos(std::exp(-ftip)) + std::acos(std::exp(-fhub)) );</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  </div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  at_new = 1.0/ ( 4.0*<a class="code" href="classF.html">F</a>*std::sin(psi)*std::cos(psi)/(s*Ct+1e-10) - 1.0 );</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  an_new = 1.0/ ( 1.0 + 4.0*<a class="code" href="classF.html">F</a>*std::pow(std::sin(psi),2)/(s*Cn + 1e-10) );</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  at_new = std::max(0.0, at_new);</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  </div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span>(std::fabs(at_new-at) < 1e-5 and std::fabs(an_new-an) < 1e-5) {</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="comment">//printf("Converged at, an = %d %0.15g %0.15g %0.15g\n",i, at, an, psi);</span></div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  at = at_new;</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  an = an_new;</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  is_converged = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  }</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  at = at_new;</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  an = an_new;</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <span class="comment">//printf("Iteration, at, an = %0.15g %0.15g %0.15g\n",at, an, psi);</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  }</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  </div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <span class="keywordflow">if</span>(!is_converged) {</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  Abort(<span class="stringliteral">"The iteration procedure for the generalized actuator disk did not converge. Exiting..."</span>);</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  }</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  </div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="comment">// Iterations converged. Now compute Ft, Fn</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  </div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  L = 0.5*<a class="code" href="namespaceMicVar__Kess.html#ad6f84c7e649afdd998b2f37ba87476bea89de8c3bfc941080efb960e5119fbd61">rho</a>*Vr*Vr*c*Cl;</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  D = 0.5*<a class="code" href="namespaceMicVar__Kess.html#ad6f84c7e649afdd998b2f37ba87476bea89de8c3bfc941080efb960e5119fbd61">rho</a>*Vr*Vr*c*Cd;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  </div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  Real Fn = L*std::cos(psi) + D*std::sin(psi);</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  Real Ft = L*std::sin(psi) - D*std::cos(psi);</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  </div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  <span class="comment">//printf("Fn and Ft %0.15g %0.15g %0.15g %0.15g\n", L, D, std::cos(psi), std::sin(psi));</span></div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  </div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  std::array<Real, 2> Fn_and_Ft;</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  Fn_and_Ft[0] = Fn;</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  Fn_and_Ft[1] = Ft;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  </div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <span class="keywordflow">return</span> Fn_and_Ft;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  </div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  <span class="comment">//exit(0);</span></div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span> }</div>
<div class="ttc" id="aERF__Constants_8H_html_a988c4efd6fd0d855e241e77a73191428"><div class="ttname"><a href="ERF__Constants_8H.html#a988c4efd6fd0d855e241e77a73191428">PI</a></div><div class="ttdeci">constexpr amrex::Real PI</div><div class="ttdef"><b>Definition:</b> ERF_Constants.H:6</div></div>
<div class="ttc" id="aERF__Interpolation__1D_8H_html_a803d0d35d4ca4791556cbe02bbf51cbb"><div class="ttname"><a href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb">interpolate_1d</a></div><div class="ttdeci">AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real interpolate_1d(const amrex::Real *alpha, const amrex::Real *beta, const amrex::Real alpha_interp, const int alpha_size)</div><div class="ttdef"><b>Definition:</b> ERF_Interpolation_1D.H:12</div></div>
<div class="ttc" id="aclassF_html"><div class="ttname"><a href="classF.html">F</a></div></div>
<div class="ttc" id="anamespaceMicVar__Kess_html_ad6f84c7e649afdd998b2f37ba87476bea89de8c3bfc941080efb960e5119fbd61"><div class="ttname"><a href="namespaceMicVar__Kess.html#ad6f84c7e649afdd998b2f37ba87476bea89de8c3bfc941080efb960e5119fbd61">MicVar_Kess::rho</a></div><div class="ttdeci">@ rho</div><div class="ttdef"><b>Definition:</b> ERF_Kessler.H:30</div></div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="classGeneralAD.html#a5be79013be63b8105a01534ca186de32">GeneralAD::source_terms_cellcentered()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="ERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_cgraph.png" border="0" usemap="#aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_cgraph" alt=""/></div>
<map name="aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_cgraph" id="aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_cgraph">
<area shape="rect" title=" " alt="" coords="5,5,180,47"/>
<area shape="rect" href="ERF__Interpolation__1D_8H.html#a803d0d35d4ca4791556cbe02bbf51cbb" title=" " alt="" coords="228,13,344,39"/>
</map>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="ERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_icgraph.png" border="0" usemap="#aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_icgraph" alt=""/></div>
<map name="aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_icgraph" id="aERF__AdvanceGeneralAD_8cpp_afffd9801c692fcb424381db8ca2dc8f2_icgraph">
<area shape="rect" title=" " alt="" coords="241,5,416,47"/>
<area shape="rect" href="classGeneralAD.html#a5be79013be63b8105a01534ca186de32" title=" " alt="" coords="5,5,193,47"/>
</map>
</div>
</div>
</div>
<a id="aa029813f35aa6d2dd949f67fa313066d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa029813f35aa6d2dd949f67fa313066d">◆ </a></span>find_rad_loc_index()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">AMREX_FORCE_INLINE AMREX_GPU_DEVICE int find_rad_loc_index </td>
<td>(</td>
<td class="paramtype">const Real </td>
<td class="paramname"><em>rad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const Real * </td>
<td class="paramname"><em>bld_rad_loc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int </td>
<td class="paramname"><em>n_bld_sections</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> {</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="comment">// Find the index of the radial location</span></div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordtype">int</span> index=-1;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  Real rhub = 2.0;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  Real rad_from_hub = rad - rhub;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="keywordflow">if</span>(rad_from_hub < 0.0) {</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  index = 0;</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  }</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<n_bld_sections;i++){</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keywordflow">if</span>(bld_rad_loc[i] > rad) {</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  index = i;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  }</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  }</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  }</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordflow">if</span>(index == -1 and rad > bld_rad_loc[n_bld_sections-1]) {</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  index = n_bld_sections-1;</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  }</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">if</span>(index == -1) {</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="comment">//printf("The radial section is at %0.15g m\n",rad);</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  Abort(<span class="stringliteral">"Could not find index of the radial section."</span>);</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  }</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  </div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  <span class="keywordflow">return</span> index;</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span> }</div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="classGeneralAD.html#a5be79013be63b8105a01534ca186de32">GeneralAD::source_terms_cellcentered()</a>.</p>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="ERF__AdvanceGeneralAD_8cpp_aa029813f35aa6d2dd949f67fa313066d_icgraph.png" border="0" usemap="#aERF__AdvanceGeneralAD_8cpp_aa029813f35aa6d2dd949f67fa313066d_icgraph" alt=""/></div>
<map name="aERF__AdvanceGeneralAD_8cpp_aa029813f35aa6d2dd949f67fa313066d_icgraph" id="aERF__AdvanceGeneralAD_8cpp_aa029813f35aa6d2dd949f67fa313066d_icgraph">
<area shape="rect" title=" " alt="" coords="241,13,384,39"/>
<area shape="rect" href="classGeneralAD.html#a5be79013be63b8105a01534ca186de32" title=" " alt="" coords="5,5,193,47"/>
</map>
</div>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_74389ed8173ad57b461b9d623a1f3867.html">Source</a></li><li class="navelem"><a class="el" href="dir_4c2ecf32dc8d7cf95ecc0db34c31b5da.html">WindFarmParametrization</a></li><li class="navelem"><a class="el" href="dir_bd16358c53c2d54003a0d897897bd9c8.html">GeneralActuatorDisk</a></li><li class="navelem"><a class="el" href="ERF__AdvanceGeneralAD_8cpp.html">ERF_AdvanceGeneralAD.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>