[2696] | 1 | #!/bin/ksh |
---|
| 2 | # |
---|
[2699] | 3 | # run_kpp4palm - script for running gasphase preprocessor |
---|
| 4 | |
---|
| 5 | #------------------------------------------------------------------------------# |
---|
| 6 | # This file is part of the PALM model system. |
---|
[2696] | 7 | # |
---|
[2699] | 8 | # PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 9 | # of the GNU General Public License as published by the Free Software Foundation, |
---|
| 10 | # either version 3 of the License, or (at your option) any later version. |
---|
| 11 | # |
---|
| 12 | # PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 13 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 14 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 15 | # |
---|
| 16 | # You should have received a copy of the GNU General Public License along with |
---|
| 17 | # PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 18 | # |
---|
[2718] | 19 | # Copyright 2017-2018 Klaus Ketelsen and MPI-CH (April 2007) |
---|
| 20 | # Copyright 2017-2018 Karlsruhe Institute of Technology |
---|
| 21 | # Copyright 2017-2018 Leibniz Universitaet Hannover |
---|
[2699] | 22 | #------------------------------------------------------------------------------# |
---|
| 23 | # |
---|
[2696] | 24 | # Current revisions: |
---|
| 25 | # ------------------ |
---|
| 26 | # |
---|
| 27 | # |
---|
| 28 | # Former revisions: |
---|
| 29 | # ----------------- |
---|
[2699] | 30 | # $Id: run_kpp4palm.ksh 3298 2018-10-02 12:21:11Z suehring $ |
---|
[3298] | 31 | # passed $MECH insted of $DEFDIR to kpp4palm.ksh forkel 25. Sept. 2018 |
---|
| 32 | # re-activaded choice of deindexing method and vector mode forkel June 2018 |
---|
| 33 | # |
---|
| 34 | # 2718 2018-01-02 08:49:38Z maronga |
---|
[2699] | 35 | # Initial revision |
---|
| 36 | # |
---|
| 37 | # |
---|
[2696] | 38 | # |
---|
[2699] | 39 | # |
---|
| 40 | # Other notes: |
---|
| 41 | # ------------ |
---|
[2696] | 42 | # Small adaptations (added MECH as argument, re-introduced relative path, |
---|
| 43 | # adaption to changing kp4 to kpp4palm) |
---|
| 44 | # filename changed from run_kp4.ksh to run_kpp4palm.ksh |
---|
| 45 | # |
---|
| 46 | # Nov. 2016: Initial Version of KPP chemistry by Klaus Ketelsen |
---|
| 47 | # |
---|
| 48 | |
---|
| 49 | echo "\$1 = " $1 |
---|
| 50 | |
---|
| 51 | if [[ $1 == "clean" ]] |
---|
| 52 | then |
---|
| 53 | cd kpp |
---|
| 54 | make distclean |
---|
| 55 | cd .. |
---|
| 56 | |
---|
| 57 | cd kpp4palm |
---|
| 58 | make distclean |
---|
| 59 | cd .. |
---|
| 60 | exit |
---|
| 61 | fi |
---|
| 62 | |
---|
| 63 | export PATH=$PATH:`pwd`/kpp4palm/bin |
---|
| 64 | |
---|
| 65 | # build kpp |
---|
| 66 | |
---|
| 67 | cp mechanisms/UserRateLaws.f90 kpp/util |
---|
| 68 | cd kpp |
---|
| 69 | make |
---|
| 70 | cd .. |
---|
| 71 | |
---|
| 72 | # build kpp4palm.exe |
---|
| 73 | |
---|
| 74 | cd kpp4palm |
---|
| 75 | make install |
---|
| 76 | cd .. |
---|
| 77 | |
---|
[3298] | 78 | # run kpp4palm/bin/kpp4palm.ksh with the following Setup |
---|
| 79 | # -d DEFDIR=$OPTARG;; # directory of definition files |
---|
| 80 | # (passed as `pwd`/mechanisms/def_$MECH) |
---|
| 81 | # -m MECH="smog";; # chemical mechanism |
---|
| 82 | # (smog, simple, simplep, cbm4, phstat, passive, passive1) |
---|
| 83 | # -i DE_INDEX=2;; # deindexing method (0,1,2,3; 0=no deindexing) |
---|
| 84 | # -v MODE="-v";; # vector mode on (not working completely yet) |
---|
| 85 | # -l VLEN=$OPTARG;; # Set vector length (not working completely yet) |
---|
| 86 | # -k KEEP="NO";; # if "yes" keep Working directory |
---|
| 87 | # -u UPDT="NO";; # if "yes" update the existing f90 code in the def_MECH directory |
---|
| 88 | # # Use "YES" with care as the existing sample file is overwritten |
---|
| 89 | # |
---|
| 90 | ## Further options (not passed as changing does not make sense to change these) |
---|
| 91 | ## -f DE_INDEX_FAST="YES";; # if set, fast deindexing |
---|
| 92 | ## -o OUTDIR=$OPTARG;; # Output directory of Generated Code |
---|
| 93 | ## (`pwd`/../../../SOURCE) |
---|
| 94 | ## -p PREFIX=$OPTARG;; # Name Prefix (chem_gasphase_mod) |
---|
| 95 | ## -s KPP_SOLVER=$OPTARG;; # Name Prefix (rosenbrock) |
---|
[2696] | 96 | |
---|
| 97 | |
---|
| 98 | echo $PATH |
---|
| 99 | # use smog mechnism as default |
---|
| 100 | MECH=smog |
---|
[3298] | 101 | DEIN=2 |
---|
[2696] | 102 | |
---|
[3298] | 103 | while getopts m:i:kuvl: opt # get options |
---|
[2696] | 104 | do case $opt in |
---|
| 105 | m) MECH=$OPTARG;; # mechanism name as part of mechanisms/def_[mechanism_name] |
---|
| 106 | |
---|
[3298] | 107 | i) DEIN=$OPTARG;; # deindexing method (0,1,2,3; 0=no deindexing) |
---|
| 108 | |
---|
[2699] | 109 | k) KEEP="-k";; # keep Working directory |
---|
| 110 | |
---|
[3298] | 111 | u) UPDT="-u";; # update sample output file |
---|
| 112 | |
---|
| 113 | v) MODE="-v";; # vector mode on |
---|
| 114 | |
---|
| 115 | c) COPY="-c";; # copy output to def_MECH |
---|
| 116 | |
---|
| 117 | l) VLEN=$OPTARG;; # Set vector length |
---|
| 118 | |
---|
[2696] | 119 | \?) print ${0##*/} "unknown option:" $OPTARG |
---|
[3298] | 120 | print "USAGE: ${0##*/} [ -m mechanism_name] [ -i n (n=0,1,2,3)] [ -k] [ -u] [ -v] [ -l N (N=vector length)]" |
---|
[2696] | 121 | exit 1;; |
---|
| 122 | esac |
---|
| 123 | done |
---|
[3298] | 124 | echo Now do kpp4palm for $MECH |
---|
[2696] | 125 | |
---|
[3298] | 126 | # kpp4palm.ksh -d `pwd`/mechanisms/def_$MECH -i $DEIN $KEEP $UPDT $MODE -l $VLEN |
---|
| 127 | kpp4palm.ksh -m $MECH -i $DEIN $KEEP $UPDT $MODE -l $VLEN |
---|