def main(): """ The main core of the program. """ global time global MAX_ITER global output_dt # ========================================================================== # Initialize # - Returns a dictionary of dictionaries, which are the parameters from the # configuration file (by section) and from the command line (listed as # section 'CommandLine') params = init() # ========================================================================== # Evolution loop prev_write = -1 for n_iter in xrange(MAX_ITER): # Exceeded maximum time if time >= tmax: break # Unexpected exit? (e.g. like "touch .dump_restart") # TODO # Write output do_write = False if output_dt > 0: curr_write = int(math.floor(time / output_dt)) if curr_write > prev_write: do_write = True prev_write = curr_write if do_write: # to allow for a condition based on step number Grid.write_data(n_iter) # Boundary condition fill Grid.fill_boundary_conditions() # Compute step size dt = compute_time_step() # Evolve a single step Hydro.one_step(dt) # Update time time = time + dt # End evolution loop # ========================================================================== # Finalize # Write final output Grid.write_data(n_iter+1) finalize()