From f31c398c4779349f3715a669e32d6f1281960a57 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 12:52:19 +0100 Subject: [PATCH 1/7] test with Julia 1.4 --- .appveyor.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e5408b4..554a73a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ environment: matrix: - julia_version: 1 - - julia_version: 1.3 + - julia_version: 1.4 - julia_version: nightly platform: diff --git a/.travis.yml b/.travis.yml index e2657a8..b1abdbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ os: - osx julia: - 1.0 - - 1.3 + - 1.4 - nightly notifications: email: false From 81e302244d20f813894354aa3085123f7ca67b1e Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 12:58:08 +0100 Subject: [PATCH 2/7] using NetCDF v0.10 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3ddd1b4..ac71bcc 100644 --- a/Project.toml +++ b/Project.toml @@ -11,7 +11,7 @@ Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" [compat] -NetCDF = "^0.8" +NetCDF = "^0.10" Parameters = "^0.12" julia = "1" Interpolations = "^0.12" From d0c17da7772caec46aabb44f2c18c557a51fee64 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 12:58:28 +0100 Subject: [PATCH 3/7] cut off halos only when actually output --- src/Output.jl | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/Output.jl b/src/Output.jl index 66cb7c4..6ebbd27 100644 --- a/src/Output.jl +++ b/src/Output.jl @@ -88,54 +88,45 @@ function output_nc!(i::Int, @unpack f_q,ep,dtint = S.grid # CUT OFF HALOS - # @views u = Prog.u[halo+1:end-halo,halo+1:end-halo] - # @views v = Prog.v[halo+1:end-halo,halo+1:end-halo] - # @views η = Prog.η[haloη+1:end-haloη,haloη+1:end-haloη] - # @views sst = Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty] - # @views ζ = (dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q) - # @views du = Diag.Tendencies.du[halo+1:end-halo,halo+1:end-halo] - # @views dv = Diag.Tendencies.dv[halo+1:end-halo,halo+1:end-halo] - # @views dη = Diag.Tendencies.dη[haloη+1:end-haloη,haloη+1:end-haloη] - # As output is before copyto!(u,u0), take u0,v0,η0 - @views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo]) - @views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo]) - @views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη]) - - @views sst = Float32.(Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty]) - @views ζ = Float32.((dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q)) - # Tendencies calculate from the last time step, du = u_n+1-u_n etc - @views du = u-Float32.(Prog.u[halo+1:end-halo,halo+1:end-halo]) - @views dv = v-Float32.(Prog.v[halo+1:end-halo,halo+1:end-halo]) - @views dη = η-Float32.(Prog.η[haloη+1:end-haloη,haloη+1:end-haloη]) - # WRITING THE VARIABLES if ncs.u != nothing + @views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo]) NetCDF.putvar(ncs.u,"u",u,start=[1,1,iout],count=[-1,-1,1]) end if ncs.v != nothing + @views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo]) NetCDF.putvar(ncs.v,"v",v,start=[1,1,iout],count=[-1,-1,1]) end if ncs.η != nothing + @views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη]) NetCDF.putvar(ncs.η,"eta",η,start=[1,1,iout],count=[-1,-1,1]) end if ncs.sst != nothing + @views sst = Float32.(Prog.sst[halosstx+1:end-halosstx,halossty+1:end-halossty]) NetCDF.putvar(ncs.sst,"sst",sst,start=[1,1,iout],count=[-1,-1,1]) end if ncs.q != nothing NetCDF.putvar(ncs.q,"q",q,start=[1,1,iout],count=[-1,-1,1]) end if ncs.ζ != nothing + @views ζ = Float32.((dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q)) NetCDF.putvar(ncs.ζ,"relvort",ζ,start=[1,1,iout],count=[-1,-1,1]) end if ncs.du != nothing + @views u = Float32.(Diag.RungeKutta.u0[halo+1:end-halo,halo+1:end-halo]) + @views du = u-Float32.(Prog.u[halo+1:end-halo,halo+1:end-halo]) NetCDF.putvar(ncs.du,"du",du,start=[1,1,iout],count=[-1,-1,1]) end if ncs.dv != nothing + @views v = Float32.(Diag.RungeKutta.v0[halo+1:end-halo,halo+1:end-halo]) + @views dv = v-Float32.(Prog.v[halo+1:end-halo,halo+1:end-halo]) NetCDF.putvar(ncs.dv,"dv",dv,start=[1,1,iout],count=[-1,-1,1]) end if ncs.dη != nothing + @views η = Float32.(Diag.RungeKutta.η0[haloη+1:end-haloη,haloη+1:end-haloη]) + @views dη = η-Float32.(Prog.η[haloη+1:end-haloη,haloη+1:end-haloη]) NetCDF.putvar(ncs.dη,"deta",dη,start=[1,1,iout],count=[-1,-1,1]) end From 307a8011f050588a42a9d73ba74fe7400c356746 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 13:49:08 +0100 Subject: [PATCH 4/7] no NetCDF.close anymore --- src/DefaultParameters.jl | 2 +- src/InitialConditions.jl | 16 ++++------------ src/Output.jl | 10 +++++----- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/DefaultParameters.jl b/src/DefaultParameters.jl index eba28f6..9787f88 100644 --- a/src/DefaultParameters.jl +++ b/src/DefaultParameters.jl @@ -185,7 +185,7 @@ Creates a Parameter struct with following options and default values # SURFACE FORCING surface_forcing::Bool=false # yes? - ωFη::Real=1.0 # (annual) frequency [1/year] + ωFη::Real=1.0 # frequency [1/year] for surfance forcing A::Real=3e-5 # Amplitude [m/s] ϕk::Real=ϕ # Central latitude of Kelvin wave pumping wk::Real=10e3 # width [m] in y of Gaussian used for surface forcing diff --git a/src/InitialConditions.jl b/src/InitialConditions.jl index 1ffe42e..9259b0d 100644 --- a/src/InitialConditions.jl +++ b/src/InitialConditions.jl @@ -53,15 +53,15 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat} end u = ncu.vars["u"][:,:,init_starti] - NetCDF.close(ncu) + # NetCDF.close(ncu) ncv = NetCDF.open(joinpath(inirunpath,"v.nc")) v = ncv.vars["v"][:,:,init_starti] - NetCDF.close(ncv) + # NetCDF.close(ncv) ncη = NetCDF.open(joinpath(inirunpath,"eta.nc")) η = ncη.vars["eta"][:,:,init_starti] - NetCDF.close(ncη) + # NetCDF.close(ncη) # remove singleton time dimension u = reshape(u,size(u)[1:2]) @@ -147,7 +147,7 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat} if initial_cond == "ncfile" && sst_initial == "restart" ncsst = NetCDF.open(joinpath(inirunpath,"sst.nc")) sst = ncsst.vars["sst"][:,:,init_starti] - NetCDF.close(ncsst) + # NetCDF.close(ncsst) sst = reshape(sst,size(sst)[1:2]) end @@ -164,11 +164,3 @@ function initial_conditions(::Type{T},S::ModelSetup) where {T<:AbstractFloat} return PrognosticVars{T}(u,v,η,sst) end - -# if injection_region == "south" -# sst_inj_region = sst_south -# elseif injection_region == "west" -# sst_inj_region = sst_west -# elseif injection_region == "rect" -# sst_inj_region = sst_rect -# end diff --git a/src/Output.jl b/src/Output.jl index 6ebbd27..d4e784c 100644 --- a/src/Output.jl +++ b/src/Output.jl @@ -147,11 +147,11 @@ function output_close!(ncs::NcFiles,feedback::Feedback,S::ModelSetup) @unpack output = S.parameters if output - for nc in (ncs.u,ncs.v,ncs.η,ncs.sst,ncs.q,ncs.ζ,ncs.du,ncs.dv,ncs.dη) - if nc != nothing - NetCDF.close(nc) - end - end + # for nc in (ncs.u,ncs.v,ncs.η,ncs.sst,ncs.q,ncs.ζ,ncs.du,ncs.dv,ncs.dη) + # if nc != nothing + # NetCDF.close(nc) + # end + # end println("All data stored.") write(feedback.progress_txt,"All data stored.") close(feedback.progress_txt) From 754740e826b645cfd463f4fab1b266c82e43e1b4 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 13:50:14 +0100 Subject: [PATCH 5/7] bump to 0.3.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index ac71bcc..4cf1483 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ShallowWaters" uuid = "56019723-2d87-4a65-81ff-59d5d8913e3c" authors = ["Milan Kloewer"] -version = "0.2.0" +version = "0.3.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 74a78ad18c540a3da5f9f53fe4e24b4f09490030 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 14:01:19 +0100 Subject: [PATCH 6/7] manifest updated --- Manifest.toml | 57 +++++++++++++++++++++++---------------------------- Project.toml | 2 +- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 47807d1..c17f380 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -11,15 +11,9 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[BinDeps]] deps = ["Libdl", "Pkg", "SHA", "URIParser", "Unicode"] -git-tree-sha1 = "66158ad56b4bf6cc8413b37d0b7bc52402682764" +git-tree-sha1 = "46cf2c1668ad07aba5a9d331bdeea994a1f13856" uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee" -version = "1.0.0" - -[[Compat]] -deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "2.2.0" +version = "1.0.1" [[Conda]] deps = ["JSON", "VersionParsing"] @@ -37,9 +31,10 @@ version = "0.2.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" -[[DelimitedFiles]] -deps = ["Mmap"] -uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +[[DiskArrays]] +git-tree-sha1 = "d89f6d225ea9e107ab1903e8b7881f1b1bd06148" +uuid = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3" +version = "0.2.3" [[Distributed]] deps = ["Random", "Serialization", "Sockets"] @@ -57,9 +52,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" [[Interpolations]] deps = ["AxisAlgorithms", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"] -git-tree-sha1 = "c7579b2617b513d8e6eb9f4b91837eefe7080af8" +git-tree-sha1 = "3af735234d9b1ff9ff1af89875735cd9549c0c5f" uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" -version = "0.12.8" +version = "0.12.9" [[JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -68,6 +63,7 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" version = "0.21.0" [[LibGit2]] +deps = ["Printf"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[Libdl]] @@ -88,15 +84,15 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[NetCDF]] -deps = ["BinDeps", "CondaBinDeps", "Formatting", "Libdl"] -git-tree-sha1 = "fce0c7962fb14b8cf2f33ea77885f3b7c7e1485e" +deps = ["BinDeps", "CondaBinDeps", "DiskArrays", "Formatting", "Libdl"] +git-tree-sha1 = "0c6a63d16e9261bf2fa4eecbab575ae7e7fef11c" uuid = "30363a11-5582-574a-97bb-aa9a979735b9" -version = "0.8.0" +version = "0.10.2" [[OffsetArrays]] -git-tree-sha1 = "707e34562700b81e8aa13548eb6b23b18112e49b" +git-tree-sha1 = "930db8ef90483570107f2396b1ffc6680f08e8b7" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.0.2" +version = "1.0.4" [[OrderedCollections]] deps = ["Random", "Serialization", "Test"] @@ -112,12 +108,12 @@ version = "0.12.0" [[Parsers]] deps = ["Dates", "Test"] -git-tree-sha1 = "d112c19ccca00924d5d3a38b11ae2b4b268dda39" +git-tree-sha1 = "f8f5d2d4b4b07342e5811d2b6428e45524e241df" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "0.3.11" +version = "1.0.2" [[Pkg]] -deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"] +deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" [[Printf]] @@ -133,10 +129,9 @@ deps = ["Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[Ratios]] -deps = ["Compat"] -git-tree-sha1 = "cdbbe0f350581296f3a2e3e7a91b214121934407" +git-tree-sha1 = "37d210f612d70f3f7d57d488cb3b6eff56ad4e41" uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439" -version = "0.3.1" +version = "0.4.0" [[SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -157,9 +152,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[StaticArrays]] deps = ["LinearAlgebra", "Random", "Statistics"] -git-tree-sha1 = "5a3bcb6233adabde68ebc97be66e95dcb787424c" +git-tree-sha1 = "4118cba3529e99af61aea9a83f7bfd3cff5ffb28" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "0.12.1" +version = "0.12.2" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -170,10 +165,10 @@ deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [[URIParser]] -deps = ["Test", "Unicode"] -git-tree-sha1 = "6ddf8244220dfda2f17539fa8c9de20d6c575b69" +deps = ["Unicode"] +git-tree-sha1 = "53a9f49546b8d2dd2e688d216421d050c9a31d0d" uuid = "30578b45-9adc-5946-b283-645ec420af67" -version = "0.4.0" +version = "0.4.1" [[UUIDs]] deps = ["Random", "SHA"] @@ -189,6 +184,6 @@ version = "1.2.0" [[WoodburyMatrices]] deps = ["LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "bbb9f7fd6fbdd9582e77c0b698312c543de5eb71" +git-tree-sha1 = "28ffe06d28b1ba8fdb2f36ec7bb079fac81bac0d" uuid = "efce3f68-66dc-5838-9240-27a6d6f5f9b6" -version = "0.5.0" +version = "0.5.2" diff --git a/Project.toml b/Project.toml index 4cf1483..e971565 100644 --- a/Project.toml +++ b/Project.toml @@ -11,10 +11,10 @@ Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" [compat] +Interpolations = "^0.12" NetCDF = "^0.10" Parameters = "^0.12" julia = "1" -Interpolations = "^0.12" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From fc6e59bfc086dfb0091930926272eef9d82e3487 Mon Sep 17 00:00:00 2001 From: milankl Date: Tue, 28 Apr 2020 15:16:58 +0100 Subject: [PATCH 7/7] Requires Julia 1.2 --- .appveyor.yml | 1 - .travis.yml | 1 - README.md | 8 +++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 554a73a..9535b2d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,5 @@ environment: matrix: - - julia_version: 1 - julia_version: 1.4 - julia_version: nightly diff --git a/.travis.yml b/.travis.yml index b1abdbd..bf4c021 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ os: - linux - osx julia: - - 1.0 - 1.4 - nightly notifications: diff --git a/README.md b/README.md index 934f5c3..2246e3d 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,11 @@ ShallowWaters is fully-explicit with an energy and enstrophy conserving advectio 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. +Requires: Julia 1.2 + ### How to use -`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`). +`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`). ```julia help?> Parameter search: Parameter @@ -25,10 +27,10 @@ search: Parameter Creates a Parameter struct with following options and default values T::DataType=Float32 # number format - + Tprog::DataType=T # number format for prognostic variables Tcomm::DataType=Tprog # number format for ghost-point copies - + # DOMAIN RESOLUTION AND RATIO nx::Int=100 # number of grid cells in x-direction Lx::Real=2000e3 # length of the domain in x-direction [m]