Skip to content

Commit 1a76bf0

Browse files
authored
change gresho to take desired Mach number as input (#287)
compute ambient pressure from M
1 parent 91bc1c8 commit 1a76bf0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

pyro/compressible/problems/gresho.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
PROBLEM_PARAMS = {"gresho.rho0": 1.0, # density in the domain
1313
"gresho.r": 0.2, # radial location of peak velocity
14-
"gresho.p0": 59.5, # ambient pressure in the domain
14+
"gresho.M": 0.1, # Mach number
1515
"gresho.t_r": 1.0} # reference time (used for setting peak velocity)
1616

1717

@@ -36,13 +36,26 @@ def init_data(my_data, rp):
3636
gamma = rp.get_param("eos.gamma")
3737

3838
rho0 = rp.get_param("gresho.rho0")
39-
p0 = rp.get_param("gresho.p0")
39+
M = rp.get_param("gresho.M")
4040

4141
rr = rp.get_param("gresho.r")
4242
t_r = rp.get_param("gresho.t_r")
4343

4444
q_r = 0.4 * np.pi * L_x / t_r
4545

46+
# pressure peaks at r = rr, and has the value
47+
# p0 + 12.5 * rr**2
48+
#
49+
# Mach number is M = q |u_phi| / sqrt(gamma p / rho),
50+
#
51+
# so p0 is found as:
52+
#
53+
# p0 + 12.5 rr**2 = rho q**2 |u_phi|**2 / (gamma M**2)
54+
#
55+
# where u_phi peaks at 5 * rr
56+
57+
p0 = rho0 * q_r**2 * (5 * rr)**2 / (gamma * M**2)
58+
4659
pres = myg.scratch_array()
4760
u_phi = myg.scratch_array()
4861

pyro/compressible/problems/inputs.gresho

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ yrboundary = periodic
2727
[gresho]
2828
r = 0.2
2929
rho0 = 1.0
30-
p0 = 59.5
30+
M = 0.1
3131
t_r = 1.0
3232

3333
[compressible]

0 commit comments

Comments
 (0)