# convert (u,v) to (r,t) fr, ft = ebdy.convert_uv_to_rt(fu_radial, fv_radial) lr, lt = ebdy.convert_uv_to_rt(lower_u, lower_v) ur, ut = ebdy.convert_uv_to_rt(upper_u, upper_v) re_radial, te_radial, pe_radial = solver.solve(RAG, fr, ft, lr, lt, ur, ut, verbose=True, tol=1e-14, maxiter=200, restart=50) ue_radial, ve_radial = ebdy.convert_rt_to_uv(re_radial, te_radial) # get error error_u = np.abs(ue_radial - ua_radial).max() error_v = np.abs(ve_radial - va_radial).max() error_p = np.abs(pe_radial - pa_radial).max() print(' Error, u: {:0.2e}'.format(error_u)) print(' Error, v: {:0.2e}'.format(error_v)) print(' Error, p: {:0.2e}'.format(error_p)) # plot the errors fig, ax = plt.subplots() clf = ax.pcolormesh(ebdy.radial_x, ebdy.radial_y, np.abs(ue_radial - ua_radial), norm=mpl.colors.LogNorm()) ax.plot(ebdy.bdy.x, ebdy.bdy.y, color='black', label='boundary', linewidth=3)
upper_v = np.zeros(nb) # solve radial stokes problem AAG = ApproximateAnnularGeometry(nb, M, ebdy.radial_width, ebdy.approximate_radius) # construct the preconditioner (for Dirichlet BC) solver = AnnularStokesSolver(AAG, 1.0) print('Solving') # get the real geometry sp = ebdy.bdy.speed if interior else ebdy.interface.speed cur = ebdy.bdy.curvature if interior else ebdy.interface.curvature RAG = RealAnnularGeometry(sp, cur, AAG) # convert (u,v) to (r,t) fr, ft = ebdy.convert_uv_to_rt(fur, fvr) lr, lt = ebdy.convert_uv_to_rt(lower_u, lower_v) ur, ut = ebdy.convert_uv_to_rt(upper_u, upper_v) re_radial, te_radial, pe_radial = solver.solve(RAG, fr, ft, lr, lt, ur, ut, verbose=False, tol=1e-12) ur, vr = ebdy.convert_rt_to_uv(re_radial, te_radial) U = np.hypot(ur, vr).max() u = ur/U v = vr/U # get derivatives of the velocity field ux, uy = ebdy.radial_grid_derivatives(u) vx, vy = ebdy.radial_grid_derivatives(v) # get a function c to test with c_func = lambda x, y: np.exp(np.cos(x))*np.sin(y) c = c_func(xr, yr) ################################################################################ # test advectors dt = 0.01