1D and 2D moving mesh algorithm
I have added a new hydro scheme, SHADOWFAX_SPH
, that uses a finite volume method on a moving mesh. The scheme is very similar to GIZMO_SPH
, except that during the density loop an actual Voronoi cell is constructed for every particle, which is then used to get a volume to update the primitive quantities, and faces through which fluxes are exchanged. There are also some small changes in the way gradients are computed, and in the way the velocity of the particles is set.
The Voronoi cell construction is completely different for 1D, 2D, and 3D, and currently only 1D and 2D have a stable implementation. 3D should compile, but does not produce reliable results (yet). However, I think it would be good to merge this in already, to prevent it from drifting too far apart from master
.
The current implementation is hydro only, but it should be very straightforward to add gravity, similarly to the way it is done in GIZMO_SPH
.
Below the results for the 2D Sod shock and Sedov blast test (the noise on the density is caused by the fact that the initial conditions contain mass and not density). The 2D Noh test crashes because of time stepping issues; I think we really need a time step limiter to make it work properly.
Merge request reports
Activity
Added 1 commit:
- e07b2c04 - Added actual grid test to testVoronoi3D; degenerate case crashes. Started docume…
Added 4 commits:
-
e07b2c04...4efc01bc - 3 commits from branch
master
- 983126f2 - Merge branch 'master' into shadowswift_new
-
e07b2c04...4efc01bc - 3 commits from branch
Added 1 commit:
- 81997283 - Added some more comments to 3D Voronoi algorithm, and ensured const correctness.
Added 27 commits:
-
81997283...4500d31f - 25 commits from branch
master
- a66c7479 - Replaced global variables by a new hydro_space struct that is part of space. Thi…
- 7e4f1880 - Merge branch 'master' into shadowswift_new
-
81997283...4500d31f - 25 commits from branch
I implemented most of your suggestions: the global variables are gone and replaced by a specific
hydro_space
struct that is part ofspace
and passed on tohydro_init_part
. Let me know if you are happy with this approach.The 3D algorithm now sort of works, but is very slow and very memory expensive (I'm actually unable to run the 3D Sod shock test on my 32 GB machine because I run out of memory). So I'm going to spend some more time trying to improve that. I also still don't fully understand the 3D algorithm, and there are some cases where it still crashes.
Anyway, if you approve my global variable changes, I think this can be merged. My further work on this should only affect the
SHADOWFAX_SPH
specific files.Added 1 commit:
- 36701c0e - Forgot to add new files.
Added 1 commit:
- cf5cb6ad - Added some more comments to 3D algorithm, and fixed a bug that affected some of …
Depending on the type of boundaries (periodic or not), I either need
space->dim[3]
and a lower box corner of(0., 0., 0.)
, or2.*space->dim[3]
and-0.5*space->dim[3]
as lower box corner. Which means in the latter case (the periodic case), I would need to recompute the lower box corner and box side length for each particle, every timehydro_init_part
is called. It seemed better to do that calculation once and store the result.mentioned in commit e9295f04
I removed your Voronoi tests from the test suite as they don't work.
I get the following errors:
/bin/sh: line 5: 37983 Aborted (core dumped) ${dir}$tst FAIL: testVoronoi2D
and
libtool: link: mpicc -std=gnu99 -I../src -I/cosma/local/gcc/4.8.1/include -I/cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/include -DTIMER -Wall -Wextra -Wno-unused-parameter -Werror -Wl,-rpath=/cosma/local/metis/c4/intel_2016/5.1.0//lib -Wl,-rpath=/cosma/local/hdf5//c5/gnu_4.8.1/1.8.9/lib -Wl,-rpath=/cosma/local/intel/Parallel_Studio_XE_2016-update3/impi/5.1.3.210/lib64/ -Wl,-rpath=/cosma/local/gcc/4.8.1/lib64/ -o testLogger testLogger.o ../src/.libs/libswiftsim.a -L/usr/lib64 -L/cosma/local/gcc/4.8.1/lib64/ -L/cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/lib /cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/lib/libhdf5_hl.so /cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/lib/libhdf5.so -lz -lrt -L/cosma/local/metis/c4/intel_2016/5.1.0//lib -L/cosma/local/hdf5//c5/gnu_4.8.1/1.8.9/lib -L/cosma/local/intel/Parallel_Studio_XE_2016-update3/impi/5.1.3.210/lib64/ -lnuma -lm -Wl,-rpath -Wl,/cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/lib -Wl,-rpath -Wl,/cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/lib mpicc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I/cosma/local/metis/c4/intel_2016/5.1.0//include -I/cosma/local/hdf5//c5/gnu_4.8.1/1.8.9/include -I/cosma/local/intel/Parallel_Studio_XE_2016-update3/impi/5.1.3.210/include64/ -I/cosma/local/gcc/4.8.1/include -I../src -I/cosma/local/gcc/4.8.1/include -I/cosma/local/hdf5/c5/gnu_4.8.1/1.8.9/include -DTIMER -Wall -Wextra -Wno-unused-parameter -Werror -MT testVoronoi1D.o -MD -MP -MF .deps/testVoronoi1D.Tpo -c -o testVoronoi1D.o testVoronoi1D.c testVoronoi1D.c:20:51: fatal error: hydro/Shadowswift/voronoi1d_algorithm.h: No such file or directory #include "hydro/Shadowswift/voronoi1d_algorithm.h" ^
Hmmm, the 2D Voronoi test also crashes on my machine, if I enable compiler optimizations. It works fine without optimization though... Any suggestions as to what might cause that problem? Can optimizations affect numerical round off?
The 1D test compiles fine on my machine. And I don't understand the error message, as the file it complains about is present in the repository, so it should be able to find it.
Could you open a new issue for this bug?