Skip to content

Commit fee85c3

Browse files
committed
Minor
1 parent bf24626 commit fee85c3

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

src/Solvers/li2019.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ function Li2019Solver(op::FEOperator,params)
2929

3030
diag_solvers = map(s -> get_block_solver(Val(s),params),params[:solver][:block_solvers])
3131
diag_blocks = [
32-
BiformBlock(a_j,trial[1],test[1]),
33-
TriformBlock(a_u,trial[2],test[2],2),
34-
BiformBlock(a_p,trial[3],test[3]),
35-
BiformBlock(a_φ,trial[4],test[4])
32+
BiformBlock(a_j,U_j,V_j),
33+
TriformBlock(a_u,U_u,V_u,2),
34+
BiformBlock(a_p,U_p,V_p),
35+
BiformBlock(a_φ,U_φ,V_φ)
3636
]
3737
blocks = map(CartesianIndices((NB,NB))) do I
3838
(I[1] == I[2]) ? diag_blocks[I[1]] : LinearSystemBlock()

test/dev/h1_h1_gmg.jl

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ function get_bilinear_form(mh_lev,biform,qdegree)
3434
return (u,v) -> biform(u,v,dΩ)
3535
end
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))
4142
np_per_level = fill(np,2)
4243
parts = with_mpi() do distribute
4344
distribute(LinearIndices((prod(np),)))
@@ -58,30 +59,31 @@ trials_u = TrialFESpace(tests_u,u);
5859
U, V = get_fe_space(trials_u,1), get_fe_space(tests_u,1)
5960
Q = 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)
6870
= Measure(Ω,qdegree)
6971

7072
a(u,v) = biform(u,v,dΩ)
7173
l(v) = liform(v,dΩ)
72-
op = AffineFEOperator(a,l,X,Y)
74+
op = AffineFEOperator(a,l,U,V)
7375
A, 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)
7678
patch_decompositions = PatchDecomposition(mh)
7779
smoothers = get_patch_smoothers(
78-
mh,tests_u,biform_u,patch_decompositions,qdegree
80+
mh,tests_u,biform,patch_decompositions,qdegree
7981
)
8082
prolongations = setup_patch_prolongation_operators(
81-
tests_u,biform_u,graddiv,qdegree
83+
tests_u,biform,biform,qdegree
8284
)
8385
restrictions = setup_patch_restriction_operators(
84-
tests_u,prolongations,graddiv,qdegree;solver=CGSolver(JacobiLinearSolver())
86+
tests_u,prolongations,biform,qdegree
8587
)
8688
gmg = 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))
10899
ns = 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)
111103
solve!(x,ns,b)
112-
xh = FEFunction(X,x)
104+
xh = FEFunction(U,x)
105+
106+
eh = xh - u
107+
err_l2 = sqrt(sum((eheh)dΩ))
108+
109+

0 commit comments

Comments
 (0)