Skip to content

Commit 62cb237

Browse files
committed
Merge branch 'master' of github.com:python-hydro/pyro2
2 parents 85a339d + 32d7b8b commit 62cb237

72 files changed

Lines changed: 5645 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ before_script:
2626
script:
2727
- flake8 .
2828
- pytest -v --cov=. --cov-config .coveragerc --nbval --ignore=docs --ignore=./multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid
29+
30+
after_success:
31+
- codecov
32+
after_failure:
33+
- codecov
34+
2935
# - travis-sphinx build
3036

3137
# after_success:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[gresho]
2+
dens_base = 10.0 ; density at the base of the atmosphere
3+
scale_height = 2.0 ; scale height of the isothermal atmosphere
4+
5+
r = 1.0
6+
u0 = 1.0
7+
p0 = 1.0
8+
9+
dens_cutoff = 0.01

compressible/problems/gresho.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
from __future__ import print_function
2+
3+
import sys
4+
import numpy
5+
import mesh.patch as patch
6+
from util import msg
7+
8+
9+
def init_data(my_data, rp):
10+
""" initialize the Gresho vortex problem """
11+
12+
msg.bold("initializing the Gresho vortex problem...")
13+
14+
# make sure that we are passed a valid patch object
15+
if not isinstance(my_data, patch.CellCenterData2d):
16+
print("ErrrrOrr: patch invalid in bubble.py")
17+
print(my_data.__class__)
18+
sys.exit()
19+
20+
# get the density and velocities
21+
dens = my_data.get_var("density")
22+
xmom = my_data.get_var("x-momentum")
23+
ymom = my_data.get_var("y-momentum")
24+
ener = my_data.get_var("energy")
25+
26+
# grav = rp.get_param("compressible.grav")
27+
28+
gamma = rp.get_param("eos.gamma")
29+
30+
# scale_height = rp.get_param("gresho.scale_height")
31+
dens_base = rp.get_param("gresho.dens_base")
32+
dens_cutoff = rp.get_param("gresho.dens_cutoff")
33+
34+
rr = rp.get_param("gresho.r")
35+
u0 = rp.get_param("gresho.u0")
36+
p0 = rp.get_param("gresho.p0")
37+
38+
# initialize the components -- we'll get a psure too
39+
# but that is used only to initialize the base state
40+
xmom[:, :] = 0.0
41+
ymom[:, :] = 0.0
42+
dens[:, :] = dens_cutoff
43+
44+
# set the density to be stratified in the y-direction
45+
myg = my_data.grid
46+
pres = myg.scratch_array()
47+
48+
dens[:, :] = dens_base
49+
50+
pres[:, :] = p0
51+
52+
x_centre = 0.5 * (myg.x[0] + myg.x[-1])
53+
y_centre = 0.5 * (myg.y[0] + myg.y[-1])
54+
55+
rad = numpy.sqrt((myg.x2d - x_centre)**2 + (myg.y2d - y_centre)**2)
56+
57+
pres[rad <= rr] += 0.5 * (u0 * rad[rad <= rr]/rr)**2
58+
pres[(rad > rr) & (rad <= 2*rr)] += \
59+
u0**2 * (0.5 * (rad[(rad > rr) & (rad <= 2*rr)] / rr)**2 +
60+
4 * (1 - rad[(rad > rr) & (rad <= 2*rr)]/rr +
61+
numpy.log(rad[(rad > rr) & (rad <= 2*rr)]/rr)))
62+
pres[rad > 2*rr] += u0**2 * (4 * numpy.log(2) - 2)
63+
#
64+
uphi = numpy.zeros_like(pres)
65+
uphi[rad <= rr] = u0 * rad[rad <= rr]/rr
66+
uphi[(rad > rr) & (rad <= 2*rr)] = u0 * (2 - rad[(rad > rr) & (rad <= 2*rr)]/rr)
67+
68+
xmom[:, :] = -dens[:, :] * uphi[:, :] * (myg.y2d - y_centre) / rad[:, :]
69+
ymom[:, :] = dens[:, :] * uphi[:, :] * (myg.x2d - x_centre) / rad[:, :]
70+
71+
ener[:, :] = pres[:, :]/(gamma - 1.0) + \
72+
0.5*(xmom[:, :]**2 + ymom[:, :]**2)/dens[:, :]
73+
74+
eint = pres[:, :]/(gamma - 1.0)
75+
76+
dens[:, :] = pres[:, :]/(eint[:, :]*(gamma - 1.0))
77+
78+
79+
def finalize():
80+
""" print out any information to the userad at the end of the run """
81+
pass
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# simple inputs files for the unsplit CTU hydro scheme
2+
3+
[driver]
4+
max_steps = 2000
5+
tmax = 10000.0
6+
cfl = 0.8
7+
8+
9+
[io]
10+
basename = lm_gresho_128_
11+
n_out = 1
12+
13+
14+
[mesh]
15+
nx = 128
16+
ny = 128
17+
xmax = 1.0
18+
ymax = 1.0
19+
20+
xlboundary = periodic
21+
xrboundary = periodic
22+
23+
ylboundary = periodic
24+
yrboundary = periodic
25+
26+
27+
[gresho]
28+
r = 0.2
29+
u0 = 0.1
30+
p0 = 1
31+
32+
[compressible]
33+
grav = 0

compressible/unsplit_fluxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def unsplit_fluxes(my_data, my_aux, rp, ivars, solid, tc, dt):
316316

317317
"""
318318
finally, we can construct the state perpendicular to the interface
319-
by adding the central difference part to the trasverse flux
319+
by adding the central difference part to the transverse flux
320320
difference.
321321
322322
The states that we represent by indices i,j are shown below

0 commit comments

Comments
 (0)