Skip to content

Commit 67e22a8

Browse files
author
Milan K
authored
Merge pull request #116 from milankl/forecasts
Forecasts
2 parents 2dfd03e + 9cff1a8 commit 67e22a8

File tree

4 files changed

+55
-6
lines changed

4 files changed

+55
-6
lines changed

experiments/forecast_ens.jl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
include("/home/kloewer/git/Juls.jl/src/Juls.jl")
2+
using .Juls
3+
using FileIO
4+
5+
"""Finds the first gap in a list of integers."""
6+
function gap(a::Array{Int,1})
7+
try
8+
return minimum([i for i in minimum(a):maximum(a) if ~(i in a)])
9+
catch
10+
return maximum(a)+1
11+
end
12+
end
13+
14+
function get_run_id(path::String,order::String="continue")
15+
runlist = filter(x->startswith(x,"run"),readdir(path))
16+
existing_runs = [parse(Int,id[4:end]) for id in runlist]
17+
if length(existing_runs) == 0 # if no runfolder exists yet
18+
run_id = 0
19+
else # create next folder
20+
if order == "fill" # find the smallest gap in runfolders
21+
run_id = gap(existing_runs)
22+
elseif order == "continue" # find largest folder and count one up
23+
run_id = maximum(existing_runs)+1
24+
end
25+
end
26+
return run_id
27+
end
28+
29+
path = "/network/aopp/chaos/pred/kloewer/julsdata/forecast/"
30+
startis = load(joinpath(path,"starti.jld2"))["starti"]
31+
outpath = joinpath(path,"Float64")
32+
33+
for i in 1:10
34+
run_id = get_run_id(outpath)
35+
36+
starti = startis[run_id+1]
37+
38+
RunJuls(Float64,
39+
output=true,
40+
Ndays=100.0,
41+
outpath=outpath,
42+
initial_cond="ncfile",
43+
output_vars=["u","v","η","sst"],
44+
initpath=path,
45+
init_run_id=1,
46+
init_starti=starti
47+
)
48+
49+
end

experiments/forecast_master.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RunJuls(Float32,
66
outpath="/network/aopp/chaos/pred/kloewer/julsdata/forecast",
77
output_vars=["u","v","η"],
88
α=1.,
9-
diffusion="Constant")
9+
diffusion="constant")
1010

1111
RunJuls(Float32,
1212
output=true,
@@ -16,4 +16,4 @@ RunJuls(Float32,
1616
initial_cond="ncfile",
1717
init_run_id=0,
1818
α=1.,
19-
diffusion="Constant")
19+
diffusion="constant")

src/DefaultParameters.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@
7676
sst_initial::String="south" # "west", "south", "rect", "flat" or "restart"
7777
sst_rect_coords::Array{Float64,1}=[0.,0.15,0.,1.0]
7878
# (x0,x1,y0,y1) are the size of the rectangle in [0,1]
79-
Uadv::Real=0.25 # Velocity scale [m/s] for tracer advection
79+
Uadv::Real=0.2 # Velocity scale [m/s] for tracer advection
8080
SSTmax::Real=1. # tracer (sea surface temperature) max for restoring
8181
SSTmin::Real=0. # tracer (sea surface temperature) min for restoring
8282
τSST::Real=500. # tracer restoring time scale [days]
8383
jSST::Real=365. # tracer consumption [days]
8484
SST_λ0::Real=222e3 # [m] transition position of relaxation timescale
8585
SST_λs::Real=111e3 # [m] transition width of relaxation timescale
8686
SST_γ0::Real=8.35 # [days] injection time scale
87-
SSTw::Real=50e3 # width [m] of the tangent used for the IC and interface relaxation
87+
SSTw::Real=5e3 # width [m] of the tangent used for the IC and interface relaxation
8888
SSTϕ::Real=0.5 # latitude/longitude fraction ∈ [0,1] of sst edge
8989

9090
# OUTPUT OPTIONS
@@ -111,7 +111,7 @@
111111
@assert η_refw > 0.0 "η_refw has to be >0, $η_refw given."
112112
@assert ωyr > 0.0 "ωyr has to be >0, $ωyr given."
113113
@assert RKo in [3,4] "RKo has to be 3 or 4, $RKo given."
114-
@assert Ndays > 0.0 "Ndays has to be >0, $Ndyas given."
114+
@assert Ndays > 0.0 "Ndays has to be >0, $Ndays given."
115115
@assert nstep_diff > 0 "nstep_diff has to be >0, $nstep_diff given."
116116
@assert nstep_advcor >= 0 "nstep_advcor has to be >=0, $nstep_advcor given."
117117
@assert bc in ["periodic","nonperiodic"] "boundary condition '$bc' unsupported."

src/TracerAdvection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function interp_uv!(uvi::AbstractMatrix,
148148
elseif (m+4,n+2) == (muv,nuv) # v case
149149
# halo sizes 1: left/bottom, 2: right/top
150150
xh1 = 2
151-
xh2 = 1 # don't fully understand why this is 1 ...
151+
xh2 = 2
152152
yh1 = 1
153153
yh2 = 1
154154
else

0 commit comments

Comments
 (0)