Skip to content

Commit 772cfaf

Browse files
committed
option fast=true added
1 parent 44c62d5 commit 772cfaf

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/smooth.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ end
493493

494494

495495
# Mount a vector with nodal forces
496-
function force_bc(mesh::Mesh, E::Float64, nu::Float64, α::Float64)
496+
function force_bc(mesh::Mesh, E::Float64, nu::Float64, α::Float64, fast::Bool)
497497
n = length(mesh.points)
498498
ndim = mesh.ndim
499499
Fbc = zeros(n*ndim)
@@ -521,7 +521,7 @@ function force_bc(mesh::Mesh, E::Float64, nu::Float64, α::Float64)
521521
K = matrixK(c, ndim, E, nu)
522522
β = 0.97
523523

524-
if mesh.qmin>0.9
524+
if mesh.qmin>0.9 || fast
525525
F = K*U
526526
else
527527
F = K*U*-c.quality)/-mesh.qmin)*α
@@ -540,7 +540,7 @@ function force_bc(mesh::Mesh, E::Float64, nu::Float64, α::Float64)
540540
end
541541

542542
function smooth!(mesh::Mesh; verbose=true, alpha::Float64=0.3, target::Float64=0.97, fixed::Bool=false, maxit::Int64=20, mintol::Float64=1e-3,
543-
tol::Float64=1e-4, facetol=1e-5, savesteps::Bool=false, filekey::String="smooth", conds=nothing)
543+
tol::Float64=1e-4, facetol=1e-5, savesteps::Bool=false, filekey::String="smooth", conds=nothing, fast=false)
544544

545545
# tol : tolerance in change of mesh quality for succesive iterations
546546
# mintol: tolerance in change of worst cell quality in a mesh for succesive iterations
@@ -582,7 +582,7 @@ function smooth!(mesh::Mesh; verbose=true, alpha::Float64=0.3, target::Float64=0
582582
for i=1:maxit
583583

584584
# Forces vector needed for smoothing
585-
F = vcat( force_bc(mesh, E, nu, alpha), zeros(nbc) )
585+
F = vcat( force_bc(mesh, E, nu, alpha, fast), zeros(nbc) )
586586

587587
# global stiffness plus LM
588588
K = mountKg(mesh, E, nu, A)

test/smoothing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ smooth!(mesh)
2626

2727
bl = Block2D( [ 1.0 0.0; 2.0 0.0; 0.0 2.0; 0.0 1.0; 1.5 0.0; 1.5 1.5; 0.0 1.5; 0.7 0.7 ], nx=3, ny=6, shape=TRI6)
2828
mesh = Mesh(bl)
29-
smooth!(mesh, eps=1e-3, epsmin=1e-2)
29+
smooth!(mesh, tol=1e-3, mintol=1e-2, fast=true)
3030
@test mesh.quality 0.94 atol=1e-2
3131

0 commit comments

Comments
 (0)