Vanka smoothers #407
Annotations
2 errors, 7 warnings, and 1 notice
|
Run julia-actions/julia-docdeploy@v1
Process completed with exit code 1.
|
Run julia-actions/julia-docdeploy@v1:
../../../.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl#L46
failed to run `@example` block in src/Examples/DarcyGMG.md:5-126
```@example DarcyGMG
module DarcyGMGApplication
using Test
using LinearAlgebra
using FillArrays, BlockArrays
using Gridap
using Gridap.ReferenceFEs, Gridap.Algebra, Gridap.Geometry, Gridap.FESpaces
using Gridap.CellData, Gridap.MultiField, Gridap.Algebra
using PartitionedArrays
using GridapDistributed
using GridapSolvers
using GridapSolvers.LinearSolvers, GridapSolvers.MultilevelTools, GridapSolvers.PatchBasedSmoothers
using GridapSolvers.BlockSolvers: LinearSystemBlock, BiformBlock, BlockTriangularSolver
function get_patch_smoothers(mh,tests,biform,patch_decompositions,qdegree)
patch_spaces = PatchFESpace(tests,patch_decompositions)
nlevs = num_levels(mh)
smoothers = map(view(tests,1:nlevs-1),patch_decompositions,patch_spaces) do tests, PD, Ph
Vh = get_fe_space(tests)
Ω = Triangulation(PD)
dΩ = Measure(Ω,qdegree)
ap = (u,v) -> biform(u,v,dΩ)
patch_smoother = PatchBasedLinearSolver(ap,Ph,Vh)
return RichardsonSmoother(patch_smoother,10,0.2)
end
return smoothers
end
function get_bilinear_form(mh_lev,biform,qdegree)
model = get_model(mh_lev)
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
return (u,v) -> biform(u,v,dΩ)
end
function main(distribute,np,nc,np_per_level)
parts = distribute(LinearIndices((prod(np),)))
Dc = length(nc)
domain = (Dc == 2) ? (0,1,0,1) : (0,1,0,1,0,1)
mh = CartesianModelHierarchy(parts,np_per_level,domain,nc)
model = get_model(mh,1)
order = 2
qdegree = 2*(order+1)
reffe_u = ReferenceFE(raviart_thomas,Float64,order-1)
reffe_p = ReferenceFE(lagrangian,Float64,order-1;space=:P)
u_exact(x) = (Dc==2) ? VectorValue(x[1]+x[2],-x[2]) : VectorValue(x[1]+x[2],-x[2],0.0)
p_exact(x) = 2.0*x[1]-1.0
tests_u = TestFESpace(mh,reffe_u,dirichlet_tags=["boundary"]);
trials_u = TrialFESpace(tests_u,[u_exact]);
U, V = get_fe_space(trials_u,1), get_fe_space(tests_u,1)
Q = TestFESpace(model,reffe_p;conformity=:L2)
mfs = Gridap.MultiField.BlockMultiFieldStyle()
X = MultiFieldFESpace([U,Q];style=mfs)
Y = MultiFieldFESpace([V,Q];style=mfs)
α = 1.e2
f(x) = u_exact(x) + ∇(p_exact)(x)
graddiv(u,v,dΩ) = ∫(α*divergence(u)⋅divergence(v))dΩ
biform_u(u,v,dΩ) = ∫(v⊙u)dΩ + graddiv(u,v,dΩ)
biform((u,p),(v,q),dΩ) = biform_u(u,v,dΩ) - ∫(divergence(v)*p)dΩ - ∫(divergence(u)*q)dΩ
liform((v,q),dΩ) = ∫(v⋅f)dΩ
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
a(u,v) = biform(u,v,dΩ)
l(v) = liform(v,dΩ)
op = AffineFEOperator(a,l,X,Y)
A, b = get_matrix(op), get_vector(op);
biforms = map(mhl -> get_bilinear_form(mhl,biform_u,qdegree),mh)
patch_decompositions = PatchDecomposition(mh)
smoothers = get_patch_smoothers(
mh,tests_u,biform_u,patch_decompositions,qdegree
)
prolongations = setup_prolongation_operators(
tests_u,qdegree;mode=:residual
)
restrictions = setup_restriction_operators(
tests_u,qdegree;mode=:residual,solver=IS_ConjugateGradientSolver(;reltol=1.e-6)
)
gmg = GMGLinearSolver(
mh,trials_u,tests_u,biforms,
prolongations,restrictions,
pre_smoothers=smoothers,
post_smoothers=smoothers,
coarsest_solver=LUSolver(),
maxiter=3,mode=:preconditioner,verbose=i_am_main(parts)
)
solver_u = gmg
solver_p = CGSolver(JacobiLinearSolver();maxiter=20,atol=1e-14,rtol=1.e-6,verbose=i_am_main(parts))
solver_p.log.depth = 2
bblocks = [LinearSystemBlock() LinearSystemBlock();
LinearSystemBlock() BiformBlock((p,q) -> ∫(-1.0/α*p*q)dΩ,Q,Q)]
coeffs = [1.0 1.0;
0.0 1.0]
P = BlockTriangularSolver(bblocks,[solver_u,solver_p],coeffs,:upper)
solver = FGMRESSolver(20,P;atol=1e-14,rtol=1.e-10,verbose=i_am_main(parts))
ns = numerical_setup(symbolic_setup(solver,A),A)
x = allocate_in_domain(A); fill!(x,0.0)
solve!(x,ns,b)
r = allocate_in_range(A)
mul!(r,A,x)
r .-= b
@test norm(r) < 1.e-5
end
end # module
```
exception =
ArgumentError: Package FillArrays not found in current path.
- Run `import Pkg; Pkg.add("FillArrays")` to install the FillArrays package.
Sta
|
Run julia-actions/julia-docdeploy@v1:
../../../.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl#L46
failed to run `@example` block in src/Examples/NavierStokes.md:29-128
```@example NavierStokes
module NavierStokesApplication
using Test
using LinearAlgebra
using FillArrays, BlockArrays
using Gridap
using Gridap.ReferenceFEs, Gridap.Algebra, Gridap.Geometry, Gridap.FESpaces
using Gridap.CellData, Gridap.MultiField, Gridap.Algebra
using PartitionedArrays
using GridapDistributed
using GridapSolvers
using GridapSolvers.LinearSolvers, GridapSolvers.MultilevelTools, GridapSolvers.NonlinearSolvers
using GridapSolvers.BlockSolvers: LinearSystemBlock, NonlinearSystemBlock, BiformBlock, BlockTriangularSolver
function add_labels_2d!(labels)
add_tag_from_tags!(labels,"top",[6])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,7,8])
end
function add_labels_3d!(labels)
add_tag_from_tags!(labels,"top",[22])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26])
end
function main(distribute,np,nc)
parts = distribute(LinearIndices((prod(np),)))
Dc = length(nc)
domain = (Dc == 2) ? (0,1,0,1) : (0,1,0,1,0,1)
model = CartesianDiscreteModel(parts,np,domain,nc)
add_labels! = (Dc == 2) ? add_labels_2d! : add_labels_3d!
add_labels!(get_face_labeling(model))
order = 2
qdegree = 2*(order+1)
reffe_u = ReferenceFE(lagrangian,VectorValue{Dc,Float64},order)
reffe_p = ReferenceFE(lagrangian,Float64,order-1;space=:P)
u_walls = (Dc==2) ? VectorValue(0.0,0.0) : VectorValue(0.0,0.0,0.0)
u_top = (Dc==2) ? VectorValue(1.0,0.0) : VectorValue(1.0,0.0,0.0)
V = TestFESpace(model,reffe_u,dirichlet_tags=["walls","top"]);
U = TrialFESpace(V,[u_walls,u_top]);
Q = TestFESpace(model,reffe_p;conformity=:L2,constraint=:zeromean)
mfs = Gridap.MultiField.BlockMultiFieldStyle()
X = MultiFieldFESpace([U,Q];style=mfs)
Y = MultiFieldFESpace([V,Q];style=mfs)
Re = 10.0
ν = 1/Re
α = 1.e2
f = (Dc==2) ? VectorValue(0.0,0.0) : VectorValue(0.0,0.0,0.0)
Π_Qh = LocalProjectionMap(divergence,Q,qdegree)
graddiv(u,v,dΩ) = ∫(α*(∇⋅v)⋅Π_Qh(u))dΩ
conv(u,∇u) = (∇u')⋅u
dconv(du,∇du,u,∇u) = conv(u,∇du)+conv(du,∇u)
c(u,v,dΩ) = ∫(v⊙(conv∘(u,∇(u))))dΩ
dc(u,du,dv,dΩ) = ∫(dv⊙(dconv∘(du,∇(du),u,∇(u))))dΩ
lap(u,v,dΩ) = ∫(ν*∇(v)⊙∇(u))dΩ
rhs(v,dΩ) = ∫(v⋅f)dΩ
jac_u(u,du,dv,dΩ) = lap(du,dv,dΩ) + dc(u,du,dv,dΩ) + graddiv(du,dv,dΩ)
jac((u,p),(du,dp),(dv,dq),dΩ) = jac_u(u,du,dv,dΩ) - ∫(divergence(dv)*dp)dΩ - ∫(divergence(du)*dq)dΩ
res_u(u,v,dΩ) = lap(u,v,dΩ) + c(u,v,dΩ) + graddiv(u,v,dΩ) - rhs(v,dΩ)
res((u,p),(v,q),dΩ) = res_u(u,v,dΩ) - ∫(divergence(v)*p)dΩ - ∫(divergence(u)*q)dΩ
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
jac_h(x,dx,dy) = jac(x,dx,dy,dΩ)
res_h(x,dy) = res(x,dy,dΩ)
op = FEOperator(res_h,jac_h,X,Y)
solver_u = LUSolver()
solver_p = CGSolver(JacobiLinearSolver();maxiter=20,atol=1e-14,rtol=1.e-6,verbose=i_am_main(parts))
solver_p.log.depth = 4
bblocks = [NonlinearSystemBlock() LinearSystemBlock();
LinearSystemBlock() BiformBlock((p,q) -> ∫(-(1.0/α)*p*q)dΩ,Q,Q)]
coeffs = [1.0 1.0;
0.0 1.0]
P = BlockTriangularSolver(bblocks,[solver_u,solver_p],coeffs,:upper)
solver = FGMRESSolver(20,P;atol=1e-11,rtol=1.e-8,verbose=i_am_main(parts))
solver.log.depth = 2
nlsolver = NewtonSolver(solver;maxiter=20,atol=1e-10,rtol=1.e-12,verbose=i_am_main(parts))
xh = solve(nlsolver,op);
@test true
end
end # module
```
exception =
ArgumentError: Package FillArrays not found in current path.
- Run `import Pkg; Pkg.add("FillArrays")` to install the FillArrays package.
Stacktrace:
[1] macro expansion
@ ./loading.jl:1772 [inlined]
[2] macro expansion
@ ./lock.jl:267 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1753
[4] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[5] invoke_in_world
@ ./essentials.jl:923 [inlined]
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1746
[7] eval
@ ./boot.jl:385 [inlined]
[8] #58
@ ~/.julia/packages/Documenter/qoyeC/
|
Run julia-actions/julia-docdeploy@v1:
../../../.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl#L46
failed to run `@example` block in src/Examples/NavierStokesGMG.md:31-175
```@example NavierStokesGMG
module NavierStokesGMGApplication
using Test
using LinearAlgebra
using FillArrays, BlockArrays
using Gridap
using Gridap.ReferenceFEs, Gridap.Algebra, Gridap.Geometry, Gridap.FESpaces
using Gridap.CellData, Gridap.MultiField, Gridap.Algebra
using PartitionedArrays
using GridapDistributed
using GridapP4est
using GridapSolvers
using GridapSolvers.LinearSolvers, GridapSolvers.MultilevelTools
using GridapSolvers.PatchBasedSmoothers, GridapSolvers.NonlinearSolvers
using GridapSolvers.BlockSolvers: NonlinearSystemBlock, LinearSystemBlock, BiformBlock, BlockTriangularSolver
function get_patch_smoothers(mh,tests,biform,patch_decompositions,qdegree;is_nonlinear=false)
patch_spaces = PatchFESpace(tests,patch_decompositions)
nlevs = num_levels(mh)
smoothers = map(view(tests,1:nlevs-1),patch_decompositions,patch_spaces) do tests, PD, Ph
Vh = get_fe_space(tests)
Ω = Triangulation(PD)
dΩ = Measure(Ω,qdegree)
ap = (u,du,dv) -> biform(u,du,dv,dΩ)
patch_smoother = PatchBasedLinearSolver(ap,Ph,Vh;is_nonlinear)
return RichardsonSmoother(patch_smoother,10,0.2)
end
return smoothers
end
function get_trilinear_form(mh_lev,triform,qdegree)
model = get_model(mh_lev)
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
return (u,du,dv) -> triform(u,du,dv,dΩ)
end
function add_labels_2d!(labels)
add_tag_from_tags!(labels,"top",[6])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,7,8])
end
function add_labels_3d!(labels)
add_tag_from_tags!(labels,"top",[22])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26])
end
function main(distribute,np,nc,np_per_level)
parts = distribute(LinearIndices((prod(np),)))
Dc = length(nc)
domain = (Dc == 2) ? (0,1,0,1) : (0,1,0,1,0,1)
add_labels! = (Dc == 2) ? add_labels_2d! : add_labels_3d!
mh = CartesianModelHierarchy(parts,np_per_level,domain,nc;add_labels! = add_labels!)
model = get_model(mh,1)
order = 2
qdegree = 2*(order+1)
reffe_u = ReferenceFE(lagrangian,VectorValue{Dc,Float64},order)
reffe_p = ReferenceFE(lagrangian,Float64,order-1;space=:P)
u_walls = (Dc==2) ? VectorValue(0.0,0.0) : VectorValue(0.0,0.0,0.0)
u_top = (Dc==2) ? VectorValue(1.0,0.0) : VectorValue(1.0,0.0,0.0)
tests_u = TestFESpace(mh,reffe_u,dirichlet_tags=["walls","top"]);
trials_u = TrialFESpace(tests_u,[u_walls,u_top]);
U, V = get_fe_space(trials_u,1), get_fe_space(tests_u,1)
Q = TestFESpace(model,reffe_p;conformity=:L2,constraint=:zeromean)
mfs = Gridap.MultiField.BlockMultiFieldStyle()
X = MultiFieldFESpace([U,Q];style=mfs)
Y = MultiFieldFESpace([V,Q];style=mfs)
Re = 10.0
ν = 1/Re
α = 1.e2
f = (Dc==2) ? VectorValue(1.0,1.0) : VectorValue(1.0,1.0,1.0)
Π_Qh = LocalProjectionMap(divergence,reffe_p,qdegree)
graddiv(u,v,dΩ) = ∫(α*(∇⋅v)⋅Π_Qh(u))dΩ
conv(u,∇u) = (∇u')⋅u
dconv(du,∇du,u,∇u) = conv(u,∇du)+conv(du,∇u)
c(u,v,dΩ) = ∫(v⊙(conv∘(u,∇(u))))dΩ
dc(u,du,dv,dΩ) = ∫(dv⊙(dconv∘(du,∇(du),u,∇(u))))dΩ
lap(u,v,dΩ) = ∫(ν*∇(v)⊙∇(u))dΩ
rhs(v,dΩ) = ∫(v⋅f)dΩ
jac_u(u,du,dv,dΩ) = lap(du,dv,dΩ) + dc(u,du,dv,dΩ) + graddiv(du,dv,dΩ)
jac((u,p),(du,dp),(dv,dq),dΩ) = jac_u(u,du,dv,dΩ) - ∫(divergence(dv)*dp)dΩ - ∫(divergence(du)*dq)dΩ
res_u(u,v,dΩ) = lap(u,v,dΩ) + c(u,v,dΩ) + graddiv(u,v,dΩ) - rhs(v,dΩ)
res((u,p),(v,q),dΩ) = res_u(u,v,dΩ) - ∫(divergence(v)*p)dΩ - ∫(divergence(u)*q)dΩ
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
jac_h(x,dx,dy) = jac(x,dx,dy,dΩ)
res_h(x,dy) = res(x,dy,dΩ)
op = FEOperator(res_h,jac_h,X,Y)
biforms = map(mhl -> get_trilinear_form(mhl,jac_u,qdegree),mh)
patch_decompositions = PatchDecomposition(mh)
smoothers = get_patch_smoothers(
mh,trials_u,jac_u,patch_decompositions,qdegree;is_nonlinear=true
)
prolongations = setup_patch_prolongation_operators(
tests_u,jac_u,graddiv,qdegree;is_nonlinear=true
)
restrictions = setup_patch_restriction_operators(
tests_u,prolongations,graddiv,qdegree;solver=IS_ConjugateGradientSolver(;
|
Run julia-actions/julia-docdeploy@v1:
../../../.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl#L46
failed to run `@example` block in src/Examples/Stokes.md:29-120
```@example Stokes
module StokesApplication
using Test
using LinearAlgebra
using FillArrays, BlockArrays
using Gridap
using Gridap.ReferenceFEs, Gridap.Algebra, Gridap.Geometry, Gridap.FESpaces
using Gridap.CellData, Gridap.MultiField, Gridap.Algebra
using PartitionedArrays
using GridapDistributed
using GridapSolvers
using GridapSolvers.LinearSolvers, GridapSolvers.MultilevelTools
using GridapSolvers.BlockSolvers: LinearSystemBlock, BiformBlock, BlockTriangularSolver
function add_labels_2d!(labels)
add_tag_from_tags!(labels,"top",[6])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,7,8])
end
function add_labels_3d!(labels)
add_tag_from_tags!(labels,"top",[22])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26])
end
function main(distribute,np,nc)
parts = distribute(LinearIndices((prod(np),)))
Dc = length(nc)
domain = (Dc == 2) ? (0,1,0,1) : (0,1,0,1,0,1)
model = CartesianDiscreteModel(parts,np,domain,nc)
add_labels! = (Dc == 2) ? add_labels_2d! : add_labels_3d!
add_labels!(get_face_labeling(model))
order = 2
qdegree = 2*(order+1)
reffe_u = ReferenceFE(lagrangian,VectorValue{Dc,Float64},order)
reffe_p = ReferenceFE(lagrangian,Float64,order-1;space=:P)
u_walls = (Dc==2) ? VectorValue(0.0,0.0) : VectorValue(0.0,0.0,0.0)
u_top = (Dc==2) ? VectorValue(1.0,0.0) : VectorValue(1.0,0.0,0.0)
V = TestFESpace(model,reffe_u,dirichlet_tags=["walls","top"]);
U = TrialFESpace(V,[u_walls,u_top]);
Q = TestFESpace(model,reffe_p;conformity=:L2,constraint=:zeromean)
mfs = Gridap.MultiField.BlockMultiFieldStyle()
X = MultiFieldFESpace([U,Q];style=mfs)
Y = MultiFieldFESpace([V,Q];style=mfs)
α = 1.e2
f = (Dc==2) ? VectorValue(1.0,1.0) : VectorValue(1.0,1.0,1.0)
Π_Qh = LocalProjectionMap(divergence,Q,qdegree)
graddiv(u,v,dΩ) = ∫(α*(∇⋅v)⋅Π_Qh(u))dΩ
biform_u(u,v,dΩ) = ∫(∇(v)⊙∇(u))dΩ + graddiv(u,v,dΩ)
biform((u,p),(v,q),dΩ) = biform_u(u,v,dΩ) - ∫(divergence(v)*p)dΩ - ∫(divergence(u)*q)dΩ
liform((v,q),dΩ) = ∫(v⋅f)dΩ
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
a(u,v) = biform(u,v,dΩ)
l(v) = liform(v,dΩ)
op = AffineFEOperator(a,l,X,Y)
A, b = get_matrix(op), get_vector(op);
solver_u = LUSolver()
solver_p = CGSolver(JacobiLinearSolver();maxiter=20,atol=1e-14,rtol=1.e-6,verbose=i_am_main(parts))
solver_p.log.depth = 2
bblocks = [LinearSystemBlock() LinearSystemBlock();
LinearSystemBlock() BiformBlock((p,q) -> ∫(-(1.0/α)*p*q)dΩ,Q,Q)]
coeffs = [1.0 1.0;
0.0 1.0]
P = BlockTriangularSolver(bblocks,[solver_u,solver_p],coeffs,:upper)
solver = FGMRESSolver(20,P;atol=1e-10,rtol=1.e-12,verbose=i_am_main(parts))
ns = numerical_setup(symbolic_setup(solver,A),A)
x = allocate_in_domain(A); fill!(x,0.0)
solve!(x,ns,b)
r = allocate_in_range(A)
mul!(r,A,x)
r .-= b
@test norm(r) < 1.e-7
end
end # module
```
exception =
ArgumentError: Package FillArrays not found in current path.
- Run `import Pkg; Pkg.add("FillArrays")` to install the FillArrays package.
Stacktrace:
[1] macro expansion
@ ./loading.jl:1772 [inlined]
[2] macro expansion
@ ./lock.jl:267 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1753
[4] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[5] invoke_in_world
@ ./essentials.jl:923 [inlined]
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1746
[7] eval
@ ./boot.jl:385 [inlined]
[8] #58
@ ~/.julia/packages/Documenter/qoyeC/src/expander_pipeline.jl:754 [inlined]
[9] cd(f::Documenter.var"#58#60"{Module, Expr}, dir::String)
@ Base.Filesystem ./file.jl:112
[10] (::Documenter.var"#57#59"{Documenter.Page, Module, Expr})()
@ Documenter ~/.julia/packages/Documenter/qoyeC/src/expander_pipeline.jl:753
[11] (::IOCapture.var"#5#9"{DataType, Documenter.var"#57#59"{Documenter.Page, Module, Expr}, IOContext{Base.PipeEndpoint
|
Run julia-actions/julia-docdeploy@v1:
../../../.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl#L46
failed to run `@example` block in src/Examples/StokesGMG.md:31-168
```@example StokesGMG
module StokesGMGApplication
using Test
using LinearAlgebra
using FillArrays, BlockArrays
using Gridap
using Gridap.ReferenceFEs, Gridap.Algebra, Gridap.Geometry, Gridap.FESpaces
using Gridap.CellData, Gridap.MultiField, Gridap.Algebra
using PartitionedArrays
using GridapDistributed
using GridapP4est
using GridapSolvers
using GridapSolvers.LinearSolvers, GridapSolvers.MultilevelTools, GridapSolvers.PatchBasedSmoothers
using GridapSolvers.BlockSolvers: LinearSystemBlock, BiformBlock, BlockTriangularSolver
function get_patch_smoothers(mh,tests,biform,patch_decompositions,qdegree)
patch_spaces = PatchFESpace(tests,patch_decompositions)
nlevs = num_levels(mh)
smoothers = map(view(tests,1:nlevs-1),patch_decompositions,patch_spaces) do tests, PD, Ph
Vh = get_fe_space(tests)
Ω = Triangulation(PD)
dΩ = Measure(Ω,qdegree)
ap = (u,v) -> biform(u,v,dΩ)
patch_smoother = PatchBasedLinearSolver(ap,Ph,Vh)
return RichardsonSmoother(patch_smoother,10,0.2)
end
return smoothers
end
function get_bilinear_form(mh_lev,biform,qdegree)
model = get_model(mh_lev)
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
return (u,v) -> biform(u,v,dΩ)
end
function add_labels_2d!(labels)
add_tag_from_tags!(labels,"top",[6])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,7,8])
end
function add_labels_3d!(labels)
add_tag_from_tags!(labels,"top",[22])
add_tag_from_tags!(labels,"walls",[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26])
end
function main(distribute,np,nc,np_per_level)
parts = distribute(LinearIndices((prod(np),)))
Dc = length(nc)
domain = (Dc == 2) ? (0,1,0,1) : (0,1,0,1,0,1)
add_labels! = (Dc == 2) ? add_labels_2d! : add_labels_3d!
mh = CartesianModelHierarchy(parts,np_per_level,domain,nc;add_labels! = add_labels!)
model = get_model(mh,1)
order = 2
qdegree = 2*(order+1)
reffe_u = ReferenceFE(lagrangian,VectorValue{Dc,Float64},order)
reffe_p = ReferenceFE(lagrangian,Float64,order-1;space=:P)
u_walls = (Dc==2) ? VectorValue(0.0,0.0) : VectorValue(0.0,0.0,0.0)
u_top = (Dc==2) ? VectorValue(1.0,0.0) : VectorValue(1.0,0.0,0.0)
tests_u = TestFESpace(mh,reffe_u,dirichlet_tags=["walls","top"]);
trials_u = TrialFESpace(tests_u,[u_walls,u_top]);
U, V = get_fe_space(trials_u,1), get_fe_space(tests_u,1)
Q = TestFESpace(model,reffe_p;conformity=:L2,constraint=:zeromean)
mfs = Gridap.MultiField.BlockMultiFieldStyle()
X = MultiFieldFESpace([U,Q];style=mfs)
Y = MultiFieldFESpace([V,Q];style=mfs)
α = 1.e2
f = (Dc==2) ? VectorValue(1.0,1.0) : VectorValue(1.0,1.0,1.0)
Π_Qh = LocalProjectionMap(divergence,reffe_p,qdegree)
graddiv(u,v,dΩ) = ∫(α*(∇⋅v)⋅Π_Qh(u))dΩ
biform_u(u,v,dΩ) = ∫(∇(v)⊙∇(u))dΩ + graddiv(u,v,dΩ)
biform((u,p),(v,q),dΩ) = biform_u(u,v,dΩ) - ∫(divergence(v)*p)dΩ - ∫(divergence(u)*q)dΩ
liform((v,q),dΩ) = ∫(v⋅f)dΩ
Ω = Triangulation(model)
dΩ = Measure(Ω,qdegree)
a(u,v) = biform(u,v,dΩ)
l(v) = liform(v,dΩ)
op = AffineFEOperator(a,l,X,Y)
A, b = get_matrix(op), get_vector(op);
biforms = map(mhl -> get_bilinear_form(mhl,biform_u,qdegree),mh)
patch_decompositions = PatchDecomposition(mh)
smoothers = get_patch_smoothers(
mh,tests_u,biform_u,patch_decompositions,qdegree
)
prolongations = setup_patch_prolongation_operators(
tests_u,biform_u,graddiv,qdegree
)
restrictions = setup_patch_restriction_operators(
tests_u,prolongations,graddiv,qdegree;solver=CGSolver(JacobiLinearSolver())
)
gmg = GMGLinearSolver(
mh,trials_u,tests_u,biforms,
prolongations,restrictions,
pre_smoothers=smoothers,
post_smoothers=smoothers,
coarsest_solver=LUSolver(),
maxiter=4,mode=:preconditioner,verbose=i_am_main(parts)
)
solver_u = gmg
solver_p = CGSolver(JacobiLinearSolver();maxiter=20,atol=1e-14,rtol=1.e-6,verbose=i_am_main(parts))
solver_u.log.depth = 2
solver_p.log.depth = 2
diag_blocks = [LinearSystemBlock(),BiformBlock((p,q) -> ∫(-1.0/α*p*q)dΩ,Q,Q)]
bblocks = map(CartesianIndic
|
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v2, julia-actions/setup-julia@v1. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
Run julia-actions/julia-buildpkg@v1
Consider using `julia-actions/cache` to speed up runs https://github.com/julia-actions/cache. To ignore, set input `ignore-no-cache: true`
|
Loading