|
3 | 3 | - [ ] add native PyTorch implementation for applying `torch.linalg` and `torch.fft` function directly on `GridArray`. |
4 | 4 | - [ ] add discrete Helmholtz decomposition in both spatial and spectral domains. |
5 | 5 | - [ ] adjust the function to act on `(batch, time, *spatial)` tensor, currently only `(*spatial)` is supported. |
| 6 | +- [x] add native vorticity computation, instead of taking FDM for pseudo-spectral. |
6 | 7 |
|
7 | 8 | ## Changelog |
| 9 | + |
| 10 | +### 0.0.4 |
| 11 | +- The forcing functions are now implemented as `nn.Module` and utilize a wrapper decorator for the potential function. |
| 12 | +- Added some common time stepping schemes, additional ones that Jax-CFD did not have includes the commonly used Crank-Nicholson IMEX. |
| 13 | +- Combined the implementation for step size satisfying the CFL condition. |
| 14 | + |
| 15 | + |
| 16 | +### 0.0.1 |
8 | 17 | - `grids.GridArray` is implemented as a subclass of `torch.Tensor`, not the original jax implentation uses the inheritance from `np.lib.mixins.NDArrayOperatorsMixin`. `__array_ufunc__()` is replaced by `__torch_function__()`. |
9 | | -- The padding of `torch.nn.functional.pad()` is different from `jax.numpy.pad()`, PyTorch's pad starts from the last dimension, while Jax's pad starts from the first dimension. For example, `F.pad(x, (0, 0, 1, 0, 1, 1))` is equivalent to `jax.numpy.pad(x, ((1, 1), (1, 0), (0, 0)))` for an array of size `(*, t, h, w)`. |
| 18 | +- The padding of `torch.nn.functional.pad()` is different from `jax.numpy.pad()`, PyTorch's pad starts from the last dimension, while Jax's pad starts from the first dimension. For example, `F.pad(x, (0, 0, 1, 0, 1, 1))` is equivalent to `jax.numpy.pad(x, ((1, 1), (1, 0), (0, 0)))` for an array of size `(*, t, h, w)`. |
| 19 | +- A handy outer sum, which is usefully in getting the n-dimensional Laplacian in the frequency domain, is implemented as follows to replace `reduce(np.add.outer, eigenvalues)` |
| 20 | + ```python |
| 21 | + def outer_sum(x: Union[List[Array], Tuple[Array]]) -> Array: |
| 22 | + """ |
| 23 | + Returns the outer sum of a list of one dimensional arrays |
| 24 | + Example: |
| 25 | + x = [a, b, c] |
| 26 | + out = a[..., None, None] + b[..., None] + c |
| 27 | + """ |
| 28 | + |
| 29 | + def _sum(a, b): |
| 30 | + return a[..., None] + b |
| 31 | + |
| 32 | + return reduce(_sum, x) |
| 33 | + ``` |
0 commit comments