Skip to content

Commit 7e9a29c

Browse files
author
Milan K
authored
Merge pull request #125 from milankl/get_id_mode
?Parameter help included
2 parents b130fc0 + 3c52018 commit 7e9a29c

File tree

2 files changed

+107
-2
lines changed

2 files changed

+107
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Please feel free to raise an [issue](https://github.com/milankl/ShallowWaters.jl
1717

1818
## How to use
1919

20-
You find the default parameters in `src/DefaultParameters.jl`. They can be changed with keyword arguments. Optionally, the number format `T` is defined as the first argument of `RunModel(T,...)`
20+
You find the options and default parameters in `src/DefaultParameters.jl` (or by typing `?Parameter`). They can be changed with keyword arguments. Optionally, the number format `T` is defined as the first argument of `RunModel(T,...)`
2121
```julia
2222
julia> Prog = RunModel(Float32,Ndays=10,g=10,H=500,Fx0=0.12);
2323
Starting ShallowWaters on Sun, 20 Oct 2019 19:58:25 without output.

src/DefaultParameters.jl

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
initpath::String=outpath # folder where to pick the restart files from
9999
init_run_id::Int=0 # run id for restart from run number
100100
init_starti::Int=-1 # timestep to start from (-1 meaning last)
101-
get_id_mode::String="continue" # "continue" or "fill"
101+
get_id_mode::String="continue" # How to determine the run id: "continue" or "fill"
102102

103103
# ASSERT - CHECK THAT THE INPUT PARAMETERS MAKE SENSE
104104
@assert all((nx,Lx,L_ratio) .> 0.) "nx, Lx, L_ratio have to be >0"
@@ -133,3 +133,108 @@
133133
@assert init_starti > 0 || init_starti == -1 "Start index, init_starti, has to be >0 || -1, $init_starti given."
134134
@assert get_id_mode in ["continue","fill"] "get_id_mode $get_id_mode unsupported."
135135
end
136+
137+
"""
138+
Creates a Parameter struct with following options and default values
139+
140+
T::DataType=Float32 # number format
141+
142+
Tprog::DataType=T # number format for prognostic variables
143+
Tcomm::DataType=T # number format for ghost-point copies
144+
145+
# DOMAIN RESOLUTION AND RATIO
146+
nx::Int=100 # number of grid cells in x-direction
147+
Lx::Real=2000e3 # length of the domain in x-direction [m]
148+
L_ratio::Real=2 # Domain aspect ratio of Lx/Ly
149+
150+
# PHYSICAL CONSTANTS
151+
g::Real=10. # gravitational acceleration [m/s]
152+
H::Real=500. # layer thickness at rest [m]
153+
ρ::Real=1e3 # water density [kg/m^3]
154+
ϕ::Real=45. # central latitue of the domain (for coriolis) [°]
155+
ω::Real=2π/(24*3600) # Earth's angular frequency [s^-1]
156+
R::Real=6.371e6 # Earth's radius [m]
157+
158+
# WIND FORCING OPTIONS
159+
wind_forcing_x::String="channel" # "channel", "double_gyre", "shear","constant" or "none"
160+
wind_forcing_y::String="constant" # "channel", "double_gyre", "shear","constant" or "none"
161+
Fx0::Real=0.12 # wind stress strength [Pa] in x-direction
162+
Fy0::Real=0.0 # wind stress strength [Pa] in y-direction
163+
164+
# BOTTOM TOPOGRAPHY OPTIONS
165+
topography::String="ridge" # "ridge", "seamount", "flat", "ridges", "bathtub"
166+
topo_height::Real=50. # height of seamount [m]
167+
topo_width::Real=300e3 # horizontal scale [m] of the seamount
168+
169+
# SURFACE RELAXATION
170+
surface_relax::Bool=false # yes?
171+
t_relax::Real=100. # time scale of the relaxation [days]
172+
η_refh::Real=5. # height difference [m] of the interface relaxation profile
173+
η_refw::Real=50e3 # width [m] of the tangent used for the interface relaxation
174+
175+
# SURFACE FORCING (Currently only Kelvin wave pumping at Eq.)
176+
surface_forcing::Bool=false # yes?
177+
ωyr::Real=1.0 # (annual) frequency [1/year]
178+
A::Real=3e-5 # Amplitude [m/s]
179+
180+
# TIME STEPPING OPTIONS
181+
RKo::Int=4 # Order of the RK time stepping scheme (3 or 4)
182+
cfl::Real=1.0 # CFL number (1.0 recommended for RK4, 0.6 for RK3)
183+
Ndays::Real=10.0 # number of days to integrate for
184+
nstep_diff::Int=1 # diffusive part every nstep_diff time steps.
185+
nstep_advcor::Int=0 # advection and coriolis update every nstep_advcor time steps.
186+
# 0 means it is included in every RK4 substep
187+
188+
# BOUNDARY CONDITION OPTIONS
189+
bc::String="periodic" # "periodic" or anything else for nonperiodic
190+
α::Real=2. # lateral boundary condition parameter
191+
# 0 free-slip, 0<α<2 partial-slip, 2 no-slip
192+
193+
# MOMENTUM ADVECTION OPTIONS
194+
adv_scheme::String="ArakawaHsu" # "Sadourny" or "ArakawaHsu"
195+
dynamics::String="nonlinear" # "linear" or "nonlinear"
196+
197+
# BOTTOM FRICTION OPTIONS
198+
bottom_drag::String="quadratic" # "linear", "quadratic" or "none"
199+
cD::Real=1e-5 # bottom drag coefficient [dimensionless] for quadratic
200+
τD::Real=300. # bottom drag coefficient [days] for linear
201+
202+
# DIFFUSION OPTIONS
203+
diffusion::String="constant" # "Smagorinsky" or "constant", biharmonic in both cases
204+
νB::Real=500.0 # [m^2/s] scaling constant for constant biharmonic diffusion
205+
cSmag::Real=0.15 # Smagorinsky coefficient [dimensionless]
206+
207+
# TRACER ADVECTION
208+
tracer_advection::Bool=true # yes?
209+
tracer_relaxation::Bool=false # yes?
210+
tracer_consumption::Bool=false # yes?
211+
tracer_pumping::Bool=false # yes?
212+
injection_region::String="west" # "west", "south", "rect" or "flat"
213+
sst_initial::String="south" # "west", "south", "rect", "flat" or "restart"
214+
sst_rect_coords::Array{Float64,1}=[0.,0.15,0.,1.0]
215+
# (x0,x1,y0,y1) are the size of the rectangle in [0,1]
216+
Uadv::Real=0.25 # Velocity scale [m/s] for tracer advection
217+
SSTmax::Real=1. # tracer (sea surface temperature) max for restoring
218+
SSTmin::Real=0. # tracer (sea surface temperature) min for restoring
219+
τSST::Real=500. # tracer restoring time scale [days]
220+
jSST::Real=365. # tracer consumption [days]
221+
SST_λ0::Real=222e3 # [m] transition position of relaxation timescale
222+
SST_λs::Real=111e3 # [m] transition width of relaxation timescale
223+
SST_γ0::Real=8.35 # [days] injection time scale
224+
SSTw::Real=5e3 # width [m] of the tangent used for the IC and interface relaxation
225+
SSTϕ::Real=0.5 # latitude/longitude fraction ∈ [0,1] of sst edge
226+
227+
# OUTPUT OPTIONS
228+
output::Bool=false # netcdf output?
229+
output_vars::Array{String,1}=["u","v","η","sst","q","ζ"] # which variables to output?
230+
output_dt::Real=6 # output time step [hours]
231+
outpath::String=pwd() # path to output folder
232+
233+
# INITIAL CONDITIONS
234+
initial_cond::String="rest" # "rest" or "ncfile" for restart from file
235+
initpath::String=outpath # folder where to pick the restart files from
236+
init_run_id::Int=0 # run id for restart from run number
237+
init_starti::Int=-1 # timestep to start from (-1 meaning last)
238+
get_id_mode::String="continue" # How to determine the run id: "continue" or "fill"
239+
"""
240+
Parameter

0 commit comments

Comments
 (0)