@@ -34,10 +34,11 @@ function get_bilinear_form(mh_lev,biform,qdegree)
3434 return (u,v) -> biform (u,v,dΩ)
3535end
3636
37- u (x) = VectorValue (x[1 ],- x[2 ])
38- nc = (4 ,4 )
39-
40- np = (1 ,1 )
37+ Dc = 3
38+ B0 = VectorValue (0. ,0. ,1. )
39+ u (x) = VectorValue (x[1 ],- x[2 ],0. )
40+ nc = Tuple (fill (4 ,Dc))
41+ np = Tuple (fill (1 ,Dc))
4142np_per_level = fill (np,2 )
4243parts = with_mpi () do distribute
4344 distribute (LinearIndices ((prod (np),)))
@@ -58,30 +59,31 @@ trials_u = TrialFESpace(tests_u,u);
5859U, V = get_fe_space (trials_u,1 ), get_fe_space (tests_u,1 )
5960Q = TestFESpace (model,reffe_p;conformity= :L2 ,constraint= :zeromean )
6061
61- α = 1.0
62- β = 1.0
62+ α = 1.e4
63+ β = 1.e4
6364Π_Qh = LocalProjectionMap (divergence,reffe_p,qdegree)
64-
65- biform (u,v,dΩ) = ∫ (∇ (v)⊙ ∇ (u) + α* (∇⋅ v)⋅ Π_Qh (u) + β* (u× B)⋅ (v× B))dΩ
65+ utb (x) = u (x)× B0
66+ biform (u,v,dΩ) = ∫ (∇ (v)⊙ ∇ (u) + α* (∇⋅ v)⋅ Π_Qh (u) + β* (u× B0)⋅ (v× B0))dΩ
67+ liform (v,dΩ) = ∫ (∇ (v)⊙ ∇ (u) + β* (utb⋅ (v× B0)))dΩ
6668
6769Ω = Triangulation (model)
6870dΩ = Measure (Ω,qdegree)
6971
7072a (u,v) = biform (u,v,dΩ)
7173l (v) = liform (v,dΩ)
72- op = AffineFEOperator (a,l,X,Y )
74+ op = AffineFEOperator (a,l,U,V )
7375A, b = get_matrix (op), get_vector (op);
7476
75- biforms = map (mhl -> get_bilinear_form (mhl,biform_u ,qdegree),mh)
77+ biforms = map (mhl -> get_bilinear_form (mhl,biform ,qdegree),mh)
7678patch_decompositions = PatchDecomposition (mh)
7779smoothers = get_patch_smoothers (
78- mh,tests_u,biform_u ,patch_decompositions,qdegree
80+ mh,tests_u,biform ,patch_decompositions,qdegree
7981)
8082prolongations = setup_patch_prolongation_operators (
81- tests_u,biform_u,graddiv ,qdegree
83+ tests_u,biform,biform ,qdegree
8284)
8385restrictions = setup_patch_restriction_operators (
84- tests_u,prolongations,graddiv ,qdegree;solver = CGSolver ( JacobiLinearSolver ())
86+ tests_u,prolongations,biform ,qdegree
8587)
8688gmg = GMGLinearSolver (
8789 trials_u,tests_u,biforms,
@@ -91,22 +93,17 @@ gmg = GMGLinearSolver(
9193 coarsest_solver= LUSolver (),
9294 maxiter= 4 ,mode= :preconditioner ,verbose= i_am_main (parts)
9395)
96+ gmg. log. depth = 4
9497
95- solver_u = gmg
96- solver_p = CGSolver (JacobiLinearSolver ();maxiter= 20 ,atol= 1e-14 ,rtol= 1.e-6 ,verbose= i_am_main (parts))
97- solver_u. log. depth = 2
98- solver_p. log. depth = 2
99-
100- diag_blocks = [LinearSystemBlock (),BiformBlock ((p,q) -> ∫ (- 1.0 / α* p* q)dΩ,Q,Q)]
101- bblocks = map (CartesianIndices ((2 ,2 ))) do I
102- (I[1 ] == I[2 ]) ? diag_blocks[I[1 ]] : LinearSystemBlock ()
103- end
104- coeffs = [1.0 1.0 ;
105- 0.0 1.0 ]
106- P = BlockTriangularSolver (bblocks,[solver_u,solver_p],coeffs,:upper )
107- solver = FGMRESSolver (20 ,P;atol= 1e-10 ,rtol= 1.e-12 ,verbose= i_am_main (parts))
98+ solver = FGMRESSolver (20 ,gmg;atol= 1e-10 ,rtol= 1.e-12 ,verbose= i_am_main (parts))
10899ns = numerical_setup (symbolic_setup (solver,A),A)
109100
110- x = allocate_in_domain (A); fill! (x,0.0 )
101+ x = allocate_in_domain (A)
102+ fill! (x,0.0 )
111103solve! (x,ns,b)
112- xh = FEFunction (X,x)
104+ xh = FEFunction (U,x)
105+
106+ eh = xh - u
107+ err_l2 = sqrt (sum (∫ (eh⋅ eh)dΩ))
108+
109+
0 commit comments