source: trunk/MESOSCALE/LMD_MM_MARS/SRC/PREP_MARS/ukdiag/compile_newdiag

Last change on this file was 1440, checked in by aslmd, 10 years ago

MESOSCALE. changes inspired by Liam Steele. mcmodel in makemeso and mpifort for larger domains. cleaning the PREP_MARS repository. added Liam's ukdiag tool to convert UK dynamical core outputs for use in mesoscale simulations.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/sh
2
3# =======================================================
4# Compiler script for newdiag.F90 interpol_soil.F90
5# Liam Steele June 2014
6# =======================================================
7
8# Determine which Fortran compiler to use
9fcomp=0
10echo "Which Fortran compiler do you want to use?"
11echo "1. ifort"
12echo "2. g95"
13echo "3. pgf90"
14while [ $fcomp != 1 -a $fcomp != 2 -a $fcomp != 3 ] ; do 
15  read fcomp
16  if [ $fcomp != 1 -a $fcomp != 2 -a $fcomp != 3 ] ; then
17    echo "Not a valid compiler choice. Please try again:"
18  fi
19done
20
21# Look for NetCDF libraries
22if [ -n "$NETCDF" ] ; then
23  echo "Will use NetCDF in directory: $NETCDF"
24else
25  success=""
26  while [ -z "$success" ] ; do 
27    echo "Cannot find NetCDF library. Please enter full path:"
28    read ncdfpath
29    if [ ! -d "$ncdfpath" ] ; then
30      echo "invalid path: $ncdfpath" ; continue
31      success=""
32    else
33      success="yes"
34    fi
35    netcdfipath=$ncdfpath
36  done
37  echo "For future use you should put this path into your bash profile, i.e."
38  echo "export NETCDF="$ncdfpath
39fi
40
41# Check diagfi.nc exists for conversion
42if ! [ -e "diagfi.nc" ] ; then
43  echo 'Please link a valid diagfi.nc file'
44  exit
45fi
46
47# Check we are in the ukv_newdiag directory
48thispwd=`echo $(pwd)`
49length=${#thispwd}
50substr=`echo $thispwd | cut -c$((length-10))-$((length))`
51if [ $substr != "ukv_newdiag" ] ; then
52  echo 'Not in ukv_newdiag directory'
53  exit
54fi
55
56# Since all checks are complete, create new diagfi. If you want to use a
57# compiler other than ifort you'll have to change the compiler flags
58echo 'Compiling executable...'
59if [ -e "newdiag.exe" ] ; then
60  rm newdiag.exe
61fi
62if [ $fcomp == 1 ] ; then
63  ifort -convert big_endian -I$NETCDF newdiag.F90 interpol_soil.F90 -o newdiag.exe -L$NETCDF -lnetcdf
64elif [ $fcomp == 2 ] ; then
65  g95 -fno-second-underscore -I$NETCDF newdiag.F90 interpol_soil.F90 -o newdiag.exe -L$NETCDF -lnetcdf
66elif [ $fcomp == 3 ] ; then
67  pgf90 -byteswapio -I$NETCDF newdiag.F90 interpol_soil.F90 -o newdiag.exe -L$NETCDF -lnetcdf
68fi
69chmod u+x newdiag.exe
70./newdiag.exe
71
72# Create link in PREP_MARS
73echo 'Linking new diagfi to PREP_MARS'
74cd ..
75ln -sf ukv_newdiag/diagfi_new.nc input_diagfi.nc
76
77echo 'Done!'
78
79exit
Note: See TracBrowser for help on using the repository browser.