Skip to content

newton-raphson/MUNA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpuTreeFluxReconstruction

Overview

GPU-focused linear quadtree/octree utilities for mesh-based AMR workflows using Morton codes. Core operations include tree completion (add ancestors), linearization/coarsening, 2:1 balancing, neighbor lookup, domain masking, and mesh-to-VTU conversion. Dimension is selected at configure time via -DMORTON_DIM=2 or 3.

Key Components

  • Morton helpers: morton2D.cuh, mortonND.cuh.
  • Host tree ops: treeND.hpp, tree2D.hpp, tree3D.hpp (generate leaves, complete, coarsen siblings, 2:1 balance, VTU dump).
  • GPU tree ops:
    • gpuTreeCompleteND.cuh, gpuTreeComplete2D.cuh: GPU tree completion (block-local buffering).
    • gpuTreeLinearize2D/ND.cuh: Coarsen full sibling sets (leaf-only).
    • gpuTreeBalanceND.cuh: GPU 2:1 balance (face neighbor refinement).
    • gpuTreeNeighbors2D/ND.cuh: Same-level neighbor lookup.
    • gpuDomainMask2D.cuh, gpuDomainMask3D.cuh: Domain filtering/masking (analytic predicates, polygons/meshes with ray tests).
  • AMR scaffolding (experimental): fvAMR.hpp (AMR state container) and fvAdvection2D.cuh (scalar advection kernel on 2:1 trees; disabled for nvcc 10.1).

Tests / Examples

  • CPU: test_tree2D, test_tree3D, test_treeSteps2D_cpu (random leaves → complete → balance, writes CSVs to steps_out_cpu/).
  • GPU (buildable on newer nvcc; some disabled for nvcc 10.1):
    • test_gpuTreeComplete2D, test_gpuTreeLinearize2D, test_gpuTreeNeighbors2D.
    • test_gpuAdaptiveCircle2D: Moving refinement region; writes VTUs to adaptive_path/ + .pvd.
    • Disabled in build2 for nvcc 10.1 compatibility: test_gpuTreeBalance2D, test_gpuDomainMask2D, test_gpuTreeSteps2D, test_gpuTreePipeline2D, advection2D.

Scripts

  • scripts/pngs_to_gif.py: Convert amr.*.png sequences to GIF. Usage: python3 scripts/pngs_to_gif.py <folder> <output.gif>; deps: imageio.
  • scripts/plot_tree_steps_cpu.py: Render quadtree CSVs (steps_out_cpu/step*.csv) to PNGs in steps_out_cpu/plots/; deps: matplotlib, pandas.
  • scripts/plot_pipeline_steps.py: Plot pipeline VTUs if generated; deps: meshio, matplotlib.

Build & Run

cd build
cmake -DMORTON_DIM=2 ..   # or 3
cmake --build . -- -j4

Examples:

  • CPU steps: ./test_treeSteps2D_cpu → CSVs in steps_out_cpu/.
  • Adaptive circle (GPU): ./test_gpuAdaptiveCircle2D [steps] → VTUs in adaptive_path/ + .pvd.

Notes / Limitations

  • nvcc 10.1 is strict; some CUDA tests are disabled in build2 to keep builds clean. Use a newer CUDA toolkit (e.g., 12.x) to build all GPU tests (balance, domain mask, advection).
  • AMR advection demo is disabled under nvcc 10.1 for the same reason.

Visualization

  • CSVs: Use scripts/plot_tree_steps_cpu.py to render quadtree tiles; PNGs saved to steps_out_cpu/plots/.
  • PNG sequences: scripts/pngs_to_gif.py to build GIFs (e.g., build2/Animation/amr.*.pngamr.gif).
  • VTUs: Load in ParaView; use .pvd collections for time series (e.g., adaptive_circle.pvd).

Visualization Helpers

  • scripts/pngs_to_gif.py: Convert a sequence of PNGs (amr.*.png) into an animated GIF.

    • Usage: python3 scripts/pngs_to_gif.py <folder> <output.gif>
    • Dependencies: pip install imageio
    • Example: python3 scripts/pngs_to_gif.py build2/Animation amr.gif
  • scripts/plot_tree_steps_cpu.py: Plot quadtree CSV outputs (ix, iy, level) from the CPU pipeline.

    • Inputs: steps_out_cpu/step*.csv generated by test_treeSteps2D_cpu
    • Outputs: PNGs in steps_out_cpu/plots/
    • Dependencies: pip install matplotlib pandas

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors