# Create finite element space space = H1Space(mesh, shapeset) set_bc(space) space.set_uniform_order(P_INIT) # Enumerate basis functions space.assign_dofs() # Initialize the discrete problem wf = WeakForm(1) set_forms(wf) # Visualize solution, gradient, and mesh sview = ScalarView("Coarse solution", 0, 0, 600, 1000) gview = VectorView("Gradient", 610, 0, 600, 1000) oview = OrderView("Polynomial orders", 1220, 0, 600, 1000) # Matrix solver solver = DummySolver() # Adaptivity loop it = 1 ndofs = 0 done = False cpu = 0.0 sln_coarse = Solution() sln_fine = Solution()
ndofs += xvel.assign_dofs(ndofs) ndofs += yvel.assign_dofs(ndofs) ndofs += press.assign_dofs(ndofs) xprev = Solution() yprev = Solution() xprev.set_zero(mesh) yprev.set_zero(mesh) # initialize the discrete problem wf = WeakForm(3) set_forms(wf, xprev, yprev) # visualize the solution vview = VectorView("velocity [m/s]", 0, 0, 1200, 350) pview = ScalarView("pressure [Pa]", 0, 500, 1200, 350) vview.set_min_max_range(0, 1.9) vview.show_scale(False) pview.show_scale(False) pview.show_mesh(False) solver = DummySolver() sys = LinSystem(wf, solver) sys.set_spaces(xvel, yvel, press) sys.set_pss(pss) #dp.set_external_fns(xprev, yprev) EPS_LOW = 0.0014 for i in range(1000):