Skip to content

Commit 4a46f30

Browse files
gmg_par_der with a nonlinear solver
1 parent 714e8c8 commit 4a46f30

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

test/dev/gmg_par_dep.jl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ function get_bilinear_form(model,info,β)
6666
if info[:FESpace] == :RT
6767
Λ = Skeleton(model)
6868
Γ = Boundary(Ω) # Γ = Boundary(model) gives an error with #polytope branches
69-
return (u,v) -> biform_dg(u,v,Ω,Λ,Γ,order,B,get_scaling(info,β))
69+
return (u0,u,v) -> biform_dg(u,v,Ω,Λ,Γ,order,B,get_scaling(info,β))
7070
elseif info[:FESpace] == :Qk
71-
return (u,v) -> biform(u,v,Ω,order,B,get_scaling(info,β))
71+
return (u0,u,v) -> biform(u,v,Ω,order,B,get_scaling(info,β))
7272
else
7373
error("Only RaviartThomas and Lagrangian FE spaces are implemented")
7474
end
@@ -188,11 +188,12 @@ function gmg_hdiv(parts,t,info,β,mh)
188188
V = get_fe_space(tests,1)
189189
if info[:FESpace] == :RT
190190
Γ = Boundary(Ω) # Γ = Boundary(model) gives an error with #polytope branches
191-
op = AffineFEOperator(a,v->liform_dg(v,Ω,Γ,k,ue,uexBxB,get_scaling(info,β)),U,V)
191+
# Linear operator
192+
# op = AffineFEOperator(a,v->liform_dg(v,Ω,Γ,k,ue,uexBxB,get_scaling(info,β)),U,V)
192193
# Nonlinear operator
193-
# res(u,v) = a(u,v) - liform_dg(v,Ω,Γ,k,β,ue)
194-
# jac(u0,u,v) = a(u,v)
195-
# op = FEOperator(res,jac,U,V)
194+
res(u,v) = a(u,u,v) - liform_dg(v,Ω,Γ,k,ue,uexBxB,get_scaling(info,β))
195+
jac(u0,u,v) = a(u0,u,v)
196+
op = FEOperator(res,jac,U,V)
196197
elseif info[:FESpace] == :Qk
197198
op = AffineFEOperator(a,v->liform(v,Ω,k,ue,uexBxB,get_scaling(info,β)),U,V)
198199
else
@@ -203,7 +204,7 @@ function gmg_hdiv(parts,t,info,β,mh)
203204
if info[:projection_solver] == :CG_Jacobi
204205
projection_solver = CGSolver(
205206
JacobiLinearSolver();
206-
maxiter=20,
207+
maxiter=10,
207208
atol=info[:projection_solver_atol],
208209
rtol=info[:projection_solver_rtol],
209210
verbose=i_am_main(parts),
@@ -240,7 +241,7 @@ function gmg_hdiv(parts,t,info,β,mh)
240241
maxiter=1,
241242
cycle_type=info[:cycle_type],
242243
verbose=i_am_main(parts)
243-
# ,is_nonlinear=true # Nonlinear solver
244+
,is_nonlinear=true # Nonlinear solver
244245
)
245246
gmg.log.depth = 4
246247

@@ -255,11 +256,12 @@ function gmg_hdiv(parts,t,info,β,mh)
255256

256257
tic!(t;barrier=true)
257258
# Nonlinear solver
258-
# nl_solver = GridapSolvers.NewtonSolver(solver,maxiter=1,atol=atol,rtol=rtol,verbose=i_am_main(parts))
259-
# uh = zero(U)
260-
# uh, cache = solve!(uh, nl_solver,op)
259+
nl_solver = GridapSolvers.NewtonSolver(solver,maxiter=1,atol=atol,rtol=rtol,verbose=i_am_main(parts))
260+
uh = zero(U)
261+
uh, cache = solve!(uh, nl_solver,op)
261262

262-
uh = solve(solver,op)
263+
# Linear solver
264+
# uh = solve(solver,op)
263265
toc!(t,"solve")
264266

265267
eh = ue-uh
@@ -310,7 +312,7 @@ function gmg_par_dep(;D=2,
310312
B = VectorValue(0.0,0.0,1.0)
311313
uexBxB = x->(VectorValue(x[1],-x[2],0.)×B)×B
312314
end
313-
title = "H1_BxB_$(name)_$(fe_space)$(fe_order)_scal_$(scaling)_qdeg_$(qdegree)_$(solver)_$(cycle_type)_S_$(smoother)_P_$(prolongation)_R_$(restriction)_Ps_$(projection_solver)"
315+
title = "NL_H1_BxB_$(name)_$(fe_space)$(fe_order)_scal_$(scaling)_qdeg_$(qdegree)_$(solver)_$(cycle_type)_S_$(smoother)_P_$(prolongation)_R_$(restriction)_Ps_$(projection_solver)"
314316

315317
info = Dict{Symbol,Any}()
316318
info[:title] = title

0 commit comments

Comments
 (0)