Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planar symmetries with staggered grids #99

Open
dgreenberg opened this issue Feb 28, 2024 · 1 comment
Open

Planar symmetries with staggered grids #99

dgreenberg opened this issue Feb 28, 2024 · 1 comment

Comments

@dgreenberg
Copy link

Hi, and first of all thanks for creating this fantastic package!

We're interested in using escnn to build ML-based solvers for fluid dynamics. In our applications, the inputs typically consist of vector fields with marker-and-cell staggering (Arakwa c-grids, see image below). This means that if pressure/height variables are at integer locations, then horizontal velocities u are offset by half a grid cell to the horizontally, and vertical velocities v by half a grid cell vertically. Examples include 2D Navier Stokes and the shallow water equations.

image

We've verified mathematically and numerically that the reference solvers we use to generate training data are equivariant to machine precision. However, it's not so clear how we can apply escnn for our staggered grid. For example, if we associate the (u, v) pair to the right and above each pressure point as a single vector in our vector field, then after counterclockwise rotation by 90 degrees the u vector becomes a new v vector and the v vector changes sign and becomes a u vector. But they would now no longer be associated with each other, but with other u and v values. This means that the group no longer operates on the fiber bundle at each point in field, but rather exchanges values between nearby finder bundles.

If I'm not mistaken, this means that escnn can't be used out of the box with this grid staggering. But perhaps I've missed something? I'd be grateful for any guidance on this point!

@maxxxzdn
Copy link

maxxxzdn commented Mar 5, 2024

It seems to be a rather non-trivial setting, and I don't think escnn has an out-of-box solution for that.

That being said, perhaps you can reformulate the task a little bit to make it compatible:

  1. define a feature field $u$ discretized on grid $x_1$, and a feature field $v$ discretized on grid $x_2$.
u_gt = field_type(u_data, x_1)
v_gt = field_type(v_data, x_2)
  1. apply two separate encoders
z_u = self.encoder_u(u_gt)
z_v = self.encoder_v(v_gt)

3a. use interpolation for exchanging information between fibers on $x_1$ and $x_2$ OR
3b. interpolate the latent fibers to a common grid $x_3$, continue the computation on it.

This formulations should be equivariant, though I am not sure how convenient it is for your task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants