-
Notifications
You must be signed in to change notification settings - Fork 18
Revisit flux climatology #493
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
base: main
Are you sure you want to change the base?
Conversation
I think we should add this as an example. It should not implement any custom types --- those should all go into the source code and become tested. What do you think? |
Yes. I totally agree! |
using julia> v = FieldTimeSeries(v_meta, arch; time_indices_in_memory=13)
ERROR: ArgumentError: Cannot specify north boundary condition ValueBoundaryCondition: Oceananigans.BoundaryConditions.PolarValue{OffsetArrays.OffsetArray{Float32, 3, Array{Float32, 3}}, Symbol} on a field at Face()!
Stacktrace:
[1] validate_boundary_condition_location(bc::BoundaryCondition{…}, loc::Face, side::Symbol)
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:57
[2] validate_boundary_conditions(loc::Tuple{…}, grid::LatitudeLongitudeGrid{…}, bcs::FieldBoundaryConditions{…})
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:76
[3] #apply_regionally!#58
@ ~/.julia/packages/Oceananigans/WEWMN/src/Utils/multi_region_transformation.jl:121 [inlined]
[4] apply_regionally!
@ ~/.julia/packages/Oceananigans/WEWMN/src/Utils/multi_region_transformation.jl:118 [inlined]
[5] macro expansion
@ ~/.julia/packages/Oceananigans/WEWMN/src/Utils/multi_region_transformation.jl:206 [inlined]
[6] Field(loc::Tuple{…}, grid::LatitudeLongitudeGrid{…}, data::OffsetArrays.OffsetArray{…}, bcs::FieldBoundaryConditions{…}, indices::Tuple{…}, op::Nothing, status::Nothing)
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:101
[7] Field(loc::Tuple{…}, grid::LatitudeLongitudeGrid{…}, T::DataType; indices::Tuple{…}, data::OffsetArrays.OffsetArray{…}, boundary_conditions::FieldBoundaryConditions{…}, operand::Nothing, status::Nothing)
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:194
[8] Field(loc::Tuple{…}, grid::LatitudeLongitudeGrid{…}, T::DataType)
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:185
[9] #_#12
@ ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:182 [inlined]
[10] Field
@ ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:178 [inlined]
[11] (Field{…})(grid::LatitudeLongitudeGrid{…})
@ Oceananigans.Fields ~/.julia/packages/Oceananigans/WEWMN/src/Fields/field.jl:178
[12] empty_field(metadata::Metadata{ECCO4Monthly, DateTime}; architecture::CPU, horizontal_halo::Tuple{Int64, Int64})
@ ClimaOcean.DataWrangling ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/DataWrangling/metadata.jl:257
[13] empty_field
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/DataWrangling/metadata.jl:230 [inlined]
[14] FieldTimeSeries(metadata::Metadata{ECCO4Monthly, StepRange{DateTime, Month}}, architecture::CPU; kw::@Kwargs{time_indices_in_memory::Int64})
@ ClimaOcean.DataWrangling ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/DataWrangling/restoring.jl:115
[15] top-level scope
@ REPL[11]:1
Some type information was truncated. Use `show(err)` to see complete types. I was under the impression that CliMA/Oceananigans.jl#4457 and CliMA/Oceananigans.jl#4463 dealt with this, no? |
Ignore this; I wasn't on main! |
I can run now. I hit this error: julia> include("flux_climatology.jl")
[ Info: Initializing simulation...
[ Info: Initializing simulation...
[ Info: ... simulation initialization complete (28.375 μs)
[ Info: Iter: 0, time: 0 seconds, Δt: 3 hours, max|u|: (0.00e+00, 0.00e+00) m s⁻¹, extrema(T): (0.00, 0.00) ᵒC, wall time: 3.121 seconds
[ Info: ... simulation initialization complete (592.593 ms)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (1.441 seconds).
[ Info: Iter: 10, time: 1.250 days, Δt: 3 hours, max|u|: (9.62e-01, 5.25e-01) m s⁻¹, extrema(T): (31.52, -2.00) ᵒC, wall time: 5.634 seconds
[ Info: Iter: 20, time: 2.500 days, Δt: 3 hours, max|u|: (9.43e-01, 5.26e-01) m s⁻¹, extrema(T): (31.51, -2.00) ᵒC, wall time: 4.154 seconds
[ Info: Iter: 30, time: 3.750 days, Δt: 3 hours, max|u|: (9.23e-01, 5.26e-01) m s⁻¹, extrema(T): (31.50, -2.00) ᵒC, wall time: 4.537 seconds
[ Info: Iter: 40, time: 5 days, Δt: 3 hours, max|u|: (9.03e-01, 5.29e-01) m s⁻¹, extrema(T): (31.49, -2.00) ᵒC, wall time: 5.144 seconds
[ Info: Iter: 50, time: 6.250 days, Δt: 3 hours, max|u|: (8.84e-01, 5.33e-01) m s⁻¹, extrema(T): (31.48, -1.99) ᵒC, wall time: 5.742 seconds
[ Info: Iter: 60, time: 7.500 days, Δt: 3 hours, max|u|: (8.64e-01, 5.37e-01) m s⁻¹, extrema(T): (31.48, -1.99) ᵒC, wall time: 5.001 seconds
[ Info: Iter: 70, time: 8.750 days, Δt: 3 hours, max|u|: (8.44e-01, 5.41e-01) m s⁻¹, extrema(T): (31.47, -1.99) ᵒC, wall time: 4.638 seconds
[ Info: Iter: 80, time: 10 days, Δt: 3 hours, max|u|: (8.24e-01, 5.46e-01) m s⁻¹, extrema(T): (31.48, -1.99) ᵒC, wall time: 4.456 seconds
[ Info: Iter: 90, time: 11.250 days, Δt: 3 hours, max|u|: (8.05e-01, 5.50e-01) m s⁻¹, extrema(T): (31.49, -1.99) ᵒC, wall time: 5.032 seconds
[ Info: Iter: 100, time: 12.500 days, Δt: 3 hours, max|u|: (7.85e-01, 5.54e-01) m s⁻¹, extrema(T): (31.49, -1.99) ᵒC, wall time: 6.087 seconds
[ Info: Iter: 110, time: 13.750 days, Δt: 3 hours, max|u|: (7.65e-01, 5.58e-01) m s⁻¹, extrema(T): (31.50, -1.99) ᵒC, wall time: 6.876 seconds
[ Info: Iter: 120, time: 15 days, Δt: 3 hours, max|u|: (7.45e-01, 5.63e-01) m s⁻¹, extrema(T): (31.51, -1.99) ᵒC, wall time: 5.981 seconds
[ Info: Iter: 130, time: 16.250 days, Δt: 3 hours, max|u|: (7.26e-01, 5.67e-01) m s⁻¹, extrema(T): (31.52, -1.99) ᵒC, wall time: 4.903 seconds
[ Info: Iter: 140, time: 17.500 days, Δt: 3 hours, max|u|: (7.24e-01, 5.71e-01) m s⁻¹, extrema(T): (31.52, -1.99) ᵒC, wall time: 5.490 seconds
[ Info: Iter: 150, time: 18.750 days, Δt: 3 hours, max|u|: (7.26e-01, 5.75e-01) m s⁻¹, extrema(T): (31.53, -2.00) ᵒC, wall time: 6.037 seconds
[ Info: Iter: 160, time: 20 days, Δt: 3 hours, max|u|: (7.38e-01, 5.80e-01) m s⁻¹, extrema(T): (31.54, -2.00) ᵒC, wall time: 5.320 seconds
[ Info: Iter: 170, time: 21.250 days, Δt: 3 hours, max|u|: (7.54e-01, 5.84e-01) m s⁻¹, extrema(T): (31.55, -2.01) ᵒC, wall time: 4.888 seconds
[ Info: Iter: 180, time: 22.500 days, Δt: 3 hours, max|u|: (7.70e-01, 5.88e-01) m s⁻¹, extrema(T): (31.55, -2.01) ᵒC, wall time: 5.062 seconds
[ Info: Iter: 190, time: 23.750 days, Δt: 3 hours, max|u|: (7.86e-01, 5.92e-01) m s⁻¹, extrema(T): (31.56, -2.02) ᵒC, wall time: 5.086 seconds
[ Info: Iter: 200, time: 25 days, Δt: 3 hours, max|u|: (8.02e-01, 5.97e-01) m s⁻¹, extrema(T): (31.57, -2.02) ᵒC, wall time: 6.011 seconds
ERROR: LoadError: TaskFailedException
nested task error: MethodError: no method matching
Closest candidates are:
ClimaOcean.OceanSeaIceModels.InterfaceComputations.InterfaceState(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
@ ClimaOcean ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/interface_states.jl:341
ClimaOcean.OceanSeaIceModels.InterfaceComputations.InterfaceState(::FT, ::FT, ::FT, ::FT, ::FT, ::FT, ::FT, ::FT, ::Bool) where FT
@ ClimaOcean ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/interface_states.jl:330
Stacktrace:
[1]
@ ClimaOcean.OceanSeaIceModels.InterfaceComputations ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/interface_states.jl:341
[2] iterate_interface_state
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/compute_interface_state.jl:117 [inlined]
[3] compute_interface_state
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/compute_interface_state.jl:48 [inlined]
[4] macro expansion
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/atmosphere_ocean_fluxes.jl:128 [inlined]
[5] cpu__compute_atmosphere_ocean_interface_state!
@ ~/.julia/packages/KernelAbstractions/sWSE0/src/macros.jl:304 [inlined]
[6] cpu__compute_atmosphere_ocean_interface_state!(__ctx__::KernelAbstractions.CompilerMetadata{…}, interface_fluxes::@NamedTuple{…}, interface_temperature::Field{…}, grid::ImmersedBoundaryGrid{…}, clock::Clock{…}, turbulent_flux_formulation::SimilarityTheoryFluxes{…}, interior_state::@NamedTuple{…}, atmosphere_state::@NamedTuple{…}, interface_properties::ClimaOcean.OceanSeaIceModels.InterfaceComputations.InterfaceProperties{…}, atmosphere_properties::@NamedTuple{…}, ocean_properties::@NamedTuple{…})
@ ClimaOcean.OceanSeaIceModels.InterfaceComputations ./none:0
[7] __thread_run(tid::Int64, len::Int64, rem::Int64, obj::KernelAbstractions.Kernel{…}, ndrange::Nothing, iterspace::KernelAbstractions.NDIteration.NDRange{…}, args::Tuple{…}, dynamic::KernelAbstractions.NDIteration.DynamicCheck)
@ KernelAbstractions ~/.julia/packages/KernelAbstractions/sWSE0/src/cpu.jl:144
[8] (::KernelAbstractions.var"#20#23"{…})()
@ KernelAbstractions ~/.julia/packages/KernelAbstractions/sWSE0/src/cpu.jl:119
Stacktrace:
[1] sync_end(c::Channel{Any})
@ Base ./task.jl:455
[2] macro expansion
@ ./task.jl:487 [inlined]
[3] __run(obj::KernelAbstractions.Kernel{…}, ndrange::Nothing, iterspace::KernelAbstractions.NDIteration.NDRange{…}, args::Tuple{…}, dynamic::KernelAbstractions.NDIteration.DynamicCheck, static_threads::Bool)
@ KernelAbstractions ~/.julia/packages/KernelAbstractions/sWSE0/src/cpu.jl:118
[4] (::KernelAbstractions.Kernel{…})(::@NamedTuple{…}, ::Vararg{…}; ndrange::Nothing, workgroupsize::Nothing)
@ KernelAbstractions ~/.julia/packages/KernelAbstractions/sWSE0/src/cpu.jl:45
[5] (::KernelAbstractions.Kernel{…})(::@NamedTuple{…}, ::Vararg{…})
@ KernelAbstractions ~/.julia/packages/KernelAbstractions/sWSE0/src/cpu.jl:38
[6] _launch!(::CPU, ::ImmersedBoundaryGrid{…}, ::KernelParameters{…}, ::Function, ::@NamedTuple{…}, ::Field{…}, ::Vararg{…}; exclude_periphery::Bool, reduced_dimensions::Tuple{}, active_cells_map::Nothing)
@ Oceananigans.Utils ~/.julia/packages/Oceananigans/pNFg0/src/Utils/kernel_launching.jl:329
[7] _launch!
@ ~/.julia/packages/Oceananigans/pNFg0/src/Utils/kernel_launching.jl:306 [inlined]
[8] launch!
@ ~/.julia/packages/Oceananigans/pNFg0/src/Utils/kernel_launching.jl:289 [inlined]
[9] compute_atmosphere_ocean_fluxes!(coupled_model::OceanSeaIceModel{…})
@ ClimaOcean.OceanSeaIceModels.InterfaceComputations ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/InterfaceComputations/atmosphere_ocean_fluxes.jl:44
[10] #update_state!#4
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:57 [inlined]
[11] update_state!
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:51 [inlined]
[12] time_step!(coupled_model::OceanSeaIceModel{…}, Δt::Float64; callbacks::Tuple{}, compute_tendencies::Bool)
@ ClimaOcean.OceanSeaIceModels ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/src/OceanSeaIceModels/time_step_ocean_sea_ice_model.jl:46
[13] time_step!(sim::Simulation{…})
@ Oceananigans.Simulations ~/.julia/packages/Oceananigans/pNFg0/src/Simulations/run.jl:149
[14] run!(sim::Simulation{…}; pickup::Bool)
@ Oceananigans.Simulations ~/.julia/packages/Oceananigans/pNFg0/src/Simulations/run.jl:105
[15] run!
@ ~/.julia/packages/Oceananigans/pNFg0/src/Simulations/run.jl:92 [inlined]
[16] compute_flux_climatology(earth::Simulation{…})
@ Main ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/experiments/flux_climatology/flux_climatology.jl:108
[17] top-level scope
@ ~/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/experiments/flux_climatology/flux_climatology.jl:239
[18] include(fname::String)
@ Base.MainInclude ./client.jl:494
[19] top-level scope
@ REPL[9]:1
in expression starting at /Users/navid/Library/CloudStorage/OneDrive-TheUniversityofMelbourne/Documents/Research/ClimaOcean.jl-v4/experiments/flux_climatology/flux_climatology.jl:239
Some type information was truncated. Use `show(err)` to see complete types. |
@simone-silvestri, why this choice of albedo/emmisivity?
|
this is the eliminate radiation from the fluxes and account only for the turbulent ones. Let's put some reasonable radiation though (the default one) and see the results |
For a climatology the important part is diagnosing all the fluxes separately anyways. But you do sum at the end to see how it adds up. |
A key question in my mind is how the fluxes differ between using a monthly vs daily ocean data product, eg capturing variability. One could also average the atmospheric state monthly to see how that changes the results. |
Don't we need a separate PR to implement some of the types that were present in the original climatology? Or are you combining the two efforts |
I'll do a separate PR in a bit. First I'm testing things within the script and modifying these types etc. When I'm settled with what works I'll implement in a new PR. We also realised with @simone-silvestri that DataWrangling method hardcodes Float32 for Datasets but it would be nice if we implement an, e.g., a const dataset_defaults = Oceananigans.Defaults(FloatType=Float32) so we can have a handle on the float type. We were getting type-instabilities from the iterator. |
don't re-use |
Do we really need a global default for the datasets? Or should we just make this settable in |
Here's the climatology computed with the script on this PR using the defaults as is on main atm ( Here's again when I changed the default to Very different from #340! |
looks like gustiness does not change the heat flux as much as I expected. There must be another bug somewhere... |
Btw, salinity flux and stresses look similar to #340 but heat flux is completely different, so it might be a temperature - specific problem (like for example radiation) |
The heat fluxes are everywhere negative?????? |
Can you also plot the difference between the atmosphere and ocean surface temperature? The sensible heat flux must have the same sign. |
You mean plot: |
Yes.... no wonder we are seeing warm SSTs.... |
OK, revisiting this, me and @simone-silvestri noticed that #340 was using radiation with This is very very similar to #340. Does this points to the Radiation being the culprit? Note that the Radiation formulation hasn't changed from #340 to now. |
…' into ss-nc/fix-climatoloy-experiment
…imaOcean.jl into ss-nc/fix-climatoloy-experiment
…imaOcean.jl into ss-nc/fix-climatoloy-experiment
Why would radiation change the sensible heat flux? |
simulation gets very warm still.. |
Could the problem be that we don't have penetrating radiation? |
@simone-silvestri, @taimoorsohail pointed to me that there are also daily heat fluxes from ECCO: https://podaac.jpl.nasa.gov/dataset/ECCO_L4_HEAT_FLUX_05DEG_DAILY_V4R4 (this will remove the uncertainty whether we are incorporating nonlinearities by comparing the mean of the fluxes vs the fluxes of the mean) |
It might also be worth plotting the surface integrated heat fluxes (i.e. |
This PR revisits #340 and enhances it to also compute statistics of the components of the heat fluxes.