Help with outputs of horizontal derivatives of vertically integrated fields #3587
Replies: 5 comments 17 replies
-
Nice example! It looks kinda like a bug. I think @simone-silvestri might be able to help |
Beta Was this translation helpful? Give feedback.
-
There isn't right now --- you have to manually compute |
Beta Was this translation helpful? Give feedback.
-
Interesting, it looks like the |
Beta Was this translation helpful? Give feedback.
-
Oh, I see why this happens. The derivative internally calls |
Beta Was this translation helpful? Give feedback.
-
@scott-conn as a stop gap, I think you can try putting this somewhere in your script: import Oceananigans.Operators: ∂xᶜᶜᶜ
using Oceananigans.ImmersedBoundaries: XYIRF, ImmersedBoundaryGrid
@inline ∂xᶜᶜᶜ(i, j, k, ibg::ImmersedBoundaryGrid, U::XYIRF) = ∂xᶜᶜᶜ(i, j, k, ibg.underlying_grid, U) This will also compute the derivative within the inactive regions. So you'll have to ignore those in output. That said we don't have a great system for masking inactive regions yet anyways, heh. Curious if this works for you. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I'm trying to output horizontal derivatives of vertically integrated fields. For example, something of the form:
$$\frac{\partial}{\partial x}\int_{-L_z}^0 u dz.$$
However, I'm having trouble when I add bathymetry to the simulation. The output is zero wherever the depth of the bathymetry is different to that of the underlying grid. I don't have this problem if I just output the vertically integrated field itself.
Here's an example where I tried adding a gaussian ridge to the baroclinic adjustment example from the docs.
A snapshot of the output looks like:
![dx_U](https://private-user-images.githubusercontent.com/71698037/328266940-d8de9353-32ab-4669-89fd-f3aa50c16d7e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NjEzNTUsIm5iZiI6MTcyMjU2MTA1NSwicGF0aCI6Ii83MTY5ODAzNy8zMjgyNjY5NDAtZDhkZTkzNTMtMzJhYi00NjY5LTg5ZmQtZjNhYTUwYzE2ZDdlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDAxMTA1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ5Yzk5YTlkYzFlYzA5MGUxZDgyYTI0MTkxOTczMmRiOWQ4ZmVjNzk3ZTk0ZjlmMjYyODI3NmZmMjEyZmVkOGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.qxBJ8oO_m7_0d6CqaK1k6YgJei3OI_K4-9KUVMskK9g)
You can see that the output is masked to zero in the centre region where the ridge is located. Any suggestions?
On a related note, I'd also like to output terms like
$$\frac{\partial}{\partial y}\left[f\int_{-L_z}^0 u dz\right].$$ $f$ in the outputs. Is there a way to do this?
I couldn't figure out how to reconstruct
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions