Skip to content

Commit 089c87f

Browse files
committed
Remove iterative solvers from Example250 again
This was no good: it takes longer than direct solvers and is unstable
1 parent 027a6a3 commit 089c87f

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
### Added
1212

13-
- example `Example250` now also demonstrates a nonlinear problem solved by an iterative linear solver
14-
with preconditioning and an initial solution.
13+
- example `Example301` now also demonstrates a nonlinear problem solved by an iterative linear solver
14+
with preconditioning.
1515

1616
### Changed
1717

1818
- `solve` uses now the residual equation for the linear systems
19+
- facelift `Example250`.
1920

2021
### Fixed
2122

examples/Example250_NSELidDrivenCavity.jl

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ using ExtendableGrids
2626
using SimplexGridFactory
2727
using LinearAlgebra
2828
using GridVisualize
29-
using LinearSolve
30-
using IncompleteLU
3129
using Test #hide
3230

3331

@@ -82,26 +80,12 @@ function u_boundary!(result, qpinfo)
8280
return nothing
8381
end
8482

85-
function initialgrid_cone()
86-
xgrid = ExtendableGrid{Float64, Int32}()
87-
xgrid[Coordinates] = Array{Float64, 2}([-1 0; 0 -2; 1 0]')
88-
xgrid[CellNodes] = Array{Int32, 2}([1 2 3]')
89-
xgrid[CellGeometries] = VectorOfConstants{ElementGeometries, Int}(Triangle2D, 1)
90-
xgrid[CellRegions] = ones(Int32, 1)
91-
xgrid[BFaceRegions] = Array{Int32, 1}([1, 2, 3])
92-
xgrid[BFaceNodes] = Array{Int32, 2}([1 2; 2 3; 3 1]')
93-
xgrid[BFaceGeometries] = VectorOfConstants{ElementGeometries, Int}(Edge1D, 3)
94-
xgrid[CoordinateSystem] = Cartesian2D
95-
return xgrid
96-
end
9783

9884
function main(;
9985
μ_final = 0.0005, # flow parameter
10086
order = 2, # FE order of the flow field (pressure order is order-1)
10187
h = 1.0e-3, # grid cell volume
10288
nrefs = 1, # additional grid refinements
103-
method_linear = nothing, # linear solver ("nothing" invokes the default solver)
104-
precon_linear = nothing, # preconditioner
10589
Plotter = nothing,
10690
kwargs...
10791
)
@@ -134,14 +118,9 @@ function main(;
134118
## prepare plots
135119
plt = GridVisualizer(; Plotter = Plotter, layout = (1, 2), clear = true, size = (1600, 800))
136120

137-
138-
## prepare an initial solution matching the boundary data
139-
sol = FEVector(FES; tags = PD.unknowns)
140-
interpolate!(sol[u], ON_BFACES, u_boundary!; regions = [1])
141-
142-
143121
## solve by μ embedding
144122
step = 0
123+
sol = nothing
145124
SC = nothing
146125
PE = PointEvaluator([id(1)])
147126
while (true)
@@ -151,11 +130,6 @@ function main(;
151130
PD,
152131
FES,
153132
SC;
154-
init = sol,
155-
method_linear,
156-
# use new preconditioner API: https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/#Specifying-Preconditioners
157-
# this does currently now work with ILU, see https://github.com/WIAS-PDELib/ExtendableFEM.jl/pull/47#issuecomment-2796849931
158-
precon_linear,
159133
return_config = true,
160134
target_residual = 1.0e-10,
161135
maxiterations = 20,
@@ -187,15 +161,7 @@ generateplots = ExtendableFEM.default_generateplots(Example250_NSELidDrivenCavit
187161
function runtests() #hide
188162
sol, plt = main(; μ_final = 0.005) #hide
189163
sum(view(sol[1])) 237.24628017878518 #hide
190-
191-
method_linear = KrylovJL_GMRES() #hide
192-
precon_linear = IncompleteLU.ilu #hide
193-
194-
sol, plt = main(; μ_final = 0.005, method_linear, precon_linear) #hide
195-
@test sum(view(sol[1])) 237.24628017878518 #hide
196-
197164
return nothing #hide
198165
end #hide
199166

200-
201167
end # module

0 commit comments

Comments
 (0)