Esempio n. 1
0
def init():
    global x_center, u0
    line_numeric.set_data(x_center, u0)
    line_exact.set_data(x_center,
                        advec.exact_solution_square_wave(x_center, 0, N))
    time_text.set_text('time = %s' % 0.0)
    return line_numeric, line_exact, time_text
Esempio n. 2
0
def animate(i):
    global x_center, solution, w
    time = dt * i
    solution = w.integrate(solution, time)
    exact_soln = advec.exact_solution_square_wave(
        x_center - advec.CHAR_SPEED * dt * i, time, N)
    line_numeric.set_data(x_center, solution)
    line_exact.set_data(x_center, exact_soln)
    time_text.set_text('time = %s' % time)
    return line_numeric, line_exact, time_text
Esempio n. 3
0
import bootstrap as bs

bs.bootstrap()

N = [80, 160, 320, 640, 1280, 2560]
T = 1.0

errorsList = []
dxList = []
for n in N:
    w = weno2.Weno2(advec.a, advec.b, n, advec.flux, advec.flux_deriv,
                    advec.max_flux_deriv, advec.CHAR_SPEED)
    x_center = w.get_x_center()
    u0 = advec.initial_condition_square_wave(x_center)
    solution = w.integrate(u0, T)
    exact = advec.exact_solution_square_wave(x_center - advec.CHAR_SPEED * T,
                                             T, n)
    points = {'left1': 0, 'right1': 0, 'left2': 0, 'right2': 0}
    for i in range(0, n):
        if x_center[i] >= -0.82:
            points['left1'] = i
            break

    for i in range(0, n):
        if x_center[i] >= -0.78:
            points['right1'] = i
            break

    for i in range(0, n):
        if x_center[i] >= 0.78:
            points['left2'] = i
            break
Esempio n. 4
0
import advection as advec
import advection_util as au
import bootstrap as bs

bs.bootstrap()

N = 640
T = 0.5
WENO_ORDER = 3

w = au.createWeno3Solver(N)
x_center = w.get_x_center()
u0 = advec.initial_condition_square_wave(x_center)

solution = w.integrate(u0, T)
exact_solution = advec.exact_solution_square_wave(x_center - advec.CHAR_SPEED * T, T, N)
au.plot_advection_solution(x_center, solution, exact_solution, T, N, WENO_ORDER)