Saving diagnostics to NetCDFOutputWriter via KernelFunctionOperation #4768
Unanswered
rosecormier
asked this question in
Helpdesk
Replies: 1 comment 4 replies
-
There are a few things to fix here:
#Store basic-state velocities
const Ux_Field = XFaceField(model.grid; data = model.velocities.u.data)
const Uy_Field = YFaceField(model.grid; data = model.velocities.v.data)
const Uz_Field = ZFaceField(model.grid; data = model.velocities.w.data)
const Ux = adapt(CuArray, Ux_Field)
const Uy = adapt(CuArray, Uy_Field)
const Uz = adapt(CuArray, Uz_Field) you should pass the fields into the kernel, like this: @kernel function pKE_ccc!(pKE, grid, u, v, w, Ux, Uy, Uz)
i, j, k = @index(Global, NTuple)
@inbounds pKE[i, j, k] = (
ℑxᶜᵃᵃ(i, j, k, grid, ψ′², u, Ux) +
ℑyᵃᶜᵃ(i, j, k, grid, ψ′², v, Uy) +
ℑzᵃᵃᶜ(i, j, k, grid, ψ′², w, Uz)
) / 2
end
pKE_op = KernelFunctionOperation{Center, Center, Center}(pKE_ccc!, grid, model.velocities...., Ux, Uy, Uz) Note that |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I (with @francispoulin) am running simulations whose initial conditions consist of a basic-state velocity plus a small perturbation velocity. I'm interested in tracking the kinetic energy associated with the perturbation velocity (i.e., difference between total velocity and basic-state velocity). To do this on a GPU, I am trying to build a
KernelFunctionOperation
analogous to those used in Oceanostics, but I'm having difficulty setting it up and not sure exactly how to pass it to the output writer.When I run the following script, I get a long error:
I'm not familiar with this error, and not sure whether I've set up my
KernelFunctionOperation
incorrectly? I've read that I can passKernelFunctionOperation
s to output writers, but I'm also not sure whether I'm passing it to the writer correctly. Any direction would be appreciated!Beta Was this translation helpful? Give feedback.
All reactions