Repository navigation
Expand file tree
/
Copy pathexamples.html
More file actions
994 lines (991 loc) · 97.8 KB
/
Copy pathexamples.html
File metadata and controls
994 lines (991 loc) · 97.8 KB
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
<!-- HTML header for doxygen 1.9.1-->
<!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>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SY496B9L99"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-SY496B9L99');
</script>
<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.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MFC: Example Cases</title>
<meta name="description" content="Example Cases — MFC documentation. Open-source exascale multiphase flow solver." />
<meta name="keywords" content="exascale, fluid dynamics, cfd, computational fluid dynamics, compressible, hpc, bryngelson, colonius, subgrid, multiphase, frontier, summit, el capitan, aurora, amd gpu, gpu, nvidia"/>
<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="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.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>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
// This file is set as MATHJAX_CODEFILE in the Doxyfile. It configures how
// MathJax renders expressions in Markdown so that it is consistent with GitHub.
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$', '$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
ignoreClass: "line" // Ignore code blocks: https://web.archive.org/web/20120430100225/http://www.mathjax.org/docs/1.1/options/tex2jax.html
},
"HTML-CSS": {
fonts: ["TeX"]
}
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="icon.ico" type="image/x-icon" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
<link href="custom.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="projectlogo"><img alt="Logo" src="icon.ico"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">MFC
</div>
<div id="projectbrief">Exascale flow solver</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Cross-navigation injected into sidebar via script below -->
<script>
document.addEventListener('DOMContentLoaded', function() {
var nav = document.createElement('div');
nav.id = 'mfc-nav';
var items = [
['../documentation/index.html', 'documentation', 'User Guide'],
['../api/index.html', 'api', 'API Documentation']
];
var path = window.location.pathname;
var apiPaths = ['/api/', '/pre_process/', '/simulation/', '/post_process/'];
for (var i = 0; i < items.length; i++) {
var a = document.createElement('a');
a.href = items[i][0];
a.textContent = items[i][2];
if (items[i][1] === 'api') {
for (var j = 0; j < apiPaths.length; j++) {
if (path.indexOf(apiPaths[j]) !== -1) { a.className = 'active'; break; }
}
} else {
if (path.indexOf('/' + items[i][1] + '/') !== -1) a.className = 'active';
}
nav.appendChild(a);
}
var sideNav = document.getElementById('side-nav');
if (sideNav) sideNav.insertBefore(nav, sideNav.firstChild);
});
</script>
<!-- end header part -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
</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">
$(function(){initNavTree('examples.html','',''); });
</script>
<div id="container">
<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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div><div class="header">
<div class="headertitle"><div class="title">Example Cases </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1 class="doxsection"><a class="anchor" id="autotoc_md218"></a>
Example Cases</h1>
<h2 class="doxsection"><a class="anchor" id="autotoc_md219"></a>
1D Fourier conduction convergence</h2>
<p>Verifies the Fourier heat conduction term <span class="tt">div(k grad T)</span> on the energy equation against the exact Laplacian of a sinusoidal temperature field.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md220"></a>
Exact solution</h3>
<p>Ideal gas, so <span class="tt">T = p / ((Gamma - 1) * rho * cv)</span>. Setting </p><pre class="fragment">rho(x) = RHO0 / (1 + A sin(2 pi x / L))
</pre><p>at uniform pressure gives exactly </p><pre class="fragment">T(x) = T0 (1 + A sin(2 pi x / L)), T0 = P0 / ((Gamma - 1) RHO0 cv).
</pre><p>At <span class="tt">t = 0</span> the velocity is zero and the pressure is uniform, so every Euler flux vanishes and the entire right-hand side is conduction: </p><pre class="fragment">d(rho E)/dt = k d2T/dx2 = -k T0 A (2 pi / L)^2 sin(2 pi x / L).
</pre><p>One time step therefore measures the conduction term in isolation, up to <span class="tt">O(dt)</span> time error and <span class="tt">O(dx^2)</span> space error. <span class="tt">compare_analytic.py</span> forms <span class="tt">(rho E(dt) - rho E(0)) / dt</span> from <span class="tt">restart_data/lustre_{0,1}.dat</span> and compares it to that expression.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md221"></a>
Running</h3>
<pre class="fragment">for nx in 50 100 200 400; do
NX=$nx ./mfc.sh run examples/1D_conduction_convergence/case.py -n 1
NX=$nx ./build/venv/bin/python3 examples/1D_conduction_convergence/compare_analytic.py
done
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md222"></a>
Observed convergence</h3>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">NX </th><th class="markdownTableHeadNone">L2 error </th><th class="markdownTableHeadNone">relative </th><th class="markdownTableHeadNone">order </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">50 </td><td class="markdownTableBodyNone">9.174206e-06 </td><td class="markdownTableBodyNone">1.314570e-03 </td><td class="markdownTableBodyNone">– </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">100 </td><td class="markdownTableBodyNone">2.293085e-06 </td><td class="markdownTableBodyNone">3.285757e-04 </td><td class="markdownTableBodyNone">2.000 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">200 </td><td class="markdownTableBodyNone">5.775688e-07 </td><td class="markdownTableBodyNone">8.275971e-05 </td><td class="markdownTableBodyNone">1.989 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">400 </td><td class="markdownTableBodyNone">1.442740e-07 </td><td class="markdownTableBodyNone">2.067299e-05 </td><td class="markdownTableBodyNone">2.001 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">800 </td><td class="markdownTableBodyNone">4.396086e-08 </td><td class="markdownTableBodyNone">6.299142e-06 </td><td class="markdownTableBodyNone">1.715 </td></tr>
</table>
<p>Second order through NX=400. The drop at NX=800 is the <span class="tt">O(dt)</span> time-splitting floor, which by then is comparable to the spatial error; refining <span class="tt">dt</span> restores second order.</p>
<p>The result is unchanged on 2 ranks (<span class="tt">-n 2</span>), which exercises the MPI temperature halo exchange.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md223"></a>
Kelvin-Helmholtz Instability (2D)</h2>
<p>Reference: See Example 4.8. </p><blockquote class="doxtable">
<p>A.S. Chamarthi, S.H. Frankel, A. Chintagunta, Implicit gradients based novel finite volume scheme for compressible single and multi-component flows, arXiv preprint arXiv:2106.01738 (2021). </p>
</blockquote>
<h4 class="doxsection"><a class="anchor" id="autotoc_md224"></a>
Initial State</h4>
<p><img src="figure0-2D_kelvin_helmholtz-example.png" alt="" height="400" class="inline"/></p>
<h4 class="doxsection"><a class="anchor" id="autotoc_md225"></a>
Evolved State</h4>
<p><img src="figure1-2D_kelvin_helmholtz-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md226"></a>
2D General Herschel-Bulkley Poiseuille Channel</h2>
<p>Validates the <b>combined</b> non-Newtonian terms of MFC's Herschel-Bulkley viscosity against a closed-form analytic Poiseuille profile: a shear-thinning power law (<span class="tt">nn = 0.5 < 1</span>) <b>and</b> a yield stress (<span class="tt">tau0 > 0</span>) acting together. The companion examples isolate each effect — <span class="tt">2D_poiseuille_nn</span> / <span class="tt">2D_poiseuille_thickening_nn</span> (power-law only, <span class="tt">tau0 = 0</span>) and <span class="tt">2D_bingham_poiseuille_nn</span> (yield only, <span class="tt">nn = 1</span>). The signature of a correct general Herschel-Bulkley model is a rigid <b>plug</b> near the centerline (where <span class="tt">|tau| < tau0</span>) joined to a shear-thinning sheared profile at the walls.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md227"></a>
Regime and parameters</h3>
<p>Single Papanastasiou-regularized Herschel-Bulkley fluid with both a sub-unity flow index and a finite yield stress:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)K</span> </td><td class="markdownTableBodyNone"><span class="tt">1.5e-2</span> </td><td class="markdownTableBodyNone">consistency index </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">0.5</span> </td><td class="markdownTableBodyNone">flow index <span class="tt">< 1</span> -> shear-thinning </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">3.5e-3</span> </td><td class="markdownTableBodyNone">yield stress -> plug half-width <span class="tt">y0 = 0.35 H</span> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1.0e4</span> </td><td class="markdownTableBodyNone">sharp Papanastasiou yield regularization </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">0.3</span> </td><td class="markdownTableBodyNone">viscosity clamp (rigid plug) </td></tr>
</table>
<p>Driven by <span class="tt">g_x = 0.1</span>, <span class="tt">rho = 1</span>, <span class="tt">pres = 10</span>, giving <span class="tt">tau_w = rho*g*H = 1e-2</span>, <span class="tt">u_plug ~ 4e-3</span> and Mach ~1e-3. Channel <span class="tt">L_y = 0.2</span>, <span class="tt">H = 0.1</span>, no-slip walls, periodic in <span class="tt">x</span>. Grid <span class="tt">m = 24</span> (x), <span class="tt">n = 63</span> (y).</p>
<p>The plug viscosity diverges as the shear rate <span class="tt">-> 0</span>, so the clamp <span class="tt">mu_max</span> sets the plug rigidity. <span class="tt">mu_max = 0.3</span> (~6x the wall effective viscosity) keeps a clear plug while keeping the explicit viscous timestep <span class="tt">dt ~ dy^2 rho/mu_max</span> tractable: <span class="tt">dt</span> scales as <span class="tt">1/mu_max</span>, so set <span class="tt">mu_max</span> just above the physical maximum required.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md228"></a>
Governing physics and analytic solution</h3>
<p>The shear stress is <span class="tt">tau = rho*g*(H - y)</span>; the fluid only flows where <span class="tt">|tau| > tau0</span>. With <span class="tt">tau = tau0 + K*|du/dy|^n</span> and <span class="tt">tau_w = rho*g*H > tau0</span>: </p><pre class="fragment">plug half-width : y0 = tau0/(rho*g)
sheared region : u(y) = (n/((n+1)*rho*g)) * K^(-1/n) *
[ (tau_w - tau0)^((n+1)/n)
- (rho*g*(H-y) - tau0)^((n+1)/n) ] (|y-H| >= y0)
plug : u_plug = (n/((n+1)*rho*g)) * K^(-1/n) *
(tau_w - tau0)^((n+1)/n) (|y-H| < y0)
</pre><p>(upper half mirrors about <span class="tt">y = H</span>). Requires <span class="tt">tau_w > tau0</span> for any flow.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md229"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_herschel_bulkley_poiseuille_nn/case.py -n 2
python examples/2D_herschel_bulkley_poiseuille_nn/compare_analytic.py
</pre><p>The run reaches <span class="tt">t_stop = 0.4</span> in ~5 min on 2 CPU ranks with <span class="tt">dt ~ 1e-5</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md230"></a>
Validation result</h3>
<p>Relative L2 error vs. the analytic Herschel-Bulkley profile: <b>3.8%</b> (2-rank run, steady-state drift between the last two saves ~1.1%). The sheared-region momentum balance <span class="tt">K*|du/dy|^n + tau0 = rho*g*(H-y)</span> holds to ~1% near the walls. A flat plug forms at the centerline: because the Papanastasiou plug is regularized (not perfectly rigid), the strict <span class="tt">>=99% u_max</span> band understates it, but the <b><span class="tt">>=95% u_max</span> plug half-width = 0.0359 = 1.03 y0</b>, matching the analytic <span class="tt">y0 = tau0/(rho*g) = 0.035 = 0.35 H</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md231"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md232"></a>
Shu-Osher problem (1D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>C. W. Shu, S. Osher, Efficient implementation of essentially non-oscillatory shock-capturing schemes, Journal of Computational Physics 77 (2) (1988) 439–471. doi:10.1016/0021-9991(88)90177-5. </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md233"></a>
Initial Condition</h3>
<p><img src="initial-1D_shuosher_old-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md234"></a>
Result</h3>
<p><img src="result-1D_shuosher_old-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md235"></a>
2D IBM-Walled Power-Law Poiseuille Channel</h2>
<p>Validates the <b>immersed boundary (IBM) + non-Newtonian viscosity interaction</b>: the channel's no-slip walls are two rectangular IB slabs instead of domain boundary conditions, so the flow exercises the per-stencil-sample Herschel-Bulkley viscosity <span class="tt">mu_eff</span> used by the IBM ghost-point and force machinery (<span class="tt">s_compute_viscous_stress_tensor</span> in <span class="tt">m_viscous.fpp</span>, consumed by <span class="tt">s_compute_ib_forces</span> in <span class="tt">m_ibm.fpp</span>). Companion to <span class="tt">examples/2D_poiseuille_thickening_nn</span>, which validates the same fluid against the same analytic profile with BC walls.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md236"></a>
Geometry and parameters</h3>
<p>Domain <span class="tt">x in [0, 0.2]</span> (periodic), <span class="tt">y in [0, 0.3]</span>, grid <span class="tt">m = 24</span>, <span class="tt">n = 95</span> (<span class="tt">dy = 0.003125</span>). Two rectangle IB slabs (<span class="tt">patch_ibgeometry = 3</span>, no-slip) bound the flow gap <span class="tt">y in [0.05, 0.25]</span> (half-height <span class="tt">H = 0.1</span>, centerline <span class="tt">y_c = 0.15</span>, 64 cells across the gap). Each slab extends beyond the domain in <span class="tt">x</span> and mostly outside the domain in <span class="tt">y</span>, so the only IB surface seen by the flow is its flat gap face; the slab centroids sit just <em>inside</em> the domain (a centroid exactly on the boundary is owned by no rank and its <span class="tt">ib_state</span> force record is never written). The domain BCs behind the slabs are no-slip walls (<span class="tt">bc_y = -16</span>), which keep the body-forced dead fluid inside the slabs benign. <span class="tt">patch_ibmass = 0</span> so the reported IB force is the pure pressure+viscous volume integration (no <span class="tt">bf_x*mass</span> bookkeeping term); <span class="tt">ib_state_wrt = T</span> writes it at every save.</p>
<p>Fluid and forcing match the BC-walled template (single Papanastasiou-regularized Herschel-Bulkley fluid, no yield stress):</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)K</span> </td><td class="markdownTableBodyNone"><span class="tt">5.0e-2</span> </td><td class="markdownTableBodyNone">consistency index </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">1.5</span> </td><td class="markdownTableBodyNone">flow index <span class="tt">> 1</span> -> shear-thickening </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">0.0</span> </td><td class="markdownTableBodyNone">no yield stress (pure power law) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1000.0</span> </td><td class="markdownTableBodyNone">Papanastasiou regularization parameter </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">0.035</span> </td><td class="markdownTableBodyNone">viscosity clamp (<span class="tt">~1.5x mu_wall = 0.0232</span>, clamp inactive) </td></tr>
</table>
<p>Driven by <span class="tt">g_x = 5e-2</span>, <span class="tt">rho = 1</span>, <span class="tt">pres = 10</span> (Mach ~3e-3); <span class="tt">cfl_adap_dt</span> with <span class="tt">cfl_target = 0.3</span> to <span class="tt">t_stop = 0.9</span> (~2 wall-viscous diffusion times).</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md237"></a>
Analytic solution</h3>
<p>In the gap the steady fully-developed power-law profile is </p><pre class="fragment">u(y) = (n/(n+1)) * (rho*g/K)^(1/n) * ( H^((n+1)/n) - |y - y_c|^((n+1)/n) )
</pre><p>and the steady x-force per wall per unit depth is <span class="tt">tau_w * L_x</span> with <span class="tt">tau_w = rho*g*H = 5e-3</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md238"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_ibm_poiseuille_nn/case.py -n 2
./build/venv/bin/python3 examples/2D_ibm_poiseuille_nn/compare_analytic.py
</pre><p>(~2.5 min on 2 CPU ranks.) For the n = 1 equivalence check, run the <span class="tt">newtonian</span> and <span class="tt">nn1</span> modes into two scratch copies and compare: </p><pre class="fragment">for MODE in newtonian nn1; do
mkdir -p build/ibm_nn_equiv/$MODE
cp examples/2D_ibm_poiseuille_nn/case.py build/ibm_nn_equiv/$MODE/
IBM_NN_MODE=$MODE ./mfc.sh run build/ibm_nn_equiv/$MODE/case.py -n 2
done
./build/venv/bin/python3 examples/2D_ibm_poiseuille_nn/check_equivalence.py \
build/ibm_nn_equiv/newtonian build/ibm_nn_equiv/nn1
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md239"></a>
Validation results</h3>
<p><b>A — n = 1 Newtonian equivalence (IBM mu_eff degeneracy).</b> A power-law fluid with <span class="tt">nn = 1, tau0 = 0, K = 0.02</span> is analytically the same fluid as a Newtonian one with <span class="tt">mu = 0.02</span>. Running both modes with the same fixed <span class="tt">dt = 6e-5</span> to <span class="tt">t = 0.3</span> gives <b>bitwise identical</b> velocity fields (max abs and rel L2 difference <span class="tt">0.0</span>) <em>and</em> bitwise identical IBM-integrated wall forces — the non-Newtonian IBM path reduces exactly to the Newtonian one.</p>
<p><b>B — analytic power-law profile (n = 1.5).</b> Relative L2 error of the steady x-averaged gap profile vs. the analytic solution: <b>5.8%</b> with the nominal <span class="tt">H = 0.1</span> (slab faces), <b>2.6%</b> with <span class="tt">H = 0.1016</span> fitted from the <span class="tt">u -> 0</span> crossings (IBM walls are sharp only to ~half a cell; the fitted walls sit <span class="tt">~dy/2 = 0.0016</span> outside the faces). Steady-state drift between the last two saves 2.0e-3; profile bluntness (mean/peak) 0.640 vs. the <span class="tt">n = 1.5</span> theory 0.625 (parabola 0.667), confirming the pointed shear-thickening profile. The BC-walled template achieves 1.46% on the same fluid; the extra error is the diffuse-wall representation, not the viscosity model.</p>
<p><b>C — IBM-integrated wall force.</b> The volume-integrated x-force converges to <b>8.05e-4</b> per wall (both walls identical by symmetry; plateaued by <span class="tt">t = 0.9</span>) vs. the analytic <span class="tt">tau_w*L_x = 1.0e-3</span> — a ratio of <b>0.80</b>. The deficit is the known coarseness of the volume-integration force estimator (second-order finite differences of ghost/dead-cell states inside the body), not the viscosity model: in Validation A the same integral is bitwise identical between the Newtonian and non-Newtonian code paths.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md240"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md241"></a>
Axisymmetric Fourier conduction convergence</h2>
<p>Axisymmetric twin of <span class="tt">examples/1D_conduction_convergence</span>. It verifies the radial part of <span class="tt">div(k grad T)</span> on a cylindrical grid, and in particular the axis cell <span class="tt">k = 0</span>, which has no face pair and is therefore the one cell fed by <span class="tt">s_compute_conduction_axis_source</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md242"></a>
Exact solution</h3>
<p>Ideal gas, so <span class="tt">T = p / ((Gamma - 1) * rho * cv)</span>. Setting </p><pre class="fragment">rho(r) = RHO0 / (1 + A (1 - r^2/R^2) + B (1 - r^4/R^4))
</pre><p>at uniform pressure gives exactly </p><pre class="fragment">T(r) = T0 (1 + A (1 - r^2/R^2) + B (1 - r^4/R^4)), T0 = P0 / ((Gamma - 1) RHO0 cv),
</pre><p>whose cylindrical Laplacian is finite on the axis: </p><pre class="fragment">(1/r) d/dr (r dT/dr) = -4 A T0 / R^2 - 16 B T0 r^2 / R^4.
</pre><p>At <span class="tt">t = 0</span> the velocity is zero and the pressure is uniform, so every Euler flux and every cylindrical geometric source vanishes and the entire right-hand side is conduction: </p><pre class="fragment">d(rho E)/dt = k (1/r) d/dr (r dT/dr).
</pre><p><span class="tt">compare_analytic.py</span> forms <span class="tt">(rho E(dt) - rho E(0)) / dt</span> from <span class="tt">restart_data/lustre_{0,1}.dat</span> and compares it to that expression.</p>
<p><span class="tt">B = 0</span> (the default) makes the exact answer a <b>constant</b>: every radial cell, axis included, must return the same number. That is the point of the profile — a sign error or a stray factor in the axis cell is unmissable against a flat field, where a sinusoid would hide it. <span class="tt">B > 0</span> makes the answer vary with <span class="tt">r</span> and turns the same case into an ordinary convergence test.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md243"></a>
The grid at the axis</h3>
<p><span class="tt">src/pre_process/m_grid.f90</span> gives the axisymmetric grid a <b>half-width cell at <span class="tt">r = 0</span></b>: cell 0 spans <span class="tt">[0, h/2]</span> with center <span class="tt">h/4</span>, and every cell above it has width <span class="tt">h</span>. Two cells therefore behave differently from the bulk:</p>
<ul>
<li><b>Cell 0</b>, the axis cell. <span class="tt">s_compute_conduction_axis_source</span> uses a distance-weighted central difference rather than <span class="tt">(T(k+1) - T(k-1)) / (y_cc(k+1) - y_cc(k-1))</span>; on a uniform grid the two are identical, but over this stencil the plain form loses an order and lands 35% high. The weighted form is exact for a quadratic and converges at second order below.</li>
<li><b>Cell 1</b>, whose inner face lies on that half-width cell. The two-point face gradient <span class="tt">(T(k+1) - T(k)) / (y_cc(k+1) - y_cc(k))</span> evaluates the gradient at the midpoint of the two cell centers, which is the face only on a uniform grid. This face flux is shared by every MFC diffusive term (<span class="tt">m_chemistry.fpp</span> uses the same expression), so the resulting 1.2% error at this one cell is a property of that shared discretization, not of the axis source. It does not shrink with <span class="tt">NR</span>, and it is reported separately below.</li>
</ul>
<h3 class="doxsection"><a class="anchor" id="autotoc_md244"></a>
Running</h3>
<pre class="fragment"># constant exact answer: the axis-cell check
for nr in 25 50 100 200 400; do
NR=$nr ./mfc.sh run examples/2D_axisym_conduction_convergence/case.py -n 1
NR=$nr ./build/venv/bin/python3 examples/2D_axisym_conduction_convergence/compare_analytic.py
done
# r-dependent exact answer: the second-order convergence table
for nr in 25 50 100 200; do
NR=$nr BAMP=0.4 ./mfc.sh run examples/2D_axisym_conduction_convergence/case.py -n 1
NR=$nr BAMP=0.4 ./build/venv/bin/python3 examples/2D_axisym_conduction_convergence/compare_analytic.py
done
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md245"></a>
Observed results</h3>
<p>Constant exact answer (<span class="tt">B = 0</span>, exact <span class="tt">= -4.000000e-02</span> in every cell):</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">NR </th><th class="markdownTableHeadNone">axis cell </th><th class="markdownTableHeadNone">axis rel err </th><th class="markdownTableHeadNone">cell 1 rel err </th><th class="markdownTableHeadNone">max bulk rel err </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">25 </td><td class="markdownTableBodyNone">-4.00000033e-02 </td><td class="markdownTableBodyNone">-8.274e-08 </td><td class="markdownTableBodyNone">+3.125e-02 </td><td class="markdownTableBodyNone">8.274e-08 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">50 </td><td class="markdownTableBodyNone">-4.00000033e-02 </td><td class="markdownTableBodyNone">-8.274e-08 </td><td class="markdownTableBodyNone">+3.125e-02 </td><td class="markdownTableBodyNone">1.193e-06 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">100 </td><td class="markdownTableBodyNone">-4.00000033e-02 </td><td class="markdownTableBodyNone">-8.274e-08 </td><td class="markdownTableBodyNone">+3.125e-02 </td><td class="markdownTableBodyNone">3.413e-06 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">200 </td><td class="markdownTableBodyNone">-4.00000033e-02 </td><td class="markdownTableBodyNone">-8.274e-08 </td><td class="markdownTableBodyNone">+3.125e-02 </td><td class="markdownTableBodyNone">7.854e-06 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">400 </td><td class="markdownTableBodyNone">-3.99999589e-02 </td><td class="markdownTableBodyNone">+1.027e-06 </td><td class="markdownTableBodyNone">+3.125e-02 </td><td class="markdownTableBodyNone">1.007e-05 </td></tr>
</table>
<p>The axis cell matches the interior to the <span class="tt">O(dt)</span> time-splitting floor at every resolution: for a quadratic profile the discretization is exact in space, so nothing else is left. Before the distance weighting was added the axis cell read <span class="tt">-5.400e-02</span>, 35% high and independent of <span class="tt">NR</span>, which is what this table is built to expose.</p>
<p>Second-order convergence (<span class="tt">B = 0.4</span>, <span class="tt">r</span>-dependent exact answer):</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">NR </th><th class="markdownTableHeadNone">axis rel err </th><th class="markdownTableHeadNone">order </th><th class="markdownTableHeadNone">bulk L2 rel err </th><th class="markdownTableHeadNone">order </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">25 </td><td class="markdownTableBodyNone">1.171e-03 </td><td class="markdownTableBodyNone">– </td><td class="markdownTableBodyNone">9.623e-04 </td><td class="markdownTableBodyNone">– </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">50 </td><td class="markdownTableBodyNone">2.856e-04 </td><td class="markdownTableBodyNone">2.04 </td><td class="markdownTableBodyNone">2.348e-04 </td><td class="markdownTableBodyNone">2.03 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">100 </td><td class="markdownTableBodyNone">7.062e-05 </td><td class="markdownTableBodyNone">2.02 </td><td class="markdownTableBodyNone">5.799e-05 </td><td class="markdownTableBodyNone">2.02 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">200 </td><td class="markdownTableBodyNone">1.757e-05 </td><td class="markdownTableBodyNone">2.01 </td><td class="markdownTableBodyNone">1.448e-05 </td><td class="markdownTableBodyNone">2.00 </td></tr>
</table>
<p>The axis cell converges at the same second order as the bulk. Cell 1 sits at 1.19e-02 at every resolution, as expected from the shared face-gradient form described above.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md246"></a>
2D IBM CFL dt (2D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md247"></a>
Result</h3>
<p><img src="result-2D_ibm_cfl_dt-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md248"></a>
Shock Droplet (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Panchal et. al., A Seven-Equation Diffused Interface Method for Resolved Multiphase Flows, JCP, 475 (2023) </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md249"></a>
Initial Condition</h3>
<p><img src="initial-2D_shockdroplet-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md250"></a>
Result</h3>
<p><img src="result-2D_shockdroplet-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md251"></a>
2D Riemann Test (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Chamarthi, A., & Hoffmann, N., & Nishikawa, H., & Frankel S. (2023). Implicit gradients based conservative numerical scheme for compressible flows. arXiv:2110.05461 </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md252"></a>
Density Initial and Final Conditions</h3>
<p><img src="alpha_rho1_initial-2D_riemann_test-example.png" alt="" width="45%" class="inline"/> <img src="alpha_rho1_final-2D_riemann_test-example.png" alt="" width="45%" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md253"></a>
2D Bingham (Yield-Stress) Poiseuille Channel</h2>
<p>Validates the <b>yield-stress term</b> of MFC's Herschel-Bulkley non-Newtonian viscosity against a closed-form analytic Poiseuille profile. Demonstrates the Bingham regime (<span class="tt">nn = 1</span>, <span class="tt">tau0 > 0</span>): a rigid <b>plug</b> of uniform velocity forms near the centerline, where the shear stress falls below the yield stress.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md254"></a>
Regime and parameters</h3>
<p>Single Papanastasiou-regularized Herschel-Bulkley fluid with unit flow index, so <span class="tt">K = mu</span> is a plain Newtonian consistency and the only non-Newtonian effect is the yield stress:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)K</span> </td><td class="markdownTableBodyNone"><span class="tt">5.0e-2</span> </td><td class="markdownTableBodyNone"><span class="tt">n = 1</span> -> plain dynamic viscosity <span class="tt">mu</span> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">1.0</span> </td><td class="markdownTableBodyNone">flow index = 1 (Bingham, no power-law) </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">4.0e-3</span> </td><td class="markdownTableBodyNone">yield stress -> plug half-width <span class="tt">y0 = 0.4 H</span> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1.0e4</span> </td><td class="markdownTableBodyNone">sharp Papanastasiou yield regularization </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">1.0</span> </td><td class="markdownTableBodyNone">viscosity clamp (rigid plug) </td></tr>
</table>
<p>Driven by <span class="tt">g_x = 0.1</span>, <span class="tt">rho = 1</span>, <span class="tt">pres = 10</span>, giving <span class="tt">tau_w = rho*g*H = 1e-2</span>, <span class="tt">u_plug ~ 3.6e-3</span> and Mach ~1e-3. Channel <span class="tt">L_y = 0.2</span>, <span class="tt">H = 0.1</span>, no-slip walls, periodic in <span class="tt">x</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md255"></a>
Governing physics and analytic solution</h3>
<p>The shear stress is <span class="tt">tau = rho*g*(H - y)</span>; the fluid only flows where <span class="tt">|tau| > tau0</span>. With <span class="tt">n = 1</span>, <span class="tt">K = mu</span>, <span class="tt">tau_w = rho*g*H > tau0</span>: </p><pre class="fragment">plug half-width : y0 = tau0/(rho*g)
sheared region : u(y) = (1/(2*mu*rho*g)) *
[ (tau_w - tau0)^2 - (rho*g*(H-y) - tau0)^2 ] (|y-H| >= y0)
plug : u_plug = (1/(2*mu*rho*g)) * (tau_w - tau0)^2 (|y-H| < y0)
</pre><p>The signature of a correct yield term is the flat plug of uniform velocity within <span class="tt">|y - H| < y0</span>. Requires <span class="tt">tau_w > tau0</span> for any flow.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md256"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_bingham_poiseuille_nn/case.py -n 2
python examples/2D_bingham_poiseuille_nn/compare_analytic.py
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md257"></a>
Validation result</h3>
<p>Relative L2 error vs. the analytic Bingham profile: <b>2.5%</b> (2-rank run, steady state confirmed). A plug forms at the centerline with half-width matching the analytic <span class="tt">y0 = tau0/(rho*g) = 0.4 H</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md258"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md259"></a>
2D Hardcodied IC Example</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md260"></a>
Initial Condition and Result</h3>
<p><img src="initial-2D_hardcoded_ic-example.png" alt="" width="45%" class="inline"/> <img src="result-2D_hardcoded_ic-example.png" alt="" width="45%" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md261"></a>
Backward Facing Step (2D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md262"></a>
Final Condition (Density)</h3>
<p><img src="final-2D_backward_facing_step-example.png" alt="" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md263"></a>
Forward Facing Step (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Woodward, P. <em>(1984). The numerical simulation of two-dimensional fluid flow with strong shocks. Journal of Computational Physics, 54(1), 115–173. <a href="https://doi.org/10.1016/0021-9991(84)90140-2">https://doi.org/10.1016/0021-9991(84)90140-2</a></em> </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md264"></a>
Final Condition (Density)</h3>
<p><img src="final-2D_forward_facing_step-example.png" alt="" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md265"></a>
3D Turbulent Mixing layer (3D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md266"></a>
Liutex visualization at transitional state</h3>
<p><img src="result-3D_turb_mixing-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md267"></a>
Taylor-Green Vortex (3D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Hillewaert, K. (2013). TestCase C3.5 - DNS of the transition of the Taylor-Green vortex, Re=1600 - Introduction and result summary. 2nd International Workshop on high-order methods for CFD. </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md268"></a>
Final Condition</h3>
<p>This figure shows the isosurface with zero q-criterion.</p>
<p><img src="result-3D_TaylorGreenVortex-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md269"></a>
1D Multi-Component Reactive Shock Tube</h2>
<p>References: </p><blockquote class="doxtable">
<p>P. J. Martínez Ferrer, R. Buttay, G. Lehnasch, and A. Mura, “A detailed verification procedure for compressible reactive multicomponent Navier–Stokes solvers”, Computers & Fluids, vol. 89, pp. 88–110, Jan. 2014. Accessed: Oct. 13, 2024. [Online]. Available: <a href="https://doi.org/10.1016/j.compfluid.2013.10.014">https://doi.org/10.1016/j.compfluid.2013.10.014</a> </p>
</blockquote>
<blockquote class="doxtable">
<p>H. Chen, C. Si, Y. Wu, H. Hu, and Y. Zhu, “Numerical investigation of the effect of equivalence ratio on the propagation characteristics and performance of rotating detonation engine”, Int. J. Hydrogen Energy, Mar. 2023. Accessed: Oct. 13, 2024. [Online]. Available: <a href="https://doi.org/10.1016/j.ijhydene.2023.03.190">https://doi.org/10.1016/j.ijhydene.2023.03.190</a> </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md270"></a>
Initial Condition</h3>
<p><img src="initial-1D_reactive_shocktube-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md271"></a>
Results</h3>
<p><img src="result-1D_reactive_shocktube-example.png" alt="" height="400" class="inline"/></p>
<p>This example case contains an automated convergence test using a 1D, two-component advection case. The case can be run by executing the bash script <span class="tt">./submitJobs.sh</span> in a terminal after enabling execution permissions with <span class="tt">chmod +x ./submitJobs.sh</span> and setting the <span class="tt">ROOT_DIR</span> and <span class="tt">MFC_DIR</span> variables. By default the script runs the case for 6 different grid resolutions with 1st, 3rd, and 5th, order spatial reconstructions. These settings can be modified by editing the variables at the top of the script. You can also run different model equations by setting the <span class="tt">ME</span> variable and different Riemann solvers by setting the <span class="tt">RS</span> variable.</p>
<p>Once the simulations have been run, you can generate convergence plots with matplotlib by running <span class="tt">python3 plot.py</span> in a terminal. This will generate plots of the L1, L2, and Linf error norms and save the results to <span class="tt">errors.csv</span>.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md272"></a>
3D Temporal Reacting Mixing Layer (H2/N2 - air, Mc = 1.5)</h2>
<p>A temporally-evolving supersonic reacting shear layer between a hot air stream and an N2-diluted hydrogen stream. The base state comes from Cantera-only stream mixing (or a counterflow flame with <span class="tt">--hot</span>) extruded into 3D by <span class="tt">hcid=371</span>. This is the supersonic counterpart to <span class="tt">examples/2D_reacting_mixing_layer</span>, which runs the same flamelet machinery at <span class="tt">Mc = 0.3</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md273"></a>
Configuration</h3>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Oxidizer stream </td><td class="markdownTableBodyNone">air, <span class="tt">X_O2 = 0.21</span>, 500 K </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Fuel stream </td><td class="markdownTableBodyNone"><span class="tt">X_H2 = 0.5</span>, balance N2, 300 K </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Pressure </td><td class="markdownTableBodyNone">101325 Pa </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Vorticity thickness <span class="tt">delta_omega</span> </td><td class="markdownTableBodyNone">1.0e-3 m </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Convective Mach number <span class="tt">Mc</span> </td><td class="markdownTableBodyNone">1.5 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Domain </td><td class="markdownTableBodyNone"><span class="tt">[15, 20, 10] delta_omega</span> in <span class="tt">(x, y, z)</span> </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Grid </td><td class="markdownTableBodyNone">14 pts/<span class="tt">delta_omega</span> in x and z, 28 in y, so 210 x 560 x 140 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Time step </td><td class="markdownTableBodyNone">1e-9 s, RK3 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Numerics </td><td class="markdownTableBodyNone">WENO5 (mapped, monotonicity-preserving), HLLC </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Boundaries </td><td class="markdownTableBodyNone">periodic in x and z, ghost-cell extrapolation in y </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Chemistry </td><td class="markdownTableBodyNone">San Diego mechanism, 9 species, unity-Lewis transport </td></tr>
</table>
<p>x is streamwise, y is cross-stream (the flamelet profile axis), z is spanwise. The resolution density follows the temporal mixing-layer DNS of Wang et al. (<em>Combustion and Flame</em>, 2024), with the box reduced to a quarter of theirs in each direction.</p>
<p>The fuel stream is diluted because pure H2's sound speed is over 4x the oxidizer's, so reaching <span class="tt">Mc = 1.5</span> would demand a velocity split of roughly 2650 m/s. <span class="tt">X_H2 = 0.5</span> brings that to about 1394 m/s and moves the stoichiometric mixture fraction off the domain edge.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md274"></a>
Initial condition</h3>
<p><span class="tt">case.py</span> calls <span class="tt">flamelet_ic.py</span> to solve a 1-D flamelet on the cross-stream grid and write it as <span class="tt">prim.<n>.00.000000.dat</span> under <span class="tt">IC/</span>. <span class="tt">hcid=370</span> would extrude those files uniformly across z and leave the flow z-invariant, so this case uses <span class="tt">hcid=371</span>: it scales the file's cross-stream velocity by <span class="tt">1 + 0.5*cos(k_z z)</span> and sets the spanwise component from the result, giving the IC 3D content at step 0. <span class="tt">k_z = 2*pi/L_z</span> is taken over the global domain, so the IC does not depend on the MPI decomposition.</p>
<p>The in-plane <span class="tt">(x, y)</span> perturbation is baked into the files by <span class="tt">perturb_xy</span>, seeded by <span class="tt">perturb_seed</span> in <span class="tt">case.py</span>. <span class="tt">IC/</span> is gitignored and regenerated on a fresh checkout, so the fixed seed is what keeps the case reproducible. Regeneration is skipped when <span class="tt">IC/</span> already matches the grid and the physical parameters, tracked in <span class="tt">.cache_key.json</span>.</p>
<p>The file spacing must match the run grid. A mismatch aborts in <span class="tt">pre_process</span>, so delete <span class="tt">IC/</span> and let it regenerate after changing the grid or <span class="tt">--scale</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md275"></a>
Running</h3>
<pre class="fragment">./mfc.sh run examples/3D_reacting_mixing_layer/case.py -n 8
</pre><p><span class="tt">--scale</span> shrinks the grid for cheap runs; <span class="tt">--scale 0.05</span> gives 32^3. <span class="tt">--hot</span> runs the full Cantera counterflow flame solve instead of the default cold mollified profile. <span class="tt">flame_strain_rate</span> in <span class="tt">case.py</span> sets the nominal inlet strain rate (default 100/s). The hot profile is mapped by mixture fraction onto the prescribed shear layer; it replaces the former scalar-dissipation-matched flamelet initialization. See <a class="el" href="thermochemistry.html" title="Thermochemistry implementation">Thermochemistry implementation</a> for the model and validation details.</p>
<p>The mechanism ships alongside the case as <span class="tt">sandiego.yaml</span> (UC San Diego Combustion Research Group, <a href="https://web.eng.ucsd.edu/mae/groups/combustion/mechanism.html">https://web.eng.ucsd.edu/mae/groups/combustion/mechanism.html</a>).</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md276"></a>
1D Multi-Component Inert Shock Tube</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>P. J. Martínez Ferrer, R. Buttay, G. Lehnasch, and A. Mura, “A detailed verification procedure for compressible reactive multicomponent Navier–Stokes solvers”, Computers & Fluids, vol. 89, pp. 88–110, Jan. 2014. Accessed: Oct. 13, 2024. [Online]. Available: <a href="https://doi.org/10.1016/j.compfluid.2013.10.014">https://doi.org/10.1016/j.compfluid.2013.10.014</a> </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md277"></a>
Initial Condition</h3>
<p><img src="initial-1D_inert_shocktube-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md278"></a>
Results</h3>
<p><img src="result-1D_inert_shocktube-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md279"></a>
Viscous Shock Tube (2D)</h2>
<p>Reference: See Example 4.13. </p><blockquote class="doxtable">
<p>A.S. Chamarthi, S.H. Frankel, A. Chintagunta, Implicit gradients based novel finite volume scheme for compressible single and multi-component flows, arXiv preprint arXiv:2106.01738 (2021)., see Example 4.13 </p>
</blockquote>
<h4 class="doxsection"><a class="anchor" id="autotoc_md280"></a>
Initial State</h4>
<p><img src="figure0-2D_viscous_shock_tube-example.png" alt="" height="400" class="inline"/></p>
<h4 class="doxsection"><a class="anchor" id="autotoc_md281"></a>
Evolved State</h4>
<p><img src="figure1-2D_viscous_shock_tube-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md282"></a>
Boundary-condition patch geometry has to match the dimensionality</h2>
<p><span class="tt">s_apply_boundary_patches</span> (<span class="tt">src/pre_process/m_boundary_conditions.fpp</span>) dispatches by dimensionality:</p>
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (p > 0) <span class="keywordflow">then</span> <span class="comment">! 3D</span></div>
<div class="line"> <span class="keywordflow">if</span> (patch_bc(i)%geometry == 2) <span class="keyword">call </span>s_circle_bc(i, bc_type)</div>
<div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (patch_bc(i)%geometry == 3) <span class="keyword">call </span>s_rectangle_bc(i, bc_type)</div>
<div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span> (n > 0) <span class="keywordflow">then</span> <span class="comment">! 2D</span></div>
<div class="line"> <span class="keywordflow">if</span> (patch_bc(i)%geometry == 1) <span class="keyword">call </span>s_line_segment_bc(i, bc_type)</div>
</div><!-- fragment --><p>There is no <span class="tt">else</span>. A geometry belonging to the other dimensionality falls straight through: <b>the patch is never applied, nothing is printed, and the face silently keeps whatever <span class="tt">bc_[xyz]</span> gave it.</b></p>
<p>That is quiet in the worst way. A nozzle cut into a no-slip wall with a 3D geometry in a 2D case simply stays a solid wall — the run completes, writes output, and the jet has a velocity of exactly zero for all time with no indication anything was ignored.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md283"></a>
Running it</h3>
<div class="fragment"><div class="line">./mfc.sh validate examples/2D_bc_patch_geometry/case.py # geometry 1, valid in 2D</div>
<div class="line">GEOMETRY=3 ./mfc.sh validate examples/2D_bc_patch_geometry/case.py # a 3D geometry in a 2D case</div>
</div><!-- fragment --><table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone"></th><th class="markdownTableHeadNone">before </th><th class="markdownTableHeadNone">after </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">GEOMETRY=1</span> </td><td class="markdownTableBodyNone">passes </td><td class="markdownTableBodyNone">passes </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">GEOMETRY=3</span> </td><td class="markdownTableBodyNone"><b>passes, then does nothing at run time</b> </td><td class="markdownTableBodyNone"><span class="tt">patch_bc(1)geometry must be 1 (line segment) in 2D; geometry 3 is never applied</span> </td></tr>
</table>
<p>The 3D direction is symmetric: geometry 1 in a 3D case is equally ignored, and is now equally refused.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md284"></a>
A second trap in the same corner</h3>
<p>The case carries a second initial-condition patch a few cells thick at the inlet, and it is load-bearing: the Dirichlet buffer is filled by pre_process from the <b>initial condition at the boundary face</b>. A domain initialised at rest stores rest in that buffer, and the "inflow" then delivers zero for all time — again with no warning. This is not what the validator change addresses; it is noted here because the two failures look identical from the outside, and knowing that saves working out which one is in play.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md285"></a>
Scope</h3>
<p>Validator only; no source change and no golden files. All 182 example cases still validate.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md286"></a>
2D Power-Law (Shear-Thickening) Poiseuille Channel</h2>
<p>Validates the <b>power-law term</b> of MFC's Herschel-Bulkley non-Newtonian viscosity against a closed-form analytic Poiseuille profile, in the shear-**thickening** regime (<span class="tt">nn > 1</span>): the velocity profile is more <b>pointed</b> (sharper-topped) than a parabola. Companion to <span class="tt">examples/2D_poiseuille_nn</span> (shear-thinning, <span class="tt">nn = 0.7</span>).</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md287"></a>
Regime and parameters</h3>
<p>Single Papanastasiou-regularized Herschel-Bulkley fluid with <b>no yield stress</b> (<span class="tt">tau0 = 0</span>), so the effective viscosity is the pure power law <span class="tt">mu = K*gamma_dot^(n-1)</span>, clamped to <span class="tt">[mu_min, mu_max]</span>:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)K</span> </td><td class="markdownTableBodyNone"><span class="tt">5.0e-2</span> </td><td class="markdownTableBodyNone">consistency index </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">1.5</span> </td><td class="markdownTableBodyNone">flow index <span class="tt">> 1</span> -> shear-thickening </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">0.0</span> </td><td class="markdownTableBodyNone">no yield stress (pure power law) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1000.0</span> </td><td class="markdownTableBodyNone">Papanastasiou regularization parameter </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">0.035</span> </td><td class="markdownTableBodyNone">viscosity clamp </td></tr>
</table>
<p>Driven by a constant body acceleration <span class="tt">g_x = 5e-2</span>, <span class="tt">rho = 1</span>, <span class="tt">pres = 10</span> (sound speed ~3.74), giving <span class="tt">u_max ~ 0.013</span> and Mach ~3e-3 (effectively incompressible). Channel <span class="tt">L_y = 0.2</span>, half-height <span class="tt">H = L_y/2 = 0.1</span>, no-slip walls at <span class="tt">y = 0, L_y</span>, periodic in <span class="tt">x</span>. Grid <span class="tt">m = 24</span> (x), <span class="tt">n = 63</span> (y).</p>
<p>For <span class="tt">n > 1</span> the maximum physical viscosity is at the <b>wall</b> (highest shear rate), <span class="tt">mu_wall = K^(1/n) * (rho*g*H)^((n-1)/n) = 0.0232</span>. <span class="tt">mu_max = 0.035 ~ 1.5*mu_wall</span> sits just above that maximum, so the clamp <b>never activates</b> (the analytic profile stays exact everywhere) while keeping the explicit viscous timestep large — the timestep scales as <span class="tt">1/mu_max</span>, so set <span class="tt">mu_max</span> just above the physical maximum viscosity.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md288"></a>
Governing physics and analytic solution</h3>
<p>Fully-developed steady channel flow balances the body force against the shear stress, <span class="tt">tau = rho*g*(H - y)</span>. With <span class="tt">tau = K*|du/dy|^n</span> (power law) the closed form is </p><pre class="fragment">u(y) = (n/(n+1)) * (rho*g/K)^(1/n) * ( H^((n+1)/n) - |y - H|^((n+1)/n) )
</pre><p>(<span class="tt">n < 1</span> blunt/flat-topped; <span class="tt">n = 1</span> parabola; <span class="tt">n > 1</span> pointed). For <span class="tt">n > 1</span> the effective viscosity <span class="tt">mu = K*gamma_dot^(n-1) -> 0</span> at the shear-free centerline (rather than diverging as for <span class="tt">n < 1</span>), so no regularization cap is needed and the analytic profile is an exact reference everywhere.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md289"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_poiseuille_thickening_nn/case.py -n 2
python examples/2D_poiseuille_thickening_nn/compare_analytic.py
</pre><p>The run reaches <span class="tt">t_stop = 0.9</span> (~2 wall-viscous diffusion times) in ~1 min on 2 CPU ranks with <span class="tt">dt = 8.4e-5</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md290"></a>
Validation result</h3>
<p>Relative L2 error vs. the analytic power-law profile: <b>1.46%</b> (2-rank run, steady-state drift between the last two saves 3.9e-3). The local momentum balance <span class="tt">K*|du/dy|^n = rho*g*(H-y)</span> holds to ~1.4% across the channel, and the profile bluntness (mean/peak = <b>0.626</b>) matches the <span class="tt">n = 1.5</span> theory <span class="tt">(n+1)/(2n+1) = 0.625</span>, confirming the pointed shear-thickening profile. <span class="tt">u_max = 1.288e-2</span> matches the analytic <span class="tt">1.291e-2</span>, confirming the clamp stays inactive.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md291"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md292"></a>
Probe files across a re-run</h2>
<p><span class="tt">s_open_probe_files</span> appends whenever <span class="tt">D/probe*_prim.dat</span> already exists:</p>
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (file_exist) <span class="keywordflow">then</span></div>
<div class="line"> <span class="keyword">open</span> (..., status=<span class="stringliteral">'old'</span>, position=<span class="stringliteral">'append'</span>)</div>
</div><!-- fragment --><p>That is correct when a run is being <b>continued</b>. It is wrong when one is being <b>started over</b>, which is what happens every time a case is re-run in place after a parameter change. The second run's rows land on top of the first's, nothing in the file marks the join, and the time column simply resets partway down. A reader sees one monotonic series and is silently wrong.</p>
<p>There is no warning, no header and no separator. The two runs need not even share a grid — a case whose resolution changed between runs produces a file whose first half was recorded at different probe locations.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md293"></a>
Reproducing</h3>
<div class="fragment"><div class="line">./mfc.sh run examples/2D_probe_rerun/case.py -n 1 # 20 steps</div>
<div class="line">./mfc.sh run examples/2D_probe_rerun/case.py -n 1 # same again, from scratch</div>
<div class="line">wc -l D/probe1_prim.dat</div>
</div><!-- fragment --><table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone"></th><th class="markdownTableHeadNone">rows in <span class="tt">D/probe1_prim.dat</span> </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">before </td><td class="markdownTableBodyNone"><b>40</b> — two runs of 20, spliced </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">after </td><td class="markdownTableBodyNone"><b>20</b> </td></tr>
</table>
<p>And the time column, read straight through, before the fix:</p>
<div class="fragment"><div class="line">0.028977</div>
<div class="line">0.030682</div>
<div class="line">0.032386 <- end of run 1</div>
<div class="line">0.000000 <- run 2 starts, time goes backwards</div>
<div class="line">0.001705</div>
<div class="line">0.003409</div>
</div><!-- fragment --><h3 class="doxsection"><a class="anchor" id="autotoc_md294"></a>
The fix</h3>
<p>Append only when continuing: <span class="tt">t_step_start > 0</span>, or <span class="tt">n_start > 0</span> under <span class="tt">cfl_dt</span>. A fresh start replaces the file, which is what every other output MFC writes already does. <span class="tt">s_open_com_files</span> had the same pattern and gets the same treatment.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md295"></a>
Why it matters beyond tidiness</h3>
<p>This produced three separate wrong numbers in one project before it was noticed. The worst was a jet whose probe files held a t = 15 run of 4,962 rows followed by a t = 40 run of 13,233 — <b>on different grids</b>. Read together they manufactured a velocity drop of 0.99 U_j in a single sample, which was time running backwards at the seam and was diagnosed as a physical instability first.</p>
<p>A related symptom is louder and easier to spot: if the probe output format changes between runs, the column count changes partway down the file and <span class="tt">numpy.loadtxt</span> refuses it outright ("the number of columns changed
from 11 to 18"). That one at least announces itself. The time reset does not.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md296"></a>
2D Shear-Thinning Lid-Driven Cavity</h2>
<p>Qualitative demonstration of MFC's Herschel-Bulkley non-Newtonian viscosity in a recirculating flow. A shear-thinning fluid fills a unit square cavity driven by a moving top lid. Unlike the Poiseuille examples, <b>this case has no closed-form analytic solution</b> — it is a qualitative demonstration of the expected shear-thinning trend (a primary vortex center shifted toward the moving lid, with stronger near-wall velocity gradients relative to the Newtonian case).</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md297"></a>
Regime and parameters</h3>
<p>Two identical Papanastasiou-regularized Herschel-Bulkley fluids (a two-fluid setup sharing one rheology), pure power law (<span class="tt">tau0 = 0</span>):</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(i)K</span> </td><td class="markdownTableBodyNone"><span class="tt">1.0e-2</span> </td><td class="markdownTableBodyNone">consistency index; <span class="tt">Re_eff = 1/K = 100</span> at unit shear rate </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(i)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">0.5</span> </td><td class="markdownTableBodyNone">flow index <span class="tt">< 1</span> -> shear-thinning </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(i)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">0.0</span> </td><td class="markdownTableBodyNone">no yield stress (pure power law) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(i)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1000.0</span> </td><td class="markdownTableBodyNone">Papanastasiou regularization parameter </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(i)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">1.0</span> </td><td class="markdownTableBodyNone">viscosity clamp </td></tr>
</table>
<p>Unit square <span class="tt">[0,1]^2</span>, <span class="tt">m = n = 99</span> (coarse smoke-run grid), all walls no-slip with the top lid moving at <span class="tt">bc_yve1 = 0.5</span>. Effective Reynolds number <span class="tt">Re_eff = 1/K = 100</span> at unit shear rate; the conventional lid-based Reynolds number <span class="tt">rho*U*L/mu(1) = 0.5/1e-2 = 50</span> with <span class="tt">U = 0.5</span> and <span class="tt">mu(1) = K</span>.</p>
<p>The auto-registered CI test of this example is truncated to 50 time steps and serves as smoke coverage only, not a physics anchor.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md298"></a>
Governing physics</h3>
<p>Incompressible recirculating cavity flow with the shear-dependent power-law viscosity <span class="tt">mu = K*gamma_dot^(n-1)</span>. With <span class="tt">n < 1</span> the fluid thins under the strong shear beneath the lid and in the corner boundary layers, while the slow cavity core stays comparatively viscous.</p>
<p><b>What to look for</b> (qualitative, no analytic match): a primary recirculating vortex whose center, relative to a Newtonian cavity at the same Reynolds number, is shifted toward the moving lid, with stronger near-wall velocity gradients — the expected shear-thinning trend. Do not expect a quantitative error; the committed grid (<span class="tt">m = n = 99</span>) is intentionally coarse. For quantitative comparison use <span class="tt">m = n = 499</span> or finer with a longer <span class="tt">t_step_stop</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md299"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_lid_driven_cavity_nn/case.py -n 2
</pre><p>Post-process and inspect the velocity / vorticity (<span class="tt">omega_wrt(3)</span>) fields; there is no <span class="tt">compare_analytic.py</span> for this qualitative case.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md300"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md301"></a>
Rayleigh-Taylor Instability (3D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md302"></a>
Final Condition and Linear Theory</h3>
<p><img src="final_condition-3D_rayleigh_taylor-example.png" alt="" height="400" class="inline"/> <img src="linear_theory-3D_rayleigh_taylor-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md303"></a>
Lid-Driven Cavity Problem (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Bezgin, D. A., & Buhendwa A. B., & Adams N. A. (2022). JAX-FLUIDS: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows. arXiv:2203.13760 </p>
</blockquote>
<blockquote class="doxtable">
<p>Ghia, U., & Ghia, K. N., & Shin, C. T. (1982). High-re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method. Journal of Computational Physics, 48, 387-411 </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md304"></a>
Final Condition</h3>
<p><img src="final_condition-2D_lid_driven_cavity-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md305"></a>
Centerline Velocities</h3>
<p><img src="centerline_velocities-2D_lid_driven_cavity-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md306"></a>
Scaling and Performance test</h2>
<p>The scaling case can exercise both weak- and strong-scaling. It adjusts itself depending on the number of requested ranks.</p>
<p>This directory also contains a collection of scripts used to test strong and weak scaling on OLCF Frontier.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md307"></a>
Weak Scaling</h3>
<p>Pass <span class="tt">--scaling weak</span>. The <span class="tt">--memory</span> option controls (approximately) how much memory each rank should use, in Gigabytes. The number of cells in each dimension is then adjusted according to the number of requested ranks and an approximation for the relation between cell count and memory usage. The problem size increases linearly with the number of ranks.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md308"></a>
Strong Scaling</h3>
<p>Pass <span class="tt">--scaling strong</span>. The <span class="tt">--memory</span> option controls (approximately) how much memory should be used in total during simulation, across all ranks, in Gigabytes. The problem size remains constant as the number of ranks increases.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md309"></a>
Example</h3>
<p>For example, to run a weak-scaling test that uses ~4GB of GPU memory per rank on 8 2-rank nodes with case optimization, one could:</p>
<div class="fragment"><div class="line">./mfc.sh run examples/scaling/benchmark.py -t pre_process simulation \</div>
<div class="line"> -e batch -p mypartition -N 8 -n 2 -w "01:00:00" -# "MFC Weak Scaling" \</div>
<div class="line"> --case-optimization -j 32 -- --scaling weak --memory 4</div>
</div><!-- fragment --><h2 class="doxsection"><a class="anchor" id="autotoc_md310"></a>
Titarev-Toro problem (1D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>V. A. Titarev, E. F. Toro, Finite-volume WENO schemes for three-dimensional conservation laws, Journal of Computational Physics 201 (1) (2004) 238–260. </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md311"></a>
Initial Condition</h3>
<p><img src="initial-1D_titarevtorro-example.png" alt="" heiht="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md312"></a>
Result</h3>
<p><img src="result-1D_titarevtorro-example.png" alt="" heiht="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md313"></a>
Rayleigh-Taylor Instability (2D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md314"></a>
Final Condition and Linear Theory</h3>
<p><img src="result-2D_rayleigh_taylor-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md315"></a>
IBM Bow Shock (3D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md316"></a>
Final Condition</h3>
<p><img src="result-3D_ibm_bowshock-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md317"></a>
Immersed-boundary force on a thin plate (issue #1849)</h2>
<p>A 2D flat plate pitching about its leading edge, 0 → 45° on an Eldredge smoothed ramp (a = 21), K = π/8 (case C1), Re_c = 300, Ma 0.2, plate thickness 2.5 % of chord. There is a published measurement to compare against:</p>
<blockquote class="doxtable">
<p>Jantzen, Taira, Granlund & Ol, <em>Phys. Fluids</em> <b>26</b>, 053606 (2014), Fig. 10, 2D panel, curve C1. </p>
</blockquote>
<p><span class="tt">C_L = F_y / (½ ρ U² c) = 2 F_y</span> here, with ρ = U = c = 1 and MFC's 2D force being per unit depth.</p>
<p>This case exists to <b>measure</b> the defect in #1849, not to fix it. Whoever does fix it needs a number to move.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md318"></a>
Running the sweep</h3>
<p><span class="tt">NCELL</span> sets how many cells lie across the plate thickness. The physical problem is identical at every level — same chord, same thickness, same domain, same times — so the sweep isolates the resolution requirement from any change of geometry, which a thickness sweep would confound.</p>
<div class="fragment"><div class="line">NCELL=2 ./mfc.sh run examples/2D_ibm_thin_plate_force/case.py # dx = 0.0125 c, 0.22 M cells</div>
<div class="line">NCELL=4 ./mfc.sh run examples/2D_ibm_thin_plate_force/case.py # dx = 0.00625 c, 0.90 M cells</div>
<div class="line">NCELL=8 ./mfc.sh run examples/2D_ibm_thin_plate_force/case.py # dx = 0.003125 c, 3.58 M cells</div>
<div class="line">NCELL=16 ./mfc.sh run examples/2D_ibm_thin_plate_force/case.py # dx = 0.0015625 c, 14.3 M cells</div>
</div><!-- fragment --><p><span class="tt">SUMMARY=1 python3 case.py</span> prints the grid and step count without running anything.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md319"></a>
What the sweep shows</h3>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">cells across the thickness </th><th class="markdownTableHeadNone">peak C_L </th><th class="markdownTableHeadNone">C_L at t = 4 </th><th class="markdownTableHeadNone">rms difference from the reference </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">2 </td><td class="markdownTableBodyNone">6.413 </td><td class="markdownTableBodyNone">1.209 </td><td class="markdownTableBodyNone">20.9 % </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">4 </td><td class="markdownTableBodyNone">4.682 </td><td class="markdownTableBodyNone">1.271 </td><td class="markdownTableBodyNone">33.5 % </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">8 </td><td class="markdownTableBodyNone">4.458 </td><td class="markdownTableBodyNone">1.111 </td><td class="markdownTableBodyNone">27.9 % </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">16 </td><td class="markdownTableBodyNone">4.833 </td><td class="markdownTableBodyNone">1.005 </td><td class="markdownTableBodyNone">26.9 % </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">reference </td><td class="markdownTableBodyNone">6.998 </td><td class="markdownTableBodyNone">1.521 </td><td class="markdownTableBodyNone">— </td></tr>
</table>
<p>Two separate readings:</p>
<p><b>The peak converges from four cells up.</b> 4.682, 4.458 and 4.833 across a fourfold refinement — a spread of 8 % with no trend. Two cells is genuinely under-resolved and 35 % out; four is enough. So a thin body does not need ten or more cells before the immersed boundary resolves it, which is worth knowing on its own for cost estimates.</p>
<p><b>The disagreement with the reference does not shrink.</b> The last column sits at 27–34 % at every resolution and shows no sign of falling as the grid refines. <b>That is the measurement that matters for #1849</b>: it rules out under-resolution as the explanation and points at the force computation itself.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md320"></a>
Why a zero-reference check is not available here</h3>
<p>The obvious cheap test — a symmetric body whose true force is exactly zero — does not apply to a pitching plate, whose lift is large and unknown. For that style of check see <span class="tt">examples/2D_ibm_force_decomposition</span> (a cylinder, whose lift must be zero) and <span class="tt">examples/3D_ibm_neighborhood_radius</span>. This case trades the exact reference for a published one.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md321"></a>
Related</h3>
<ul>
<li>#1849 — the force integral over body cells on a thin plate, which this measures</li>
<li>#1859 — an out-of-bounds coefficient read in the same force path, fixed</li>
<li>#1863 — a spurious transverse force on multi-rank runs, open</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md322"></a>
Azimuthal Fourier conduction convergence (3D cylindrical)</h2>
<p>Third member of the conduction verification set, after <span class="tt">examples/1D_conduction_convergence</span> (Cartesian) and <span class="tt">examples/2D_axisym_conduction_convergence</span> (radial, plus the axis cell). Both of those run at <span class="tt">p = 0</span> and therefore have no azimuthal direction at all. This case covers it.</p>
<p>In 3D cylindrical mode (<span class="tt">grid_geometry == 3</span>) the third coordinate is the azimuth and <span class="tt">dz</span> is in <b>radians</b>, so the azimuthal term carries two metric factors, <span class="tt">(1/r^2) d2T/dtheta2</span>: one for the gradient and one for the divergence. <span class="tt">m_rhs.fpp</span> divides the conduction flux difference by <span class="tt">dz(l)</span> alone, so both factors have to come out of <span class="tt">grid_spacing</span> in <span class="tt">m_conduction.fpp</span>, which is why that direction uses <span class="tt">y_cc(y)**2 * (z_cc(z+1) - z_cc(z))</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md323"></a>
Exact solution</h3>
<p>Ideal gas, so <span class="tt">T = p / ((Gamma - 1) * rho * cv)</span>. Setting </p><pre class="fragment">rho(r, theta) = RHO0 / (1 + A (r/R)^2 cos(theta))
</pre><p>at uniform pressure gives exactly </p><pre class="fragment">T(r, theta) = T0 (1 + A (r/R)^2 cos(theta)), T0 = P0 / ((Gamma - 1) RHO0 cv),
</pre><p>which is single-valued and smooth on the axis. Its cylindrical Laplacian splits into </p><pre class="fragment">(1/r) d/dr (r dT/dr) = +4 A T0 cos(theta) / R^2 (radial half)
(1/r^2) d2T/dtheta2 = -1 A T0 cos(theta) / R^2 (azimuthal half)
</pre><p>and the sum, <span class="tt">3 A T0 cos(theta) / R^2</span>, is <b>independent of <span class="tt">r</span></b>. At <span class="tt">t = 0</span> the velocity is zero and the pressure uniform, so every Euler flux and every cylindrical geometric source vanishes and the whole right-hand side is conduction: </p><pre class="fragment">(rho E(dt) - rho E(0)) / dt = k grad^2 T + O(dt).
</pre><p>The radial half is reproduced <em>exactly</em> by the discretization: the 3D cylindrical <span class="tt">r</span>-grid is uniform (<span class="tt">m_grid.f90</span> only half-cells the axis for <span class="tt">grid_geometry == 2</span>), <span class="tt">T</span> is quadratic in <span class="tt">r</span>, and both the two-point face gradient and the two-point average of <span class="tt">F</span> are exact for that. Subtracting it therefore isolates the azimuthal half, and <span class="tt">compare_analytic.py</span> reports it ring by ring. Dropping either metric factor multiplies the azimuthal half by <span class="tt">r^2</span>, which no refinement removes.</p>
<p>Boundaries: periodic in <span class="tt">x</span> and in <span class="tt">theta</span>, so the azimuthal direction has no boundary error at all. Excluded from the bulk error are cell <span class="tt">k = 0</span>, which reads the ghost across the axis (the documented non-converging axis error), and the two outermost cells: <span class="tt">k = NR-1</span> reads the mirrored wall ghost where <span class="tt">dT/dr</span> is not actually zero, and <span class="tt">k = NR-2</span> picks up an <span class="tt">O(dt)</span> share of that through the later Runge-Kutta stages.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md324"></a>
Running</h3>
<pre class="fragment">for np_ in 32 64 128 256; do
NP=$np_ ./mfc.sh run examples/3D_cyl_azimuthal_conduction_convergence/case.py -n 1
NP=$np_ ./build/venv/bin/python3 examples/3D_cyl_azimuthal_conduction_convergence/compare_analytic.py
done
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md325"></a>
Observed results</h3>
<p><span class="tt">NR = 32</span>, <span class="tt">NX = 32</span>, exact <span class="tt">= 7.5e-01 cos(theta)</span>. The azimuthal truncation error of a centered second difference is <span class="tt">-dtheta^2/12</span> of the azimuthal half, i.e. <span class="tt">dtheta^2/36</span> of the total, and nothing else contributes:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">NP </th><th class="markdownTableHeadNone">bulk L2 rel err </th><th class="markdownTableHeadNone">order </th><th class="markdownTableHeadNone">predicted <span class="tt">dtheta^2/36</span> </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">32 </td><td class="markdownTableBodyNone">1.070e-03 </td><td class="markdownTableBodyNone">– </td><td class="markdownTableBodyNone">1.071e-03 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">64 </td><td class="markdownTableBodyNone">2.676e-04 </td><td class="markdownTableBodyNone">2.00 </td><td class="markdownTableBodyNone">2.677e-04 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">128 </td><td class="markdownTableBodyNone">6.689e-05 </td><td class="markdownTableBodyNone">2.00 </td><td class="markdownTableBodyNone">6.693e-05 </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">256 </td><td class="markdownTableBodyNone">1.670e-05 </td><td class="markdownTableBodyNone">2.00 </td><td class="markdownTableBodyNone">1.673e-05 </td></tr>
</table>
<p>Azimuthal half recovered ring by ring, as a fraction of its exact value (<span class="tt">NP = 64</span>, so the expected value is <span class="tt">1 - dtheta^2/12 = 0.999197</span> at every radius):</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">r </th><th class="markdownTableHeadNone">0.094 </th><th class="markdownTableHeadNone">0.531 </th><th class="markdownTableHeadNone">1.031 </th><th class="markdownTableHeadNone">1.844 </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">got/exact </td><td class="markdownTableBodyNone">0.999199 </td><td class="markdownTableBodyNone">0.999197 </td><td class="markdownTableBodyNone">0.999197 </td><td class="markdownTableBodyNone">0.999197 </td></tr>
</table>
<p>Flat across a 20x span in <span class="tt">r</span>, i.e. a 380x span in <span class="tt">r^2</span>. Refining <span class="tt">NR</span> at fixed <span class="tt">NP</span> leaves the bulk error unchanged (2.676e-04 at <span class="tt">NR = 32</span>, 2.656e-04 at <span class="tt">NR = 64</span>), confirming that the radial half contributes no error and that the table above is a pure azimuthal measurement.</p>
<p>Without the <span class="tt">r^2</span> in <span class="tt">grid_spacing</span> the same <span class="tt">NP = 64</span> run gives a bulk L2 of 3.542e-01 and a ring-by-ring azimuthal ratio of 0.0088, 0.282, 1.063, 3.397 at those four radii – exactly <span class="tt">r^2</span>, and independent of resolution.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md326"></a>
Perfectly Stirred Reactor</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>G. B. Skinner and G. H. Ringrose, “Ignition Delays of a Hydrogen—Oxygen—Argon Mixture at Relatively Low Temperatures”, J. Chem. Phys., vol. 42, no. 6, pp. 2190–2192, Mar. 1965. Accessed: Oct. 13, 2024. </p>
</blockquote>
<p><img src="result-nD_perfect_reactor-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md327"></a>
Validation</h3>
<p>After running the simulation, compare MFC species mass fractions and induction time against a Cantera 0-D ideal-gas reactor reference:</p>
<div class="fragment"><div class="line">python analyze.py</div>
</div><!-- fragment --><p>This reads the Silo output, runs an equivalent Cantera reactor, prints the induction times (Skinner et al. / Cantera / (Che)MFC), and saves <span class="tt">plots-nD_perfect_reactor-example.png</span>. All dependencies are installed automatically by the MFC toolchain.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md328"></a>
2D Power-Law (Shear-Thinning) Poiseuille Channel</h2>
<p>Validates the <b>power-law term</b> of MFC's Herschel-Bulkley non-Newtonian viscosity against a closed-form analytic Poiseuille profile. Demonstrates the shear-thinning regime (<span class="tt">nn < 1</span>): the velocity profile is blunter (flatter-topped) than a parabola.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md329"></a>
Regime and parameters</h3>
<p>Single Papanastasiou-regularized Herschel-Bulkley fluid with <b>no yield stress</b> (<span class="tt">tau0 = 0</span>), so the effective viscosity is the pure power law <span class="tt">mu = K*gamma_dot^(n-1)</span>, clamped to <span class="tt">[mu_min, mu_max]</span>:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Parameter </th><th class="markdownTableHeadNone">Value </th><th class="markdownTableHeadNone">Role </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)K</span> </td><td class="markdownTableBodyNone"><span class="tt">2.0e-2</span> </td><td class="markdownTableBodyNone">consistency index </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)nn</span> </td><td class="markdownTableBodyNone"><span class="tt">0.7</span> </td><td class="markdownTableBodyNone">flow index <span class="tt">< 1</span> -> shear-thinning </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)tau0</span> </td><td class="markdownTableBodyNone"><span class="tt">0.0</span> </td><td class="markdownTableBodyNone">no yield stress (pure power law) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)hb_m</span> </td><td class="markdownTableBodyNone"><span class="tt">1000.0</span> </td><td class="markdownTableBodyNone">Papanastasiou regularization parameter </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><span class="tt">fluid_pp(1)mu_min</span>/<span class="tt">mu_max</span> </td><td class="markdownTableBodyNone"><span class="tt">1e-6</span> / <span class="tt">10.0</span> </td><td class="markdownTableBodyNone">viscosity clamp </td></tr>
</table>
<p>Driven by a constant body acceleration <span class="tt">g_x = 8e-2</span>, <span class="tt">rho = 1</span>, <span class="tt">pres = 10</span> (sound speed ~3.74), giving <span class="tt">u_max ~ 0.011</span> and Mach ~3e-3 (effectively incompressible). Channel <span class="tt">L_y = 0.2</span>, half-height <span class="tt">H = L_y/2 = 0.1</span>, no-slip walls at <span class="tt">y = 0, L_y</span>, periodic in <span class="tt">x</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md330"></a>
Governing physics and analytic solution</h3>
<p>Fully-developed steady channel flow balances the body force against the shear stress, <span class="tt">tau = rho*g*(H - y)</span>. With <span class="tt">tau = K*|du/dy|^n</span> (power law) the closed form is </p><pre class="fragment">u(y) = (n/(n+1)) * (rho*g/K)^(1/n) * ( H^((n+1)/n) - |y - H|^((n+1)/n) )
</pre><p>(<span class="tt">n < 1</span> blunt/flat-topped; <span class="tt">n = 1</span> parabola; <span class="tt">n > 1</span> pointed). For <span class="tt">n < 1</span> the viscosity diverges at the shear-free centerline, so any regularized solver caps it there; the near-wall momentum balance <span class="tt">K*|du/dy|^n = rho*g*(H-y)</span> is the cleanest pointwise correctness test and holds regardless of the cap.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md331"></a>
How to run</h3>
<pre class="fragment">./mfc.sh run examples/2D_poiseuille_nn/case.py -n 2
python examples/2D_poiseuille_nn/compare_analytic.py
</pre><h3 class="doxsection"><a class="anchor" id="autotoc_md332"></a>
Validation result</h3>
<p>Relative L2 error vs. the analytic power-law profile: <b>0.68%</b> (2-rank run, steady state confirmed). The local momentum balance holds to ~0.1% across the channel, and the profile bluntness (mean/peak = <b>0.706</b>) matches the <span class="tt">n = 0.7</span> theory <span class="tt">(n+1)/(2n+1) = 0.708</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md333"></a>
References</h3>
<ul>
<li>Papanastasiou, T. C. (1987). Flows of materials with yield. <em>J. Rheol.</em> 31, 385.</li>
</ul>
<h2 class="doxsection"><a class="anchor" id="autotoc_md334"></a>
Richtmyer-Meshkov Instability (2D)</h2>
<p>Reference: See Example 4.18. </p><blockquote class="doxtable">
<p>A.S. Chamarthi, S.H. Frankel, A. Chintagunta, Implicit gradients based novel finite volume scheme for compressible single and multi-component flows, arXiv preprint arXiv:2106.01738 (2021). </p>
</blockquote>
<h4 class="doxsection"><a class="anchor" id="autotoc_md335"></a>
Initial State</h4>
<p><img src="figure0-2D_richtmyer_meshkov-example.png" alt="" height="400" class="inline"/></p>
<h4 class="doxsection"><a class="anchor" id="autotoc_md336"></a>
Evolved State</h4>
<p><img src="figure1-2D_richtmyer_meshkov-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md337"></a>
Automatic <span class="tt">ib_neighborhood_radius</span> when ranks are not cubes</h2>
<p><span class="tt">ib_neighborhood_radius</span> is a count of <b>rank hops</b>. A rank keeps an immersed-boundary patch only while the patch's centroid lies inside its own subdomain grown outward by that many hops (<span class="tt">s_get_neighbor_bounds</span>, <span class="tt">f_neighborhood_ranks_own_location</span>), and drops it otherwise. So the radius has to be large enough that the body is reachable within that many hops <b>in every direction</b> — and the hop that needs the most is the one stepping across the <em>thinnest</em> rank.</p>
<p>When the radius is not set in the case file, MFC chooses it from the body's half-extent divided by a rank width. The width it used was assembled the wrong way round:</p>
<div class="fragment"><div class="line">local_rank_width = -1._wp</div>
<div class="line"><span class="keywordflow">do</span> each direction:</div>
<div class="line"> local_rank_width = max(local_rank_width, <this rank<span class="stringliteral">'s extent in that direction>)</span></div>
<div class="line"><span class="stringliteral"></span> </div>
</div><!-- fragment --><p>Each rank reports its <b>widest</b> extent, and the minimum is taken over ranks. On a decomposition where every rank is long in one direction and thin in another, the reported width is the long one, the radius comes out too small, and ranks that should have kept the patch drop it.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md338"></a>
The case</h3>
<p>A thin plate in a long, narrow channel: 20 chords by 8 by 6, with 400 x 50 x 50 cells chosen so MFC's topology search settles on <b>16 x 2 x 2</b> at 64 ranks. That is an ordinary shape for a wake, a jet or a channel — the flow direction resolved far more finely than the cross-stream ones — and it makes the ranks strongly anisotropic:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">direction </th><th class="markdownTableHeadNone">ranks </th><th class="markdownTableHeadNone">extent per rank </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">x </td><td class="markdownTableBodyNone">16 </td><td class="markdownTableBodyNone"><b>1.250</b> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">y </td><td class="markdownTableBodyNone">2 </td><td class="markdownTableBodyNone">4.000 </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">z </td><td class="markdownTableBodyNone">2 </td><td class="markdownTableBodyNone">3.000 </td></tr>
</table>
<p>The plate is 1.0 x 2.4 x 0.1, so <span class="tt">s_get_ib_bound</span> (geometry 9, the cuboid's half-diagonal) returns <b>1.3010</b>. Crossing that at 1.250 per hop needs <span class="tt">ceil(1.1 * 1.3010 / 1.250) = 2</span> hops. The old width of 4.000 gives <span class="tt">ceil(1.1 * 1.3010 / 4.000) = 1</span>.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md339"></a>
Running it</h3>
<div class="fragment"><div class="line">./mfc.sh run examples/3D_ibm_neighborhood_radius/case.py -n 64</div>
</div><!-- fragment --><p>and read the line MFC prints at start-up:</p>
<div class="fragment"><div class="line">Automatic choice of ib_neighborhood_radius selected: N</div>
</div><!-- fragment --><table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone"></th><th class="markdownTableHeadNone">printed radius </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">before </td><td class="markdownTableBodyNone"><b>1</b> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">after </td><td class="markdownTableBodyNone"><b>2</b> </td></tr>
</table>
<p>Both runs complete; the case is 1 M cells and takes a few minutes on two CPU nodes. <span class="tt">SUMMARY=1 python3
case.py</span> prints the half-extent, the rank extents and the arithmetic above without running anything.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md340"></a>
It is not only this case</h3>
<p>The same two production grids that motivated the fix, measured from their own <span class="tt">lustre_*_cb.dat</span>:</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">case </th><th class="markdownTableHeadNone">topology </th><th class="markdownTableHeadNone">old width </th><th class="markdownTableHeadNone">old radius </th><th class="markdownTableHeadNone">new width </th><th class="markdownTableHeadNone">new radius </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">gust encounter, 128 ranks </td><td class="markdownTableBodyNone">16 x 2 x 4 </td><td class="markdownTableBodyNone">2.051 </td><td class="markdownTableBodyNone">1 </td><td class="markdownTableBodyNone">1.052 </td><td class="markdownTableBodyNone"><b>2</b> </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">flapping wing, 128 ranks </td><td class="markdownTableBodyNone">8 x 4 x 4 </td><td class="markdownTableBodyNone">1.745 </td><td class="markdownTableBodyNone">1 </td><td class="markdownTableBodyNone">1.027 </td><td class="markdownTableBodyNone"><b>2</b> </td></tr>
</table>
<p>Both pick 1 where 2 is required.</p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md341"></a>
Scope</h3>
<p>The new width is never larger than the old one, so the chosen radius never decreases: the change can only make the neighbourhood more conservative, at the cost of more hops in the force reduction. Cases that set <span class="tt">ib_neighborhood_radius</span> explicitly are untouched, and so is any decomposition whose ranks are close to cubic, where the widest and narrowest extents coincide — which is why a uniform grid with a balanced topology shows no difference.</p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md342"></a>
2D Triple Point (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Trojak, W., & Dzanic, T. Positivity-preserving discoutinous spectral element method for compressible multi-species flows. arXiv:2308.02426 </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md343"></a>
Numerical Schlieren at Final Time</h3>
<p><img src="final-2D_triple_point-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md344"></a>
Gas Jet (2D)</h2>
<h3 class="doxsection"><a class="anchor" id="autotoc_md345"></a>
Final Condition</h3>
<p><img src="final_condition-2D_jet-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md346"></a>
Lax shock tube problem (1D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>P. D. Lax, Weak solutions of nonlinear hyperbolic equations and their numerical computation, Communications on pure and applied mathematics 7 (1) (1954) 159–193. </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md347"></a>
Initial Condition</h3>
<p><img src="initial-1D_laxshocktube-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md348"></a>
Result</h3>
<p><img src="result-1D_laxshocktube-example.png" alt="" height="400" class="inline"/></p>
<h2 class="doxsection"><a class="anchor" id="autotoc_md349"></a>
Isentropic vortex problem (2D)</h2>
<p>Reference: </p><blockquote class="doxtable">
<p>Coralic, V., & Colonius, T. (2014). Finite-volume Weno scheme for viscous compressible multicomponent flows. Journal of Computational Physics, 274, 95–121. <a href="https://doi.org/10.1016/j.jcp.2014.06.003">https://doi.org/10.1016/j.jcp.2014.06.003</a> </p>
</blockquote>
<h3 class="doxsection"><a class="anchor" id="autotoc_md350"></a>
Density</h3>
<p><img src="alpha_rho1-2D_isentropicvortex-example.png" alt="" height="400" class="inline"/></p>
<h3 class="doxsection"><a class="anchor" id="autotoc_md351"></a>
Density Norms</h3>
<p><img src="density_norms-2D_isentropicvortex-example.png" alt="" height="400" class="inline"/></p>
<div style="text-align:center; font-size:0.75rem; color:#888; padding:16px 0 0;">Page last updated: 2026-10-07</div> </div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- HTML footer for doxygen 1.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath">
<ul></ul>
</div>
</body>
</html>

