Skip to content

Commit d836642

Browse files
author
Michael Zingale
committed
docstrings
1 parent 13debc9 commit d836642

File tree

4 files changed

+84
-11
lines changed

4 files changed

+84
-11
lines changed

advection/simulation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,8 @@ def dovis(self):
176176

177177

178178
def finalize(self):
179-
179+
"""
180+
Do any final clean-ups for the simulation and call the problem's
181+
finalize() method.
182+
"""
180183
exec self.problem_name + '.finalize()'

compressible/simulation.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ def __init__(self, idens=-1, ixmom=-1, iymom=-1, iener=-1):
3535
class Simulation:
3636

3737
def __init__(self, problem_name, rp, timers=None):
38+
"""
39+
Initialize the Simulation object for compressible hydrodynamics.
40+
41+
Parameters
42+
----------
43+
problem_name : str
44+
The name of the problem we wish to run. This should
45+
correspond to one of the modules in compressible/problems/
46+
rp : RuntimeParameters object
47+
The runtime parameters for the simulation
48+
timers : TimerCollection object, optional
49+
The timers used for profiling this simulation
50+
"""
3851

3952
self.rp = rp
4053
self.cc_data = None
@@ -52,7 +65,8 @@ def __init__(self, problem_name, rp, timers=None):
5265

5366
def initialize(self):
5467
"""
55-
initialize the grid and variables for compressible flow
68+
Initialize the grid and variables for compressible flow and set
69+
the initial conditions for the chosen problem.
5670
"""
5771

5872
# setup the grid
@@ -176,14 +190,17 @@ def timestep(self):
176190

177191

178192
def preevolve(self):
179-
180-
# do nothing
193+
"""
194+
Do any necessary evolution before the main evolve loop. This
195+
is not needed for compressible flow.
196+
"""
181197
pass
182198

183199

184200
def evolve(self, dt):
185201
"""
186-
Evolve the equations of compressible hydrodynamics through a timestep dt
202+
Evolve the equations of compressible hydrodynamics through a
203+
timestep dt.
187204
"""
188205

189206
tm_evolve = self.tc.timer("evolve")
@@ -224,6 +241,9 @@ def evolve(self, dt):
224241

225242

226243
def dovis(self):
244+
"""
245+
Do runtime visualization.
246+
"""
227247

228248
pylab.clf()
229249

@@ -338,4 +358,8 @@ def dovis(self):
338358

339359

340360
def finalize(self):
361+
"""
362+
Do any final clean-ups for the simulation and call the problem's
363+
finalize() method.
364+
"""
341365
exec self.problem_name + '.finalize()'

diffusion/simulation.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
class Simulation:
1010

1111
def __init__(self, problem_name, rp, timers=None):
12+
"""
13+
Initialize the Simulation object for diffusion:
14+
15+
a = k a
16+
t xx
17+
18+
Parameters
19+
----------
20+
problem_name : str
21+
The name of the problem we wish to run. This should
22+
correspond to one of the modules in diffusion/problems/
23+
rp : RuntimeParameters object
24+
The runtime parameters for the simulation
25+
timers : TimerCollection object, optional
26+
The timers used for profiling this simulation
27+
"""
1228

1329
self.rp = rp
1430
self.cc_data = None
@@ -23,7 +39,8 @@ def __init__(self, problem_name, rp, timers=None):
2339

2440
def initialize(self):
2541
"""
26-
initialize the grid and variables for diffusion
42+
Initialize the grid and variables for diffusion and set the initial
43+
conditions for the chosen problem.
2744
"""
2845

2946
# setup the grid
@@ -97,8 +114,10 @@ def timestep(self):
97114

98115

99116
def preevolve(myd):
100-
101-
# do nothing
117+
"""
118+
Do any necessary evolution before the main evolve loop. This
119+
is not needed for diffusion.
120+
"""
102121
pass
103122

104123

@@ -160,6 +179,9 @@ def evolve(self, dt):
160179

161180

162181
def dovis(self):
182+
"""
183+
Do runtime visualization.
184+
"""
163185

164186
pylab.clf()
165187

@@ -184,6 +206,10 @@ def dovis(self):
184206

185207

186208
def finalize(self):
209+
"""
210+
Do any final clean-ups for the simulation and call the problem's
211+
finalize() method.
212+
"""
187213
exec self.problem_name + '.finalize()'
188214

189215

incompressible/simulation.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111
class Simulation:
1212

1313
def __init__(self, problem_name, rp, timers=None):
14+
"""
15+
Initialize the Simulation object for incompressible flow.
16+
17+
Parameters
18+
----------
19+
problem_name : str
20+
The name of the problem we wish to run. This should
21+
correspond to one of the modules in incompressible/problems/
22+
rp : RuntimeParameters object
23+
The runtime parameters for the simulation
24+
timers : TimerCollection object, optional
25+
The timers used for profiling this simulation
26+
"""
1427

1528
self.rp = rp
1629
self.cc_data = None
@@ -25,7 +38,8 @@ def __init__(self, problem_name, rp, timers=None):
2538

2639
def initialize(self):
2740
"""
28-
initialize the grid and variables for incompressible flow
41+
Initialize the grid and variables for incompressible flow and
42+
set the initial conditions for the chosen problem.
2943
"""
3044

3145
# setup the grid
@@ -214,7 +228,7 @@ def preevolve(self):
214228

215229
def evolve(self, dt):
216230
"""
217-
Evolve the incompressible equations through one timestep
231+
Evolve the incompressible equations through one timestep.
218232
"""
219233

220234
u = self.cc_data.get_var("x-velocity")
@@ -472,7 +486,9 @@ def evolve(self, dt):
472486

473487

474488
def dovis(self):
475-
489+
"""
490+
Do runtime visualization
491+
"""
476492
pylab.clf()
477493

478494
pylab.rc("font", size=10)
@@ -525,4 +541,8 @@ def dovis(self):
525541

526542

527543
def finalize(self):
544+
"""
545+
Do any final clean-ups for the simulation and call the problem's
546+
finalize() method.
547+
"""
528548
exec self.problem_name + '.finalize()'

0 commit comments

Comments
 (0)