KernelFunctionOperation question #4888
Unanswered
SamDeAbreu
asked this question in
Computational science!
Replies: 1 comment 9 replies
-
|
Without inspecting very closely to find a typo, the methodology is correct. However, it is "more correct" to delay averaging as long as possible. For example, your expression has a pattern: Q1_ffc = (u_y - v_x)^2 - (u_y + v_x)^2
Q2_fcf = (u_z - w_x)^2 - (u_z + w_x)^2
Q3_cff = (v_z - w_y)^2 - (v_z + w_y)^2
Q4_ccc = (u_x^2 + v_y^2 + w_z^2)You could compute all of these in separate AbstractOperation, and then finally assemble into Q1_ffc(i, j, k, grid, u, v) = (∂yᵃᶠᵃ(i, j, k, grid, u) - ∂xᶠᵃᵃ(i, j, k, grid, v))^2 - (∂yᵃᶠᵃ(i, j, k, grid, u) + ∂xᶠᵃᵃ(i, j, k, grid, v))^2
Q_ccc(i, j, k, grid, u, v, w) = ℑxyᶜᶜᵃ(i, j, k, grid, Q1_ffc, u, v) + # etcin other words, form the components at the locations they "naturally" occur at and then average at the end. You also shouldn't get a segmentation fault. Is |
Beta Was this translation helpful? Give feedback.
9 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.
-
Hi everyone,
I'm trying to compute a quantity that involves a lot of derivatives of the velocity fields on GPU over a large grid. The quantity is:
Q = 0.5*((u_y - v_x)**2 + (u_z - w_x)**2 + (v_z - w_y)**2 - (u_x**2 + v_y**2 + w_z**2) - (u_y + v_x)**2 - (u_z + w_x)**2 - (v_z+w_y)**2)evaluated at the surface. I originally computed each derivative separately, used
@at (Center, Center, Center)at each one, and then computed Q. This resulted in a segmentation fault, which I believe was a result of running out of memory from storing all of the derivative fields.I decided then that maybe it is time to learn about kernel operations to avoid storing all the fields. This is how I went about it:
Is this correct?
Beta Was this translation helpful? Give feedback.
All reactions