Installing Flux on an Ubuntu system
CHAPTER 1. Environment
- Flux7 is a Linux application. If Windows is your operating system
you may create a dual boot system as described e.g., in
https://linuxconfig.org/how-to-install-ubuntu-20-04-alongside-windows-10-dual-boot
- It is more practical however to install Ubuntu as a windows subsystem.
A big avantage of this solution is that Linux and Windows run simultaneously. You may use your
windows application while Flux is running in the background.
The installation may be straightforward by the command "wsl --install"
windows/wsl/install
but may also be a bit tricky. See, e.g. windows subsystem and
installation
It may be necessary to make an adjustment in the BIOS in order to enable virtualization.
- A third possibility (not recommended) is to use the unix-like MSYS2 environment, see Appendix
CHAPTER 2. Obtaining gcc and gfortran and other preparations
In Linux, open a terminal window, and give the commands
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install gcc
- sudo apt-get install gfortran
This should install the gfortran compiler.
Now that you are at it, also download some X11 stuff:
- sudo apt-get install xorg-dev
- sudo apt-get install x11-xserver-utils
- sudo apt-get install xfonts-base
- sudo apt-get install xfonts-75dpi
Download the latest Flux distribution from
http://pjms.nl/FLUXBIN/
Unpack, but do not install yet.
In the following flux7.9.7 is the identifier of the Flux distribution, may change in the future.
tar -jxvf Downloads/flux7.9.7.tar.bz2
Put the following environment variables in $HOME/.profile:
(instead of PGPLOT any other directory name may be chosen)
export PGPLOT_DIR=${HOME}/PGPLOT
export PGPLOT_DEV=/xwin
export PGPLOT_BACKGROUND=white
export PGPLOT_FOREGROUND=black
export PGPLOT_XW_WIDTH=0.6
export FLUX=${HOME}/flux7.9.7/FLUX7
PATH=.:$FLUX/BIN:$PATH
You have to reboot for these changes to take effect systemwide.
Note the '.:' may be omitted from the PATH, if you really like
the default Ubuntu behaviour of not automatically recognizing commands in the current directory.
CHAPTER 3. Installing PGPLOT
download pgplot5.2.tar.gz from
ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz
most likely the following command works:
- wget ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz
Alternative.
- ftp ftp.astro.caltech.edu
- (Name:) anonymous
- (Password:) Your e-mail adress
- cd /pub/pgplot
- get pgplot5.2.tar.gz
- exit
Unpack the download:
~$ tar -zxvf Downloads/pgplot5.2.tar.gz
~$ cd pgplot
Copy the 2 PostScript files of FLUX (optional, see:
pjms.nl/FLUXHTML/psdriver.html )
~/pgplot$ cd drivers
~/pgplot/drivers$ mv psdriv.f psdriv.f.orig
~/pgplot/drivers$ cp -a $FLUX/PGPLOT.PSDRIV/psdriv.f .
~/pgplot/src$ cd ../src
~/pgplot/src$ mv grtext.f grtext.f.orig
~/pgplot/src$ cp -a $FLUX/PGPLOT.PSDRIV/grtext.f .
Make destination directory PGPLOT.
~/pgplot/src$ cd ~
~$ mkdir PGPLOT
~$ cd PGPLOT
copy drivers.list to the destination dir, and edit
~/PGPLOT$ cp ~/pgplot/drivers.list .
~/PGPLOT$ vi drivers.list
uncomment the wanted drivers, my choice are:
PSDRIV 1 /PS PostScript printers, monochrome, landscape Std F77
PSDRIV 2 /VPS Postscript printers, monochrome, portrait Std F77
PSDRIV 3 /CPS PostScript printers, color, landscape Std F77
PSDRIV 4 /VCPS PostScript printers, color, portrait Std F77
XWDRIV 1 /XWINDOW Workstations running X Window System C
XWDRIV 2 /XSERVE Persistent window on X Window System C
create makefile:
~/PGPLOT$ ~/pgplot/makemake ~/pgplot linux g77_gcc_aout
~/PGPLOT$ vi makefile
a few changes in the makefile (< = old, > = new):
25,27c25,26
< FCOMPL=g77
< FFLAGC=-Wall -O
---
> FCOMPL=gfortran
> FFLAGC=-Wall -O
remove line 27 (-fno-backslash)
~/PGPLOT$ make
~/PGPLOT$ make cpg
~/PGPLOT$ make clean
Make a test, e.g.
~$ cd $PGPLOT_DIR
~/PGPLOT$ ./pgdemo1
and watch the nice pictures.
CHAPTER 4. BUILDING FLUX
You already downloaded FLUX,
extracted the files
and set environmental variables FLUX and PATH
as described above.
Go to $FLUX
$ cd $FLUX
$ makemake
(For other than Linux or Mingw64 use "makemake makedefs-file")
If you did not include '.:' in the PATH (see chapter 2) you will now get the error
bash: makemake: command not found
As a work around type:
$ ./makemake
$ make clean
$ make
!Yippee No errors!!
test if flux is working
$ cd $FLUX/INPUT
$ ./fluxvelo.sh
if these don't work, try instead
$ sh cd $FLUX/INPUT
$ sh ./fluxvelo.sh
let it run, takes 1 to 40 minutes depending on system
At the end it will tell you the time used
(on my computer it took 50 seconds, on my notebook over half an hour.)
For some further tests try, e.g.,
$ $FLUX/testall
Further tests and demo's may be found in various subdirectories, such as
cd PLOTXY
demo
Appending: Installing Flux in MSYS2 - MinGW-64
MSYS2 MinGW-w64 is a unix-like environment running under Windows. My experience is that the resulting Flux7 is slower than the Ubuntu versions.
It is assumed that you have MSYS2 etc installed, see https://www.msys2.org/
and set up a development environment. In the following a few notes about installing flux7 this way.
GrWin
Unforunately this system does not support XWindows, but an alternative is available: GrWin.
see https://grwin.com/grwin/en/
- download two packages, the GrWin Server and the GrWin Toolkit.
- Obtain an installation key and install the GrWin Server.
- Open a terminal window in the Mingw64 shell (command /mingw64.exe)
- install gcc and gfortran e.g. command
pacman -S mingw64/mingw-w64-x86_64-gcc-fortran
- unpack the GrWin Toolkit, command tar -zxvf GrWinTk-113e.tgz
- This makes directory GrWinTk
- In this directory give command 'make'. This fetches the pgplot distribution and does some further initializations.
- Optionally make the PostScript driver update as described in chapter 3 above
- go to directory build/MinGw64-gfortran/ and give command make.
In order to make this work I had to make a change in ../../src/Lowlevel.c line 47, change NULL into 0, i.e.
static COPYDATASTRUCT cds = {0, 0, (LPVOID)cmdbuff};
- If everything went well you now have files libGrWin.a libGrWin0.a libcpgplot.a libpgplot.a
Copy these together with grfont.dat and rgb.txt to a place where they may be found with environment variable PGPLOT_DIR, say, /c/GrWin
- Install flux7 as described above, using file makedefs.mingw64