Skip to content

Commit 9526610

Browse files
committed
Remove iterative solvers from Example250 again
This was no good: it takes longer than direct solvers and is unstable
1 parent 99e2d97 commit 9526610

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

CHANGELOG.md

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

77
### Added
88

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

1212
### Changed
1313

1414
- `solve` uses now the residual equation for the linear systems.
15+
- facelift `Example250`.
1516

1617
## v0.9.0 March 22, 2025
1718

examples/Example250_NSELidDrivenCavity.jl

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,12 @@ function u_boundary!(result, qpinfo)
8282
return nothing
8383
end
8484

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
9785

9886
function main(;
9987
μ_final = 0.0005, # flow parameter
10088
order = 2, # FE order of the flow field (pressure order is order-1)
10189
h = 1.0e-3, # grid cell volume
10290
nrefs = 1, # additional grid refinements
103-
method_linear = nothing, # linear solver ("nothing" invokes the default solver)
104-
precon_linear = nothing, # preconditioner
10591
Plotter = nothing,
10692
kwargs...
10793
)
@@ -134,14 +120,9 @@ function main(;
134120
## prepare plots
135121
plt = GridVisualizer(; Plotter = Plotter, layout = (1, 2), clear = true, size = (1600, 800))
136122

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-
143123
## solve by μ embedding
144124
step = 0
125+
sol = nothing
145126
SC = nothing
146127
PE = PointEvaluator([id(1)])
147128
while (true)
@@ -151,11 +132,6 @@ function main(;
151132
PD,
152133
FES,
153134
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,
159135
return_config = true,
160136
target_residual = 1.0e-10,
161137
maxiterations = 20,
@@ -187,15 +163,7 @@ generateplots = ExtendableFEM.default_generateplots(Example250_NSELidDrivenCavit
187163
function runtests() #hide
188164
sol, plt = main(; μ_final = 0.005) #hide
189165
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-
197166
return nothing #hide
198167
end #hide
199168

200-
201169
end # module

0 commit comments

Comments
 (0)