@@ -101,7 +101,7 @@ function execute(problem::Problem{:analytical};kwargs...)
101
101
d < 1.0e-8
102
102
end
103
103
oldcell_to_coods = get_cell_coordinates (trian)
104
- oldcell_to_is_in = collect1d (apply (is_in,oldcell_to_coods))
104
+ oldcell_to_is_in = collect1d (lazy_map (is_in,oldcell_to_coods))
105
105
incell_to_cell = findall (oldcell_to_is_in)
106
106
outcell_to_cell = findall (collect (Bool, .! oldcell_to_is_in))
107
107
model_solid = DiscreteModel (model,incell_to_cell)
@@ -132,16 +132,15 @@ function execute(problem::Problem{:analytical};kwargs...)
132
132
# Quadratures
133
133
println (" Defining quadratures" )
134
134
order = _get_kwarg (:order ,kwargs,2 )
135
- order = _get_kwarg (:order ,kwargs,2 )
136
- quads = get_FSI_quadratures (Tₕ,order)
135
+ dTₕ = get_FSI_measures (Tₕ,order)
137
136
138
137
# Test FE Spaces
139
138
println (" Defining FE spaces" )
140
139
Y_ST, X_ST, Y_FSI, X_FSI = get_FE_spaces (strategy,coupling,models,order,bconds,constraint= :zeromean )
141
140
142
141
# Stokes problem for initial solution
143
142
println (" Defining Stokes operator" )
144
- op_ST = get_Stokes_operator ([ X_ST,Y_ST] ,strategy,Tₕ[ :Ωf ],quads [:Ωf ],μ_f,fv_ST_Ωf (0.0 ))
143
+ op_ST = get_Stokes_operator (X_ST,Y_ST,strategy,dTₕ [:Ωf ],μ_f,fv_ST_Ωf (0.0 ))
145
144
146
145
# Setup equation parameters
147
146
mesh_params = Dict {Symbol,Any} (
@@ -172,7 +171,7 @@ function execute(problem::Problem{:analytical};kwargs...)
172
171
173
172
# FSI problem
174
173
println (" Defining FSI operator" )
175
- op_FSI = get_FSI_operator ([ X_FSI,Y_FSI] ,coupling,strategy,Tₕ,quads ,params)
174
+ op_FSI = get_FSI_operator (X_FSI,Y_FSI,coupling,strategy,Tₕ,dTₕ ,params)
176
175
177
176
# Setup output files
178
177
folderName = " fsi-results"
@@ -184,53 +183,53 @@ function execute(problem::Problem{:analytical};kwargs...)
184
183
185
184
# Solve Stokes problem
186
185
@timeit " ST problem" begin
187
- println (" Defining Stokes solver" )
188
- xh = solve (op_ST)
189
- if (is_vtk)
190
- writePVD (filePath, Tₕ[:Ωf ], [(xh, 0.0 )])
186
+ println (" Defining Stokes solver" )
187
+ xh = solve (op_ST)
188
+ if (is_vtk)
189
+ writePVD (filePath, Tₕ[:Ωf ], [(xh, 0.0 )])
190
+ end
191
191
end
192
- end
193
192
194
- # Compute Stokes solution L2-norm
195
- l2 (w) = w⋅ w
196
- eu_ST = u (0.0 ) - restrict ( xh[1 ],Tₕ[ :Ωf ])
197
- ev_ST = v (0.0 ) - restrict ( xh[2 ],Tₕ[ :Ωf ])
198
- ep_ST = p (0.0 ) - restrict ( xh[3 ],Tₕ[ :Ωf ])
199
- eul2_ST = sqrt (sum ( integrate (l2 (eu_ST),Tₕ [:Ωf ],quads[ :Ωf ]) ))
200
- evl2_ST = sqrt (sum ( integrate (l2 (ev_ST),Tₕ [:Ωf ],quads[ :Ωf ]) ))
201
- epl2_ST = sqrt (sum ( integrate (l2 (ep_ST),Tₕ [:Ωf ],quads[ :Ωf ]) ))
202
- println (" Stokes L2-norm u: " , eul2_ST)
203
- println (" Stokes L2-norm v: " , evl2_ST)
204
- println (" Stokes L2-norm p: " , epl2_ST)
205
- @test eul2_ST < 1.0e-10
206
- @test evl2_ST < 1.0e-10
207
- @test epl2_ST < 1.0e-10
193
+ # Compute Stokes solution L2-norm
194
+ l2 (w) = w⋅ w
195
+ eu_ST = u (0.0 ) - xh[1 ]
196
+ ev_ST = v (0.0 ) - xh[2 ]
197
+ ep_ST = p (0.0 ) - xh[3 ]
198
+ eul2_ST = sqrt (∑ ( ∫ (l2 (eu_ST))dTₕ [:Ωf ] ))
199
+ evl2_ST = sqrt (∑ ( ∫ (l2 (ev_ST))dTₕ [:Ωf ] ))
200
+ epl2_ST = sqrt (∑ ( ∫ (l2 (ep_ST))dTₕ [:Ωf ] ))
201
+ println (" Stokes L2-norm u: " , eul2_ST)
202
+ println (" Stokes L2-norm v: " , evl2_ST)
203
+ println (" Stokes L2-norm p: " , epl2_ST)
204
+ @test eul2_ST < 1.0e-10
205
+ @test evl2_ST < 1.0e-10
206
+ @test epl2_ST < 1.0e-10
208
207
209
- # Solve FSI problem
210
- @timeit " FSI problem" begin
211
- println (" Defining FSI solver" )
212
- xh0 = interpolate_everywhere ([u (0.0 ),v (0.0 ),p (0.0 )],X_FSI (0.0 ))
213
- nls = NLSolver (
214
- show_trace = true ,
215
- method = :newton ,
216
- linesearch = BackTracking (),
217
- ftol = 1.0e-10 ,
218
- iterations = 50
219
- )
220
- odes = ThetaMethod (nls, dt, 0.5 )
221
- solver = TransientFESolver (odes)
222
- xht = solve (solver, op_FSI, xh0, t0, tf)
223
- end
208
+ # Solve FSI problem
209
+ @timeit " FSI problem" begin
210
+ println (" Defining FSI solver" )
211
+ xh0 = interpolate_everywhere ([u (0.0 ),v (0.0 ),p (0.0 )],X_FSI (0.0 ))
212
+ nls = NLSolver (
213
+ show_trace = true ,
214
+ method = :newton ,
215
+ linesearch = BackTracking (),
216
+ ftol = 1.0e-10 ,
217
+ iterations = 50
218
+ )
219
+ odes = ThetaMethod (nls, dt, 0.5 )
220
+ solver = TransientFESolver (odes)
221
+ xht = solve (solver, op_FSI, xh0, t0, tf)
222
+ end
224
223
225
- # Compute outputs
226
- out_params = Dict (
227
- :u => u,
228
- :v => v,
229
- :p => p,
230
- :filePath => filePath,
231
- :is_vtk => is_vtk
232
- )
233
- output = computeOutputs (xht,Tₕ,quads ,strategy,out_params)
224
+ # Compute outputs
225
+ out_params = Dict (
226
+ :u => u,
227
+ :v => v,
228
+ :p => p,
229
+ :filePath => filePath,
230
+ :is_vtk => is_vtk
231
+ )
232
+ output = computeOutputs (xht,Tₕ,dTₕ ,strategy,out_params)
234
233
235
234
end
236
235
@@ -305,7 +304,7 @@ function get_FE_spaces(problem::Problem{:analytical},strategy::WeakForms.MeshStr
305
304
)
306
305
end
307
306
308
- function computeOutputs (xht,Tₕ,quads ,strategy,params)
307
+ function computeOutputs (xht,Tₕ,dTₕ ,strategy,params)
309
308
310
309
# Unpack parameters
311
310
u = params[:u ]
@@ -326,18 +325,18 @@ function computeOutputs(xht,Tₕ,quads,strategy,params)
326
325
println (" ============================" )
327
326
328
327
# Compute errors
329
- eu = u (t) - restrict ( xh[1 ],Tₕ[ :Ω ])
330
- ev = v (t) - restrict ( xh[2 ],Tₕ[ :Ω ])
331
- ep = p (t) - restrict ( xh[3 ],Tₕ[ :Ω ])
332
- eul2 = sqrt (sum ( integrate (l2 (eu),Tₕ [:Ω ],quads[ :Ω ] ) ))
333
- evl2 = sqrt (sum ( integrate (l2 (ev),Tₕ [:Ω ],quads[ :Ω ] ) ))
334
- epl2 = sqrt (sum ( integrate (l2 (ep),Tₕ [:Ω ],quads[ :Ω ] ) ))
328
+ eu = u (t) - xh[1 ]
329
+ ev = v (t) - xh[2 ]
330
+ ep = p (t) - xh[3 ]
331
+ eul2 = sqrt (∑ ( ∫ (l2 (eu))dTₕ [:Ω ] ))
332
+ evl2 = sqrt (∑ ( ∫ (l2 (ev))dTₕ [:Ω ] ))
333
+ epl2 = sqrt (∑ ( ∫ (l2 (ep))dTₕ [:Ω ] ))
335
334
336
335
# Write to PVD
337
336
if (is_vtk)
338
- uh = restrict ( xh[1 ],Tₕ[ :Ω ])
339
- vh = restrict ( xh[2 ],Tₕ[ :Ω ])
340
- ph = restrict ( xh[3 ],Tₕ[ :Ω ])
337
+ uh = xh[1 ]
338
+ vh = xh[2 ]
339
+ ph = xh[3 ]
341
340
pvd[t] = createvtk (
342
341
Tₕ[:Ω ],
343
342
filePath * " _$t .vtu" ,
0 commit comments