Skip to content
Snippets Groups Projects

1D and 2D moving mesh algorithm

Merged Bert Vandenbroucke requested to merge shadowswift_new into master

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.

SodShock

Sedov

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Added 3 commits:

    • a20694b0 - 1 commit from branch master
    • 12583d4c - Merge branch 'master' into shadowswift_new
    • d8411230 - Added a lot of comments to 3D Voronoi algorithm, fixed bug in testVoronoi3D. Dis…
  • Added 1 commit:

    • 81997283 - Added some more comments to 3D Voronoi algorithm, and ensured const correctness.
  • Let me know when you are happy for me to look at the changes again.

  • Matthieu Schaller Title changed from 1D and 2D moving mesh algorithm to [WIP] 1D and 2D moving mesh algorithm

    Title changed from 1D and 2D moving mesh algorithm to [WIP] 1D and 2D moving mesh algorithm

  • Bert Vandenbroucke Added 27 commits:

    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
  • I implemented most of your suggestions: the global variables are gone and replaced by a specific hydro_space struct that is part of space and passed on to hydro_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.

  • Thanks ! Could you add the file hydro_space.h to the repository ?

  • Added 1 commit:

  • Sure! I've clearly never used git before...

  • Added 1 commit:

    • cf5cb6ad - Added some more comments to 3D algorithm, and fixed a bug that affected some of …
  • Thanks for adding it. Any reason not to use directly space->dim[3] where you need it for Shadowfax ? Do the quantities in hydro_space evolve with time ?

  • Depending on the type of boundaries (periodic or not), I either need space->dim[3] and a lower box corner of (0., 0., 0.), or 2.*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 time hydro_init_part is called. It seemed better to do that calculation once and store the result.

  • I see. The compiler would optimize this out as it is a trivial operation but let's not agonize about this for now. I'll accept this merge request so that the infrastructure gets included.

  • Matthieu Schaller Title changed from [WIP] 1D and 2D moving mesh algorithm to 1D and 2D moving mesh algorithm

    Title changed from [WIP] 1D and 2D moving mesh algorithm to 1D and 2D moving mesh algorithm

  • Matthieu Schaller Status changed to merged

    Status changed to merged

  • 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?

  • Please register or sign in to reply
    Loading