1 | #!/bin/bash |
---|
2 | # |
---|
3 | # run_kpp4palm - script for running gasphase preprocessor |
---|
4 | |
---|
5 | #------------------------------------------------------------------------------# |
---|
6 | # This file is part of the PALM model system. |
---|
7 | # |
---|
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 | # |
---|
19 | # Copyright 2017-2020 Klaus Ketelsen and MPI-CH (April 2007) |
---|
20 | # Copyright 2017-2020 Karlsruhe Institute of Technology |
---|
21 | # Copyright 2017-2020 Leibniz Universitaet Hannover |
---|
22 | #------------------------------------------------------------------------------# |
---|
23 | # |
---|
24 | # Current revisions: |
---|
25 | # ------------------ |
---|
26 | # |
---|
27 | # |
---|
28 | # Former revisions: |
---|
29 | # ----------------- |
---|
30 | # $Id: run_kpp4palm.sh 4481 2020-03-31 18:55:54Z Giersch $ |
---|
31 | # updated some comments |
---|
32 | # |
---|
33 | # |
---|
34 | # 4451 2020-03-10 07:25:32Z raasch |
---|
35 | # rename run_kpp4palm.ksh to run_kpp4palm.sh, convert to bash |
---|
36 | # default mechanism changed to phstatp |
---|
37 | # |
---|
38 | # 3487 2018-11-05 07:18:02Z maronga |
---|
39 | # Some correctetion of comments |
---|
40 | # |
---|
41 | # 3458 2018-10-30 14:51:23Z kanani |
---|
42 | # passed $MECH insted of $DEFDIR to kpp4palm.ksh forkel 25. Sept. 2018 |
---|
43 | # re-activaded choice of deindexing method and vector mode forkel June 2018 |
---|
44 | # |
---|
45 | # 2718 2018-01-02 08:49:38Z maronga |
---|
46 | # Initial revision |
---|
47 | # |
---|
48 | # |
---|
49 | # |
---|
50 | # |
---|
51 | # Other notes: |
---|
52 | # ------------ |
---|
53 | # Small adaptations (added MECH as argument, re-introduced relative path, |
---|
54 | # adaption to changing kp4 to kpp4palm) |
---|
55 | # filename changed from run_kp4.ksh to run_kpp4palm.ksh |
---|
56 | # |
---|
57 | # Nov. 2016: Initial Version of KPP chemistry by Klaus Ketelsen |
---|
58 | # |
---|
59 | |
---|
60 | echo "\$1 = " $1 |
---|
61 | |
---|
62 | if [[ $1 == "clean" ]] |
---|
63 | then |
---|
64 | cd kpp |
---|
65 | make distclean |
---|
66 | cd .. |
---|
67 | |
---|
68 | cd kpp4palm |
---|
69 | make distclean |
---|
70 | cd .. |
---|
71 | exit |
---|
72 | fi |
---|
73 | |
---|
74 | export PATH=$PATH:`pwd`/kpp4palm/bin |
---|
75 | |
---|
76 | # build kpp |
---|
77 | |
---|
78 | cp mechanisms/UserRateLaws.f90 kpp/util |
---|
79 | cd kpp |
---|
80 | make |
---|
81 | cd .. |
---|
82 | |
---|
83 | # build kpp4palm.exe |
---|
84 | |
---|
85 | cd kpp4palm |
---|
86 | make install |
---|
87 | cd .. |
---|
88 | |
---|
89 | # run kpp4palm/bin/kpp4palm.sh with the following arguments |
---|
90 | # |
---|
91 | # -m MECH="phstatp";; # chemical mechanism |
---|
92 | # (phstat, phstatp, smog, simple,cbm4, etc, see directory mechanisms) |
---|
93 | # -i DE_INDEX=2;; # deindexing method (0,1,2,3; 0=no deindexing) |
---|
94 | # -v MODE="-v";; # vector mode on (not working completely yet) |
---|
95 | # -l VLEN=$OPTARG;; # Set vector length (not working completely yet) |
---|
96 | # -k KEEP="NO";; # if "yes" keep Working directory |
---|
97 | # -u UPDT="NO";; # if "yes" update the existing f90 code in the def_MECH directory |
---|
98 | # # Use "YES" with care as the existing sample file is overwritten |
---|
99 | # |
---|
100 | ## Further options (currently not passed as changing does not make sense to change these) |
---|
101 | ## -f DE_INDEX_FAST="YES";; # if set, fast deindexing |
---|
102 | ## -o OUTDIR=$OPTARG;; # Output directory of Generated Code |
---|
103 | ## (`pwd`/../../../SOURCE) |
---|
104 | ## -p PREFIX=$OPTARG;; # Name Prefix (chem_gasphase_mod) |
---|
105 | ## -s KPP_SOLVER=$OPTARG;; # Name Prefix (rosenbrock) |
---|
106 | |
---|
107 | |
---|
108 | echo $PATH |
---|
109 | # use phstatp (photo-stationary) mechanism as default |
---|
110 | MECH=phstatp |
---|
111 | DEIN=2 |
---|
112 | |
---|
113 | while getopts m:i:kuvl: opt # get options |
---|
114 | do case $opt in |
---|
115 | m) MECH=$OPTARG;; # mechanism name as part of mechanisms/def_[mechanism_name] |
---|
116 | |
---|
117 | i) DEIN=$OPTARG;; # deindexing method (0,1,2,3; 0=no deindexing) |
---|
118 | |
---|
119 | k) KEEP="-k";; # keep Working directory |
---|
120 | |
---|
121 | u) UPDT="-u";; # update sample output file |
---|
122 | |
---|
123 | v) MODE="-v";; # vector mode on |
---|
124 | |
---|
125 | c) COPY="-c";; # copy output to def_MECH |
---|
126 | |
---|
127 | l) VLEN=$OPTARG;; # Set vector length |
---|
128 | |
---|
129 | \?) print ${0##*/} "unknown option:" $OPTARG |
---|
130 | print "USAGE: ${0##*/} [ -m mechanism_name] [ -i n (n=0,1,2,3)] [ -k] [ -u] [ -v] [ -l N (N=vector length)]" |
---|
131 | exit 1;; |
---|
132 | esac |
---|
133 | done |
---|
134 | echo Now do kpp4palm for $MECH |
---|
135 | |
---|
136 | kpp4palm.sh -m $MECH -i $DEIN $KEEP $UPDT $MODE -l $VLEN |
---|