From d74a254d35cd83d0538da5580fcb63294d42ecc7 Mon Sep 17 00:00:00 2001 From: akshaysridhar Date: Mon, 16 Dec 2024 10:50:30 -0800 Subject: [PATCH] modified: examples/hybrid/sphere/deformation_flow.jl modified: src/Operators/finitedifference.jl --- examples/hybrid/sphere/deformation_flow.jl | 17 +++++++++++++++-- src/Operators/finitedifference.jl | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/hybrid/sphere/deformation_flow.jl b/examples/hybrid/sphere/deformation_flow.jl index e9dc83adb1..909cf8951e 100644 --- a/examples/hybrid/sphere/deformation_flow.jl +++ b/examples/hybrid/sphere/deformation_flow.jl @@ -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(), @@ -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 @@ -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) @@ -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( @@ -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( diff --git a/src/Operators/finitedifference.jl b/src/Operators/finitedifference.jl index 7fad31fa91..6a0bd9a8a7 100644 --- a/src/Operators/finitedifference.jl +++ b/src/Operators/finitedifference.jl @@ -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)