Reference
Contents
Index
ShallowWaters.ArakawaHsuVars
ShallowWaters.ArakawaHsuVars
ShallowWaters.BernoulliVars
ShallowWaters.BernoulliVars
ShallowWaters.BottomdragVars
ShallowWaters.BottomdragVars
ShallowWaters.Constants
ShallowWaters.Grid
ShallowWaters.LaplaceVars
ShallowWaters.LaplaceVars
ShallowWaters.NcFiles
ShallowWaters.NcFiles
ShallowWaters.Parameter
ShallowWaters.PrognosticVars
ShallowWaters.RungeKuttaVars
ShallowWaters.RungeKuttaVars
ShallowWaters.SSPRK3coeff
ShallowWaters.SSPRK3coeff
ShallowWaters.SemiLagrangeVars
ShallowWaters.SemiLagrangeVars
ShallowWaters.SmagorinskyVars
ShallowWaters.SmagorinskyVars
ShallowWaters.TendencyVars
ShallowWaters.TendencyVars
ShallowWaters.VolumeFluxVars
ShallowWaters.VolumeFluxVars
ShallowWaters.VorticityVars
ShallowWaters.VorticityVars
Base.convert
Base.convert
ShallowWaters.AHα!
ShallowWaters.AHβ!
ShallowWaters.AHγ!
ShallowWaters.AHδ!
ShallowWaters.ChannelWind
ShallowWaters.ConstantWind
ShallowWaters.DoubleGyreWind
ShallowWaters.FlatBottom
ShallowWaters.Ftime
ShallowWaters.InterfaceRelaxation
ShallowWaters.Ix!
ShallowWaters.Ixy!
ShallowWaters.Iy!
ShallowWaters.KelvinPump
ShallowWaters.NoWind
ShallowWaters.PV!
ShallowWaters.PV_ArakawaHsu!
ShallowWaters.PV_Sadourny!
ShallowWaters.PVadvection!
ShallowWaters.Ridge
ShallowWaters.Ridges
ShallowWaters.Seamount
ShallowWaters.ShearWind
ShallowWaters.UVfluxes!
ShallowWaters.Uflux!
ShallowWaters.Vflux!
ShallowWaters.add_drag_diff_tendencies!
ShallowWaters.add_halo
ShallowWaters.add_halo
ShallowWaters.adv_sst!
ShallowWaters.advection_coriolis!
ShallowWaters.axb!
ShallowWaters.backtraj!
ShallowWaters.bernoulli!
ShallowWaters.bilin
ShallowWaters.bottom_drag!
ShallowWaters.bottom_drag_linear!
ShallowWaters.bottom_drag_quadratic!
ShallowWaters.caxb!
ShallowWaters.clip
ShallowWaters.continuity!
ShallowWaters.continuity_forcing!
ShallowWaters.continuity_itself!
ShallowWaters.continuity_surf_relax!
ShallowWaters.coriolis_at_lat
ShallowWaters.countnans
ShallowWaters.cxab!
ShallowWaters.cxayb!
ShallowWaters.dambmc!
ShallowWaters.departure!
ShallowWaters.diffusion!
ShallowWaters.diffusion_constant!
ShallowWaters.diffusion_smagorinsky!
ShallowWaters.duration_estimate
ShallowWaters.dxaybzc!
ShallowWaters.feedback!
ShallowWaters.feedback_end!
ShallowWaters.feedback_init
ShallowWaters.fu!
ShallowWaters.fv!
ShallowWaters.gap
ShallowWaters.get_run_id_path
ShallowWaters.ghost_points!
ShallowWaters.ghost_points!
ShallowWaters.ghost_points_sst!
ShallowWaters.ghost_points_sst!
ShallowWaters.ghost_points_sst_nonperiodic!
ShallowWaters.ghost_points_sst_periodic!
ShallowWaters.ghost_points_u_nonperiodic!
ShallowWaters.ghost_points_u_periodic!
ShallowWaters.ghost_points_uv!
ShallowWaters.ghost_points_uv!
ShallowWaters.ghost_points_v_nonperiodic!
ShallowWaters.ghost_points_v_periodic!
ShallowWaters.ghost_points_η!
ShallowWaters.ghost_points_η!
ShallowWaters.ghost_points_η_nonperiodic!
ShallowWaters.ghost_points_η_periodic!
ShallowWaters.interp_uv!
ShallowWaters.m_per_lat
ShallowWaters.meshgrid
ShallowWaters.momentum_u!
ShallowWaters.momentum_v!
ShallowWaters.nan_detection!
ShallowWaters.nc_create
ShallowWaters.no_bottom_drag!
ShallowWaters.output_close!
ShallowWaters.preallocate
ShallowWaters.progress!
ShallowWaters.readable_secs
ShallowWaters.remove_halo
ShallowWaters.remove_halo
ShallowWaters.rhs!
ShallowWaters.rhs_linear!
ShallowWaters.rhs_nonlinear!
ShallowWaters.run_model
ShallowWaters.smagorinsky_coeff!
ShallowWaters.speed!
ShallowWaters.stress_tensor!
ShallowWaters.thickness!
ShallowWaters.time_integration
ShallowWaters.tracer_relax_consumption!
ShallowWaters.viscous_tensor_constant!
ShallowWaters.viscous_tensor_smagorinsky!
ShallowWaters.waves
ShallowWaters.wrap
ShallowWaters.yy_q
ShallowWaters.β_at_lat
ShallowWaters.∂x
ShallowWaters.∂x!
ShallowWaters.∂y
ShallowWaters.∂y!
ShallowWaters.∇²
ShallowWaters.∇²!
ShallowWaters.ArakawaHsuVars
— TypeArakawaHsu variables collected in a struct.
ShallowWaters.ArakawaHsuVars
— MethodGenerator function for ArakawaHsu VarCollection.
ShallowWaters.BernoulliVars
— TypeBernoulli variables collected in a struct.
ShallowWaters.BernoulliVars
— MethodGenerator function for Bernoulli VarCollection.
ShallowWaters.BottomdragVars
— TypeBottomdrag variables collected in a struct.
ShallowWaters.BottomdragVars
— MethodGenerator function for Bottomdrag VarCollection.
ShallowWaters.Constants
— MethodGenerator function for the mutable struct Constants.
ShallowWaters.Grid
— MethodGenerator function for the Grid struct.
ShallowWaters.LaplaceVars
— TypeLaplace variables collected in a struct.
ShallowWaters.LaplaceVars
— MethodGenerator function for Laplace VarCollection.
ShallowWaters.NcFiles
— MethodGenerator function for "empty" NcFiles struct.
ShallowWaters.NcFiles
— MethodGenerator function for NcFiles struct, creating the underlying netCDF files.
ShallowWaters.Parameter
— TypeCreates a Parameter struct with following options and default values T=Float32 # number format
Tprog=T # number format for prognostic variables
Tcomm=Tprog # number format for ghost-point copies
Tini=Tprog # number format to reduce precision for initial conditions
# DOMAIN RESOLUTION AND RATIO
nx::Int=100 # number of grid cells in x-direction
Lx::Float64=4000e3 # length of the domain in x-direction [m]
L_ratio::Float64=2 # Domain aspect ratio of Lx/Ly
# PHYSICAL CONSTANTS
g::Float64 = 0.1 # gravitational acceleration [m/s]
H::Float64 = 500. # layer thickness at rest [m]
ρ::Float64 = 1e3 # water density [kg/m^3]
ϕ::Float64 = 45. # central latitude of the domain (for coriolis) [°]
ω::Float64 = 2π/(24*3600) # Earth's angular frequency [s^-1]
R::Float64 = 6.371e6 # Earth's radius [m]
# SCALE
scale::Float64=2^6 # multiplicative scale for the momentum equations u,v
scale_sst::Float64=2^15 # multiplicative scale for sst
# WIND FORCING OPTIONS
wind_forcing_x::String="shear" # "channel", "double_gyre", "shear","constant" or "none"
wind_forcing_y::String="constant" # "channel", "double_gyre", "shear","constant" or "none"
Fx0::Float64=0.12 # wind stress strength [Pa] in x-direction
Fy0::Float64=0.0 # wind stress strength [Pa] in y-direction
seasonal_wind_x::Bool=true # Change the wind stress with a sine of frequency ωFx,ωFy
seasonal_wind_y::Bool=false # same for y-component
ωFx::Float64=2 # frequency [1/year] for x component
ωFy::Float64=2 # frequency [1/year] for y component
# BOTTOM TOPOGRAPHY OPTIONS
topography::String="ridges" # "ridge", "seamount", "flat", "ridges", "bathtub"
topo_ridges_positions::Vector{Float64} = [0.05,0.25,0.45,0.9]
topo_height::Float64 = 100. # height of seamount [m]
topo_width::Float64 = 300e3 # horizontal scale [m] of the seamount
# SURFACE RELAXATION
surface_relax::Bool=false # yes?
t_relax::Float64 = 100. # time scale of the relaxation [days]
η_refh::Float64 = 5. # height difference [m] of the interface relaxation profile
η_refw::Float64 = 50e3 # width [m] of the tangent used for the interface relaxation
# SURFACE FORCING
surface_forcing::Bool=false # yes?
ωFη::Float64 = 1.0 # frequency [1/year] for surfance forcing
A::Float64 = 3e-5 # Amplitude [m/s]
ϕk::Float64 = ϕ # Central latitude of Kelvin wave pumping
wk::Float64 = 10e3 # width [m] in y of Gaussian used for surface forcing
# TIME STEPPING OPTIONS
time_scheme::String="RK" # Runge-Kutta ("RK") or strong-stability preserving RK
# "SSPRK2","SSPRK3","4SSPRK3"
RKo::Int=4 # Order of the RK time stepping scheme (2, 3 or 4)
RKs::Int=3 # Number of stages for SSPRK2
RKn::Int=5 # n^2 = s = Number of stages for SSPRK3
cfl::Float64 = 0.9 # CFL number (1.0 recommended for RK4, 0.6 for RK3)
Ndays::Float64 = 200.0 # number of days to integrate for
nstep_diff::Int=1 # diffusive part every nstep_diff time steps.
nstep_advcor::Int=0 # advection and coriolis update every nstep_advcor time steps.
# 0 means it is included in every RK4 substep
compensated::Bool=false # Compensated summation in the time integration?
# BOUNDARY CONDITION OPTIONS
bc::String="periodic" # "periodic" or anything else for nonperiodic
α::Float64 = 2 # lateral boundary condition parameter
# 0 free-slip, 0<α<2 partial-slip, 2 no-slip
# PARAMETERS FOR ADJOINT METHOD
data_steps::StepRange{Int,Int} = 0:1:0 # Timesteps where data exists
data::Array{Float32, 1} = [0.] # model data
J::Float64 = 0. # Placeholder for cost function evaluation
j::Int = 1 # For keeping track of the entry in data
# CHECKPOINTING VARIABLES
i::Int = 0 # Placeholder for current timestep, needed for Checkpointing.jl
# MOMENTUM ADVECTION OPTIONS
adv_scheme::String="ArakawaHsu" # "Sadourny" or "ArakawaHsu"
dynamics::String="nonlinear" # "linear" or "nonlinear"
# BOTTOM FRICTION OPTIONS
bottom_drag::String="none" # "linear", "quadratic" or "none"
cD::Float64 = 1e-5 # bottom drag coefficient [dimensionless] for quadratic
τD::Float64 = 300. # bottom drag coefficient [days] for linear
# DIFFUSION OPTIONS
diffusion::String="constant" # "Smagorinsky" or "constant", biharmonic in both cases
νB::Float64 = 500.0 # [m^2/s] scaling constant for constant biharmonic diffusion
cSmag::Float64 = 0.15 # Smagorinsky coefficient [dimensionless]
# TRACER ADVECTION
tracer_advection::Bool=true # yes?
tracer_relaxation::Bool=true # yes?
tracer_consumption::Bool=false # yes?
sst_initial::String="waves" # "west", "south", "linear", "waves","rect", "flat" or "restart"
sst_rect_coords::Array{Float64,1}=[0.,0.15,0.,1.0]
# (x0,x1,y0,y1) are the size of the rectangle in [0,1]
Uadv::Float64 = 0.2 # Velocity scale [m/s] for tracer advection
SSTmax::Float64 = 1. # tracer (sea surface temperature) max for initial conditions
SSTmin::Float64 = -1. # tracer (sea surface temperature) min for initial conditions
τSST::Float64 = 100 # tracer restoring time scale [days]
jSST::Float64 = 365 # tracer consumption [days]
SSTw::Float64 = 5e5 # width [m] of the tangent used for the IC and interface relaxation
SSTϕ::Float64 = 0.5 # latitude/longitude fraction ∈ [0,1] of sst edge
SSTwaves_ny::Float64 = 4 # wave crests/troughs in y
SSTwaves_nx::Float64 = SSTwaves_ny*L_ratio # wave crests/troughs in x
SSTwaves_p::Float64 = 1/2 # power for rectangles (p<1)/smootheness(p>=1) of waves
# OUTPUT OPTIONS
output::Bool=false # netcdf output?
output_vars::Array{String,1}=["u","v","η","sst"] # which variables to output? "du","dv","dη","H","ζ" also allowed
output_dt::Float64 = 24 # output time step [hours]
outpath::String=pwd() # path to output folder
compression_level::Int=3 # compression level
return_time::Bool=false # return time of simulation of progn vars?
# INITIAL CONDITIONS
initial_cond::String="rest" # "rest" or "ncfile" for restart from file
initpath::String=outpath # folder where to pick the restart files from
init_run_id::Int=0 # run id for restart from run number
init_starti::Int=-1 # timestep to start from (-1 meaning last)
get_id_mode::String="continue" # How to determine the run id: "continue" or "fill"
run_id::Int=-1 # Output with a specific run id
init_interpolation::Bool=true # Interpolate the initial conditions in case grids don't match?
ShallowWaters.PrognosticVars
— MethodZero generator function for Grid G as argument.
ShallowWaters.RungeKuttaVars
— TypeRunge Kutta time stepping scheme diagnostic cariables collected in a struct.
ShallowWaters.RungeKuttaVars
— MethodGenerator function for RungeKutta VarCollection.
ShallowWaters.SSPRK3coeff
— TypeCoefficients for strong stability-preserving Runge-Kutta 3rd order. From: KETCHESON, LOĆZI, AND PARSANI, 2014. INTERNAL ERROR PROPAGATION IN EXPLICIT RUNGE–KUTTA METHODS, SIAM J NUMER ANAL 52/5. DOI:10.1137/130936245
ShallowWaters.SSPRK3coeff
— MethodGenerator function for a SSPRK3coeff struct.
ShallowWaters.SemiLagrangeVars
— TypeSemiLagrange variables collected in a struct.
ShallowWaters.SemiLagrangeVars
— MethodGenerator function for SemiLagrange VarCollection.
ShallowWaters.SmagorinskyVars
— TypeSmagorinsky variables collected in a struct.
ShallowWaters.SmagorinskyVars
— MethodGenerator function for Smagorinsky VarCollection.
ShallowWaters.TendencyVars
— TypeTendencies collected in a struct.
ShallowWaters.TendencyVars
— MethodGenerator function for Tendencies VarCollection.
ShallowWaters.VolumeFluxVars
— TypeVolumeFluxes collected in a struct.
ShallowWaters.VolumeFluxVars
— MethodGenerator function for VolumeFluxes VarCollection.
ShallowWaters.VorticityVars
— TypeVorticity variables collected in a struct.
ShallowWaters.VorticityVars
— MethodGenerator function for Vorticity VarCollection.
Base.convert
— MethodConvert function for two arrays, X1, X2, in case their eltypes differ. Convert every element from X1 and store it in X2.
Base.convert
— MethodConvert function for two arrays, X1, X2, in case their eltypes are identical. Just pass X1, such that X2 is pointed to the same place in memory.
ShallowWaters.AHα!
— MethodLinear combination α of potential voriticity q according to the energy and enstrophy conserving scheme of Arakawa and Hsu, 1990
ShallowWaters.AHβ!
— MethodLinear combination δ of potential voriticity q according to the energy and enstrophy conserving scheme of Arakawa and Hsu, 1990
ShallowWaters.AHγ!
— MethodLinear combination γ of potential voriticity q according to the energy and enstrophy conserving scheme of Arakawa and Hsu, 1990
ShallowWaters.AHδ!
— MethodLinear combination β of potential voriticity q according to the energy and enstrophy conserving scheme of Arakawa and Hsu, 1990
ShallowWaters.ChannelWind
— MethodReturns the constant forcing matrices Fx,Fy that vary only meriodionally/zonally as a cosine with strongest forcing in the middle and vanishing forcing at boundaries.
ShallowWaters.ConstantWind
— MethodReturns constant in in space forcing matrices Fx,Fy.
ShallowWaters.DoubleGyreWind
— MethodReturns the constant forcing matrices Fx,Fy that vary only meriodionally/zonally with a superposition of sin & cos for a double gyre circulation. See Cooper&Zanna 2015 or Kloewer et al 2018.
ShallowWaters.FlatBottom
— MethodReturns a matrix of constant water depth H.
ShallowWaters.Ftime
— MethodTime evolution of forcing.
ShallowWaters.InterfaceRelaxation
— MethodReturns a reference state for Newtonian cooling/surface relaxation shaped as a hyperbolic tangent to force the continuity equation.
ShallowWaters.Ix!
— MethodLinear interpolation of a variable u in the x-direction. m,n = size(ux) must be m+1,n = size(u).
ShallowWaters.Ixy!
— MethodBilinear interpolation a variable u in x and y-direction. m,n = size(uxy) must be m+1,n+1 = size(u).
ShallowWaters.Iy!
— MethodLinear interpolation a variable u in the y-direction. m,n = size(uy) must be m,n+1 = size(u).
ShallowWaters.KelvinPump
— MethodReturns Kelvin wave pumping forcing of the continuity equation.
ShallowWaters.NoWind
— MethodReturns constant in in space forcing matrices Fx,Fy.
ShallowWaters.PV!
— MethodPotential vorticity calculated as q = (f + ∂v/∂x - ∂u/∂y)/h.
ShallowWaters.PV_ArakawaHsu!
— MethodAdvection of potential vorticity qhv,qhu as in Arakawa and Hsu, 1990 Energy and enstrophy conserving (in the limit of non-divergent mass flux) scheme with τ = 0.
ShallowWaters.PV_Sadourny!
— MethodAdvection of potential vorticity qhv,qhu as in Sadourny, 1975 enstrophy conserving scheme.
ShallowWaters.PVadvection!
— MethodTransit function to call the specified advection scheme.
ShallowWaters.Ridge
— MethodReturns a matrix of water depth for the whole domain that contains a meridional Gaussian ridge in the middle. Water depth, heigth and width of the ridge are adjusted with the constants waterdepth, topofeatheight and topofeat_width.
ShallowWaters.Ridges
— MethodSame as Ridge() but for n ridges at various x positions.
ShallowWaters.Seamount
— MethodReturns a matrix of water depth for the whole domain that contains a Gaussian seamount in the middle. Water depth, heigth and width of the seamount are adjusted with the constants H, topofeatheight and topofeatwidth.
ShallowWaters.ShearWind
— MethodReturns the constant forcing matrices Fx,Fy that vary only meriodionally/zonally as a hyperbolic tangent with strongest shear in the middle.
ShallowWaters.UVfluxes!
— MethodCalculate the mass/volume fluxes U,V from u,v,η.
ShallowWaters.Uflux!
— MethodZonal mass flux U = uh.
ShallowWaters.Vflux!
— MethodMeridional mass flux V = vh.
ShallowWaters.add_drag_diff_tendencies!
— MethodUpdate u with bottom friction tendency (Bu,Bv) and biharmonic viscosity.
ShallowWaters.add_halo
— MethodExtends the matrices u,v,η,sst with a halo of ghost points for boundary conditions.
ShallowWaters.add_halo
— MethodExtends the matrices u,v,η,sst with a halo of ghost points for boundary conditions.
ShallowWaters.adv_sst!
— MethodAdvection of sst/tracer based on the departure points xd,yd via bilinear interpolation. Departure points are clipped/wrapped to remain within the domain. Boundary conditions either periodic (wrap around behaviour) or no-flux (no gradient via clipping). Once the respective 4 surrounding grid points are found do bilinear interpolation on the unit square.
ShallowWaters.advection_coriolis!
— MethodUpdate advective and Coriolis tendencies.
ShallowWaters.axb!
— MethodAdd to a x multiplied with b. a += x*b
ShallowWaters.backtraj!
— MethodSolves the trajectory equation for a given time step dt and the velocity uv (this can be u or v). One function for three cases
(i) u is interpolated from u-grid with halo onto T-grid (ii) v is interpolated from v-grid with halo onto T-grid (iii) u or v already on the T-grid: All matrices have same size.
Uses relative grid nodes in the departure points rd, such that actually solved is rd = 0 - dt*uv. The indices i,j of rd determine the arrival grid point.
ShallowWaters.bernoulli!
— MethodBernoulli potential p = 1/2*(u² + v²) + gη.
ShallowWaters.bilin
— MethodBilinear interpolation on (x,y) in the unit square [0,1]x[0,1]. The values at the corners are f00 = f(0,0), f01 = f(0,1), etc.
ShallowWaters.bottom_drag!
— MethodTransit function to call the specified bottom drag function.
ShallowWaters.bottom_drag_linear!
— MethodLinear bottom drag computed as rB*(u,v). rB is negative and contains the grid spacing Δ as gradient operators are dimensionless.
ShallowWaters.bottom_drag_quadratic!
— MethodQuadratic bottom drag Bu,Bv = cD/h * | uv | * uv
ShallowWaters.caxb!
— Methodc equals add a to x multiplied with b. c = a + x*b
ShallowWaters.clip
— MethodClips the relative lower-left corner index xyi (for both x or y indices) to remain within the domain. ij is the index of the underlying matrix. xy is the actual coordinate, mn (m or n) the size of the domain, and h1,h2 are the halo sizes (left/south and right/north).
ShallowWaters.continuity!
— MethodTransit function to call the specified continuity function.
ShallowWaters.continuity_forcing!
— MethodContinuity equation's right-hand side with time&space dependent forcing.
ShallowWaters.continuity_itself!
— MethodContinuity equation's right-hand side -∂x(uh) - ∂y(vh) without forcing.
ShallowWaters.continuity_surf_relax!
— MethodContinuity equation's right-hand side with surface relaxation -∂x(uh) - ∂y(vh) + γ*(η_ref - η).
ShallowWaters.coriolis_at_lat
— MethodCoriolis parameter f [1/s] at latitude ϕ [°] given Earth's rotation ω [1/s].
ShallowWaters.countnans
— MethodReturns the number of NaNs in an array.
ShallowWaters.cxab!
— Methodc equals add x multiplied to a plus b. c = x*(a+b)
ShallowWaters.cxayb!
— Methodc = xa + yb
ShallowWaters.dambmc!
— Methodd equals add a minus b minus c. c = (a - b) - c.
ShallowWaters.departure!
— MethodComputes the departure point for semi-Lagrangian advection following Diamantakis, 2014. u,v are assumed to be the time averaged velocities over the previous advection time step. (Presumably need to be changed to 2nd order extrapolation in case the tracer is not passive)
Uses fixed-point iteration once to find the departure point.
ShallowWaters.diffusion!
— MethodTransit function to call the specified diffusion scheme.
ShallowWaters.diffusion_constant!
— MethodBiharmonic diffusion operator with constant viscosity coefficient Viscosity = ν∇⁴ ⃗u. Although constant, the coefficient is actually inside Viscosity = ∇⋅ν∇∇² ⃗u.
ShallowWaters.diffusion_smagorinsky!
— MethodSmagorinsky-like biharmonic viscosity Viscosity = ∇ ⋅ (cSmag Δ⁴ |D| ∇∇² ⃗u) The Δ⁴-scaling is omitted as gradient operators are dimensionless.
ShallowWaters.duration_estimate
— MethodEstimates the total time the model integration will take.
ShallowWaters.dxaybzc!
— Methodd = xa + yb + z*c
ShallowWaters.feedback!
— MethodFeedback function that calls duration estimate, nan_detection and progress.
ShallowWaters.feedback_end!
— MethodFinalises the progress txt file.
ShallowWaters.feedback_init
— MethodInitialises the progress txt file.
ShallowWaters.fu!
— MethodCoriolis term f*u.
ShallowWaters.fv!
— MethodCoriolis term f*v.
ShallowWaters.gap
— MethodFinds the first gap in a list of integers.
ShallowWaters.get_run_id_path
— MethodChecks output folders to determine a 4-digit run id number.
ShallowWaters.ghost_points!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_sst!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_sst!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_sst_nonperiodic!
— MethodCopy ghost points for η from inside to the halo in the nonperiodic case.
ShallowWaters.ghost_points_sst_periodic!
— MethodCopy ghost points for η from inside to the halo in the periodic case.
ShallowWaters.ghost_points_u_nonperiodic!
— MethodCopy ghost points for u from inside to the halo in the nonperiodic case.
ShallowWaters.ghost_points_u_periodic!
— MethodCopy ghost points for u from inside to the halo in the periodic case.
ShallowWaters.ghost_points_uv!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_uv!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_v_nonperiodic!
— MethodCopy ghost points for v from inside to the halo in the nonperiodic case.
ShallowWaters.ghost_points_v_periodic!
— MethodCopy ghost points for v from inside to the halo in the periodic case.
ShallowWaters.ghost_points_η!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_η!
— MethodDecide on boundary condition P.bc which ghost point function to execute.
ShallowWaters.ghost_points_η_nonperiodic!
— MethodCopy ghost points for η from inside to the halo in the nonperiodic case.
ShallowWaters.ghost_points_η_periodic!
— MethodCopy ghost points for η from inside to the halo in the periodic case.
ShallowWaters.interp_uv!
— MethodInterpolates the matrix uv into the matrix uvi, where xx, yy specify the coordinates as indices (including fraction. Interpolation only onto the inner entries of uvi. (They will be copied back later via the ghostpoint function). Two cases (i) u velocities: from u-grid with halo to T-grid (ii) v velocities: from v-grid with halo to T-grid.
ShallowWaters.m_per_lat
— MethodMeter per 1 degree of latitude (or longitude at the equator).
ShallowWaters.meshgrid
— MethodSimilar to the numpy meshgrid function: repeats x length(y)-times and vice versa. Returns two matrices xx,yy of same shape so that each row of xx is x and each column of yy is y.
ShallowWaters.momentum_u!
— MethodSum up the tendencies of the non-diffusive right-hand side for the u-component.
ShallowWaters.momentum_v!
— MethodSum up the tendencies of the non-diffusive right-hand side for the v-component.
ShallowWaters.nan_detection!
— MethodReturns a boolean whether the prognostic variables contains a NaN.
ShallowWaters.nc_create
— MethodCreates a netCDF file based on grid vectors x,y the variable name, its path, unit and long_name.
ShallowWaters.no_bottom_drag!
— MethodNo bottom drag.
ShallowWaters.output_close!
— MethodCloses netCDF and progress.txt files.
ShallowWaters.preallocate
— MethodPreallocate the diagnostic variables and return them as matrices in structs.
ShallowWaters.progress!
— MethodConverts time step into percent for feedback.
ShallowWaters.readable_secs
— MethodReturns a human readable string representing seconds in terms of days, hours, minutes or seconds.
ShallowWaters.remove_halo
— MethodCut off the halo from the prognostic variables.
ShallowWaters.remove_halo
— MethodCut off the halo from the prognostic variables.
ShallowWaters.rhs!
— MethodTransit function to call either the rhslinear or the rhsnonlinear.
ShallowWaters.rhs_linear!
— MethodTendencies du,dv of
∂u/∂t = fv - g∂η/∂x + Fx
∂v/∂t = -fu - g∂η/∂y + Fy
the linear shallow water equations.
ShallowWaters.rhs_nonlinear!
— MethodTendencies du,dv of
∂u/∂t = qhv - ∂(1/2*(u²+v²) + gη)/∂x + Fx
∂v/∂t = -qhu - ∂(1/2*(u²+v²) + gη)/∂y + Fy
the nonlinear shallow water equations.
ShallowWaters.run_model
— Methodu,v,η,sst = run_model()
runs ShallowWaters with default parameters as defined in src/DefaultParameters.jl
Examples
julia> u,v,η,sst = run_model(Float64,nx=200,output=true)
ShallowWaters.smagorinsky_coeff!
— MethodνSmag = cSmag * |D|, where deformation rate |D| = √((∂u/∂x - ∂v/∂y)^2 + (∂u/∂y + ∂v/∂x)^2). The grid spacing Δ is omitted here as the operators are dimensionless.
ShallowWaters.speed!
— MethodSquared velocities u²,v².
ShallowWaters.stress_tensor!
— MethodBiharmonic stress tensor ∇∇²(u,v) = (∂/∂x(∇²u), ∂/∂y(∇²u); ∂/∂x(∇²v), ∂/∂y(∇²v))
ShallowWaters.thickness!
— MethodLayer thickness h obtained by adding sea surface height η to bottom height H.
ShallowWaters.time_integration
— MethodIntegrates ShallowWaters forward in time.
ShallowWaters.tracer_relax_consumption!
— MethodTracer relaxation.
ShallowWaters.viscous_tensor_constant!
— MethodBiharmonic stress tensor times constant viscosity coefficient νB * ∇∇² ⃗u = (S11, S12; S21, S22)
ShallowWaters.viscous_tensor_smagorinsky!
— MethodBiharmonic stress tensor times Smagorinsky coefficient νSmag * ∇∇² ⃗u = (S11, S12; S21, S22).
ShallowWaters.waves
— MethodCreate a wave-checkerboard pattern over xx,yy like a nx x ny checkerboard. p is the power to which the waves are raised. Choose p<1 for rectangles, and p > 1 for more smootheness.
ShallowWaters.wrap
— MethodClips the relative lower-left corner index xyi (for both x or y indices) to remain within the domain. ij is the index of the underlying matrix. xy is the actual coordinate, mn (m or n) the size of the domain, and h is the halo size.
ShallowWaters.yy_q
— MethodHelper function to create yy_q based on the boundary condition bc.
ShallowWaters.β_at_lat
— MethodCoriolis parameter's derivative β wrt latitude [(ms)^-1] at latitude ϕ, given Earth's rotation ω [1/s] and radius R [m].
ShallowWaters.∂x!
— MethodCalculates the 2nd order centred gradient in x-direction on any grid (u,v,T or q). The size of dudx must be m-1,n compared to m,n = size(u)
ShallowWaters.∂x
— Method∂x is the 2nd order centred Gradient-operator ∂/∂x with grid spacing Δ (default 1).
ShallowWaters.∂y!
— MethodCalculates the 2nd order centred gradient in y-direction on any grid (u,v,T or q). The size of dudy must be m,n-1 compared to m,n = size(u).
ShallowWaters.∂y
— Method∂y is the 2nd order centred Gradient-operator ∂/∂y with grid spacing Δ (default 1).
ShallowWaters.∇²!
— Method∇² is the 2nd order centred Laplace-operator ∂/∂x^2 + ∂/∂y^2. The 1/Δ²-factor is omitted and moved into the viscosity coefficient.
ShallowWaters.∇²
— Method∇² is the 2nd order centred Laplace-operator ∂/∂x^2 + ∂/∂y^2 with grid spacing Δ (default 1).