Skip to content

Commit 629992d

Browse files
author
Milan K
authored
Merge pull request #126 from milankl/KelvinPump
surface forcing latitude adjustment
2 parents 7e9a29c + 93cb4e9 commit 629992d

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

src/Constants.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Constants{T,Tprog}(P::Parameter,G::Grid) where {T<:AbstractFloat,Tprog<
5555
SSTmin = T(P.SSTmin)
5656

5757
# SURFACE FORCING
58-
ωyr = -2π*P.ωyr/24/365/3600
58+
ωyr = -2π*P.ωyr/24/365.25/3600
5959

6060
return Constants{T,Tprog}(RKaΔt,RKbΔt,one_minus_α,g,cD,rD,γ,cSmag,νB,rSST,jSST,SSTmin,ωyr)
6161
end

src/DefaultParameters.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
g::Real=10. # gravitational acceleration [m/s]
1515
H::Real=500. # layer thickness at rest [m]
1616
ρ::Real=1e3 # water density [kg/m^3]
17-
ϕ::Real=45. # central latitue of the domain (for coriolis) [°]
17+
ϕ::Real=45. # central latitude of the domain (for coriolis) [°]
1818
ω::Real=2π/(24*3600) # Earth's angular frequency [s^-1]
1919
R::Real=6.371e6 # Earth's radius [m]
2020

@@ -35,10 +35,12 @@
3535
η_refh::Real=5. # height difference [m] of the interface relaxation profile
3636
η_refw::Real=50e3 # width [m] of the tangent used for the interface relaxation
3737

38-
# SURFACE FORCING (Currently only Kelvin wave pumping at Eq.)
38+
# SURFACE FORCING
3939
surface_forcing::Bool=false # yes?
4040
ωyr::Real=1.0 # (annual) frequency [1/year]
4141
A::Real=3e-5 # Amplitude [m/s]
42+
ϕk::Real=ϕ # Central latitude of Kelvin wave pumping
43+
wk::Real=10e3 # width [m] in y of Gaussian used for surface forcing
4244

4345
# TIME STEPPING OPTIONS
4446
RKo::Int=4 # Order of the RK time stepping scheme (3 or 4)

src/Feedback.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ function feedback!(Prog::PrognosticVars,feedback::Feedback,S::ModelSetup)
139139
if feedback.nans_detected
140140
println(" NaNs detected at time step $i")
141141
if output
142+
@unpack progress_txt = feedback
142143
write(progress_txt," NaNs detected at time step $i")
143144
flush(progress_txt)
144145
end

src/Forcing.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,19 @@ function FlatBottom(::Type{T},P::Parameter,G::Grid) where {T<:AbstractFloat}
194194
return fill(T(H),(nx+2*haloη,ny+2*haloη))
195195
end
196196

197-
"""Returns Kelvin wave pumping forcing of the continuity equation at the equator."""
197+
"""Returns Kelvin wave pumping forcing of the continuity equation."""
198198
function KelvinPump(::Type{T},P::Parameter,G::Grid) where {T<:AbstractFloat}
199199

200200
@unpack x_T,y_T,Lx,Ly = G
201-
@unpack c,β,R,ϕ,Δ = G
202-
@unpack A = P
201+
@unpack R,ϕ,Δ = G
202+
@unpack A,ϕk,wk = P
203203

204204
xx_T,yy_T = meshgrid(x_T,y_T)
205205

206-
# y-coordinate of the Equator
207-
= 2π*R/360. # meters per degree latitude
208-
y_eq = Ly/2 - ϕ*
209-
y_15S = Ly/2 -+15)*
210-
y_15N = Ly/2 --15)*
206+
= 2π*R/360. # meters per degree latitude
207+
y0 = Ly/2 --ϕk)*# y[m] for central latitude of pumping
211208

212-
= A*Δ*exp.(-β*(yy_T.-y_eq).^2/(2c))
213-
214-
Fη[yy_T .< y_15S] .= 0.0
215-
Fη[yy_T .> y_15N] .= 0.0
209+
= A*Δ*exp.(-(yy_T.-y0).^2/(2*wk^2))
216210

217211
return T.(Fη)
218212
end

0 commit comments

Comments
 (0)