Skip to content

A OMP parallel second order accurate FV code to solve the Euler equations on Cartesian and Voronoi meshes.

Notifications You must be signed in to change notification settings

lucas56098/openmpFV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openmpFV

A OMP parallel second order accurate FV code to solve the Euler equations on Cartesian and Voronoi meshes.

Includes grid generation methods from vmp and a second order slope limited MUSCL Hankock scheme to solve the Euler equations as in (Springel 2010). We employ an HLL Riemann solver. Additionally there exist various plotting and analysis routines in a python visualization toolkit.

The original version of this code was part of my bachelor thesis and can be found here. This version has various improvements and will recieve further updates in the future.


Warning

Construction Zone: Expect large changes in single commits. Things may break, change or evolve rapidly. No documentation so far...

Improvements:

  • openMP parallelization of hydro calculations
  • CFL timestepping and revised main loop
  • general code cleanup + removal of advection, SWE ...
  • improved KH and RT initial conditions for direct comparison to (Springel 2010)
  • improved file naming: c_n30_FV2_BC1_0_1s_test_step148.csv
  • initial conditions into seperate file
  • run & compile options in bash file run.sh
  • option to restart code from snapshot (voronoi only so far)
  • customizable box length for cartesian and voronoi
  • Added HLLC riemann solver instead of HLL
  • Getting started guide
  • Profiling option (simply compile with ./run.sh -bt to activate)

Todo:

  • Improve Installation guide
  • FV moving mesh?
  • high res RT

Further ideas

  • Multithreaded mesh generation?
  • Ahmdals law calculations (VERA?)
  • Profiling for performance improvements
  • direct speed comparison with AREPO
  • proper termination (when unphysical behaviour)
  • ifdef usage to specify FV/DG/moving
  • eventually DG improvements
  • MPI?

Simulation Examples

KH: cartesian FV 2nd-order, HLLC

1 1

RT: N = 48x144, cartesian FV 2nd-order, HLLC

1

2D-Riemann Problem as in (Kurganov and Tadmor, 2002)

1


Performance and Scalability

Strong scaling for a N=300x300, t = 0.01s, 3 snapshot, KH testcase. f_parallel = 99.3% allows for a theoretical max speedup of 143.

1 1

Gradient and flux calculation are by far the most time consuming. For high thread numbers the single-thread snapshot saving becomes relevant.

1


Getting started

Before starting make sure you have the following installed:

  • C++ with a working compiler that supports OpenMP
  • CMake
  • Git (alternatively one can manually download the files)
  • Python packages for vis_tk.py:
pip install pandas numpy matplotlib tqdm scipy sodshock aeropy geopandas 

Start by going into the folder where you want to clone the repository into and do:

git clone https://github.com/lucas56098/openmpFV.git

After that run the install script

cd openmpFV
chmod +x install.sh
./install.sh

This will install the Eigen header Library into src/Eigen.

You can specify your simulation options in the run.sh and build the code with

./run.sh -b

If you want to activate the time profiling compile with ./run.sh -bt instead.

To run the simulation simply do

./run.sh

If everything works correctly your output will look something like this

Starting program...
grid generated
file storage format: src/files/testfolder/v_n10_FV2_BC-1_1_0s_testname_step0.csv

snap nr. : delta_t : t_sim, Time: [ELAPSED < ETA]
---------------------------------------------------
0 : 0.000984895 : 0, Time: [00:00<35791394:07]
250 : 0.00109206 : 0.252848, Time: [00:00<00:00]
500 : 0.0010486 : 0.531439, Time: [00:00<00:00]
750 : 0.000893345 : 0.770378, Time: [00:00<00:00]
1000 : 0.000808048 : 0.98032, Time: [00:00<00:00]
1023 : 0.000813236 : 0.999675, Time: [00:00<00:00]
---------------------------------------------------
Total time: 0.197646
max RSS memory size: 11.9062 MB
done

As a next step you can visualize a snapshot using vis_tk.py. Simply make a new python file in src and run. To find your snapshots look at the file storage format above.

import vis_tk as v

# load snapshot
s, p, q = v.process_file("files/your_folder_name/your_filename.csv")

# plot density
v.plot_2D(s, p, q[:, 1], vmin = 0, vmax = 3)

For now just look through the vis_tk.py package for further plotting options and through the run.sh file for changed run options. Eventually a documentation might follow.

About

A OMP parallel second order accurate FV code to solve the Euler equations on Cartesian and Voronoi meshes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages