Skip to content

Commit 240047e

Browse files
glwagnergiordano
andauthored
Possibly simplify interpolate_atmosphere_state kernel (#424)
* Possibly simplify interp kernel * Add assert --------- Co-authored-by: Mosè Giordano <[email protected]>
1 parent 2ba44c2 commit 240047e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ JLD2 = "0.4, 0.5"
4242
KernelAbstractions = "0.9"
4343
MPI = "0.20"
4444
NCDatasets = "0.12, 0.13, 0.14"
45-
Oceananigans = "0.95.27 - 0.99"
45+
Oceananigans = "0.95.28 - 0.99"
4646
OffsetArrays = "1.14"
4747
PrecompileTools = "1"
4848
Scratch = "1"

src/OceanSeaIceModels/InterfaceComputations/interpolate_atmospheric_state.jl

+8-7
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ function interpolate_atmosphere_state!(interfaces, atmosphere::PrescribedAtmosph
6363

6464
# Assumption, should be generalized
6565
ua = atmosphere.velocities.u
66+
times = ua.times
67+
time_indexing = ua.time_indexing
68+
t = clock.time
69+
@assert times isa StepRangeLen
70+
time_interpolator = TimeInterpolator(ua.time_indexing, times, clock.time)
6671

6772
launch!(arch, grid, kernel_parameters,
6873
_interpolate_primary_atmospheric_state!,
6974
atmosphere_data,
7075
space_fractional_indices,
71-
clock.time,
72-
ua.times,
73-
ua.time_indexing,
76+
time_interpolator,
7477
exchange_grid,
7578
atmosphere_velocities,
7679
atmosphere_tracers,
@@ -120,9 +123,7 @@ end
120123

121124
@kernel function _interpolate_primary_atmospheric_state!(surface_atmos_state,
122125
space_fractional_indices,
123-
time,
124-
atmos_times,
125-
time_indexing,
126+
time_interpolator,
126127
exchange_grid,
127128
atmos_velocities,
128129
atmos_tracers,
@@ -140,7 +141,7 @@ end
140141
fj = get_fractional_index(i, j, jj)
141142

142143
x_itp = FractionalIndices(fi, fj, nothing)
143-
t_itp = TimeInterpolator(time_indexing, atmos_times, time)
144+
t_itp = time_interpolator
144145
atmos_args = (x_itp, t_itp, atmos_backend, atmos_time_indexing)
145146

146147
uₐ = interp_atmos_time_series(atmos_velocities.u, atmos_args...)

0 commit comments

Comments
 (0)