Reducing a Field
on a ImmersedBoundaryGrid
with additional masking
#3193
Unanswered
tomchor
asked this question in
Computational science!
Replies: 1 comment 3 replies
-
For a conditional average you have to use the For the moment we cannot condition on another field unfortunately, we can probably rework @inline large_stratification(i, j, k, grid, b) = abs(b[i, j, k]) > 1e-5
@compute condition = Field(KernelFunctionOperation{Center, Center, Face}(large_stratification, grid, bz))
Kb = Average(Field(-w*b/bz); condition) This will average all cells with @inline small_stratification(i, j, k, grid, b) = abs(b[i, j, k]) > 1e-5
@compute condition = Field(KernelFunctionOperation{Center, Center, Face}(small_stratification, grid, bz))
Kb = Average(Field(-w*b/bz); condition) |
Beta Was this translation helpful? Give feedback.
3 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.
-
I'm trying to calculate an average of a field on an
ImmersedBoundaryGrid
. The part that's a bit complicated is that I'm trying to average only the parts where another field satisfy a given condition. (So that's another mask on top of the immersed boundary mask.)Here's a small example of what I'm trying to do:
But this throws me:
Which is kinda expected I guess since that operation with a field isn't defined. But I can't broadcast the operations either since I'm on the GPU and this would use scalar indices:
And the examples above also don't take into account the immersed boundary masking, which I'm assuming I should also take into account manually, but not sure how.
What would be the best approach here?
Beta Was this translation helpful? Give feedback.
All reactions