t = 0

dt = dt_lagrangian

x_tracers = []
y_tracers = []

while t < max_time - 1e-10:

    # get the velocity fields at this time
    u = EmbeddedFunction(ebdyc)
    u.define_via_function(lambda x, y: u_function(x, y, t))
    v = EmbeddedFunction(ebdyc)
    v.define_via_function(lambda x, y: v_function(x, y, t))
    # get the velocity fields on the boundary
    ub = ebdyc.interpolate_radial_to_boundary(u).bdy_value_list[0]
    vb = ebdyc.interpolate_radial_to_boundary(v).bdy_value_list[0]

    # step of the first order method to get things started
    if t == 0:

        bx = ebdy.bdy.x + dt * ub
        by = ebdy.bdy.y + dt * vb

        bx, by, new_t = arc_length_parameterize(bx, by, return_t=True)
        bu_interp = interp1d(0, 2 * np.pi, bdy.dt, ub, p=True)
        bv_interp = interp1d(0, 2 * np.pi, bdy.dt, vb, p=True)
        # old boundary velocity values have to be in the correct place
        ubo_new_parm = bu_interp(new_t)
        vbo_new_parm = bv_interp(new_t)
        ubo = ub.copy()
Exemplo n.º 2
0
c = c0.copy()
t = 0
while t < max_time - 1e-10:

    st = time.time()
    # get the velocity fields
    u = EmbeddedFunction(ebdyc)
    u.define_via_function(lambda x, y: u_function(x, y, t))
    v = EmbeddedFunction(ebdyc)
    v.define_via_function(lambda x, y: v_function(x, y, t))
    print('Time to compute u:                            {:0.1f}'.format(
        (time.time() - st) * 1000))
    st = time.time()

    # get the velocity fields on the boundary
    ub = ebdyc.interpolate_radial_to_boundary(u)
    vb = ebdyc.interpolate_radial_to_boundary(v)
    print('Time to interp u to bdy:                      {:0.1f}'.format(
        (time.time() - st) * 1000))
    st = time.time()

    # first, move the boundary with the fluid velocity
    bx = ebdy.bdy.x + dt * ub.bdy_value_list[0]
    by = ebdy.bdy.y + dt * vb.bdy_value_list[0]
    print('Time to move bdy:                             {:0.1f}'.format(
        (time.time() - st) * 1000))
    st = time.time()

    # take gradients of the velocity fields
    dx = lambda f: fd_x_4(f, grid.xh, periodic_fix=True)
    dy = lambda f: fd_y_4(f, grid.yh, periodic_fix=True)