Skip to content

Commit fac04e9

Browse files
committed
refactor: consolidate stretch and body force params into derived types
Implements items 7 and 5 from issue #1427: - x_a/x_b/y_a/y_b/z_a/z_b -> type(bounds_info) :: x_stretch, y_stretch, z_stretch - bf_x/bf_y/bf_z + k_x/w_x/p_x/g_x (and y/z) -> type(body_force_axis) :: bf_x, bf_y, bf_z
1 parent 4541c24 commit fac04e9

32 files changed

Lines changed: 274 additions & 275 deletions

File tree

docs/documentation/case.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ When the simulation is 2D/axi-symmetric or 1D, it requires that $p=0$ or $p=n=0$
146146
- `stretch_[x,y,z]` activates grid stretching in the $[x,y,z]$ directions.
147147
The grid is gradually stretched such that the domain boundaries are pushed away from the origin along a specified axis.
148148

149-
- `a_[x,y,z]`, `[x,y,z]_a`, and `[x,y,z]_b` are parameters that define the grid stretching function. When grid stretching along the $x$ axis is considered, the stretching function is given as:
149+
- `a_[x,y,z]`, `[x,y,z]_stretch%%beg`, and `[x,y,z]_stretch%%end` (where `beg` is the negative-direction anchor and `end` the positive-direction anchor) are parameters that define the grid stretching function. When grid stretching along the $x$ axis is considered, the stretching function is given as:
150150

151-
\f[ x_{cb,stretch} = x_{cb} + \frac{x_{cb}}{a_x} \Bigg[ \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_a)}{L} \right) \right] + \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_b)}{L} \right) \right] -2 \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_b-x_a)}{2L} \right) \right] \Bigg] \f]
151+
\f[ x_{cb,stretch} = x_{cb} + \frac{x_{cb}}{a_x} \Bigg[ \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_{stretch,beg})}{L} \right) \right] + \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_{stretch,end})}{L} \right) \right] -2 \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{stretch,end}-x_{stretch,beg})}{2L} \right) \right] \Bigg] \f]
152152

153153
where `x_cb` and `x_[cb,stretch]` are the coordinates of a cell boundary at the original and stretched domains, respectively.
154154
`L` is the domain length along the `x` axis: `L`=`x_domain%%end`-`x_domain%%beg`.
155-
Crudely speaking, `x_a` and `x_b` define the coordinates at which the grid begins to get stretched in the negative and positive directions along the $x$ axis, respectively.
155+
Crudely speaking, `x_stretch%%beg` and `x_stretch%%end` define the coordinates at which the grid begins to get stretched in the negative and positive directions along the $x$ axis, respectively.
156156
$a_x$ defines the smoothness of the stretching.
157157
Stretching along the $y$ and $z$ axes follows the same logistics.
158158
Optimal choice of the parameters for grid stretching is case-dependent and left to the user.
@@ -987,15 +987,15 @@ This parameter enables the use of true `pi_\infty` in bubble dynamics models whe
987987

988988
| Parameter | Type | Description |
989989
| ---: | :---: | :--- |
990-
| `bf_x[y,z]` | Logical | Enable body forces in the x[y,z] direction |
991-
| `k_x[y,y]` | Real | Magnitude of oscillating acceleration |
992-
| `w_x[y,z]` | Real | Frequency of oscillating acceleration |
993-
| `p_x[y,z]` | Real | Phase shift of oscillating acceleration |
994-
| `g_x[y,z]` | Real | Magnitude of background acceleration |
990+
| `bf_[x,y,z]%%enabled` | Logical | Enable body forces in the [x,y,z] direction |
991+
| `bf_[x,y,z]%%k` | Real | Magnitude of oscillating acceleration |
992+
| `bf_[x,y,z]%%w` | Real | Frequency of oscillating acceleration |
993+
| `bf_[x,y,z]%%p` | Real | Phase shift of oscillating acceleration |
994+
| `bf_[x,y,z]%%g` | Real | Magnitude of background acceleration |
995995

996-
`k_x[y,z]`, `w_x[y,z]`, `p_x[y,z]`, and `g_x[y,z]` define an oscillating acceleration in the `x[y,z]` direction with the form
996+
`bf_[x,y,z]%%k`, `bf_[x,y,z]%%w`, `bf_[x,y,z]%%p`, and `bf_[x,y,z]%%g` define an oscillating acceleration in the `[x,y,z]` direction with the form
997997

998-
\f[ a_{x[y,z]} = g_{x[y,z]} + k_{x[y,z]}\sin\left(w_{x[y,z]}t + p_{x[y,z]}\right). \f]
998+
\f[ a_{[x,y,z]} = bf_{[x,y,z]}\%g + bf_{[x,y,z]}\%k\sin\left(bf_{[x,y,z]}\%w \cdot t + bf_{[x,y,z]}\%p\right). \f]
999999

10001000
By convention, positive accelerations in the `x[y,z]` direction are in the positive `x[y,z]` direction.
10011001

examples/2D_axisym_shockwatercavity/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@
161161
"y_domain%end": ye,
162162
"stretch_x": "T",
163163
"a_x": 20,
164-
"x_a": -1.2 * D0,
165-
"x_b": 1.2 * D0,
164+
"x_stretch%beg": -1.2 * D0,
165+
"x_stretch%end": 1.2 * D0,
166166
"stretch_y": "T",
167167
"a_y": 20,
168-
"y_a": -0.0 * D0,
169-
"y_b": 1.2 * D0,
168+
"y_stretch%beg": -0.0 * D0,
169+
"y_stretch%end": 1.2 * D0,
170170
"m": Nx,
171171
"n": Ny,
172172
"p": 0,

examples/2D_hardcoded_ic/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"x_domain%end": 4.0e00,
1515
"stretch_x": "T",
1616
"a_x": 7,
17-
"x_a": -2,
18-
"x_b": 2,
17+
"x_stretch%beg": -2,
18+
"x_stretch%end": 2,
1919
"y_domain%beg": 0.0e00,
2020
"y_domain%end": 4.0e00,
2121
"stretch_y": "T",
2222
"a_y": 7,
23-
"y_a": -2,
24-
"y_b": 2,
23+
"y_stretch%beg": -2,
24+
"y_stretch%end": 2,
2525
"m": 199,
2626
"n": 199,
2727
"p": 0,

examples/2D_isentropicvortex/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
"loops_y": 2,
5858
"a_x": 1.03,
5959
"a_y": 1.03,
60-
"x_a": -1.5,
61-
"y_a": -1.5,
62-
"x_b": 1.5,
63-
"y_b": 1.5,
60+
"x_stretch%beg": -1.5,
61+
"y_stretch%beg": -1.5,
62+
"x_stretch%end": 1.5,
63+
"y_stretch%end": 1.5,
6464
"m": Nx,
6565
"n": Nx,
6666
"p": 0,

examples/2D_isentropicvortex_analytical/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
"loops_y": 2,
5858
"a_x": 1.03,
5959
"a_y": 1.03,
60-
"x_a": -1.5,
61-
"y_a": -1.5,
62-
"x_b": 1.5,
63-
"y_b": 1.5,
60+
"x_stretch%beg": -1.5,
61+
"y_stretch%beg": -1.5,
62+
"x_stretch%end": 1.5,
63+
"y_stretch%end": 1.5,
6464
"m": Nx,
6565
"n": Nx,
6666
"p": 0,

examples/2D_phasechange_bubble/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@
191191
"stretch_x": "T",
192192
"loops_x": 3,
193193
"a_x": 4.0e0,
194-
"x_a": -2.0 * R0,
195-
"x_b": 2.0 * R0,
194+
"x_stretch%beg": -2.0 * R0,
195+
"x_stretch%end": 2.0 * R0,
196196
"stretch_y": "T",
197197
"loops_y": 3,
198198
"a_y": 4.0e0,
199-
"y_a": -2.0 * R0,
200-
"y_b": 2.0 * R0,
199+
"y_stretch%beg": -2.0 * R0,
200+
"y_stretch%end": 2.0 * R0,
201201
"cyl_coord": "T",
202202
"m": Nx,
203203
"n": Ny,

examples/2D_rayleigh_taylor/case.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
"fluid_pp(2)%pi_inf": 0.0e00,
8080
"fluid_pp(2)%Re(1)": 1 / 0.0073,
8181
# Body Forces
82-
"bf_y": "T",
83-
"k_y": 0.0,
84-
"w_y": 0.0,
85-
"p_y": 0.0,
86-
"g_y": -9.81,
82+
"bf_y%enabled": "T",
83+
"bf_y%k": 0.0,
84+
"bf_y%w": 0.0,
85+
"bf_y%p": 0.0,
86+
"bf_y%g": -9.81,
8787
# Water Patch
8888
"patch_icpp(1)%geometry": 3,
8989
"patch_icpp(1)%hcid": 204,

examples/2D_shockdroplet/case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"y_domain%end": 6 * D,
3939
"stretch_y": "T",
4040
"a_y": 3.67,
41-
"y_a": -5.7 * D,
42-
"y_b": 5.7 * D,
41+
"y_stretch%beg": -5.7 * D,
42+
"y_stretch%end": 5.7 * D,
4343
"loops_y": 2,
4444
"m": int(Nx),
4545
"n": int(Ny),

examples/2D_shockdroplet_muscl/case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"y_domain%end": 6 * D,
3939
"stretch_y": "T",
4040
"a_y": 3.67,
41-
"y_a": -5.7 * D,
42-
"y_b": 5.7 * D,
41+
"y_stretch%beg": -5.7 * D,
42+
"y_stretch%end": 5.7 * D,
4343
"loops_y": 2,
4444
"m": int(Nx),
4545
"n": int(Ny),

examples/3D_performance_test/case.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
"z_domain%end": 4.0e-03 / 1.0e-03,
1717
"stretch_x": "T",
1818
"a_x": 4.0e00,
19-
"x_a": -1.5e-03 / 1.0e-03,
20-
"x_b": 1.5e-03 / 1.0e-03,
19+
"x_stretch%beg": -1.5e-03 / 1.0e-03,
20+
"x_stretch%end": 1.5e-03 / 1.0e-03,
2121
"stretch_y": "T",
2222
"a_y": 4.0e00,
23-
"y_a": -1.5e-03 / 1.0e-03,
24-
"y_b": 1.5e-03 / 1.0e-03,
23+
"y_stretch%beg": -1.5e-03 / 1.0e-03,
24+
"y_stretch%end": 1.5e-03 / 1.0e-03,
2525
"stretch_z": "T",
2626
"a_z": 4.0e00,
27-
"z_a": -1.5e-03 / 1.0e-03,
28-
"z_b": 1.5e-03 / 1.0e-03,
27+
"z_stretch%beg": -1.5e-03 / 1.0e-03,
28+
"z_stretch%end": 1.5e-03 / 1.0e-03,
2929
"cyl_coord": "F",
3030
"m": 200,
3131
"n": 200,

0 commit comments

Comments
 (0)