Skip to content

Commit

Permalink
fix for variable h
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwegert committed Dec 9, 2024
1 parent bd474f8 commit e810988
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ writevtk(model,path*"model")

Ω_act = Triangulation(model)
hₕ = CellField(get_element_sizes(model),Ω_act)
hmin = GridapTopOpt._get_minimum_element_diameter(hₕ)

# Cut the background model
reffe_scalar = ReferenceFE(lagrangian,Float64,1)
Expand Down Expand Up @@ -107,7 +108,7 @@ cl = H # Characteristic length
u0_max = maximum(abs,get_dirichlet_dof_values(U))
μ = ρ*cl*u0_max/Re # Viscosity
# Stabilization parameters
γ(h) = 100.0*μ/h
γ(h) = 1e5*μ/h
β1(h) = 1/3*(h^2/4μ)

# Terms
Expand All @@ -118,7 +119,7 @@ c_Ω(p,q) = (β1 ∘ hₕ)*∇(p)⋅∇(q)

a_fluid((u,p),(v,q)) =
( a_Ω(u,v)+b_Ω(u,q)+b_Ω(v,p)-c_Ω(p,q)) * Ω.dΩf +
( a_Ω(u,v)+b_Ω(u,q)+b_Ω(v,p)-c_Ω(p,q)+γ*uv ) * Ω.dΩs
( a_Ω(u,v)+b_Ω(u,q)+b_Ω(v,p)-c_Ω(p,q)+ hₕ)*(uv)) * Ω.dΩs

## Structure
# Stabilization and material parameters
Expand Down Expand Up @@ -166,7 +167,7 @@ vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)
## Optimiser
converged(m) = GridapTopOpt.default_al_converged(
m;
L_tol = 0.5h,
L_tol = 0.5*hmin,
C_tol = 0.01vf
)
function has_oscillations(m,os_it)
Expand Down
2 changes: 1 addition & 1 deletion src/LevelSetEvolution/UnfittedEvolution/CutFEMEvolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function get_transient_operator(φh,velh,s::CutFEMEvolve)
v_norm = maximum(abs,get_free_dof_values(velh))
β(vh,∇φ) = vh/+ v_norm) * ∇φ/+ norm(∇φ))

stiffness(t,u,v) = (((β (velh,(φh))) (u)) * v)dΩ_bg + (γg*h^2*jump((u) n_Γg)*jump((v) n_Γg))dΓg
stiffness(t,u,v) = (((β (velh,(φh))) (u)) * v)dΩ_bg + ((γg*h*h)*jump((u) n_Γg)*jump((v) n_Γg))dΓg
mass(t, ∂ₜu, v) = (∂ₜu * v)dΩ_bg
forcing(t,v) = (0v)dΩ_bg + (0*jump((v) n_Γg))dΓg
# Second term is added to address the following issue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function get_residual_and_jacobian(s::StabilisedReinit{InteriorPenalty},φh)
= Ωs.

W(u,∇u) = sign(u) * ∇u /+ norm(∇u))
a(w,u,v) = (v*(W (w,(w))) (u))dΩ_bg + (h^2*jump((u)) jump((v)))dΛ + ((γd/h)*v*u)dΓ
a(w,u,v) = (v*(W (w,(w))) (u))dΩ_bg + (h*h*jump((u)) jump((v)))dΛ + ((γd/h)*v*u)dΓ
b(w,v) = ((sign w)*v)dΩ_bg
res(u,v) = a(u,u,v) - b(u,v)
jac(u,du,v) = a(u,du,v)
Expand Down

0 comments on commit e810988

Please sign in to comment.