2019-10-06 01:15:30 +00:00
|
|
|
|
|
2014-12-23 15:34:56 -02:00
|
|
|
|
# **The AMUN Code**
|
2024-03-07 09:34:43 -03:00
|
|
|
|
## Copyright (C) 2008-2024 Grzegorz Kowal
|
2014-12-22 13:32:19 -02:00
|
|
|
|
|
2023-07-13 22:32:09 -03:00
|
|
|
|
[](https://drone.amuncode.org/gkowal/amun-code)
|
2021-11-10 16:56:52 -03:00
|
|
|
|
|
2014-12-22 13:32:19 -02:00
|
|
|
|
AMUN is a parallel code to perform numerical simulations in fluid approximation
|
|
|
|
|
on uniform or non-uniform (adaptive) meshes. The goal in developing this code is
|
|
|
|
|
to create a solid framework for simulations with support for number of numerical
|
2019-10-06 01:15:30 +00:00
|
|
|
|
methods which can be selected in an easy way through a parameter file. The
|
2014-12-22 13:32:19 -02:00
|
|
|
|
following features are already implemented:
|
|
|
|
|
|
|
|
|
|
* hydrodynamic and magnetohydrodynamic set of equations (HD and MHD),
|
2015-06-24 17:01:01 -03:00
|
|
|
|
* both classical and special relativity cases for the above equations,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* Cartesian coordinate system so far,
|
2014-12-22 13:32:19 -02:00
|
|
|
|
* uniform and adaptive mesh generation and update,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* a number of time integration methods, from 2nd to 5th order Runge-Kutta
|
|
|
|
|
methods: Strong Stability Preserving and Embedded (with the error control),
|
|
|
|
|
* high order reconstructions: from 2nd to 9th order WENO and MP, both explicit
|
|
|
|
|
and compact methods, the 2nd order TVD interpolation has a number of limiters
|
|
|
|
|
supported,
|
2022-11-25 18:26:26 -03:00
|
|
|
|
* Riemann solvers of KEPES-, Roe- and HLL-types (HLL, HLLC, and HLLD),
|
2019-10-06 01:15:30 +00:00
|
|
|
|
* standard boundary conditions: periodic, open, reflective, hydrostatic, etc.
|
2020-05-01 15:24:01 -03:00
|
|
|
|
* turbulence driving using Alvelius or Ornstein–Uhlenbeck methods,
|
2015-01-06 17:01:34 -02:00
|
|
|
|
* viscous and resistive source terms,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* support for passive scalars,
|
|
|
|
|
* data stored in an internal XML+binary or the HDF5 format,
|
|
|
|
|
* data integrity of the XML+binary format guaranteed by the XXH64 or XXH3 hashes;
|
|
|
|
|
* support for Zstandard, LZ4, and LZMA compressions in the XML+binary format,
|
2021-12-01 21:52:41 -03:00
|
|
|
|
* support for Deflate, SZIP, Zstandard, and ZFP compressions in the HDF5 format,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* easy and consistend Python interface to read snapshots in both formats,
|
2021-12-09 22:11:49 -03:00
|
|
|
|
* MPI/OpenMP parallelization,
|
2020-08-13 16:35:39 -03:00
|
|
|
|
* completely written in Fortran 2008,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* simple Makefile or CMake for building the code executable,
|
2020-05-01 15:24:01 -03:00
|
|
|
|
* minimum requirements, only Fortran compiler and Python are required to
|
|
|
|
|
prepare, run, and analyze your simulations.
|
2014-12-22 13:32:19 -02:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
|
version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Developers
|
|
|
|
|
==========
|
|
|
|
|
|
|
|
|
|
- Grzegorz Kowal <grzegorz@amuncode.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
|
============
|
|
|
|
|
|
2019-10-06 01:15:30 +00:00
|
|
|
|
* Fortran 2003 compiler, tested compilers include:
|
|
|
|
|
- [GNU Fortran](https://gcc.gnu.org/fortran/) version 4.5 or newer,
|
|
|
|
|
- [PGI Community Edition](https://www.pgroup.com/products/community.htm),
|
|
|
|
|
version 18.10 or newer,
|
|
|
|
|
- [Intel Fortran](https://software.intel.com/en-us/fortran-compilers)
|
|
|
|
|
compiler version 9.0 or newer.
|
2021-12-17 15:47:09 -03:00
|
|
|
|
- [NVIDIA HPC](https://developer.nvidia.com/hpc-sdk) compiler version 21.11
|
|
|
|
|
or newer.
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* Recommended, although optional, [OpenMPI](https://www.open-mpi.org/) for
|
|
|
|
|
parallel runs, tested with version 1.8 or newer.
|
|
|
|
|
* Optional [CMake](https://cmake.org) version 3.16 or newer, for advanced
|
|
|
|
|
compilation option selection.
|
|
|
|
|
* Optionally, the XML-binary format compression requires:
|
2021-02-05 10:17:07 -03:00
|
|
|
|
[LZ4 library](https://lz4.github.io),
|
|
|
|
|
[Zstandard library](http://facebook.github.io/zstd/), or
|
|
|
|
|
[LZMA library](https://tukaani.org/xz/)
|
2021-12-01 21:36:29 -03:00
|
|
|
|
[XXHASH library](http://www.xxhash.com/).
|
2020-05-01 15:24:01 -03:00
|
|
|
|
* Optional [HDF5 libraries](https://www.hdfgroup.org/solutions/hdf5/), tested
|
|
|
|
|
with version 1.10 or newer. The code now uses the new XML-binary snapshot
|
2020-05-01 15:34:33 -03:00
|
|
|
|
format. However, if you still want to use older HDF5 snapshot format, you
|
2020-05-01 15:24:01 -03:00
|
|
|
|
will need these libraries.
|
2021-12-01 21:36:29 -03:00
|
|
|
|
* Deflate compression is natively supported in HDF5 libraries, however,
|
|
|
|
|
optionally these compression formats are supported through filters:
|
2021-12-01 21:52:41 -03:00
|
|
|
|
[SZIP](https://support.hdfgroup.org/doc_resource/SZIP/)
|
2021-12-01 21:36:29 -03:00
|
|
|
|
[HDF5Plugin-Zstandard](https://github.com/gkowal/HDF5Plugin-Zstandard),
|
|
|
|
|
[H5Z-ZFP](https://github.com/LLNL/H5Z-ZFP).
|
2014-12-22 13:32:19 -02:00
|
|
|
|
|
|
|
|
|
|
2020-08-13 16:35:39 -03:00
|
|
|
|
Recommended compilation (using CMake)
|
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
|
|
1. Clone the AMUN source code:
|
|
|
|
|
- from GitLab:
|
|
|
|
|
`git clone https://gitlab.com/gkowal/amun-code.git`
|
2021-12-01 21:36:29 -03:00
|
|
|
|
- from Bitbucket:
|
|
|
|
|
`git clone https://grzegorz_kowal@bitbucket.org/amunteam/amun-code.git`,
|
2020-08-13 16:35:39 -03:00
|
|
|
|
- or unpack the archive downloaded from page
|
|
|
|
|
[Downloads](https://bitbucket.org/amunteam/amun-code/downloads/).
|
2021-12-01 21:36:29 -03:00
|
|
|
|
2. Create the build directory, e.g. `mkdir amun-build && cd amun-build`.
|
2020-08-13 16:35:39 -03:00
|
|
|
|
3. Call `ccmake <path to amun-code>`, e.g. `ccmake ..`, and press 'c' once.
|
2021-12-01 21:36:29 -03:00
|
|
|
|
Set available options, if necessary. Press 'c' once again, and 'g' to
|
|
|
|
|
generate makefiles.
|
2020-08-13 16:35:39 -03:00
|
|
|
|
4. Compile the code using `make`. The executable file **amun.x** should be
|
2021-12-01 21:36:29 -03:00
|
|
|
|
available in a few moments.
|
2020-08-13 16:35:39 -03:00
|
|
|
|
|
|
|
|
|
|
2021-12-01 21:36:29 -03:00
|
|
|
|
Alternative compilation (using `make`)
|
2020-08-13 16:35:39 -03:00
|
|
|
|
===========================================
|
|
|
|
|
|
2019-10-06 01:15:30 +00:00
|
|
|
|
1. Clone the AMUN source code:
|
|
|
|
|
- from GitLab:
|
|
|
|
|
`git clone https://gitlab.com/gkowal/amun-code.git`
|
2021-12-01 21:36:29 -03:00
|
|
|
|
- from Bitbucket:
|
|
|
|
|
`git clone https://grzegorz_kowal@bitbucket.org/amunteam/amun-code.git`,
|
2019-10-06 01:15:30 +00:00
|
|
|
|
- or unpack the archive downloaded from page
|
2018-01-04 12:05:33 -02:00
|
|
|
|
[Downloads](https://bitbucket.org/amunteam/amun-code/downloads/).
|
2021-12-01 21:36:29 -03:00
|
|
|
|
2. Go to directory **build/hosts/** and copy file **default** to a new file
|
|
|
|
|
named exactly as your host name, i.e. `cp default $HOSTNAME`.
|
2014-12-22 13:32:19 -02:00
|
|
|
|
3. Customize your compiler and compilation options in your new host file.
|
2021-12-01 21:36:29 -03:00
|
|
|
|
4. Go up to the directory **build/** and copy file **make.default** to
|
|
|
|
|
**make.config**.
|
2014-12-22 13:32:19 -02:00
|
|
|
|
5. Customize compilation time options in **make.config**.
|
2018-03-30 21:38:53 -03:00
|
|
|
|
6. Compile sources by typing `make` in directory **build/**. The executable file
|
|
|
|
|
**amun.x** should be created there.
|
2014-12-22 13:32:19 -02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
|
=====
|
|
|
|
|
|
2019-10-06 01:15:30 +00:00
|
|
|
|
In order to run some test problems you can simply copy the problem parameter
|
|
|
|
|
file from directory **problems/** to the location where you wish to run your
|
|
|
|
|
test. Copy the executable file **amun.x** from the **build/** directory compiled
|
|
|
|
|
earlier. If you provide option _-i <parameter_file>_, the code will know that
|
|
|
|
|
parameters have to be read from file _<parameter_file>_. If you don't provide
|
|
|
|
|
this option, the code assumes that the parameters are stored in file
|
|
|
|
|
**params.in** in the same director.
|
|
|
|
|
|
|
|
|
|
In order to run serial version, just type in your terminal:
|
|
|
|
|
`./amun.x -i ./params.in`.
|
|
|
|
|
|
|
|
|
|
In order to run parallel version (after compiling the code with MPI support),
|
|
|
|
|
type in your terminal:
|
|
|
|
|
`mpirun -n N ./amun.x -i ./params.in`,
|
2020-05-01 15:24:01 -03:00
|
|
|
|
where N is the number of processors to use.
|
2020-05-01 15:34:33 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reading data
|
|
|
|
|
============
|
|
|
|
|
|
2021-12-01 21:36:29 -03:00
|
|
|
|
By default, the code uses the new XML+binary snapshot data format. Parameter
|
|
|
|
|
**snapshot_format** set to either **xml** or **h5** controls which file format
|
|
|
|
|
is used.
|
2020-05-01 15:34:33 -03:00
|
|
|
|
|
2021-12-01 21:36:29 -03:00
|
|
|
|
In order to read the data produced in this format, you will need to install the
|
|
|
|
|
Python module AmunPy included in subdirectory **python/amunpy**. Simply go to
|
|
|
|
|
this directory and run
|
|
|
|
|
`python ./setup.py install --user`
|
2020-05-01 15:34:33 -03:00
|
|
|
|
to install the module in your home directory.
|
|
|
|
|
|
|
|
|
|
Import the module in your python script using
|
|
|
|
|
`from amunpy import *`,
|
2021-12-01 21:36:29 -03:00
|
|
|
|
and then initiate the interface to the XML+binary snapshots using
|
2020-05-01 15:34:33 -03:00
|
|
|
|
`snapshot = AmunXML(<path to the snapshot directory>)`
|
2021-12-01 21:36:29 -03:00
|
|
|
|
or to the HDF5 files using
|
|
|
|
|
`snapshot = AmunH5(<path to any HDF5 snapshot file>)`
|
|
|
|
|
and read desired variables using function
|
2020-05-01 15:34:33 -03:00
|
|
|
|
`var = snapshot.dataset(<variable>)`.
|
|
|
|
|
|
2021-12-01 21:36:29 -03:00
|
|
|
|
The function **dataset()** returns the requested variable mapped on the uniform
|
|
|
|
|
mesh as a NumPy array.
|