-
Notifications
You must be signed in to change notification settings - Fork 28
Flatiron CFD‐summer school‐Moving‐mesh MANGA Quickstart
A simple 2-d python moving-mesh code to teach you the basics. The template is the code with the exercises that you have to implement. It already contains all the nuts and bolt of the voronoi tessellation done. The solution contains the same code, but now solved so that you can compare your work against mine.
Simple 2-D Python Moving-mesh Code - template
Simple 2-D Python Moving-mesh Code - solution
##Make a directories for ChaNGa/MANGA codes This step is optionally, but I do like puts all my codes in one directory off my home directory.
$ mkdir Codes $ cd Codes
ChaNGa is built on the Charm++ parallel library and runtime system. Version 7.0.0 is assumed for this workshop. It can be downloaded directly from the Charm group's source archive using the Git version control system.
Check out the latest development version of Charm++ from the repository:
$ git clone https://github.com/UIUC-PPL/charm
This will create a directory named charm. Move to this directory:
$ cd charm
To obtain the current stable release, 7.0.0, checkout the v7.0.0 tag:
$ git checkout v7.0.0
We need to use a rational compiler for this. Sometimes you can use the default compiler, but on most hpc systems, you must run something like.
$ module load gcc
And now build Charm with the multicore-linux machine layer:
$ ./build ChaNGa multicore-linux-x86_64 "-j8"
Note: the ''ChaNGa'' argument in the above build script is an instruction to build all the charm++ libraries on which ChaNGa depends. Please note that most machines will benefit from adding ''--with-production'' before "-j8", but it doesn't always work (cough, flatiron rusty, cough). C++ is compute intensive to compile; appending a ''-jN'' where N is the number of cores on your system can significantly speed up the build process by compiling in parallel. Usually most machines benefit from using the ''--with-production'' flag, but for some reason this does not work on rusty.
Now be sure to specific where the charm directory is
$ export CHARM_DIR=$HOME/Codes/charm
ChaNGa itself can also be downloaded from the N-Body Shop source archive using ''git''. ChaNGa depends on a utility module which also needs to be downloaded. This is the public branch, but you should contact the main developer to get access to the latest updates.
git clone https://github.com/N-BodyShop/changa.git git clone https://github.com/N-BodyShop/utility.git
This will create a directories named changa and utility. Move to the changa directory:
$ cd changa
Now configure ChaNGa for the science you are simulating. Up to now you have done everything to run ChaNGa, but to use the moving mesh version you can use the MANGA Users Guide. Or continue with the quickstart below.
In the changa directory, checkout the proper branch
git checkout moving-mesh
Enable moving mesh with the configure command:
./configure --enable-moving-mesh --enable-cooling=ad
Note that cooling modules are needed to be specified. In the above example ad
specifies adiabatic cooling.
ad
is the usual preference and works with other modules including radiation (--enable-radiation
) and GR (--enable-gr
). Please note that GR is not yet publicly available.
Now make it
make -jN
where N is the number of jobs will now build a moving mesh version of ChaNGa. The first build will usually fail as there is a dependency that is not yet fixed in the Makefile. Just do another make and you will be fine.
To generate the initial conditions for common envelope requires an installation of MESA, which is a pain. Fortunately, we have two test cases in ''moving-mesh-ICs/test-cases'' in ''cee-test'' and ''tde-test''.
Create a work directory somewhere
$ cd (scratch-directory)/(test-case)
copy everything in ''cee-test'' or ''tde-test'' to this directory. Create a link to or copy ChaNGa there.
$ ln -s (changa-directory)/ChaNGa .
Now you are ready to run.
./ChaNGa +ppn (num_of_tasks) tde.param or cee.param
For those who are running cee.param, you need to edit cee.param to disable bDoublePos and bDoubleVel if you want to use yt below
#bDoublePos = 1 #bDoubleVel = 1
YT has been the analysis framework that is useful for analyzing and visualizing simulation outputs. See the yt webpage for information on how to install it. For the case of flatiron rusty, loading python using
module load python
loads yt as well. Both ''cee-test'' and ''tde-test'' has a file called ''plot.py'' to plot things. Just run it using
python plot.py
Look in the MANGA users guide for more details.