lower_v = upper_v upper_v = temp # get an approximate geometry print('Generating preconditioner') 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(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
e1 = np.abs(etx - itx).max() e2 = np.abs(ety - ity).max() err = max(e1, e2) print('Error is: {:0.2e}'.format(err)) # now do this with radial coords using helper functions solver = VectorHelper(ebdy) etx, ety = solver.get_interface_traction_uvp(ru, rv, rp) # get error in this computation e1 = np.abs(etx - itx).max() e2 = np.abs(ety - ity).max() err = max(e1, e2) print('Error is: {:0.2e}'.format(err)) # test out the method with the other coords itr, itt = ebdy.convert_uv_to_rt(itx, ity) rr, rt = ebdy.convert_uv_to_rt(ru, rv) etr, ett = solver.get_interface_traction_rtp(rr, rt, rp) e1 = np.abs(etr - itr).max() e2 = np.abs(ett - itt).max() err = max(e1, e2) print('Error is: {:0.2e}'.format(err)) # test this on the boundary, instead btx = btxx * ebdy.interface.normal_x + btxy * ebdy.interface.normal_y bty = btxy * ebdy.interface.normal_x + btyy * ebdy.interface.normal_y etx, ety = solver.get_boundary_traction_uvp(ru, rv, rp) # get error in this computation e1 = np.abs(etx - btx).max() e2 = np.abs(ety - bty).max() err = max(e1, e2)
fvr = fv_func(rr, tr) lower_u = np.zeros(nb) lower_v = np.zeros(nb) upper_u = np.zeros(nb) 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)