Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

How to install prep-chem-src v1.5

Bash:
#!/bin/bash

# Basic Package Management for WRF-CHEM Tools and Processors

sudo apt-get update
sudo apt-get upgrade
sudo apt install gcc gfortran g++ libtool automake autoconf make m4 default-jre default-jdk csh ksh git build-essential unzip mlocate byacc flex

#Directory Listings
export HOME=`cd;pwd`
mkdir $HOME/WRFCHEM
cd $HOME/WRFCHEM
mkdir Downloads
mkdir Libs
mkdir Libs/grib2
mkdir Libs/NETCDF
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/Libs
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/Libs/grib2
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/Libs/NETCDF
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5




##############################Downloading Libraries############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads

wget -c -4 https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz
wget -c -4 https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_2.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.0.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.0.tar.gz
wget -c -4 https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
wget -c -4 https://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip



#############################Compilers############################
export DIR=$HOME/WRFCHEM/WRF_CHEM_Tools/Libs
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran

#IF statement for GNU compiler issue
export GCC_VERSION=$(/usr/bin/gcc -dumpfullversion | awk '{print$1}')
export GFORTRAN_VERSION=$(/usr/bin/gfortran -dumpfullversion | awk '{print$1}')
export GPLUSPLUS_VERSION=$(/usr/bin/g++ -dumpfullversion | awk '{print$1}')

export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')

export version_10="10"

if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
then
  export fallow_argument=-fallow-argument-mismatch
  export boz_argument=-fallow-invalid-boz
else
  export fallow_argument=
  export boz_argument=
fi


export FFLAGS=$fallow_argument
export FCFLAGS=$fallow_argument


echo "##########################################"
echo "FFLAGS = $FFLAGS"
echo "FCFLAGS = $FCFLAGS"
echo "##########################################"


#############################zlib############################
#Uncalling compilers due to comfigure issue with zlib1.2.12
#With CC & CXX definied ./configure uses different compiler Flags

cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
tar -xvzf v1.2.12.tar.gz
cd zlib-1.2.12/
CC= CXX= ./configure --prefix=$DIR/grib2
make
make install
#make check



#############################libpng############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
tar -xvzf libpng-1.6.37.tar.gz
cd libpng-1.6.37/
./configure --prefix=$DIR/grib2
make
make install
#make check


#############################JasPer############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
unzip jasper-1.900.1.zip
cd jasper-1.900.1/
autoreconf -i
./configure --prefix=$DIR/grib2
make
make install

export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include


#############################hdf5 library for netcdf4 functionality############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
tar -xvzf hdf5-1_12_2.tar.gz
cd hdf5-hdf5-1_12_2
./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran
make
make install
#make check

export HDF5=$DIR/grib2
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH

##############################Install NETCDF C Library############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
tar -xzvf v4.9.0.tar.gz
cd netcdf-c-4.9.0/
export CPPFLAGS=-I$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared
make
make install
#make check

export PATH=$DIR/NETCDF/bin:$PATH
export NETCDF=$DIR/NETCDF


##############################NetCDF fortran library############################
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads
tar -xvzf v4.6.0.tar.gz
cd netcdf-fortran-4.6.0/
export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
export CPPFLAGS=-I$DIR/NETCDF/include
export LDFLAGS=-L$DIR/NETCDF/lib
./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared
make
make install
#make check





# Downloading PREP-CHEM-SRC-1.5 and untarring files
cd $HOME/WRFCHEM/WRF_CHEM_Tools/Downloads

wget -c http://ftp.cptec.inpe.br/pesquisa/bramsrd/BRAMS_5.4/PREP-CHEM/PREP-CHEM-SRC-1.5.tar.gz
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5
tar -xzvf PREP-CHEM-SRC-1.5.tar.gz -C $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5

cd $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5


# Installation of PREP-CHEM-SRC-1.5

cd $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/bin/build

sed -i '47s|/scratchin/grupos/catt-brams/shared/libs/gfortran/netcdf-4.1.3|${DIR}/NETCDF|' include.mk.gfortran.wrf  #Changing NETDCF Location
sed -i '53s|/scratchin/grupos/catt-brams/shared/libs/gfortran/hdf5-1.8.13-serial|${DIR}/grib2|' include.mk.gfortran.wrf #Changing HDF5 Location
sed -i '55s|-L/scratchin/grupos/catt-brams/shared/libs/gfortran/zlib-1.2.8/lib|-L${DIR}/grib2/lib|' include.mk.gfortran.wrf #Changing zlib Location
sed -i '69s|-frecord-marker=4|-frecord-marker=4 ${fallow_argument}|' include.mk.gfortran.wrf #Changing adding fallow argument mismatch to fix dummy error

make OPT=gfortran.wrf CHEM=RADM_WRF_FIM AER=SIMPLE  # Compiling and making of PRE-CHEM-SRC-1.5

read -t 5 -p "Finished installing WRF-CHEM-PREP. I am going to wait for 5 seconds only ..."

#Verifying and Running PREP-CHEM-SRC

echo "
___________________________________
Verifying and Running PREP-CHEM-SRC
___________________________________"
mkdir $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/extra/UserData/DataIn #Directory for Input Data

cd $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/extra/UserData
wget -c -4 http://ftp1.cptec.inpe.br/pesquisa/bramsrd/BRAMS_5.4/data-brams/prep-chem/global_emissions_v3_24aug2015.tar.gz  #Downloading Sample Data

tar -xvzf global_emissions_v3_24aug2015.tar.gz -C $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/extra/UserData/DataIn

cd $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/bin

ln -s $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/extra/UserData  #symbolic link to UserData files

ln -s $HOME/WRFCHEM/WRF_CHEM_Tools/PREP-CHEM-SRC-1.5/extra/UserData/DataIn datain #symbolic link to Input Data


./prep_chem_sources_RADM_WRF_FIM_SIMPLE.exe

echo "
______________________________
verify .ctl, .vfm, .gra, bin
was created
______________________________
"
ls -a
 
@ehsantaghizadeh
@Ankan
@llsalazardom
@dbp
@patelviral1195
@fjpi

So the issue with prep-chem-src 1.5 is that it has issues with gcc version numbers.
IF you are using gcc < gcc9.0 you shouldn't have any issues. With gcc > gcc9.0 it has extra flags that need to be included
Bash:
FFLAGS= --fallow-argument-mismatch --fallow-invalid-boz -m64
FCFLAGS= --fallow-argument-mismatch --fallow-invalid-boz -m64

As for the intel compilers, I have never gotten them to work because the intel classic compilers were built differently then the LLVM compilers.
For that error you need to reach out to the software author:

Here is the email for the Prep-Chem-Src v1.5 support
atende.cptec@inpe.br
 
Top