source: palm/trunk/UTIL/chemistry/gasphase_preproc/run_kpp4palm.sh @ 4451

Last change on this file since 4451 was 4451, checked in by raasch, 5 years ago

kpp4 scripts converted from ksh to bash, default mechanism changed from smog to phstatp

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