Skip to content

Commit

Permalink
Fix critical bug in Poisson solver
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed Mar 27, 2024
1 parent b28d325 commit 28a19a6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions exponax/_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import jax.numpy as jnp
from jaxtyping import Array, Complex, Float

from ._spectral import build_derivative_operator, build_laplace_operator, spatial_shape
from ._spectral import (
build_derivative_operator,
build_laplace_operator,
space_indices,
spatial_shape,
)


class Poisson(eqx.Module):
Expand Down Expand Up @@ -85,9 +90,13 @@ def step(
**Returns:**
- `u`: The solution.
"""
f_hat = jnp.fft.rfft(f)
f_hat = jnp.fft.rfftn(f, axes=space_indices(self.num_spatial_dims))
u_hat = self.step_fourier(f_hat)
u = jnp.fft.irfft(u_hat, self.num_points)
u = jnp.fft.irfftn(
u_hat,
axes=space_indices(self.num_spatial_dims),
s=spatial_shape(self.num_spatial_dims, self.num_points),
)
return u

def __call__(
Expand Down

0 comments on commit 28a19a6

Please sign in to comment.