Skip to content

JA4S/JAX-AMR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

154 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAX-AMR: A JAX-based adaptive mesh refinement framework

JAX-AMR is an adaptive mesh refinement framework based on dynamically updated multi-layer blocks with fixed positions and fixed shapes. This framework is fully compatible with JIT and vectorized operations.

Authors:

Correspondence via mail (Haocheng Wen).

Implementation Strategy

The multi-layer blocks and the partitioning and refinement strategies in JAX-AMR are illustrated as follows.

Schematic diagram of multi-layer blocks in JAX-AMR

For the detailed implementation strategies of JAX-AMR, please refer to our paper.

Note: The last block of each layer in JAX-AMR is marked as a NAN block, with all values in its data and info set to NAN. This is to mark the values of ghost grids without neighbor block as invalid values NAN. Therefore, it is important to note that if the solver involves computing global extrema, averages, or similar operations, the influence of NAN values needs to be removed. For instance, the function jnp.nanmax should be used instead of jnp.max.

Quick Installation

JAX-AMR modules can be easily installed using pip install git:

pip install git+https://github.com/JA4S/JAX-AMR.git

Example

An example for the conjunction of a simple CFD solver with JAX-AMR are provided here.

Open jax_amr_basic_example.ipynb in Google Colab to run the example.

The density result and refinement level for the example are shown as follows.

result

refinement level

An example for the conjunction of a simple CFD solver with EB (Embedded Boundary) are provided here.

Open jax_eb_basic_example.ipynb in Google Colab to run the example.

The density result for the example is shown as follows.

result

State of the Project

  • 2D AMR, fully jit-compiled ✅
  • conjuction with the CFD solver ✅
  • Embedded boudary method (not yet combined with AMR)✅
  • 3D AMR (soon)
  • parallel mannagment (soon)

Citation

JANC: A cost-effective, differentiable compressible reacting flow solver featured with JAX-based adaptive mesh refinement

@article{Wen2025,
   author = {Haocheng Wen and Faxuan Luo and Sheng Xu and Bing Wang},
   doi = {10.48550/arXiv.2504.13750},
   journal = {arXiv preprint},
   title = {JANC: A cost-effective, differentiable compressible reacting flow solver featured with JAX-based adaptive mesh refinement},
   year = {2025}
}

License

This project is licensed under the MIT License - see the LICENSE file or for details https://en.wikipedia.org/wiki/MIT_License.

About

A JAX-based adaptive mesh refinement framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages