hatfullr / fluxcal

GNU General Public License v3.0
0 stars 0 forks source link

FluxCal

Installing FluxCal

Dependencies

First, clone this repository:

git clone https://github.com/hatfullr/fluxcal.git

Next, make sure gfortran is installed:

sudo apt install gfortran

Then run the bash script install in the main directory:

cd fluxcal
./install

FluxCal is currently only supported on Linux, and there are no future plans to support Windows. We recommend that Windows users try installing the Ubuntu terminal on Windows 10, then continue with the installation instructions above.

By default, the install script links three Python executables to the $HOME/bin directory: tools/plot_closest, tools/plot_lc, and tools/plot_Teff. To use these scripts, you will need Python (2 or 3) and matplotlib,

python -m pip install -U pip
python -m pip install -U matplotlib

Uninstalling FluxCal

To uninstall FluxCal, simply delete the FluxCal directory:

rm -rf fluxcal

Running FluxCal

To run FluxCal in the current working directory ., first copy the work directory:

cp fluxcal/defaults/work ./name_of_directory

Then copy or link your data file to the ./work directory:

cp datafile ./name_of_directory

Now, navigate into name_of_directory and edit flux_cal.input as you see fit. Make sure you change the line that reads flux_cal_dir='../', changing ../ to instead be the path of your FluxCal installation. If you forget this step, FluxCal will not detect the proper data files it needs to run correctly. Finally, run flux_cal:

./flux_cal

Creating FluxCal data files

In order to run FluxCal, you will need to supply your own input data files. The files must have the name fluxcal_XXXX.dat, fluxcal_XXXXX.dat, or fluxcal_XXXXXX.dat, where X should be replaced with numbers, such as fluxcal_0000.dat. When you run flux_cal, it will search for files of this name, using the numbers as indexes. As indicated by flux_cal.input, it will loop through input files starting at fluxcal_<start>.dat and ending at fluxcal_<finish>.dat, skipping a number of files step between each (when step is zero, it increments by 1, or reads fluxcal_<start>.dat and then finishes).

The list of required data is provided in LIST_OF_REQUIRED_DATA in the FluxCal directory:

This is a list of the data flux_cal requires.

data files:
Header (all in one line):
t                 !time (real*8)
Body:
x(i)              !x position (real*8)
y(i)              !y position (real*8)
z(i)              !z position (real*8)
am(i)             !mass (real*8)
hp(i)             !smoothing length (real*8)
rho(i)            !density (real*8)
vx(i)             !x velocity (real*8)
vy(i)             !y velocity (real*8)
vz(i)             !z velocity (real*8)
a(i)              !specific internal energy (real*8)
wmeanmolecular(i) !mean molecular weight (real*8)
g(i)              !local g magnitude (real*8)

See lib/read_fluxcal.f for hints about formatting.

As suggested in the file, lib/read_fluxcal.f gives some hints about the structure of the input data files:

      open(12,file=trim(adjustl(infname)),form='unformatted')
      read(12) t
...
      do i=1,nmax
         read(12,end=200) x(i),y(i),z(i),am(i),hp(i),rho(i),
     $        vx(i),vy(i),vz(i),a(i),wmeanmolecular(i),
     $        localg(i)
...
      end do
 200  close(12)

All variables listed above (t, x, y, etc.) are real*8 Fortran data types defined in lib/flux_cal.h. We suggest using Fortran to generate your data files, but any language can be used provided it is compatible with the above code.

Plotting utilities

FluxCal comes prepackaged with a suite of plotting utilities which can be found either at fluxcal/tools/ or in a work directory:

plot_Teff
plot_closest
plot_lc

You can run these simply as executables, provided you have Python and matplotlib installed (see "Installation" above). Please note that plot_Teff is more sophisticated and general than plot_closest and plot_lc.

PySPLASH has native support for teffs.dat files output from using get_fluxes=.true. in FluxCal and can be used to quickly create animated gifs and videos. After installing PySPLASH use `pysplash teffs.dat`

Troubleshooting

Failing compilation on install

There is a known, relatively rare bug where compilation fails upon trying to build mathlib/bilinear_interpolation.f. If you encounter this error or any others after running install, try running make until the error disappears. If the error persists, do the following:

make clean
make