Compile Pflotran On Mac

less than 1 minute read

Published:

Install PFLOTRAN on MAC

The documentation shows the steps for Linux and is the same for MacOS.

Install fortran compiler

Go to this website to download the latest gfortran installer for macOS. Then install gfortran on mac.

Download and install Petsc

git clone https://gitlab.com/petsc/petsc.git petsc_v3.11.3
cd petsc_v3.11.3
git checkout v3.11.3

configure Petsc

note: only python v2 is supported.

python2.7 ./config/configure.py --CFLAGS='-O3' --CXXFLAGS='-O3' --FFLAGS='-O3' --with-debugging=no --download-mpich=yes --download-hdf5=yes --download-fblaslapack=yes --download-metis=yes --download-parmetis=yes --download-cmake=yes

define PETSC_DIR and PETSC_ARCH. You will see prompts when the configuration is completed.

export PETSC_DIR=$PWD
export PETSC_ARCH=arch-darwin-c-release 

Compile Petsc

cd $PETSC_DIR
make all

Download and compile PFLOTRAN

git clone https://bitbucket.org/pflotran/pflotran
cd pflotran/src/pflotran
make -j4 pflotran

regression test

export MPIRUN=/Users/shua784/Dropbox/github/petsc/arch-darwin-c-debug/bin/mpiexec
$MPIRUN -n 1 $PFLOTRAN_EXE -pflotranin 543_flow.in # use one core for this test

Once the test model is finished (should take less than few seconds), the installation processes are done!

Update PFLOTRAN

  • make sure PETSC_DIR and PETSC_ARCH are in your environment
export PETSC_DIR=$PWD
export PETSC_ARCH=arch-darwin-c-release
  • Pull the changes from remote repo
git pull
  • Recompile PFLOTRAN
cd pflotran/src/pflotran
make -j4 pflotran