CliMA / ClimateMachine.jl

Climate Machine: an Earth System Model that automatically learns from data
https://clima.github.io/ClimateMachine.jl/latest/
Other
453 stars 78 forks source link

Bug in VTK interpolation? #2045

Open kpamnany opened 3 years ago

kpamnany commented 3 years ago

Description

Discovered by @LenkaNovak running julia --project tutorials/Atmos/agnesi_hs_lin.jl --vtk 0.5shours --vtk-number-sample-points 1 --sim-time 15000:

...
┌ Info: Starting Agnesi_HS_LINEAR
│     dt              = 6.15284e-01
│     timeend         = 15000.00
│     number of steps = 24379
└     norm(Q)         = 1.0862508060259192e+11
ERROR: LoadError: ArgumentError: range(-1.0, stop=1.0, length=1): endpoints differ
Stacktrace:
 [1] _linspace1(::Type{Float64}, ::Float64, ::Float64, ::Int64) at ./twiceprecision.jl:681
 [2] _range(::Float64, ::Nothing, ::Float64, ::Int64) at ./twiceprecision.jl:598
 [3] _range at ./range.jl:420 [inlined]
 [4] #range#43 at ./range.jl:91 [inlined]
 [5] writevtk_helper(::String, ::Array{Float64,3}, ::Array{Float64,3}, ::DiscontinuousSpectralElementGrid{Float64,3,(4, 4, 4),125,CUDA.CuArray,Tuple{CUDA.CuArray{Float64,1},CUDA.CuArray{Float64,1},CUDA.CuArray{Float64,1}},Tuple{CUDA.CuArray{Float64,2},CUDA.CuArray{Float64,2},CUDA.CuArray{Float64,2}},CUDA.CuArray{Float64,3},CUDA.CuArray{Float64,4},CUDA.CuArray{Int64,1},CUDA.CuArray{Int64,2},CUDA.CuArray{Int64,3},StackedBrickTopology{3,Float64,2},Tuple{Array{Float64,2},Array{Float64,2},Array{Float64,2}},ClimateMachine.Mesh.Grids.MinNodalDistance{Float64}}, ::Array{String,1}, ::Array{Float64,3}, ::Array{String,1}; number_sample_points::Int64) at /central/home/kpamnany/ClimateMachine.jl/src/InputOutput/VTK/writevtk.jl:161
...

The range call in this line throws this error, and it appears that --vtk-number-sample-points 1 for any experiment will fail similarly. Is 2 the minimum number of sampling points intended @jkozdon?

jkozdon commented 3 years ago

My bad, there is a check but I didn't protect against 1 🤦

see #2046