from cases.wave_equation.dirichlet.derivative.derivative import WaveEquationDerivative from utils import State c = 2.0 num_grid_points = 1000 dt = 1 / (16 * num_grid_points * c) params = { 'num_grid_points': num_grid_points, 'domain_size': 1.0, 'dt': dt, 'sampling_rate': 100 } time_derivative_input = [c] # case_sol_input = [c, [(1, 1.0), (2, 2.0)]] axes = np.tile( np.linspace(0, params['domain_size'], num_grid_points + 1)[:-1], (2, 1)) # setup the axes state = State(2, num_grid_points, axes, [("x", "u"), ("x", "v")]) state_vars = state.get_state_vars() starting_cond = starting_conditions.GaussianBump(params['domain_size'] * 0.5, 50) state_vars[0] = starting_cond.get_start_condition(axes[0]) #state_vars[0] = np.sin(axes[0] * 2 * np.pi / params['domain_size']) run_utils.run_visual_without_solution(params, Explicit, WaveEquationDerivative, time_derivative_input, state)
num_grid_points = 1000 dt = 1 / (16 * num_grid_points * c) params = { 'num_grid_points': num_grid_points, 'domain_size': 1.0, 'dt': dt, 'sampling_rate': 1000 } time_derivative_input = [c] axes = np.tile( np.linspace(0, params['domain_size'], num_grid_points + 1)[:-1], (2, 1)) # setup axes state = State(2, num_grid_points, axes, [("u", "x"), ("v", "x")]) # create state state_vars = state.get_state_vars() # get underlying numpy-array starting_cond = GaussianBump(params['domain_size'] * 0.5, 200.0) # choose a starting-condition state_vars[0] = starting_cond.get_start_condition( axes[0]) # apply the starting condition variables # state_vars[1] = starting_cond.derivative(axes[1]) run_utils.run_visual_without_solution(params, Explicit, PeriodicWaveTimeDerivative, time_derivative_input, state)