@@ -33,6 +33,44 @@ class Euler:
3333 """A 1D compressible Euler solver using the piecewise parabolic method
3434 (PPM), following the original Colella & Woodward ideas
3535
36+ Parameters
37+ ----------
38+ nx : int
39+ the number of zones
40+ C : float
41+ the CFL number
42+ fixed_dt : float, optional
43+ a fixed timestep to use for every step. In this case we
44+ do not estimate the timestep using the CFL criteria.
45+ bc_left_type : str
46+ boundary condition type at the left edge. Allowed values
47+ are: "reflect", "outflow", "periodic"
48+ bc_left_type : str
49+ boundary condition type at the right edge. Allowed values
50+ are: "reflect", "outflow", "periodic"
51+ gamma : float
52+ the ratio of specific heats
53+ init_cond : function
54+ the function to call to initialize the conserved state.
55+ This has the signature `init_cond(grid, v, gamma, U, params)`
56+ where `grid` is a `FVGrid`, `v` is a `FluidVars`, and `params`
57+ is a `dict` with any optional parameters needed for
58+ initialization.
59+ grav_func : function
60+ the function to call to compute the gravitational acceleration.
61+ This has the signature: `g = grav_func(grid, rho, params)`, where
62+ `grid` is a FVGrid`, `rho` is the density (array), and `params`
63+ is a `dict` of option parameters needed to interpret gravity.
64+ params : dict, optional
65+ a dictionary of parameters that is passed to the initial condition
66+ and gravity functions.
67+ use_hse_reconstruction : bool, optional
68+ do we subtract off HSE from pressure before doing the parabolic
69+ reconstruction?
70+ use_limiting : bool, optional
71+ do we limit the parabola coefficients?
72+ use_flattening : bool, optional
73+ do we apply flattening to the shock to smear them out?
3674 """
3775
3876 def __init__ (self , nx , C , * ,
@@ -111,7 +149,13 @@ def estimate_dt(self):
111149 self .dt = self .C * self .grid .dx / np .max (np .abs (q [:, self .v .qu ]) + cs )
112150
113151 def cons_to_prim (self ):
114- """Convert the conserved variable state to primitive variables"""
152+ """Convert the conserved variable state to primitive variables
153+
154+ Returns
155+ -------
156+ q : ndarray
157+ the primitive variable array.
158+ """
115159
116160 q = self .grid .scratch_array (nc = self .v .nvar )
117161
@@ -163,6 +207,13 @@ def construct_parabola(self):
163207 def interface_states (self ):
164208 """Trace the primitive variables to the interfaces by integrating
165209 under the parabola and doing a characteristic projection
210+
211+ Returns
212+ -------
213+ q_left : ndarray
214+ the left primitive variable state on the interface.
215+ q_right : ndarray
216+ the right primitive variable state on the interface.
166217 """
167218
168219 # convert to primitive variables
@@ -266,7 +317,18 @@ def interface_states(self):
266317 return q_left , q_right
267318
268319 def cons_flux (self , state ):
269- """ given an interface state, return the conservative flux"""
320+ """ given an interface state, return the conservative flux
321+
322+ Parameters
323+ ----------
324+ state : RiemannState
325+ the interface state from the Riemann solver.
326+
327+ Returns
328+ -------
329+ flux : ndarray
330+ the conserved flux through the interface for the input state.
331+ """
270332
271333 flux = np .zeros ((self .v .nvar ), dtype = np .float64 )
272334
@@ -278,7 +340,20 @@ def cons_flux(self, state):
278340
279341 def compute_fluxes (self , q_left , q_right ):
280342 """given the left and right states, solve the Riemann
281- problem to get the interface state and return the fluxes"""
343+ problem to get the interface state and return the fluxes
344+
345+ Parameters
346+ ----------
347+ q_left : ndarray
348+ the left primitive variable state on the interface.
349+ q_right : ndarray
350+ the right primitive variable state on the interface.
351+
352+ Returns
353+ -------
354+ flux : ndarray
355+ the conserved flux through each interface.
356+ """
282357
283358 flux = self .grid .scratch_array (nc = self .v .nvar )
284359
@@ -327,7 +402,15 @@ def advance_step(self):
327402 self .U [:, self .v .umx ] * g_new )
328403
329404 def evolve (self , tmax , * , verbose = True ):
330- """The main evolution driver to advance the state to time tmax"""
405+ """The main evolution driver to advance the state to time tmax
406+
407+ Parameters
408+ ----------
409+ tmax : float
410+ maximum simulation time to evolve to
411+ verbose : bool, optional
412+ enable / disable verbosity
413+ """
331414
332415 while self .t < tmax :
333416
@@ -360,7 +443,15 @@ def evolve(self, tmax, *, verbose=True):
360443 bc_right_type = self .bcs_right [n ])
361444
362445 def draw_prim (self , gp , ivar ):
363- """Draw the parabola for a primitive variable (ivar) on a GridPlot object"""
446+ """Draw the parabola for a primitive variable (ivar) on a GridPlot object
447+
448+ Parameters
449+ ----------
450+ gp : GridPlot
451+ the grid plot object for the figure
452+ ivar : int
453+ the index of the primitive variable to plot
454+ """
364455
365456 self .construct_parabola ()
366457 self .q_parabola [ivar ].draw_parabola (gp )
0 commit comments