Skip to content

lucas56098/openmpFV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openmpFV

A multithreaded second order accurate finite volume hydrodynamics solver on static 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) and an HLLC Riemann solver. Additionally there exist various plotting and analysis routines in a python visualization toolkit.

Note

The original version of this code was part of my bachelor thesis and can be found here. This version has some improvements and generally is more cleaned up.


Improvements:

  • parallelization of hydro calculations
  • CFL timestepping
  • general code cleanup + removal of advection, SWE ...
  • improved KH and RT initial conditions for direct comparison to (Springel 2010)
  • improved file naming & initial conditions into seperate file
  • run & compile options in bash file run.sh
  • option to restart code from snapshot
  • customizable box length
  • HLLC riemann solver instead of HLL
  • Profiling option (compile with ./run.sh -bt to activate)

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 multithreaded second order accurate finite volume hydrodynamics solver on static meshes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages