Ignore:
Timestamp:
Oct 30, 2018 2:51:23 PM (6 years ago)
Author:
kanani
Message:

Reintegrated fixes/changes from branch chemistry

Location:
palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/Makefile

    r2696 r3458  
    2828
    2929distclean: clean
    30         rm -f $(bindir)/kp4.exe
     30        rm -f $(bindir)/kpp4palm.exe
    3131
    3232# ----------------------------------------------
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh

    r3298 r3458  
    4040# -----------------
    4141# $Id$
     42# forkel   30. Oktober 2018: Integrating contents of kp4_compress into chem_gasphase_mod.f90
    4243# forkel   25. September 2018: Added cat for $MECH to pass mechanism name to kpp4palm
    4344# ketelsen 18. September 2018: Added cat for '#INLINE F90_GLOBAL'
     
    121122      k)   KEEP="YES";;              # keep Working directory
    122123
    123       o)   OUTDIR=$OPTARG;;          # Output directory of Generated Code
    124 
    125       p)   PREFIX=$OPTARG;;          # Name Prefix
    126 
    127       s)   KPP_SOLVER=$OPTARG;;      # Update sample f90 code in the def_MECH directory
    128 
    129       u)   UPDT="YES";;              # keep Working directory
     124      o)   OUTDIR=$OPTARG;;          # Output directory of Generated Code =
     125                                     # SOURCE directory (do not change)
     126
     127      p)   PREFIX=$OPTARG;;          # Name Prefix (chem_gasphase_mod, do not change)
     128
     129      s)   KPP_SOLVER=$OPTARG;;      # Chosen solver (only Rosebrock solvers work for vector mode)
     130
     131      u)   UPDT="YES";;              # update mechanisms/def_$MECH/chem_gasphase_mod.f90
    130132
    131133      v)   MODE="vector";;           # Set to vector Mode
     
    163165
    164166KPP_FILE_LIST="Initialize Integrator LinearAlgebra Jacobian Function Rates Util"
    165 
     167if [[ $MODE = "vector" ]]
     168 then
     169KPP_FILE_LIST="$KPP_FILE_LIST kp4_compress_subroutines"
     170fi
    166171
    167172KPP_SUBROUTINE_LIST="Initialize"
     
    189194   # get vector Solver
    190195   cp $BASE/templates/${KPP_SOLVER}_vec.f90 ${KPP_SOLVER}.f90
     196   cp $BASE/templates/kp4_compress_header ${PREFIX}_kp4_compress_header.f90
     197   cp $BASE/templates/kp4_compress_subroutines ${PREFIX}_kp4_compress_subroutines.f90
    191198fi
    192199
     
    207214         KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Rosenbrock  FunTemplate JacTemplate"
    208215        KPP_INTERFACE_IGNORE="WAXPY"
     216
    209217      else
    210218        KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST FunTemplate JacTemplate"
     219        KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST kco_initialize kco_compress kco_finalize"
    211220      fi;;
    212221
     
    246255
    247256KPP_INCLUDE_LIST="Parameters Global JacobianSP Monitor"
     257if [[ $MODE = "vector" ]]
     258 then
     259KPP_INCLUDE_LIST="$KPP_INCLUDE_LIST kp4_compress_header"
     260fi
    248261
    249262#Get definition Files
     
    309322done
    310323
    311 echo start kp4.exe with arguments
     324echo start kpp4palm.exe with arguments
    312325echo $PREFIX $MODE $VLEN $DE_INDEX $DE_INDEX_FAST
    313326
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C

    r3298 r3458  
    1212//Current revisions:
    1313//------------------
    14 / 
    15 / 
     14//
     15//
    1616//Former revisions:
    1717//-----------------
    18 //$Id: create_kpp_module.C 2470 2017-09-14 13:56:42Z forkel $
    19 // forkel 25.09.2018:  added  automatic line with meechanism name (read mech_list)
    20 // forkel 20.09.2018:  added  vl_glo = size(tempi,1)
    21 // ketelsen 18.09.2018: Removed creation of fill_ Subroutine and creation of calls thereof
    22 //
    23 // forkel 12.09.2018: Fix in order not to loose the values of qvap and fakt
    24 //
    25 // forkel 03.09.2018: Bug fix: moved kppi.add_line("    CALL initialize after fakt = fakti(is)
    26 // forkel June 2018: added qvap and fakt, re-established original uppercase/lowercase
    27 //                    Deleted definition of qvap,fakt in create_kpp_integrate again
    28 //
    29 // ketelsen July 2018: Changes for vector mode (edit_WAXPY, edit_FunTemplate, edit_JacTemplate,
    30 //                            some cleanup of comments, various changes in create_kpp_integrate)
    31 //
    32 // forkel June 2018: Added qvap and fakt, re-established original uppercase/lowercase
    33 //
    34 //
    35 / 2017-09-14 13:56:42Z forkel $
    36 // Removed preprocessor directive __chem again
    37 //
    38 // 2017-09-14 13:56:42Z forkel $
    39 //
     18//$Id: create_kpp_module.C 3453 2018-10-30 13:21:51Z forkel $
     19// exclude kco_compress from handling by global_variables2vector (30.10.2018, forkel)
     20//
     21// Added  automatic line with mechanism name (read mech_list) (25.09.2018, forkel)
     22//
     23// Added  vl_glo = size(tempi,1) (20.09.2018, forkel)
     24//
     25// Removed creation of fill_ Subroutine and creation of calls thereof (18.09.2018, ketelsen)
     26//
     27// Fix in order not to loose the values of qvap and fakt (12.09.2018, forkel)
     28//
     29// Bug fixes: moved kppi.add_line("    CALL initialize after fakt = fakti(is)
     30// Deleted definition of qvap,fakt in create_kpp_integrate again (03.09.2018, forkel)
     31//
     32// Changes for vector mode (edit_WAXPY, edit_FunTemplate, edit_JacTemplate,
     33// some cleanup of comments, various changes in create_kpp_integrate) (July 2018, ketelsen)
     34//
     35//
     36// Added qvap and fakt                            (June 2018, forkel)
     37// --> Change in module_header: qvap, fakt added  (June 2018, forkel)
     38//
     39// re-established original uppercase/lowercase     (June 2018, forkel)
     40// --> Change in module_header: reset case in  Initialize, Integrate, and
     41//     Update_rconst                               (June 2018, forkel)
     42//
     43// Removed preprocessor directive __chem again (2017-09-14, forkel)
    4044//
    41 //added phot
    42 //change of some output to lowercase with uppercase Fortran
    43 //
    44 // Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
    45 //
    46 
     45// Added phot                                                 (2017-09-14, forkel)
     46// --> Change in module_header: Variables for photolyis added (2017-09-14, forkel)
     47//
     48// change of some output to lowercase with uppercase Fortran (2017, forkel)
     49//
     50// Intial version of KP4 adapted to PALM                      (Nov. 2016, ketelsen)
     51//
    4752#include <stdio.h>
    48 //  mz_rs_20090111+
    4953// stdlib is necessary to define getenv:
    5054#include <stdlib.h>
    51 //  mz_rs_20090111-
    5255
    5356#include "create_kpp_module.h"
     
    131134     }
    132135
    133 //   Change global variables to vector
     136//   Change global variables to vector (except for kp4_compress, which has already the right form)
    134137     
    135138     for(it=kpp_subroutines.begin();it!=kpp_subroutines.end();it++) {
    136        it->global_variables2vector (global_variable_list);
     139       if(it->get_name() != "kco_compress" ) {
     140         it->global_variables2vector (global_variable_list);
     141       }
    137142     }
    138143
     
    162167       }
    163168     }
    164 // cout << "## after Edit individual subroutines    " <<endl;
    165 
    166169   }
    167170
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.h

    r3298 r3458  
    11#ifndef mecca
     2#define mecca 1
     3//
     4// ############################################################################
     5//
     6//     create_mz_kpp_module
     7//
     8//     create scalar code from .f90 sources created by KPP to be used in MESSy
     9//
     10//     COPYRIGHT Klaus Ketelsen and MPI-CH   April 2007
     11//
     12// ############################################################################
     13//
     14//Current revisions:
     15//------------------
     16//
     17//
     18// Former revisions:
     19// -----------------------
     20// $Id$
    221// ketelsen 18.09.2018: Removed create_fill_routine
    3 
    4 #include <iostream>
    5 #include <fstream>
    6 
    7 #include <string>
    8 #include <list>
    9 #include <vector>
    10 
    11 #include "fortran_file.h"
    12 #include "expand_decomp.h"
    13 
    14 // Class to create module which contains code generated by kpp.
    15 
    16 /
    17 /
    18 // ketelsen 18.09.2018: Removed create_fill_routine
     22//
     23// initial version                                  (Nov. 2016, ketelsen)
     24//
    1925
    2026#include <iostream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C

    r3298 r3458  
    99//
    1010// ############################################################################
     11//Current revisions:
     12//------------------
     13//
     14//
     15// Former revisions:
     16// -----------------------
     17// $Id: expand_decomp.C 3327 2018-10-09 19:55:00Z forkel $
     18//
     19// initial version                                  (Nov. 2016, ketelsen)
     20
    1121
    1222#include <fstream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.h

    r2696 r3458  
    1111//
    1212// ############################################################################
     13//Current revisions:
     14//------------------
     15//
     16//
     17// Former revisions:
     18// -----------------------
     19// $Id: expand_decomp.h 3327 2018-10-09 19:55:00Z forkel $
     20//
     21// initial version                                  (Nov. 2016, ketelsen)
     22
    1323
    1424#include <iostream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C

    r3298 r3458  
    1313//Current revisions:
    1414//------------------
    15 /
    16 /
     15//
     16//
    1717//Former revisions:
    1818//-----------------
    19 //$Id: fortran_file.C 2470 2017-09-14 13:56:42Z forkel $
    20 //  ketelsen 18.09.2018: (Rev 3260) added vector switch and creation of dimension statement
    21 //  forkel Sept.2018:  'fill_' routine applied to qvap and fakt
    22 //                      removal of unnecessary variables (LOOKAT, monitor etc. from Fortran code)
    23 //  forkel June 2018:  Moved adaption to PALM conventions to the end of the process
    24 //                     in order to make future use of vector code adaptations possible
    25 //  forkel 20.04.2018: Replace Roundoff = WLAMCH('E') by Roundoff = epsilon(one)
     19//$Id:
     20//
     21// Added vector switch and creation of dimension statement (rev. 3260, 18.09.2018, ketelsen)
    2622//
     23// removal of unnecessary variables (LOOKAT, monitor etc. from Fortran code) (Sept.2018, forkel)
    2724//
     25// Replace Roundoff = WLAMCH('E') by Roundoff = epsilon(one)   (20.04.2018, forkel)
    2826//
    29 / 2017-09-14 13:56:42Z forkel $
     27// Moved adaption to PALM conventions to the end of the processing kpp output
     28//  in order to make future use of vector code adaptations possible (June 2018, forkel)
     29//
     30// changed KPP-generated code to lowercase with uppercase Fortran  expressions
     31// added photolysis variables                               (2017-09-14, forkel)
    3032//
    31 //
    32 //changed KPP-generated code to lowercase with uppercase Fortran  expressions
    33 //added photolysis variables
    34 //
    35 //
    36 //
    37 //
    38 // Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
     33// Initial version of KP4 adapted to PALM                   (Nov 2016, ketelsen)
    3934//
    4035
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.h

    r3298 r3458  
    1414//Current revisions:
    1515//------------------
    16 /
    17 /
    18 //Former revisions:
    19 //-----------------
    20 // Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
    21 //  forkel Sept.2018:  added edit_Initialize
    22 //  forkel          :  added global_subtolower
    2316//
    24 / Intial version of KP4
    25 
     17//
     18// Former revisions:
     19// -----------------------
     20// $Id: fortran_file.h 3327 2018-10-09 19:55:00Z forkel $
     21//
     22// added edit_Initialize                            (Sept.2018, forkel)
     23//
     24// added global_subtolower                          (forkel)
     25// initial version                                  (Nov. 2016, ketelsen)
    2626
    2727#include <iostream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C

    r3298 r3458  
    99//
    1010// ############################################################################
     11//
    1112//Current revisions:
    1213//------------------
    13 / 
    14 / 
     14//
     15//
    1516//Former revisions:
    16 //-----------------
    17 //$Id: fortran_file.C 2470 2017-09-14 13:56:42Z forkel $
    18 //  ketelsen 18.09.2018: Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j
    19 //
    20 //  forkel Sept.2018:  added edit_Initialize
    21 //                     changed loop direction for update_rconst in edit_Update_RCONST
    22 / 2017-09-14 13:56:42Z forkel $
    23 //
    24 //
    25 // Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
    26 //
    27 
     17//-----------------------
     18//$Id: fortran_file_vec.C 3327 2018-10-09 19:55:00Z forkel $
     19// Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j (18.09.2018, ketelsen)
     20//
     21// added edit_Initialize, changed loop direction for update_rconst in edit_Update_RCONST (Sept. 2018, forkel)
     22//
     23// initial version       (Nov. 2016, ketelsen)
     24//
    2825
    2926#include <fstream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/main.C

    r2696 r3458  
    99//
    1010// ############################################################################
     11//
     12//Current revisions:
     13//------------------
     14//
     15//
     16// Former revisions:
     17// -----------------------
     18// $Id: main.C 3327 2018-10-09 19:55:00Z forkel $
     19//
     20// initial version       (Nov. 2016, ketelsen)
     21//
    1122
    1223//  mz_rs_20090111+
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.C

    r3298 r3458  
    99//
    1010// ############################################################################
     11//
     12//Current revisions:
     13//------------------
     14//
     15//
     16// Former revisions:
     17// -----------------------
     18// $Id: program_line.C 3327 2018-10-09 19:55:00Z forkel $
     19//
     20// global_subtolower     (June 2018, forkel)
     21//
     22// initial version       (Nov. 2016, ketelsen)
     23//
     24
    1125
    1226#include "program_line.h"
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.h

    r3298 r3458  
    1212// ############################################################################
    1313//
    14 // forkel June 2018: added    void   global_subtolower(string &line);
     14//Current revisions:
     15//------------------
     16//
     17//
     18// Former revisions:
     19// -----------------------
     20// $Id: program_line.h 3327 2018-10-09 19:55:00Z forkel $
     21//
     22// added    void   global_subtolower(string &line); (June 2018, forkel)
     23//
     24// initial version                                  (Nov. 2016, ketelsen)
    1525
    1626#include <iostream>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.C

    r2696 r3458  
    99//
    1010// ############################################################################
     11//
     12//Current revisions:
     13//------------------
     14//
     15//
     16// Former revisions:
     17// -----------------------
     18// $Id: utils.C 3327 2018-10-09 19:55:00Z forkel $
     19//
     20// initial version                                  (Nov. 2016, ketelsen)
     21
    1122
    1223//  mz_rs_20090111+
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.h

    r2696 r3458  
    1111//
    1212// ############################################################################
     13//
     14//Current revisions:
     15//------------------
     16//
     17//
     18// Former revisions:
     19// -----------------------
     20// $Id: utils.h 3327 2018-10-09 19:55:00Z forkel $
     21//
     22// initial version                                  (Nov. 2016, ketelsen)
     23//
    1324
    1425#include <string>
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/Rosenbrock_vec.f90

    r3298 r3458  
    22!       and can only be used with KP4.
    33!
     4!Current revisions:
     5!------------------
     6!
     7!
     8! Former revisions:
     9! -----------------------
     10! $Id$
     11! commented USE kp4_compress                       (30.10.2018, forkel)
     12!
     13! initial version (Rev. 3185)                      (June 2018, ketelsen)
     14!
     15
    416SUBROUTINE Rosenbrock(N,Y,Tstart,Tend, &
    517           AbsTol,RelTol,              &
     
    358370!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    359371
    360   USE kp4_compress,    ONLY: kco_initialize, kco_compress, &
    361                              kco_finalize, cell_done
     372! USE kp4_compress,    ONLY: kco_initialize, kco_compress, &
     373!                            kco_finalize, cell_done
    362374  IMPLICIT NONE
    363375
  • palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header

    r3298 r3458  
    4040!--------------------------------------------------------------------------------!
    4141!
    42 ! Current revisions:
    43 ! ------------------
    44 !
    45 !
    46 ! Former revisions:
    47 ! -----------------
    48 ! $Id: module_header 2460 2017-09-13 14:47:48Z forkel $
    49 ! forkel June 2018: qvap, fakt added
    50 ! forkel June 2018: reset case in  Initialize, Integrate, Update_rconst
    51 !
    52 !
    53 ! 2460 2017-09-13 14:47:48Z forkel
    5442!
    55 ! forkel Sept. 2017: Variables for photolyis added
     43! MODULE HEADER TEMPLATE
    5644!
    57 !
    58 ! Nov. 2016: Intial version (Klaus Ketelsen)
    59 !
    60 !------------------------------------------------------------------------------!
    61 !
    62 
     45!  Initial version (Nov. 2016, ketelsen), for later modifications of module_header
     46!  see comments in kpp4palm/src/create_kpp_module.C
    6347
    6448! Set kpp Double Precision to PALM Default Precision
Note: See TracChangeset for help on using the changeset viewer.