Skip to content

Commit 45bda15

Browse files
author
Milan K
authored
Merge pull request #138 from milankl/julia14
Julia14
2 parents be8457c + fc6e59b commit 45bda15

File tree

8 files changed

+57
-79
lines changed

8 files changed

+57
-79
lines changed

.appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
environment:
22
matrix:
3-
- julia_version: 1
4-
- julia_version: 1.3
3+
- julia_version: 1.4
54
- julia_version: nightly
65

76
platform:

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 1.0
8-
- 1.3
7+
- 1.4
98
- nightly
109
notifications:
1110
email: false

Manifest.toml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
1111

1212
[[BinDeps]]
1313
deps = ["Libdl", "Pkg", "SHA", "URIParser", "Unicode"]
14-
git-tree-sha1 = "66158ad56b4bf6cc8413b37d0b7bc52402682764"
14+
git-tree-sha1 = "46cf2c1668ad07aba5a9d331bdeea994a1f13856"
1515
uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
16-
version = "1.0.0"
17-
18-
[[Compat]]
19-
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
20-
git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb"
21-
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
22-
version = "2.2.0"
16+
version = "1.0.1"
2317

2418
[[Conda]]
2519
deps = ["JSON", "VersionParsing"]
@@ -37,9 +31,10 @@ version = "0.2.0"
3731
deps = ["Printf"]
3832
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
3933

40-
[[DelimitedFiles]]
41-
deps = ["Mmap"]
42-
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
34+
[[DiskArrays]]
35+
git-tree-sha1 = "d89f6d225ea9e107ab1903e8b7881f1b1bd06148"
36+
uuid = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3"
37+
version = "0.2.3"
4338

4439
[[Distributed]]
4540
deps = ["Random", "Serialization", "Sockets"]
@@ -57,9 +52,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
5752

5853
[[Interpolations]]
5954
deps = ["AxisAlgorithms", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"]
60-
git-tree-sha1 = "c7579b2617b513d8e6eb9f4b91837eefe7080af8"
55+
git-tree-sha1 = "3af735234d9b1ff9ff1af89875735cd9549c0c5f"
6156
uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
62-
version = "0.12.8"
57+
version = "0.12.9"
6358

6459
[[JSON]]
6560
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@@ -68,6 +63,7 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
6863
version = "0.21.0"
6964

7065
[[LibGit2]]
66+
deps = ["Printf"]
7167
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
7268

7369
[[Libdl]]
@@ -88,15 +84,15 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
8884
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
8985

9086
[[NetCDF]]
91-
deps = ["BinDeps", "CondaBinDeps", "Formatting", "Libdl"]
92-
git-tree-sha1 = "fce0c7962fb14b8cf2f33ea77885f3b7c7e1485e"
87+
deps = ["BinDeps", "CondaBinDeps", "DiskArrays", "Formatting", "Libdl"]
88+
git-tree-sha1 = "0c6a63d16e9261bf2fa4eecbab575ae7e7fef11c"
9389
uuid = "30363a11-5582-574a-97bb-aa9a979735b9"
94-
version = "0.8.0"
90+
version = "0.10.2"
9591

9692
[[OffsetArrays]]
97-
git-tree-sha1 = "707e34562700b81e8aa13548eb6b23b18112e49b"
93+
git-tree-sha1 = "930db8ef90483570107f2396b1ffc6680f08e8b7"
9894
uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
99-
version = "1.0.2"
95+
version = "1.0.4"
10096

10197
[[OrderedCollections]]
10298
deps = ["Random", "Serialization", "Test"]
@@ -112,12 +108,12 @@ version = "0.12.0"
112108

113109
[[Parsers]]
114110
deps = ["Dates", "Test"]
115-
git-tree-sha1 = "d112c19ccca00924d5d3a38b11ae2b4b268dda39"
111+
git-tree-sha1 = "f8f5d2d4b4b07342e5811d2b6428e45524e241df"
116112
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
117-
version = "0.3.11"
113+
version = "1.0.2"
118114

119115
[[Pkg]]
120-
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
116+
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
121117
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
122118

123119
[[Printf]]
@@ -133,10 +129,9 @@ deps = ["Serialization"]
133129
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
134130

135131
[[Ratios]]
136-
deps = ["Compat"]
137-
git-tree-sha1 = "cdbbe0f350581296f3a2e3e7a91b214121934407"
132+
git-tree-sha1 = "37d210f612d70f3f7d57d488cb3b6eff56ad4e41"
138133
uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439"
139-
version = "0.3.1"
134+
version = "0.4.0"
140135

141136
[[SHA]]
142137
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
@@ -157,9 +152,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
157152

158153
[[StaticArrays]]
159154
deps = ["LinearAlgebra", "Random", "Statistics"]
160-
git-tree-sha1 = "5a3bcb6233adabde68ebc97be66e95dcb787424c"
155+
git-tree-sha1 = "4118cba3529e99af61aea9a83f7bfd3cff5ffb28"
161156
uuid = "90137ffa-7385-5640-81b9-e52037218182"
162-
version = "0.12.1"
157+
version = "0.12.2"
163158

164159
[[Statistics]]
165160
deps = ["LinearAlgebra", "SparseArrays"]
@@ -170,10 +165,10 @@ deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
170165
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
171166

172167
[[URIParser]]
173-
deps = ["Test", "Unicode"]
174-
git-tree-sha1 = "6ddf8244220dfda2f17539fa8c9de20d6c575b69"
168+
deps = ["Unicode"]
169+
git-tree-sha1 = "53a9f49546b8d2dd2e688d216421d050c9a31d0d"
175170
uuid = "30578b45-9adc-5946-b283-645ec420af67"
176-
version = "0.4.0"
171+
version = "0.4.1"
177172

178173
[[UUIDs]]
179174
deps = ["Random", "SHA"]
@@ -189,6 +184,6 @@ version = "1.2.0"
189184

190185
[[WoodburyMatrices]]
191186
deps = ["LinearAlgebra", "SparseArrays"]
192-
git-tree-sha1 = "bbb9f7fd6fbdd9582e77c0b698312c543de5eb71"
187+
git-tree-sha1 = "28ffe06d28b1ba8fdb2f36ec7bb079fac81bac0d"
193188
uuid = "efce3f68-66dc-5838-9240-27a6d6f5f9b6"
194-
version = "0.5.0"
189+
version = "0.5.2"

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ShallowWaters"
22
uuid = "56019723-2d87-4a65-81ff-59d5d8913e3c"
33
authors = ["Milan Kloewer"]
4-
version = "0.2.0"
4+
version = "0.3.0"
55

66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
@@ -11,10 +11,10 @@ Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1111
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1212

1313
[compat]
14-
NetCDF = "^0.8"
14+
Interpolations = "^0.12"
15+
NetCDF = "^0.10"
1516
Parameters = "^0.12"
1617
julia = "1"
17-
Interpolations = "^0.12"
1818

1919
[extras]
2020
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ ShallowWaters is fully-explicit with an energy and enstrophy conserving advectio
1515

1616
Please feel free to raise an [issue](https://github.com/milankl/ShallowWaters.jl/issues) if you discover bugs or have an idea how to improve ShallowWaters.
1717

18+
Requires: Julia 1.2
19+
1820
### How to use
1921

20-
`RunModel` initialises the model, preallocates memory and starts the time integration. You find the options and default parameters in `src/DefaultParameters.jl` (or by typing `?Parameter`).
22+
`RunModel` initialises the model, preallocates memory and starts the time integration. You find the options and default parameters in `src/DefaultParameters.jl` (or by typing `?Parameter`).
2123
```julia
2224
help?> Parameter
2325
search: Parameter
2426

2527
Creates a Parameter struct with following options and default values
2628

2729
T::DataType=Float32 # number format
28-
30+
2931
Tprog::DataType=T # number format for prognostic variables
3032
Tcomm::DataType=Tprog # number format for ghost-point copies
31-
33+
3234
# DOMAIN RESOLUTION AND RATIO
3335
nx::Int=100 # number of grid cells in x-direction
3436
Lx::Real=2000e3 # length of the domain in x-direction [m]

src/DefaultParameters.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Creates a Parameter struct with following options and default values
185185
186186
# SURFACE FORCING
187187
surface_forcing::Bool=false # yes?
188-
ωFη::Real=1.0 # (annual) frequency [1/year]
188+
ωFη::Real=1.0 # frequency [1/year] for surfance forcing
189189
A::Real=3e-5 # Amplitude [m/s]
190190
ϕk::Real=ϕ # Central latitude of Kelvin wave pumping
191191
wk::Real=10e3 # width [m] in y of Gaussian used for surface forcing

src/InitialConditions.jl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat}
5353
end
5454

5555
u = ncu.vars["u"][:,:,init_starti]
56-
NetCDF.close(ncu)
56+
# NetCDF.close(ncu)
5757

5858
ncv = NetCDF.open(joinpath(inirunpath,"v.nc"))
5959
v = ncv.vars["v"][:,:,init_starti]
60-
NetCDF.close(ncv)
60+
# NetCDF.close(ncv)
6161

6262
ncη = NetCDF.open(joinpath(inirunpath,"eta.nc"))
6363
η = ncη.vars["eta"][:,:,init_starti]
64-
NetCDF.close(ncη)
64+
# NetCDF.close(ncη)
6565

6666
# remove singleton time dimension
6767
u = reshape(u,size(u)[1:2])
@@ -147,7 +147,7 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat}
147147
if initial_cond == "ncfile" && sst_initial == "restart"
148148
ncsst = NetCDF.open(joinpath(inirunpath,"sst.nc"))
149149
sst = ncsst.vars["sst"][:,:,init_starti]
150-
NetCDF.close(ncsst)
150+
# NetCDF.close(ncsst)
151151

152152
sst = reshape(sst,size(sst)[1:2])
153153
end
@@ -164,11 +164,3 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat}
164164

165165
return PrognosticVars{T}(u,v,η,sst)
166166
end
167-
168-
# if injection_region == "south"
169-
# sst_inj_region = sst_south
170-
# elseif injection_region == "west"
171-
# sst_inj_region = sst_west
172-
# elseif injection_region == "rect"
173-
# sst_inj_region = sst_rect
174-
# end

src/Output.jl

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,54 +88,45 @@ function output_nc!(i::Int,
8888
@unpack f_q,ep,dtint = S.grid
8989

9090
# CUT OFF HALOS
91-
# @views u = Prog.u[halo+1:end-halo,halo+1:end-halo]
92-
# @views v = Prog.v[halo+1:end-halo,halo+1:end-halo]
93-
# @views η = Prog.η[haloη+1:end-haloη,haloη+1:end-haloη]
94-
# @views sst = Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty]
95-
# @views ζ = (dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q)
96-
# @views du = Diag.Tendencies.du[halo+1:end-halo,halo+1:end-halo]
97-
# @views dv = Diag.Tendencies.dv[halo+1:end-halo,halo+1:end-halo]
98-
# @views dη = Diag.Tendencies.dη[haloη+1:end-haloη,haloη+1:end-haloη]
99-
10091
# As output is before copyto!(u,u0), take u0,v0,η0
101-
@views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo])
102-
@views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo])
103-
@views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη])
104-
105-
@views sst = Float32.(Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty])
106-
@views ζ = Float32.((dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q))
107-
10892
# Tendencies calculate from the last time step, du = u_n+1-u_n etc
109-
@views du = u-Float32.(Prog.u[halo+1:end-halo,halo+1:end-halo])
110-
@views dv = v-Float32.(Prog.v[halo+1:end-halo,halo+1:end-halo])
111-
@views= η-Float32.(Prog.η[haloη+1:end-haloη,haloη+1:end-haloη])
112-
11393
# WRITING THE VARIABLES
11494
if ncs.u != nothing
95+
@views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo])
11596
NetCDF.putvar(ncs.u,"u",u,start=[1,1,iout],count=[-1,-1,1])
11697
end
11798
if ncs.v != nothing
99+
@views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo])
118100
NetCDF.putvar(ncs.v,"v",v,start=[1,1,iout],count=[-1,-1,1])
119101
end
120102
if ncs.η != nothing
103+
@views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη])
121104
NetCDF.putvar(ncs.η,"eta",η,start=[1,1,iout],count=[-1,-1,1])
122105
end
123106
if ncs.sst != nothing
107+
@views sst = Float32.(Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty])
124108
NetCDF.putvar(ncs.sst,"sst",sst,start=[1,1,iout],count=[-1,-1,1])
125109
end
126110
if ncs.q != nothing
127111
NetCDF.putvar(ncs.q,"q",q,start=[1,1,iout],count=[-1,-1,1])
128112
end
129113
if ncs.ζ != nothing
114+
@views ζ = Float32.((dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q))
130115
NetCDF.putvar(ncs.ζ,"relvort",ζ,start=[1,1,iout],count=[-1,-1,1])
131116
end
132117
if ncs.du != nothing
118+
@views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo])
119+
@views du = u-Float32.(Prog.u[halo+1:end-halo,halo+1:end-halo])
133120
NetCDF.putvar(ncs.du,"du",du,start=[1,1,iout],count=[-1,-1,1])
134121
end
135122
if ncs.dv != nothing
123+
@views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo])
124+
@views dv = v-Float32.(Prog.v[halo+1:end-halo,halo+1:end-halo])
136125
NetCDF.putvar(ncs.dv,"dv",dv,start=[1,1,iout],count=[-1,-1,1])
137126
end
138127
if ncs.!= nothing
128+
@views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη])
129+
@views= η-Float32.(Prog.η[haloη+1:end-haloη,haloη+1:end-haloη])
139130
NetCDF.putvar(ncs.dη,"deta",dη,start=[1,1,iout],count=[-1,-1,1])
140131
end
141132

@@ -156,11 +147,11 @@ function output_close!(ncs::NcFiles,feedback::Feedback,S::ModelSetup)
156147
@unpack output = S.parameters
157148

158149
if output
159-
for nc in (ncs.u,ncs.v,ncs.η,ncs.sst,ncs.q,ncs.ζ,ncs.du,ncs.dv,ncs.dη)
160-
if nc != nothing
161-
NetCDF.close(nc)
162-
end
163-
end
150+
# for nc in (ncs.u,ncs.v,ncs.η,ncs.sst,ncs.q,ncs.ζ,ncs.du,ncs.dv,ncs.dη)
151+
# if nc != nothing
152+
# NetCDF.close(nc)
153+
# end
154+
# end
164155
println("All data stored.")
165156
write(feedback.progress_txt,"All data stored.")
166157
close(feedback.progress_txt)

0 commit comments

Comments
 (0)