NanoASURA is a subset of ASURA and has been developed by Takayuki Saitoh.
NanoASURA-MD is a code revised to handle magneto-hydrodynamics (MHD), developed as teaching material for the CfCA numerical hydrodynamics school, based on NanoASURA.
You can clone this repository by using the following command:
> git clone git@github.com:cfcanaoj/NanoASURA-MHD.git
The structure of this repository is as follows:
-+-src-+-setup
+-runs-+-MHDalfwave
| +-MHDbw
| +-MHDrt
| +-MHDot
| +-MHDrotor
| +-MHDshocktube
| +-MHDgrvcollapse
|
+-plot
"src" holds the main simulation code. The directories under "runs" have input parameter files for each model. "Plot" is the directory for the data plot.
NanoASURA-MHD is written in C, in particular, C99. This software requires only a C compiler that can compile C99 sources and there is no need to prepare other libraries.
After you have cloned/downloaded this repository, just type the "make" command in the src directory:
> cd src
> make
You can find the binary file "asura.out" in the src directory.
This code requires a parameter file to specify the run mode. The default name of the parameter file is "param.txt", but it is possible to use different files with different names.
The parameter files are prepared under "runs/?" directories. So, first, copy the binary file "asura.out" to the working directory "runs/?".
Hereafter, assume that we are in "runs/MHDalfven". To run the code type the following command:
> cd runs/MHDalfven
> ./asura.out
Then the code reads the parameter file and start the calculation. The output directory of the run is specified in the parameter file, "OutDir" in the parameter file.
There is a plot tool in the "plot" directory. This plot tool requires "python", "numpy", and "matplotlib". To compile the plot tool, just type the "make" command in "plot",
> make
You then obtain "plot.out".
"plot.out" also reads the local parameter file, "param.toml". Here is an example of the first part of "param.toml".
Title = "nano ASURA MHD parameter file"
# All parameters described in this file are updated at runtime.
[Environment]
PythonPath = "python3"
[Mode]
PlotType = 0
#0=Alfven wave
#1=OrszagTang
#2=Blast wave
#3=Kelvin-Helmholtz instability
#4=Rayleigh-Taylor instability
#5=Gravitational Collapse of Rotating Magnetized Cloud Core
WriteMode = 2
# 0->pdf, 1->eps, 2->png
ShowTime = 1
[TargetFiles]
FileStart = 0
FileEnd = 100
[Hydro]
SelectKernelType = 5 # gaussian kernel
[AlfvenWave]
OutDir = "./data_aw"
FileName = "alfvenwave"
DataDir = "../runs/MHDalfwave/data"
PlotType = 0 # 0=1d profile along k and 2d map of Beta
Xmin = 0.0
Xmax = 1.154700538379251
Ymin = 0.0
Ymax = 2.0
Bzmin = -0.1
Bzmax = 0.1
GridSize = 64
First of all, You need to check PythonPath, which is in the [Environment] section.
This plot tool calls python defined at PathonPath. It should match your own environment.
In the [Mode] section,
we can see the following parameters:PlotType (target simulation), WriteMode (output format), and ShowTime (whether the simulation time is printed or not).
Output files are sequentially numbered. This allows you to specify which files to be plotted.
The start and end file numbers are defined in the [TargetFiles] section.
Parameters for Alfven wave propagation runs are given in the [AlfvenWave] section.
Important parameters are DataDir which defines the simulation data directory, OutDir which defines the output directory name, and
PlotType which is used to select the plot type. As far as you are running Alfven wave propagation tests with the given initial condition,
you do not need to changee any of the other parameters.
After edit the parameter file, you type the following command:
> ./plot.out
Then, you get snapshots in the output directory. Since this case use "WriteMode 2", the plot tool writes png files in the output directory.