Remember to use --recursive option while downloading the repo:
git clone --recursive https://github.com/gronki/diskvert.gitThe easiest way is to run diskvert is to use Docker, because Python scripts have not been maintained since 2021 and they require and older Python version to run.
Clone the repository (attention to the --recursive flag) and run the script:
git clone --recursive --depth 1 https://github.com/gronki/diskvert.git
cd diskvert
./run_docker.shThe code is compiler during the build of the container and paths are set so that you can easily run all provided tools. Also, the shared library is set allowing to run the computational kernel written in Fortran from Python (however this is incomplete, example in draw_matrix.py).
work directory will be created, and example input will be copied to that directory. You may try if the code works by running
# run computation
cat input.txt | diskvert -corona -o mydisk
# plot the result
diskvert-plot mydisk.datThe results will be available in the work directory.
Inside Docker, work directory will be mounted under /work, while the code directory under /source. All files you put in these two locations will be immediately visible both to Docker and by the host operating system.
If at any point you make changes to the Fortran code, inside Docker simply run:
rebuildCode will be recompiled and installed in Docker in appropriate places.
If you make any changes to the equations and need to regenerate the Jacobian coefficients, run:
# regenerates coefficients an
coefficients
# builds and installs code
rebuildProgram requires GCC 6 (or newer), including gfortran or other compiler suite (such as Intel Parallel Studio). Developement package for Lapack, OpenBLAS or other compatible library is required.
cd build
make
# install system-wide in /usr/local
sudo make installIf one has no root access, installation can be made in user's home directory.
Typical location is ~/.local/bin and ~/.local/lib, which is achieved by following commands:
# install for current user only
make install prefix=~/.local
# add the directory to system path
# this line can be also added to .bashrc
export PATH="$PATH:$HOME/.local/bin"Following files will be installed in the directory given by prefix parameter:
bin/diskvert
bin/dv-rad1
bin/dv-mag-rx
bin/dv-mag
bin/dv-alpha-rx
bin/dv-alpha
lib/libdiskvert.so
lib/diskvert/modules/gfortran/alphadisk.mod
lib/diskvert/modules/gfortran/globals.mod
lib/diskvert/modules/gfortran/heatbalance.mod
(and a couple of other .mod files...)
lib/pkgconfig/diskvert.pc
To install the Python package, a setup script is provided. Is it advised (but not required) that you use a virtual environment. Installing the package system-wide is risky and can conflict with your distribution's packages.
python3 -m venv venv
. venv/bin/activate
cd python
python setup.py installIf you make any changes to the equations and need to regenerate the Jacobian coefficients, run:
cd sympy
python coefficients.pyIf you have any issues running this script, follow the Docker guide.
The library for reading key-value files can be obtained separately from here: libconfort.
The recommended way to produce models is to execute diskvert program, which refers to the most up-to-date version of the model.
(Other programs: dv-alpha, dv-alpha-rx, dv-mag and dv-rad1 work but are not officially supported.)
After successful build an installation, execution of program does not require changing the source code.
For example, the following command will process the input file input.par, and produce three output files (model.dat, model.txt and model.col):
cat input.par | diskvert -o modelIt may be helpful to store the files in archive file (here called model.tgz) to save disk space:
tar czf model.{tgz,col,dat,txt} && rm model.{col,dat,txt}The structure of the input file consists of key-value pairs (case-sensitive!), for example:
mbh 10
mdot 0.1
radius 6.5
alpha 0.02
# this is a comment
The following keywords are allowed, all taking numerical values:
-
mbhis the black hole mass (in solar masses) -
mdotis the accretion rate (in units of Eddington rate) -
radiusis the radius from the center of the black hole (in Schwarzschild radii) -
alpha,etaandnuare magnetic parameters ($\eta$ and$\nu$ are not required, refer to the paper for details and relations)
Note: every switch can be negated by adding -no prefix (for example: -no-fluxcorr).
-equilibrium/-dyfu(default) assumes that radiation and gas temperature are equal-comptonsolves heating and cooling balance but only using Compton term-corona/-balanceattempts to solve the full heating/cooling balance (will fail to converge if the instability occurs)-post-coronasolves the full heating-cooling balance after relaxation using constant density. It is used to get the solution despite thermal instability (can be used with-dyfuor-comptonand is ignored with-corona).-relincludes the relativistic term in Compton scattering-quenchenables switching off MRI (often causes divergence)-fluxcorr(default) accounts for correction of flux for very strongly magnetized disks-klnishenables Klein-Nishina cross section (does not converge, obviously)-alpha-prad(default) includes radiation pressure in alpha prescription
import diskvert as dv
import matplotlib.pyplot as plt
d,p = dv.col2python('disk.dat')
plt.plot(d['z'] / p.zdisk, d['trad'], color = '#6F6F6E')
plt.plot(d['z'] / p.zdisk, d['temp'], color = '#E94626')
plt.show()diskvert-plot -show disk.dat
diskvert-plot -tau disk.dat -o disk.png
diskvert-random
diskvert-random | diskvert -compton -post-corona -o disk \
&& diskvert-plot -show -xl disk.dat