Skip to content

Commit e82b18f

Browse files
author
Michael Zingale
committed
docstrings
1 parent d836642 commit e82b18f

File tree

3 files changed

+106
-13
lines changed

3 files changed

+106
-13
lines changed

compressible/BC.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,29 @@
99
import eos
1010
from util import msg
1111

12-
def user(bcName, bcEdge, variable, my_data):
13-
12+
def user(bc_name, bc_edge, variable, my_data):
13+
"""
14+
A hydrostatic boundary. This integrates the equation of HSE into
15+
the ghost cells to get the pressure and density under the assumption
16+
that the specific internal energy is constant.
17+
18+
Upon exit, the ghost cells for the input variable will be set
19+
20+
Parameters
21+
----------
22+
bc_name : {'hse'}
23+
The descriptive name for the boundary condition -- this allows
24+
for pyro to have multiple types of user-supplied boundary
25+
conditions. For this module, it needs to be 'hse'.
26+
bc_edge : {'ylb', 'yrb'}
27+
The boundary to update: ylb = lower y boundary; yrb = upper y
28+
boundary.
29+
variable : {'density', 'x-momentum', 'y-momentum', 'energy'}
30+
The variable whose ghost cells we are filling
31+
my_data : CellCenterData2d object
32+
The data object
33+
34+
"""
1435
dens = my_data.get_var("density")
1536
xmom = my_data.get_var("x-momentum")
1637
ymom = my_data.get_var("y-momentum")
@@ -21,9 +42,9 @@ def user(bcName, bcEdge, variable, my_data):
2142

2243
myg = my_data.grid
2344

24-
if (bcName == "hse"):
45+
if (bc_name == "hse"):
2546

26-
if (bcEdge == "ylb"):
47+
if (bc_edge == "ylb"):
2748

2849
# lower y boundary
2950

@@ -73,7 +94,7 @@ def user(bcName, bcEdge, variable, my_data):
7394
msg.fail("error: variable not defined")
7495

7596

76-
elif (bcEdge == "yrb"):
97+
elif (bc_edge == "yrb"):
7798

7899
# upper y boundary
79100

@@ -128,4 +149,4 @@ def user(bcName, bcEdge, variable, my_data):
128149

129150

130151
else:
131-
msg.fail("error: bc type %s not supported" % (bcName) )
152+
msg.fail("error: bc type %s not supported" % (bc_name) )

compressible/eos.py

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,73 @@
11
"""
2-
This is a gamma-law equation of state.
2+
This is a gamma-law equation of state: p = rho e (gamma - 1), where
3+
gamma is the constant ratio of specific heats.
34
"""
45

56
def pres(gamma, dens, eint):
6-
""" given the density and the specific internal energy, return the
7-
pressure """
7+
"""
8+
Given the density and the specific internal energy, return the
9+
pressure
10+
11+
Parameters
12+
----------
13+
gamma : float
14+
The ratio of specific heats
15+
dens : float
16+
The density
17+
eint : float
18+
The specific internal energy
19+
20+
Returns
21+
-------
22+
out : float
23+
The pressure
24+
25+
"""
826
p = dens*eint*(gamma - 1.0)
927
return p
1028

1129

1230
def dens(gamma, pres, eint):
13-
""" given the pressure and the specific internal energy, return
14-
the density """
31+
"""
32+
Given the pressure and the specific internal energy, return
33+
the density
34+
35+
Parameters
36+
----------
37+
gamma : float
38+
The ratio of specific heats
39+
pres : float
40+
The pressure
41+
eint : float
42+
The specific internal energy
43+
44+
Returns
45+
-------
46+
out : float
47+
The density
48+
49+
"""
1550
dens = pres/(eint*(gamma - 1.0))
1651
return dens
1752

1853

1954
def rhoe(gamma, pres):
20-
""" given the pressure, return (rho * e) """
55+
"""
56+
Given the pressure, return (rho * e)
57+
58+
Parameters
59+
----------
60+
gamma : float
61+
The ratio of specific heats
62+
pres : float
63+
The pressure
64+
65+
Returns
66+
-------
67+
out : float
68+
The internal energy density, rho e
69+
70+
"""
2171
rhoe = pres/(gamma - 1.0)
2272
return rhoe
2373

compressible/unsplitFluxes.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,29 @@ def unsplitFluxes(my_data, rp, vars, tc, dt):
138138
139139
currently we assume a gamma-law EOS
140140
141-
grav is the gravitational acceleration in the y-direction
141+
The runtime parameter grav is assumed to be the gravitational
142+
acceleration in the y-direction
143+
144+
Parameters
145+
----------
146+
my_data : CellCenterData2d object
147+
The data object containing the grid and advective scalar that
148+
we are advecting.
149+
rp : RuntimeParameters object
150+
The runtime parameters for the simulation
151+
vars : Variables object
152+
The Variables object that tells us which indices refer to which
153+
variables
154+
tc : TimerCollection object
155+
The timers we are using to profile
156+
dt : float
157+
The timestep we are advancing through.
158+
159+
Returns
160+
-------
161+
out : ndarray, ndarray
162+
The fluxes on the x- and y-interfaces
163+
142164
"""
143165

144166
tm_flux = tc.timer("unsplitFluxes")

0 commit comments

Comments
 (0)