Skip to content

Commit

Permalink
Add single layer option
Browse files Browse the repository at this point in the history
  • Loading branch information
mandli committed Oct 31, 2015
1 parent 9fc9b21 commit 99c559e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions 1d/multilayer/qinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ def set_riemann_init_condition(state,jump_location,q_left,q_right):
(x >= jump_location) * q_right[m] * np.ones((mx))


def set_quiescent_init_condition(state):
def set_quiescent_init_condition(state, single_layer=False):
"""Set a quiescent (stationary) initial condition
This assumes that you have already set the h hat values and the densities.
"""
state.q[0,:] = state.aux[h_hat_index[0],:] * state.problem_data['rho'][0]
state.q[1,:] = np.zeros((state.grid.dimensions[0].num_cells))
state.q[2,:] = state.aux[h_hat_index[1],:] * state.problem_data['rho'][1]
state.q[3,:] = np.zeros((state.grid.dimensions[0].num_cells))
if single_layer:
state.q[2,:] = np.zeros((state.grid.dimensions[0].num_cells))
state.q[3,:] = np.zeros((state.grid.dimensions[0].num_cells))
else:
state.q[2,:] = state.aux[h_hat_index[1],:] * state.problem_data['rho'][1]
state.q[3,:] = np.zeros((state.grid.dimensions[0].num_cells))



Expand Down

0 comments on commit 99c559e

Please sign in to comment.