@@ -3,7 +3,6 @@ import AlgebraicMultigrid as AMG
3
3
using Test
4
4
using SparseArrays, LinearAlgebra
5
5
using Ferrite, FerriteGmsh, SparseArrays
6
- using Printf
7
6
using Downloads: download
8
7
9
8
# # Test QR factorization
@@ -259,7 +258,7 @@ function create_nns_frame(x_coords::Vector{Float64}, dofmap::Vector{Int})
259
258
return B
260
259
end
261
260
262
- function cantilever_beam (P, E,A, I, L, n_elem)
261
+ function cantilever_beam (P, E, A, I, L, n_elem)
263
262
le = L / n_elem
264
263
n_nodes = n_elem + 1
265
264
dofs_per_node = 3 # u, w, theta
316
315
ml = smoothed_aggregation (A, B)
317
316
@show ml
318
317
319
- @printf (" No NNS: final residual at iteration %2d: %6.2e\n " , length (residuals_wonns), residuals_nns[end ])
320
- @printf (" With NNS: final residual at iteration %2d: %6.2e\n " , length (residuals_nns), residuals_wonns[end ])
318
+ println (" No NNS: final residual at iteration " , length (residuals_wonns), " : " , residuals_nns[end ])
319
+ println (" With NNS: final residual at iteration " , length (residuals_nns), " : " , residuals_wonns[end ])
320
+
321
321
322
322
# test QR factorization on linear elasticity
323
323
aggregate = StandardAggregation ()
341
341
A = 1e-4 # Cross-section area (for axial)
342
342
I = 1e-6 # Moment of inertia (for bending)
343
343
L = 1.0 # Total length
344
- A, b, B = cantilever_beam (P, E,A, I, L, n_elem)
344
+ A, b, B = cantilever_beam (P, E, A, I, L, n_elem)
345
345
# test solution
346
346
# Analaytical solution for cantilever beam
347
347
u = A \ b
351
351
x_nns, residuals_nns = solve (A, b, SmoothedAggregationAMG (B); log= true , reltol= 1e-10 )
352
352
x_wonns, residuals_wonns = solve (A, b, SmoothedAggregationAMG (); log= true , reltol= 1e-10 )
353
353
354
- @printf (" No NNS: final residual at iteration %2d: %6.2e\n " , length (residuals_wonns), residuals_nns[end ])
355
- @printf (" With NNS: final residual at iteration %2d: %6.2e\n " , length (residuals_nns), residuals_wonns[end ])
354
+ println (" No NNS: final residual at iteration " , length (residuals_wonns), " : " , residuals_nns[end ])
355
+ println (" With NNS: final residual at iteration " , length (residuals_nns), " : " , residuals_wonns[end ])
356
+
356
357
357
358
# test QR factorization on bending beam
358
359
# Aggregation
0 commit comments