Skip to content

Commit

Permalink
Fix friction force typo
Browse files Browse the repository at this point in the history
  • Loading branch information
skygering committed Jul 10, 2023
1 parent e20986e commit 9df96ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/simple_strait.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ coupling_settings = CouplingSettings(
# Floe creation
floe_arr = initialize_floe_field(
FT,
10,
50,
[0.7],
domain,
hmean,
Expand Down Expand Up @@ -81,7 +81,7 @@ simulation = Simulation(
model = model,
consts = consts,
Δt = Δt,
nΔt = 1000,
nΔt = 3000,
verbose = false,
coupling_settings = coupling_settings,
fracture_settings = fracture_settings,
Expand Down
5 changes: 2 additions & 3 deletions src/physical_processes/collisions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ function calc_friction_forces(
for i in axes(vdiff, 1)
v = vdiff[i, :]
n = normal[i, :]
vnorm = norm(v)
force_dir = maximum(abs.(v)) == 0 ? zeros(FT, 2) : v/vnorm
friction = G * Δl[i] * Δt * vnorm * -dot(force_dir, v) * force_dir
force_dir = maximum(abs.(v)) == 0 ? zeros(FT, 2) : v/norm(v)
friction = G * Δl[i] * Δt * norm(n) * -dot(force_dir, v) * force_dir
if norm(friction) > consts.μ*norm(n)
friction = -consts.μ*norm(n)*force_dir
end
Expand Down

0 comments on commit 9df96ab

Please sign in to comment.