diff --git a/extensions/GalerkinToolkitExamples/src/example004.jl b/extensions/GalerkinToolkitExamples/src/example004.jl index cf747594..27841b10 100644 --- a/extensions/GalerkinToolkitExamples/src/example004.jl +++ b/extensions/GalerkinToolkitExamples/src/example004.jl @@ -111,7 +111,7 @@ function nlsolve_solver(;linear_solver=Example001.lu_solver(),timer=TimerOutput( error("todo") end function finalize!(setup) - setup.linear_solver.finalize!(setup) + setup.linear_solver.finalize!(setup.ls_setup) end (;setup,solve!,setup!,finalize!) end diff --git a/extensions/GalerkinToolkitExamples/test/example004_defs.jl b/extensions/GalerkinToolkitExamples/test/example004_defs.jl index 2a77b270..4781edb3 100644 --- a/extensions/GalerkinToolkitExamples/test/example004_defs.jl +++ b/extensions/GalerkinToolkitExamples/test/example004_defs.jl @@ -1,9 +1,10 @@ import GalerkinToolkit as gk -using GalerkinToolkitExamples: Example004 +using GalerkinToolkitExamples: Example004, Example002 using Test using PartitionedArrays using PetscCall +using TimerOutputs function example004_tests_np_4(distribute) tol = 1.0e-8 @@ -22,8 +23,8 @@ function example004_tests_np_4(distribute) params = Dict{Symbol,Any}() domain = (0,10,0,10,0,10) - cells_per_dir = (20,20,20) - parts_per_dir = (2,2,2) + cells_per_dir = (10,10,10) + parts_per_dir = (2,2,1) np = prod(parts_per_dir) parts = distribute(LinearIndices((np,))) ghost_layers = 0 @@ -33,4 +34,26 @@ function example004_tests_np_4(distribute) @test results[:eh1] < tol @test results[:el2] < tol + + params = Dict{Symbol,Any}() + domain = (0,10,0,10,0,10) + cells_per_dir = (50,50,50) + parts_per_dir = (2,2,1) + np = prod(parts_per_dir) + parts = distribute(LinearIndices((np,))) + ghost_layers = 0 + mesh = gk.cartesian_mesh(domain,cells_per_dir,parts_per_dir;parts,ghost_layers) + params[:mesh] = mesh + params[:export_vtu] = false + options = "-pc_type gamg -ksp_type cg -ksp_error_if_not_converged true -ksp_converged_reason -ksp_rtol 1.0e-6" + PetscCall.init(args=split(options)) + # TODO a more comfortable way of passing a timer? + linear_solver = Example002.ksp_solver() + timer = TimerOutput() + params[:solver] = Example004.nlsolve_solver(;timer,linear_solver,method=:newton,show_trace=true) + params[:timer] = timer + results = Example004.main(params) + @test results[:eh1] < tol + @test results[:el2] < tol + end