Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRA55 error trying to run simulations longer than 1 year #229

Open
glwagner opened this issue Nov 10, 2024 · 1 comment
Open

JRA55 error trying to run simulations longer than 1 year #229

glwagner opened this issue Nov 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@glwagner
Copy link
Member

Luckily this is fairly easy to illustrate, though one has to run it for a whole year to see the error:

using Oceananigans
using Oceananigans.Units
using Dates, CFTime
import ClimaOcean
using Printf

Nz = 40
z = ClimaOcean.exponential_z_faces(; Nz, depth=5000)
arch = GPU()
grid = LatitudeLongitudeGrid(arch; z,
                             size = (1440, 560, Nz),
                             halo = (7, 7, 7),
                             longitude = (0, 360),
                             latitude = (-70, 70))

bathymetry = ClimaOcean.regrid_bathymetry(grid) # builds gridded bathymetry based on ETOPO1
grid = ImmersedBoundaryGrid(grid, GridFittedBottom(bathymetry))

# Build an ocean simulation initialized to the ECCO state estimate on Jan 1, 1993
ocean = ClimaOcean.ocean_simulation(grid)
dates = DateTimeProlepticGregorian(1993, 1, 1)
set!(ocean.model, T = ClimaOcean.ECCOMetadata(:temperature; dates),
                  S = ClimaOcean.ECCOMetadata(:salinity; dates))

# Build and run an OceanSeaIceModel (with no sea ice component) forced by JRA55 reanalysis
atmosphere = ClimaOcean.JRA55_prescribed_atmosphere(arch)
coupled_model = ClimaOcean.OceanSeaIceModel(ocean; atmosphere)
simulation = Simulation(coupled_model, Δt=5minutes, stop_time=4 * 360days)
run!(simulation)

yields eventually

[ Info: Iter: 104310, time: 362.188 days, Δt: 5 minutes, elapsed: 61.595 ms, SDPD: 48705.2, max|u|: (2.11e+00, 2.42e+00, 2.39e-02)
[ Info: Iter: 104320, time: 362.222 days, Δt: 5 minutes, elapsed: 72.342 ms, SDPD: 41469.7, max|u|: (2.13e+00, 2.41e+00, 2.39e-02)
ERROR: LoadError: BoundsError: attempt to access 640×320×2 Array{Float32, 3} at index [1:640, 1:320, 1:22]
Stacktrace:
  [1] throw_boundserror(A::Array{Float32, 3}, I::Tuple{UnitRange{Int64}, UnitRange{Int64}, UnitRange{Int64}})
    @ Base ./abstractarray.jl:737
  [2] checkbounds
    @ ./abstractarray.jl:702 [inlined]
  [3] view
    @ ./subarray.jl:184 [inlined]
  [4] maybeshrink(temparray::Array{Float32, 3}, a::NCDatasets.Variable{Float32, 3, NCDatasets.NCDataset{Nothing, Missing}}, indices::Tuple{UnitRange{Int64}, UnitRange{Int64}, UnitRange{Int64}})
    @ DiskArrays /orcd/data/raffaele/001/glwagner/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:290
  [5] getindex_disk_batch!(out::Nothing, a::NCDatasets.Variable{Float32, 3, NCDatasets.NCDataset{Nothing, Missing}}, i::Tuple{UnitRange{Int64}, UnitRange{Int64}, Vector{Int64}})
    @ DiskArrays /orcd/data/raffaele/001/glwagner/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:231
  [6] getindex_disk!
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:258 [inlined]
  [7] getindex_disk
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:218 [inlined]
  [8] getindex
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/DiskArrays/ny95C/src/diskarray.jl:370 [inlined]
  [9] getindex(::CommonDataModel.CFVariable{Union{Missing, Float32}, 3, NCDatasets.Variable{Float32, 3, NCDatasets.NCDataset{…}}, CommonDataModel.Attributes{NCDatasets.Variable{…}}, @NamedTuple{fillvalue::Float32, missing_values::Tuple{}, scale_factor::Nothing, add_offset::Nothing, calendar::Nothing, time_origin::Nothing, time_factor::Nothing, maskingvalue::Missing}}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Vector{Int64})
    @ CommonDataModel /orcd/data/raffaele/001/glwagner/.julia/packages/CommonDataModel/G3moc/src/cfvariable.jl:445
 [10] set!(fts::FieldTimeSeries{Center, Center, Nothing, Oceananigans.OutputReaders.Cyclical{…}, ClimaOcean.DataWrangling.JRA55.JRA55NetCDFBackend, Tuple{…}, OffsetArrays.OffsetArray{…}, Oceananigans.Grids.ZRegularLLG{…}, Float32, FieldBoundaryConditions{…}, StepRangeLen{…}, String, String, Dict{…}}, path::String, name::String)
    @ ClimaOcean.DataWrangling.JRA55 /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/DataWrangling/JRA55.jl:245
 [11] set! (repeats 2 times)
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/DataWrangling/JRA55.jl:227 [inlined]
 [12] update_field_time_series!(fts::FieldTimeSeries{Center, Center, Nothing, Oceananigans.OutputReaders.Cyclical{…}, ClimaOcean.DataWrangling.JRA55.JRA55NetCDFBackend, Tuple{…}, OffsetArrays.OffsetArray{…}, Oceananigans.Grids.ZRegularLLG{…}, Float32, FieldBoundaryConditions{…}, StepRangeLen{…}, String, String, Dict{…}}, n₁::Int64, n₂::Int64)
    @ Oceananigans.OutputReaders /orcd/data/raffaele/001/glwagner/.julia/packages/Oceananigans/36mHl/src/OutputReaders/field_time_series_indexing.jl:265
 [13] update_field_time_series!(fts::FieldTimeSeries{Center, Center, Nothing, Oceananigans.OutputReaders.Cyclical{…}, ClimaOcean.DataWrangling.JRA55.JRA55NetCDFBackend, Tuple{…}, OffsetArrays.OffsetArray{…}, Oceananigans.Grids.ZRegularLLG{…}, Float32, FieldBoundaryConditions{…}, StepRangeLen{…}, String, String, Dict{…}}, time_index::Oceananigans.Units.Time{Float64})
    @ Oceananigans.OutputReaders /orcd/data/raffaele/001/glwagner/.julia/packages/Oceananigans/36mHl/src/OutputReaders/field_time_series_indexing.jl:253
 [14] update_model_field_time_series!(atmos::ClimaOcean.OceanSeaIceModels.PrescribedAtmospheres.PrescribedAtmosphere{…}, time::Oceananigans.Units.Time{…})
    @ ClimaOcean.OceanSeaIceModels.PrescribedAtmospheres /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/OceanSeaIceModels/PrescribedAtmospheres.jl:352
 [15] #update_state!#3
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:48 [inlined]
 [16] update_state!
    @ /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:46 [inlined]
 [17] time_step!(coupled_model::ClimaOcean.OceanSeaIceModels.OceanSeaIceModel{ClimaOcean.OceanSeaIceModels.MinimumTemperatureSeaIce{…}, ClimaOcean.OceanSeaIceModels.PrescribedAtmospheres.PrescribedAtmosphere{…}, Simulation{…}, ClimaOcean.OceanSeaIceModels.CrossRealmFluxes.OceanSeaIceSurfaceFluxes{…}, Clock{…}, ImmersedBoundaryGrid{…}}, Δt::Float64; callbacks::Tuple{}, compute_tendencies::Bool)
    @ ClimaOcean.OceanSeaIceModels /orcd/data/raffaele/001/glwagner/.julia/packages/ClimaOcean/qgewU/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:41
 [18] time_step!(sim::Simulation{ClimaOcean.OceanSeaIceModels.OceanSeaIceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}})
    @ Oceananigans.Simulations /orcd/data/raffaele/001/glwagner/.julia/packages/Oceananigans/36mHl/src/Simulations/run.jl:134
 [19] run!(sim::Simulation{ClimaOcean.OceanSeaIceModels.OceanSeaIceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}}; pickup::Bool)
    @ Oceananigans.Simulations /orcd/data/raffaele/001/glwagner/.julia/packages/Oceananigans/36mHl/src/Simulations/run.jl:97
 [20] run!(sim::Simulation{ClimaOcean.OceanSeaIceModels.OceanSeaIceModel{…}, Float64, Float64, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}, OrderedCollections.OrderedDict{…}})
    @ Oceananigans.Simulations /orcd/data/raffaele/001/glwagner/.julia/packages/Oceananigans/36mHl/src/Simulations/run.jl:85
 [21] top-level scope
    @ /orcd/data/raffaele/001/glwagner/OceananigansPaper/listings/simple_global_simulation.jl:62
 [22] include(fname::String)
    @ Base.MainInclude ./client.jl:489
 [23] top-level scope
    @ REPL[1]:1
in expression starting at /orcd/data/raffaele/001/glwagner/OceananigansPaper/listings/simple_global_simulation.jl:62
Some type information was truncated. Use `show(err)` to see complete types.
@navidcy navidcy added the bug Something isn't working label Nov 10, 2024
@simone-silvestri
Copy link
Collaborator

This should be fixed by #287?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants