Ejemplo n.º 1
0
            + u[0] * u[2] / x[0]
        )
        + 1 / x[0] * sympy.diff(p, x[2])
        - mu
        * (
            +1 / x[0] * sympy.diff(x[0] * sympy.diff(u[2], x[0]), x[0])
            + sympy.diff(u[2], x[1], 2)
            + 1 / x[0] ** 2 * sympy.diff(u[2], x[2], 2)
            - u[2] / x[0] ** 2
            + 2 / x[0] ** 2 * sympy.diff(u[0], x[2])
        )
    )
    f = (sympy.simplify(f0), sympy.simplify(f1), sympy.simplify(f2))
    return f


if __name__ == "__main__":
    mesh_sizes = [8, 16, 32, 64]
    # mesh_sizes = [10, 20, 40, 80]
    Dt = [0.5 ** k for k in range(12)]
    errors = helpers.compute_time_errors(
        # problem_flat_cylindrical,
        # problem_whirl_cylindrical,
        problem_guermond1_cylindrical,
        # problem_taylor_cylindrical,
        ns_cyl.IPCS,
        mesh_sizes,
        Dt,
    )
    helpers.show_timeorder_info(Dt, mesh_sizes, errors)
    x0 = x[0] - alpha
    x1 = x[1]
    F = 1 - 2*mu*t
    u = (smp.sin(x0) * smp.cos(x1) * F / x[0],
         -smp.cos(x0) * smp.sin(x1) * F / x[0],
         0
         )
    p = rho/4 * (smp.cos(2*x0) + smp.cos(2*x1)) * F**2
    solution = {'u': u,
                'p': p
                }
    f = _get_navier_stokes_rhs_cylindrical(u, p)
    print f
    exit()
    return mesh_generator, solution, f, mu, rho, cell_type


if __name__ == '__main__':
    mesh_sizes = [10, 20, 30]
    #mesh_sizes = [10, 20, 40, 80]
    Dt = [0.5 ** k for k in range(20)]
    errors = helpers.compute_time_errors(
        #problem_flat_cylindrical,
        problem_whirl_cylindrical,
        #problem_guermond1_cylindrical,
        #problem_taylor_cylindrical,
        ns_cyl.IPCS,
        mesh_sizes, Dt
        )
    helpers.show_timeorder_info(Dt, mesh_sizes, errors)
Ejemplo n.º 3
0
    t = smp.symbols('t')
    x0 = x[0]
    x1 = x[1]
    #F = smp.exp(-2*mu*t)
    F = 1 - 2*mu*t
    u = (smp.sin(x0) * smp.cos(x1) * F,
         -smp.cos(x0) * smp.sin(x1) * F,
         0
         )
    p = rho/4 * (smp.cos(2*x0) + smp.cos(2*x1)) * F**2
    solution = {'u': u,
                'p': p
                }
    f = _get_navier_stokes_rhs(u, p)
    return mesh_generator, solution, f, mu, rho, cell_type


if __name__ == '__main__':
    mesh_sizes = [10, 20, 40]
    Dt = [0.5 ** k for k in range(20)]
    errors = helpers.compute_time_errors(
        #problem_flat,
        #problem_whirl,
        problem_guermond1,
        #problem_guermond2,
        #problem_taylor,
        ns_car.IPCS,
        mesh_sizes, Dt
        )
    helpers.show_timeorder_info(Dt, mesh_sizes, errors)