@@ -83,7 +83,14 @@ function exact_error!(result, u, qpinfo)
8383 return result .= result .^ 2
8484end
8585
86- function main (; μ = 0.001 , nrefs = 5 , reconstruct = true , Plotter = nothing , kwargs... )
86+ function main (;
87+ μ = 0.001 ,
88+ nrefs = 5 ,
89+ reconstruct = true ,
90+ Plotter = nothing ,
91+ use_LM_restrictions = true ,
92+ kwargs...
93+ )
8794
8895 # # problem description
8996 PD = ProblemDescription ()
@@ -96,6 +103,11 @@ function main(; μ = 0.001, nrefs = 5, reconstruct = true, Plotter = nothing, kw
96103 assign_operator! (PD, NonlinearOperator (kernel_nonlinear!, [id_u, grad (u), id (p)]; params = [μ], kwargs... ))
97104 assign_operator! (PD, LinearOperator (f! (μ), [id_u]; kwargs... ))
98105 assign_operator! (PD, InterpolateBoundaryData (u, u!; regions = 1 : 4 ))
106+ if use_LM_restrictions
107+ assign_restriction! (PD, MeanValueRestriction (p; value = 0 ))
108+ else
109+ assign_operator! (PD, FixDofs (p; dofs = [1 ]))
110+ end
99111
100112 # # grid
101113 xgrid = uniform_refine (grid_unitsquare (Triangle2D), nrefs)
@@ -106,10 +118,12 @@ function main(; μ = 0.001, nrefs = 5, reconstruct = true, Plotter = nothing, kw
106118 # # solve
107119 sol = solve (PD, FES; kwargs... )
108120
109- # # move integral mean of pressure
110- pintegrate = ItemIntegrator ([id (p)])
111- pmean = sum (evaluate (pintegrate, sol)) / sum (xgrid[CellVolumes])
112- view (sol[p]) .- = pmean
121+ if ! use_LM_restrictions
122+ # # move integral mean of pressure
123+ pintegrate = ItemIntegrator ([id (p)])
124+ pmean = sum (evaluate (pintegrate, sol)) / sum (xgrid[CellVolumes])
125+ view (sol[p]) .- = pmean
126+ end
113127
114128 # # error calculation
115129 ErrorIntegratorExact = ItemIntegrator (exact_error!, [id (u), id (p)]; quadorder = 4 , params = [μ], kwargs... )
127141
128142generateplots = ExtendableFEM. default_generateplots (Example252_NSEPlanarLatticeFlow, " example252.png" ) # hide
129143function runtests () # hide
130- L2errorU, plt = main (; nrefs = 4 ) # hide
144+ L2errorU, _ = main (; use_LM_restrictions = false , nrefs = 4 ) # hide
145+ @test L2errorU ≈ 0.010616923333947861 # hide
146+ L2errorU, _ = main (; use_LM_restrictions = true , nrefs = 4 ) # hide
131147 @test L2errorU ≈ 0.010616923333947861 # hide
132148 return nothing # hide
133149end # hide
0 commit comments