Changeset 3298 for palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin
- Timestamp:
- Oct 2, 2018 12:21:11 PM (6 years ago)
- Location:
- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh
r2718 r3298 21 21 # Copyright 2017-2018 Leibniz Universitaet Hannover 22 22 #------------------------------------------------------------------------------# 23 # Nov. 2016: Initial Version of KPP chemistry convertor adapted for PALM 24 # by Klaus Ketelsen 25 # 26 # This code is a modified version of KP4 (Jöckel, P., Kerkweg, A., Pozzer, A., 27 # Sander, R., Tost, H., Riede, H., Baumgaertner, A., Gromov, S., and Kern, B., 28 # 2010: Development cycle 2 of the Modular Earth Submodel System (MESSy2), 29 # Geosci. Model Dev., 3, 717-752, https://doi.org/10.5194/gmd-3-717-2010). 30 # KP4 is part of the Modular Earth Submodel System (MESSy), which is is 31 # available under the GNU General Public License (GPL). 32 # 33 #------------------------------------------------------------------------------# 23 34 # 24 35 # Current revisions: … … 29 40 # ----------------- 30 41 # $Id$ 42 # forkel 25. September 2018: Added cat for $MECH to pass mechanism name to kpp4palm 43 # ketelsen 18. September 2018: Added cat for '#INLINE F90_GLOBAL' 44 # (moved here from mechanisms/def_MECH/chem_gasphase.kpp 45 # 46 # forkel: 14. September 2018: WCOPY removed 47 # ketelsen: July 2018: Adaptations for vektor mode 48 # forkel June 2018: re-established original case of subroutine names 49 # forkel May 2018: additional copying of chem_gasphase_mod.f90 into $DEFDIR 50 # forkel 20.04.2018: removed wlamch and wlamch_add from $KPP_SUBROUTINE_LIST 51 # (epsilon(one) is used now) 52 # forkel March 2017 53 # Re-introduced relative path for KPP_HOME 54 # Subroutine list adapted to lowercase subroutine names 55 # Added arr2, removed update_sun and k_3rd from subroutine list 56 # Renamed output file to chem_gasphase_mod 57 # Renamed this file from kp4/ksh to kpp4kpp.ksh 58 # changed location of def_mechanism directories to gasphase_preproc/mechanisms 59 # 60 # 61 # 2718 2018-01-02 08:49:38Z maronga 31 62 # Initial revision 32 63 # 33 64 # 65 ########################################################################## 34 66 # 35 67 # … … 63 95 # Default 64 96 97 MECH=smog 65 98 OUTDIR=`pwd`/../../../SOURCE 66 99 OUTFILE=chem_gasphase_mod … … 70 103 VLEN=1 71 104 KEEP="NO" 72 DE_INDEX="NO" 73 DE_INDEX_FAST="NO" 105 UPDT="NO" 106 DE_INDEX=0 107 DE_INDEX_FAST="YES" 74 108 75 109 export KPP_SOLVER=Rosenbrock … … 77 111 # get Command line option 78 112 79 echo xxxxxxxxxx 80 while getopts :d:ifkp:o:s:v:w: c # get options 113 while getopts :m:i:fkup:o:s:vl:w: c # get options 81 114 do case $c in 82 d) DEFDIR=$OPTARG;; # directory of definition files83 84 i) DE_INDEX= "YES";;# if set, deindexing115 m) MECH=$OPTARG;; # mechanism 116 117 i) DE_INDEX=$OPTARG;; # if set, deindexing 85 118 86 119 f) DE_INDEX_FAST="YES";; # if set, fast deindexing … … 92 125 p) PREFIX=$OPTARG;; # Name Prefix 93 126 94 s) KPP_SOLVER=$OPTARG;; # Name Prefix 95 96 v) MODE="vector" 97 VLEN=$OPTARG;; # Set to vector Mode 127 s) KPP_SOLVER=$OPTARG;; # Update sample f90 code in the def_MECH directory 128 129 u) UPDT="YES";; # keep Working directory 130 131 v) MODE="vector";; # Set to vector Mode 132 133 l) VLEN=$OPTARG;; # Set vector length 98 134 99 135 w) WORK=$OPTARG;; # Working directory 100 136 101 137 \?) print ${0##*/} "unknown option:" $OPTARG 102 print "USAGE: ${0##*/} [ - d dir -e -k -o dir -p name -s solver -vlength -w dir ] "138 print "USAGE: ${0##*/} [ -m dir -e -k -u -o dir -p name -s solver -v -l length -w dir ] " 103 139 exit 1;; 104 140 esac … … 106 142 shift OPTIND-1 107 143 108 echo $DEFDIR 144 echo MECHANISM = $MECH 145 echo DE_INDEX = $DE_INDEX 146 echo KEEP = $KEEP 147 echo UPDT = $UPDT 148 echo MODE = $MODE 149 echo VLEN = $VLEN 109 150 110 151 DEF_PREFIX=${PREFIX}.kpp 152 DEFDIR=`pwd`/mechanisms/def_$MECH 153 echo DEFDIR = $DEFDIR 111 154 112 155 # Create or clean working directory … … 122 165 123 166 124 KPP_SUBROUTINE_LIST=" initialize"125 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST integrate fun"126 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST kppsolve kppdecomp wlamch wlamch_add"127 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST jac_spk_arr "128 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST update_rconst arr2"167 KPP_SUBROUTINE_LIST="Initialize" 168 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST INTEGRATE Fun" 169 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST KppSolve KppDecomp" 170 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Jac_SP k_arr " 171 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Update_RCONST ARR2" 129 172 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST initialize_kpp_ctrl error_output" 130 173 … … 149 192 150 193 # Interface ignore list 151 KPP_INTERFACE_IGNORE="waxpy wcopy" 194 KPP_INTERFACE_IGNORE=" " 195 196 echo " " 197 echo KPP_SOLVER $KPP_SOLVER 198 echo " " 152 199 153 200 case $KPP_SOLVER in … … 155 202 156 203 Rosenbrock) 157 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST wcopy wscal waxpy" 158 if [[ $MODE != "vector" ]] 159 then 160 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST rosenbrock funtemplate jactemplate" 161 fi;; 204 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST WSCAL WAXPY" 205 if [[ $MODE != "vector" ]] 206 then 207 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Rosenbrock FunTemplate JacTemplate" 208 KPP_INTERFACE_IGNORE="WAXPY" 209 else 210 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST FunTemplate JacTemplate" 211 fi;; 162 212 163 213 rosenbrock_mz) … … 167 217 rosenbrock) 168 218 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST WCOPY WSCAL WAXPY" 169 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST rosenbrock funtemplate jactemplate";;219 KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Rosenbrock FunTemplate JacTemplate";; 170 220 171 221 kpp_lsode) … … 203 253 cp $DEFDIR/${PREFIX}.kpp . 204 254 255 # Global variable are defined here 256 # This has the advantage that it is not necessary to include these variables in all .kpp definition files 257 258 cat >> ${PREFIX}.kpp << EOF 259 #INLINE F90_GLOBAL 260 ! QVAP - Water vapor 261 REAL(kind=dp) :: QVAP 262 ! FAKT - Conversion factor 263 REAL(kind=dp) :: FAKT 264 265 #ENDINLINE 266 EOF 267 268 # Store mechanism name in file mech_list 269 cat >> mech_list << EOF 270 ! Mechanism: $MECH 271 ! 272 EOF 273 205 274 # Run kpp 206 275 … … 240 309 done 241 310 311 echo start kp4.exe with arguments 312 echo $PREFIX $MODE $VLEN $DE_INDEX $DE_INDEX_FAST 313 242 314 $BASE/bin/kpp4palm.exe $PREFIX $MODE $VLEN $DE_INDEX $DE_INDEX_FAST 243 315 316 #Prelimanary, substitution has to be moved into kpp4palm.exe 317 if [[ $MODE = "vector" ]] 318 then 319 sed -i -e 's/phot(nphot/phot(vl_dim,nphot/g' kk_kpp.f90 320 fi 244 321 245 322 if [[ -e $OUTDIR/${OUTFILE}.f90 ]] … … 248 325 fi 249 326 cp -p kk_kpp.f90 $OUTDIR/${OUTFILE}.f90 250 #cp -p kk_kpp.f90 $MY_PWD/../SOURCE/${OUTFILE}.f90251 252 327 echo " " 253 328 echo "Write kpp module -- > " $OUTDIR/${OUTFILE}.f90 329 330 if [[ $UPDT = "YES" ]] 331 then 332 cp -p kk_kpp.f90 $DEFDIR/${OUTFILE}.f90 333 echo " " 334 echo "Write kpp module -- > " $DEFDIR/${OUTFILE}.f90 335 fi 254 336 255 337 if [[ $KEEP = "NO" ]]
Note: See TracChangeset
for help on using the changeset viewer.