Skip to content

Commit 44d5e23

Browse files
committed
Upgrade jaxdf to 0.3.0, add regression test for FD accuracy bug (#224)
1 parent bf8a0aa commit 44d5e23

4 files changed

Lines changed: 59 additions & 27 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313
### Fixed
1414

1515
- Tracer leak in OnGrid/FourierSeries laplacian_with_pml when using helmholtz_solver with checkpoint=False
16+
- FiniteDifferences with non-default accuracy no longer causes pytree mismatch in time-domain simulation (#224)
1617

1718
### Changed
1819

1920
- Migrated from Poetry to uv for dependency management and builds
2021
- Minimum Python version bumped to 3.11
2122
- Upgraded plumkdocs to >=1.0.0 and mkdocstrings to >=1.0.0
23+
- Upgraded jaxdf dependency to >=0.3.0
2224

2325
## [0.2.1] - 2024-09-17
2426

2527
### Changed
28+
2629
- Upgraded `jaxdf` dependency
2730

2831
## [0.2.0] - 2023-12-18

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ license = "LGPL-3.0-only"
1313
keywords = ["jax", "acoustics", "simulation", "ultrasound", "differentiable-programming"]
1414
requires-python = ">=3.11"
1515
dependencies = [
16-
"jaxdf>=0.2.8",
16+
"jaxdf>=0.3.0",
1717
"matplotlib>=3.0.0",
1818
]
1919
classifiers = [

tests/acoustics/test_simulate_wave_propagation.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,27 @@ def test_correct_call():
4040
assert "Starting simulation using FourierSeries code" in log_contents
4141

4242

43+
def test_fd_nondefault_accuracy():
44+
"""Regression test for jwave#224: FD fields with accuracy != 8
45+
must not cause pytree mismatch in lax.scan."""
46+
from jwave import FiniteDifferences
47+
from jwave.acoustics import TimeWavePropagationSettings
48+
from jwave.geometry import circ_mask
49+
50+
domain = Domain((64, 64), (1e-3, 1e-3))
51+
p0_arr = 5.0 * circ_mask(domain.N, 3, (32, 32))
52+
p0 = FiniteDifferences(
53+
jnp.expand_dims(p0_arr, -1), domain, accuracy=4)
54+
sound_speed = FiniteDifferences(
55+
jnp.expand_dims(jnp.ones(domain.N) * 1500.0, -1), domain, accuracy=4)
56+
medium = Medium(domain, sound_speed=sound_speed, pml_size=0)
57+
time_axis = TimeAxis.from_medium(medium, cfl=0.1)
58+
time_axis.t_end = 2e-6
59+
settings = TimeWavePropagationSettings(smooth_initial=False)
60+
61+
p = simulate_wave_propagation(medium, time_axis, p0=p0, settings=settings)
62+
assert p is not None
63+
64+
4365
if __name__ == "__main__":
4466
test_correct_call()

uv.lock

Lines changed: 33 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)