Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
谢萧涯 authored and 谢萧涯 committed Sep 11, 2024
1 parent 22236dc commit 81c5745
Showing 1 changed file with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ function non_orographic_gravity_wave_forcing(
k = 2.0 * π / λ
c = range(-99.6, 99.6, nc)
ν = k .* c
ν_vec= range(pi/3600,pi/300,length=5)

ρ_endlevel = Fields.level(ᶜρ, Spaces.nlevels(axes(ᶜρ)))
ρ_endlevel_m1 = Fields.level(ᶜρ, Spaces.nlevels(axes(ᶜρ)) - 1)
Expand Down Expand Up @@ -463,14 +464,15 @@ function non_orographic_gravity_wave_forcing(
B0 = ntuple(
n -> wave_source_convection(
ρ_source,
ν[n],
ν_vec,
u_source,
k,
c[n],
0.004,
5000,
),
Val(nc),
)
@info B0
else
B0 = ntuple(
n -> wave_source_original(
Expand Down Expand Up @@ -595,9 +597,9 @@ function non_orographic_gravity_wave_forcing(
B0 = ntuple(
n -> wave_source_convection(
ρ_source,
ν[n],
ν_vec,
u_source,
k,
c[n],
0.004,
5000,
),
Expand Down Expand Up @@ -773,37 +775,39 @@ end

function wave_source_convection(
ρ₀,
ν,
ν_vec,
U,
k,
c,
Q₀,
h,
σₓ = 3000,
τ = 1,
L = 1000000,
N = 0.010,
N = 0.012,
)
F=0.0
Δ=ν_vec[2]-ν_vec[1]
nc_para=[14/45,64/45,24/45,64/45,14/45] #newton-cotes parameter
for i=1:5
ν= ν_vec[i]
k= ν/c
ν_hat = ν - U * k
if abs(ν_hat) > N
B0 = 0.0
else
Qₜ = Q₀ * (1 / (1 + (100 * ν)^2))
if abs(ν_hat) < N
Qₜ = (1 / (1 + (100 * ν)^2))
m = k * sqrt((N / ν_hat)^2 - 1) * (-sign(ν_hat))
B =
(k / ν_hat)^2 *
(σₓ / sqrt(2)) *
exp(-(k * σₓ / 2)^2) *
Q₀ *
Q₀ * (2*pi)^2 *
Qₜ *
(pi / (m * h)) *
(sin(m * h) / (m^2 - (pi / h)^2))
B0 = abs(k^2 / ν) *ρ₀ * sign(ν_hat) * sqrt((N / ν_hat)^2 - 1) * abs(B)^2 / (L * τ)
# B0 = ρ₀ * sign(ν_hat) * sqrt((N / ν_hat)^2 - 1) * abs(B)^2 / (L * τ)
F = F+ nc_para[i] * Δ * abs(k^2 / ν) *ρ₀ * sign(c-U) * sqrt((N / ν_hat)^2 - 1) * abs(B)^2 / (L * τ)
end
return B0
end
#Need to be specify from convection Profiles: heating depth h, heating amplitude Q₀, mean wind in heating region U.
#Now they are simply setted as 5000, 0.004, and velocity at the source level.
return F
end

function wave_source_original(c, u_source, Bw, Bn, cw, cn, gw_c0, flag)
sign((c - u_source)) * (
Expand Down

0 comments on commit 81c5745

Please sign in to comment.