Skip to content

Commit

Permalink
modified: examples/hybrid/sphere/deformation_flow.jl
Browse files Browse the repository at this point in the history
	modified:   src/Operators/finitedifference.jl
  • Loading branch information
akshaysridhar committed Dec 16, 2024
1 parent c3338cc commit d74a254
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions examples/hybrid/sphere/deformation_flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ const SlopeLimitedFlux = Operators.TVDSlopeLimitedFlux(
top = Operators.FirstOrderOneSided(),
method = Operators.MinModLimiter(),
)
const LinVanLeerFlux = Operators.LinVanLeerC2F(
bottom = Operators.FirstOrderOneSided(),
top = Operators.FirstOrderOneSided(),
)
const FCTBorisBook = Operators.FCTBorisBook(
bottom = Operators.FirstOrderOneSided(),
top = Operators.FirstOrderOneSided(),
Expand Down Expand Up @@ -189,10 +193,13 @@ function vertical_tendency!(Yₜ, Y, cache, t)
ᶠwinterp(ᶜJ, Y.c.ρ) * (
upwind1(face_uᵥ, q_n) + SlopeLimitedFlux(
upwind3(face_uᵥ, q_n) - upwind1(face_uᵥ, q_n),
Y.c.ρ * q_n / dt,
q_n / dt,
face_uᵥ
)
),
)
elseif fct_op == LinVanLeerFlux
@. ρqₜ_n -= vdivf2c(ᶠwinterp(ᶜJ, Y.c.ρ) * LinVanLeerFlux(face_uᵥ, q_n, dt))
else
error("unrecognized FCT operator $fct_op")
end
Expand Down Expand Up @@ -323,6 +330,9 @@ tracer_ranges(sol) =
@info "Slope Limited Solutions"
tvd_sol = run_deformation_flow(false, SlopeLimitedFlux, _dt)
lim_tvd_sol = run_deformation_flow(true, SlopeLimitedFlux, _dt)
@info "vanLeer Flux Solutions"
lvl_sol= run_deformation_flow(false, LinVanLeerFlux, _dt)
lim_lvl_sol = run_deformation_flow(true, LinVanLeerFlux, _dt)
@info "Third-Order Upwind Solutions"
third_upwind_sol = run_deformation_flow(false, upwind3, _dt)
lim_third_upwind_sol = run_deformation_flow(true, upwind3, _dt)
Expand Down Expand Up @@ -407,9 +417,11 @@ for (sol, suffix) in (
(third_upwind_sol, "_third_upwind"),
(fct_sol, "_fct"),
(tvd_sol, "_tvd"),
(lvl_sol, "_lvl"),
(lim_third_upwind_sol, "_lim_third_upwind"),
(lim_fct_sol, "_lim_fct"),
(lim_tvd_sol, "_lim_tvd"),
(lim_lvl_sol, "_lim_lvl"),
)
for (sol_index, day) in ((1, 6), (2, 12))
Plots.png(
Expand All @@ -429,8 +441,9 @@ for (sol, suffix) in (
(third_upwind_sol, "_third_upwind"),
(fct_sol, "_fct"),
(tvd_sol, "_tvd"),
(lvl_sol, "_lvl"),
(lim_fct_sol, "_lim_fct"),
(lim_tvd_sol, "_lim_tvd"),
(lim_lvl_sol, "_lim_lvl"),
)
for (sol_index, day) in ((1, 6), (2, 12))
Plots.png(
Expand Down
2 changes: 1 addition & 1 deletion src/Operators/finitedifference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ function compute_Δ𝛼_linvanleer(a⁻, a⁰, a⁺, v, dt)
𝛼 = min(abs(Δ𝜙_avg),
2 * (a⁰ - min𝜙),
2 * (max𝜙 - a⁰))
Δ𝛼 = sign(Δ𝜙_avg) * 𝛼 #* (1 - sign(v) * v * dt)
Δ𝛼 = sign(Δ𝜙_avg) * 𝛼 * (1 - sign(v) * v * dt)
end

function slope_limited_product(v, a⁻, a⁻⁻, a⁺, a⁺⁺, dt)
Expand Down

0 comments on commit d74a254

Please sign in to comment.