From 0c46fd31eacb9efb4f1bc1fa75e00414cc9851a3 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Tue, 1 Oct 2024 17:30:05 +1000 Subject: [PATCH] More fixes --- Project.toml | 1 - src/Solvers/badia2024.jl | 2 +- src/Solvers/petsc.jl | 6 ++-- src/parameters.jl | 2 +- test/seq/expansion_badia2024_tests.jl | 49 +++++++++++++-------------- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Project.toml b/Project.toml index 18089f2..b000522 100644 --- a/Project.toml +++ b/Project.toml @@ -30,7 +30,6 @@ gmsh_jll = "630162c2-fc9b-58b3-9910-8442a8a132e6" BSON = "0.3" FileIO = "1" Gridap = "0.18" -GridapDistributed = "0.4.0" GridapGmsh = "0.7.2" GridapP4est = "0.3.7" GridapPETSc = "0.5.0" diff --git a/src/Solvers/badia2024.jl b/src/Solvers/badia2024.jl index 14b7c58..6ddc0ec 100644 --- a/src/Solvers/badia2024.jl +++ b/src/Solvers/badia2024.jl @@ -16,7 +16,7 @@ function Badia2024Solver(op::FEOperator,params) U_u, U_p, U_j, U_φ = get_trial(op) V_u, V_p, V_j, V_φ = get_test(op) - diag_solvers = map(s -> get_block_solver(Val(s),params),params[:solver][:block_solvers]) + diag_solvers = map(s -> get_block_solver(Val(s),params), params[:solver][:block_solvers]) uj_block = NonlinearSystemBlock(1) p_block = BiformBlock(a_Ip,U_p,V_p) diff --git a/src/Solvers/petsc.jl b/src/Solvers/petsc.jl index 4bd12af..c6b4fb1 100644 --- a/src/Solvers/petsc.jl +++ b/src/Solvers/petsc.jl @@ -17,10 +17,10 @@ function petsc_mumps_setup(ksp) @check_error_code GridapPETSc.PETSC.PCFactorGetMatrix(pc[],mumpsmat) # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 4, 1) @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 7, 0) - # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) - # @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 2) + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 28, 2) + @check_error_code GridapPETSc.PETSC.MatMumpsSetIcntl(mumpsmat[], 29, 1) # @check_error_code GridapPETSc.PETSC.MatMumpsSetCntl(mumpsmat[], 3, 1.0e-6) - # @check_error_code GridapPETSc.PETSC.KSPView(ksp[],C_NULL) + @check_error_code GridapPETSc.PETSC.KSPView(ksp[],C_NULL) end # Standalone AMG solver, 5 iterations diff --git a/src/parameters.jl b/src/parameters.jl index 20cd51b..000e0b9 100644 --- a/src/parameters.jl +++ b/src/parameters.jl @@ -589,5 +589,5 @@ function params_bcs_stabilization(params::Dict{Symbol,Any}) :μ=>true, ) optional = Dict(:domain=>params[:fluid][:domain]) - _check_mandatory_and_add_optional_weak(params[:bcs][:stabilization],mandatory,optional,params,"[:bcs][:thin_wall]") + _check_mandatory_and_add_optional_weak(params[:bcs][:stabilization],mandatory,optional,params,"[:bcs][:stabilization]") end diff --git a/test/seq/expansion_badia2024_tests.jl b/test/seq/expansion_badia2024_tests.jl index d5f3bf3..98e4b60 100644 --- a/test/seq/expansion_badia2024_tests.jl +++ b/test/seq/expansion_badia2024_tests.jl @@ -2,38 +2,37 @@ module ExpansionBadia2024TestsSequential using GridapMHD: expansion using SparseArrays +using SparseMatricesCSR +using GridapPETSc -cw = 0.028 Re = 1.0 -Ha = 100.0 +Ha = 10.0 N = Ha^2/Re -mesh = Dict( - :mesher => :p4est_MG, - :base_mesh => "coarse", - :num_refs_coarse => 0, - :ranks_per_level => [1,1], -) +# solver = Dict( +# :solver => :badia2024, +# :matrix_type => SparseMatrixCSC{Float64,Int64}, +# :vector_type => Vector{Float64}, +# :block_solvers => [:julia,:cg_jacobi,:cg_jacobi], +# :petsc_options => "-ksp_error_if_not_converged true -ksp_converged_reason" +# ) + +# solver = Dict( +# :solver => :badia2024, +# :matrix_type => SparseMatrixCSR{0,PetscScalar,PetscInt}, +# :vector_type => Vector{PetscScalar}, +# :block_solvers => [:petsc_from_options,:cg_jacobi,:cg_jacobi], +# :petsc_options => "-ksp_error_if_not_converged true -ksp_converged_reason -ksp_type preonly -pc_type lu -pc_factor_mat_solver_type mumps", +# ) + solver = Dict( :solver => :badia2024, - :matrix_type => SparseMatrixCSC{Float64,Int64}, - :vector_type => Vector{Float64}, - :block_solvers => [:gmg,:cg_jacobi,:cg_jacobi], - :petsc_options => "-ksp_error_if_not_converged true -ksp_converged_reason" + :matrix_type => SparseMatrixCSR{0,PetscScalar,PetscInt}, + :vector_type => Vector{PetscScalar}, + :block_solvers => [:petsc_mumps,:cg_jacobi,:cg_jacobi], + :petsc_options => "-ksp_error_if_not_converged true -ksp_converged_reason", ) -expansion(np=1,backend=:mpi,mesh=mesh,solver=solver,order=2,ζ=100.0,N=N,Ha=Ha,cw=cw,title="ExpansionGMG",formulation=:mhd) -""" -# ReferenceSolution -expansion(np=1,backend=:mpi,solver=:julia,order=2,ζ=0.0,N=N,Ha=Ha,cw=cw,title="ExpansionRef") +expansion(np=4,backend=:mpi,mesh="710",solver=solver,order=2,ζ=10.0,N=N,Ha=Ha,title="Expansion") -expansion(np=1,backend=:mpi,solver=:julia,order=2,ζ=0.0,N=N,Ha=Ha,cw=cw,title="ExpansionRefBis",mesh=mesh) - -meshbis = Dict( - :mesher => :p4est_SG, - :base_mesh => "coarse", - :num_refs => 1 -) -expansion(np=1,backend=:mpi,solver=:julia,order=2,ζ=0.0,N=N,Ha=Ha,cw=cw,title="ExpansionRefBis",mesh=meshbis) -""" end # module \ No newline at end of file