Index: palm/trunk/UTIL/chemistry/gasphase_preproc/mechanisms/def_salsa+phstat/chem_gasphase_mod.f90
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/mechanisms/def_salsa+phstat/chem_gasphase_mod.f90	(revision 3944)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/mechanisms/def_salsa+phstat/chem_gasphase_mod.f90	(revision 3949)
@@ -117,6 +117,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Parameters.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -130,25 +130,25 @@
 
 ! NSPEC - Number of chemical species
-  INTEGER, PARAMETER :: nspec = 3 
+  INTEGER, PARAMETER :: nspec = 8 
 ! NVAR - Number of Variable species
-  INTEGER, PARAMETER :: nvar = 3 
+  INTEGER, PARAMETER :: nvar = 8 
 ! NVARACT - Number of Active species
-  INTEGER, PARAMETER :: nvaract = 3 
+  INTEGER, PARAMETER :: nvaract = 8 
 ! NFIX - Number of Fixed species
   INTEGER, PARAMETER :: nfix = 1 
 ! NREACT - Number of reactions
-  INTEGER, PARAMETER :: nreact = 2 
+  INTEGER, PARAMETER :: nreact = 7 
 ! NVARST - Starting of variables in conc. vect.
   INTEGER, PARAMETER :: nvarst = 1 
 ! NFIXST - Starting of fixed in conc. vect.
-  INTEGER, PARAMETER :: nfixst = 4 
+  INTEGER, PARAMETER :: nfixst = 9 
 ! NONZERO - Number of nonzero entries in Jacobian
-  INTEGER, PARAMETER :: nonzero = 9 
+  INTEGER, PARAMETER :: nonzero = 14 
 ! LU_NONZERO - Number of nonzero entries in LU factoriz. of Jacobian
-  INTEGER, PARAMETER :: lu_nonzero = 9 
+  INTEGER, PARAMETER :: lu_nonzero = 14 
 ! CNVAR - (NVAR+1) Number of elements in compressed row format
-  INTEGER, PARAMETER :: cnvar = 4 
+  INTEGER, PARAMETER :: cnvar = 9 
 ! CNEQN - (NREACT+1) Number stoicm elements in compressed col format
-  INTEGER, PARAMETER :: cneqn = 3 
+  INTEGER, PARAMETER :: cneqn = 8 
 ! NHESS - Length of Sparse Hessian
   INTEGER, PARAMETER :: nhess = 3 
@@ -159,7 +159,12 @@
 !   VAR(ind_spc) = C(ind_spc)
 
-  INTEGER, PARAMETER, PUBLIC :: ind_o3 = 1 
-  INTEGER, PARAMETER, PUBLIC :: ind_no = 2 
-  INTEGER, PARAMETER, PUBLIC :: ind_no2 = 3 
+  INTEGER, PARAMETER, PUBLIC :: ind_hno3 = 1 
+  INTEGER, PARAMETER, PUBLIC :: ind_h2so4 = 2 
+  INTEGER, PARAMETER, PUBLIC :: ind_nh3 = 3 
+  INTEGER, PARAMETER, PUBLIC :: ind_ocnv = 4 
+  INTEGER, PARAMETER, PUBLIC :: ind_ocsv = 5 
+  INTEGER, PARAMETER, PUBLIC :: ind_no2 = 6 
+  INTEGER, PARAMETER, PUBLIC :: ind_o3 = 7 
+  INTEGER, PARAMETER, PUBLIC :: ind_no = 8 
 
 ! Index declaration for fixed species in C
@@ -172,5 +177,5 @@
 
 ! NJVRP - Length of sparse Jacobian JVRP
-  INTEGER, PARAMETER :: njvrp = 3 
+  INTEGER, PARAMETER :: njvrp = 8 
 
 ! NSTOICM - Length of Sparse Stoichiometric Matrix
@@ -193,6 +198,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Global.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -232,13 +237,4 @@
 
 ! QVAP - Water vapor
-! REAL(dp),dimension(:),allocatable             :: qvap
-  REAL(dp)                                    :: qvap
-! FAKT - Conversion factor
-! REAL(dp),dimension(:),allocatable             :: fakt
-  REAL(dp)                                    :: fakt
-
-  !   declaration of global variable declarations for photolysis will come from 
-
-! QVAP - Water vapor
   REAL(kind=dp):: qvap
 ! FAKT - Conversion factor
@@ -267,6 +263,6 @@
 ! 
 ! File                 : chem_gasphase_mod_JacobianSP.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -282,15 +278,17 @@
 
 
-  INTEGER, PARAMETER, DIMENSION(9):: lu_irow =  (/ &
-       1, 1, 1, 2, 2, 2, 3, 3, 3 /) 
-
-  INTEGER, PARAMETER, DIMENSION(9):: lu_icol =  (/ &
-       1, 2, 3, 1, 2, 3, 1, 2, 3 /) 
-
-  INTEGER, PARAMETER, DIMENSION(4):: lu_crow =  (/ &
-       1, 4, 7, 10 /) 
-
-  INTEGER, PARAMETER, DIMENSION(4):: lu_diag =  (/ &
-       1, 5, 9, 10 /) 
+  INTEGER, PARAMETER, DIMENSION(14):: lu_irow =  (/ &
+       1, 2, 3, 4, 5, 6, 6, 6, 7, 7, 7, 8, &
+       8, 8 /) 
+
+  INTEGER, PARAMETER, DIMENSION(14):: lu_icol =  (/ &
+       1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 6, &
+       7, 8 /) 
+
+  INTEGER, PARAMETER, DIMENSION(9):: lu_crow =  (/ &
+       1, 2, 3, 4, 5, 6, 9, 12, 15 /) 
+
+  INTEGER, PARAMETER, DIMENSION(9):: lu_diag =  (/ &
+       1, 2, 3, 4, 5, 6, 10, 14, 15 /) 
 
 
@@ -311,6 +309,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Monitor.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -322,10 +320,17 @@
 
 
-  CHARACTER(len=15), PARAMETER, DIMENSION(3):: spc_names =  (/ &
-     'O3             ','NO             ','NO2            ' /)
-
-  CHARACTER(len=100), PARAMETER, DIMENSION(2):: eqn_names =  (/ &
+  CHARACTER(len=15), PARAMETER, DIMENSION(8):: spc_names =  (/ &
+     'HNO3           ','H2SO4          ','NH3            ',&
+     'OCNV           ','OCSV           ','NO2            ',&
+     'O3             ','NO             ' /)
+
+  CHARACTER(len=100), PARAMETER, DIMENSION(7):: eqn_names =  (/ &
      '    NO2 --> O3 + NO                                                                                 ',&
-     'O3 + NO --> NO2                                                                                     ' /)
+     'O3 + NO --> NO2                                                                                     ',&
+     '  H2SO4 --> H2SO4                                                                                   ',&
+     '   HNO3 --> HNO3                                                                                    ',&
+     '    NH3 --> NH3                                                                                     ',&
+     '   OCNV --> OCNV                                                                                    ',&
+     '   OCSV --> OCSV                                                                                    ' /)
 
 ! INLINED global variables
@@ -371,6 +376,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Initialize.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -397,6 +402,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Integrator.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -455,6 +460,6 @@
 ! 
 ! File                 : chem_gasphase_mod_LinearAlgebra.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -482,6 +487,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Jacobian.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -509,6 +514,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Function.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -538,6 +543,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Rates.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -564,6 +569,6 @@
 ! 
 ! File                 : chem_gasphase_mod_Util.f90
-! Time                 : Thu Mar 28 15:59:27 2019
-! Working directory    : /home/forkel-r/palmstuff/work/trunk20190327/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
+! Time                 : Fri May  3 17:24:49 2019
+! Working directory    : /home/forkel-r/palmstuff/work/trunk20190503/UTIL/chemistry/gasphase_preproc/tmp_kpp4palm
 ! Equation file        : chem_gasphase_mod.kpp
 ! Output root filename : chem_gasphase_mod
@@ -792,11 +797,16 @@
 !  
 ! Computation of equation rates
-  a(1) = rct(1) * v(3)
-  a(2) = rct(2) * v(1) * v(2)
+  a(1) = rct(1) * v(6)
+  a(2) = rct(2) * v(7) * v(8)
 
 ! Aggregate function
-  vdot(1) = a(1) - a(2)
-  vdot(2) = a(1) - a(2)
-  vdot(3) = - a(1) + a(2)
+  vdot(1) = 0
+  vdot(2) = 0
+  vdot(3) = 0
+  vdot(4) = 0
+  vdot(5) = 0
+  vdot(6) = - a(1) + a(2)
+  vdot(7) = a(1) - a(2)
+  vdot(8) = a(1) - a(2)
       
 END SUBROUTINE fun
@@ -809,9 +819,14 @@
   REAL(kind=dp):: x(nvar)
 
-  x(2) = x(2) - jvs(4) * x(1)
-  x(3) = x(3) - jvs(7) * x(1) - jvs(8) * x(2)
-  x(3) = x(3) / jvs(9)
-  x(2) = (x(2) - jvs(6) * x(3)) /(jvs(5))
-  x(1) = (x(1) - jvs(2) * x(2) - jvs(3) * x(3)) /(jvs(1))
+  x(7) = x(7) - jvs(9) * x(6)
+  x(8) = x(8) - jvs(12) * x(6) - jvs(13) * x(7)
+  x(8) = x(8) / jvs(14)
+  x(7) = (x(7) - jvs(11) * x(8)) /(jvs(10))
+  x(6) = (x(6) - jvs(7) * x(7) - jvs(8) * x(8)) /(jvs(6))
+  x(5) = x(5) / jvs(5)
+  x(4) = x(4) / jvs(4)
+  x(3) = x(3) / jvs(3)
+  x(2) = x(2) / jvs(2)
+  x(1) = x(1) / jvs(1)
       
 END SUBROUTINE kppsolve
@@ -831,35 +846,55 @@
 ! Local variables
 ! B - Temporary array
-  REAL(kind=dp):: b(3)
+  REAL(kind=dp):: b(8)
 !
 ! Following line is just to avoid compiler message about unused variables
    IF ( f(nfix) > 0.0_dp )  CONTINUE
 
-! B(1) = dA(1)/dV(3)
+! B(1) = dA(1)/dV(6)
   b(1) = rct(1)
-! B(2) = dA(2)/dV(1)
-  b(2) = rct(2) * v(2)
-! B(3) = dA(2)/dV(2)
-  b(3) = rct(2) * v(1)
+! B(2) = dA(2)/dV(7)
+  b(2) = rct(2) * v(8)
+! B(3) = dA(2)/dV(8)
+  b(3) = rct(2) * v(7)
+! B(4) = dA(3)/dV(2)
+  b(4) = rct(3)
+! B(5) = dA(4)/dV(1)
+  b(5) = rct(4)
+! B(6) = dA(5)/dV(3)
+  b(6) = rct(5)
+! B(7) = dA(6)/dV(4)
+  b(7) = rct(6)
+! B(8) = dA(7)/dV(5)
+  b(8) = rct(7)
 
 ! Construct the Jacobian terms from B's
 ! JVS(1) = Jac_FULL(1,1)
-  jvs(1) = - b(2)
-! JVS(2) = Jac_FULL(1,2)
-  jvs(2) = - b(3)
-! JVS(3) = Jac_FULL(1,3)
-  jvs(3) = b(1)
-! JVS(4) = Jac_FULL(2,1)
-  jvs(4) = - b(2)
-! JVS(5) = Jac_FULL(2,2)
-  jvs(5) = - b(3)
-! JVS(6) = Jac_FULL(2,3)
-  jvs(6) = b(1)
-! JVS(7) = Jac_FULL(3,1)
+  jvs(1) = 0
+! JVS(2) = Jac_FULL(2,2)
+  jvs(2) = 0
+! JVS(3) = Jac_FULL(3,3)
+  jvs(3) = 0
+! JVS(4) = Jac_FULL(4,4)
+  jvs(4) = 0
+! JVS(5) = Jac_FULL(5,5)
+  jvs(5) = 0
+! JVS(6) = Jac_FULL(6,6)
+  jvs(6) = - b(1)
+! JVS(7) = Jac_FULL(6,7)
   jvs(7) = b(2)
-! JVS(8) = Jac_FULL(3,2)
+! JVS(8) = Jac_FULL(6,8)
   jvs(8) = b(3)
-! JVS(9) = Jac_FULL(3,3)
-  jvs(9) = - b(1)
+! JVS(9) = Jac_FULL(7,6)
+  jvs(9) = b(1)
+! JVS(10) = Jac_FULL(7,7)
+  jvs(10) = - b(2)
+! JVS(11) = Jac_FULL(7,8)
+  jvs(11) = - b(3)
+! JVS(12) = Jac_FULL(8,6)
+  jvs(12) = b(1)
+! JVS(13) = Jac_FULL(8,7)
+  jvs(13) = - b(2)
+! JVS(14) = Jac_FULL(8,8)
+  jvs(14) = - b(3)
       
 END SUBROUTINE jac_sp
@@ -890,4 +925,9 @@
   rconst(1) = (phot(j_no2))
   rconst(2) = (arr2(1.8e-12_dp , 1370.0_dp , temp))
+  rconst(3) = (1.0_dp)
+  rconst(4) = (1.0_dp)
+  rconst(5) = (1.0_dp)
+  rconst(6) = (1.0_dp)
+  rconst(7) = (1.0_dp)
       
 END SUBROUTINE update_rconst
@@ -2282,12 +2322,17 @@
 !   i = 1
 !   i = 2
-    jvs(4) = (jvs(4)) / jvs(1) 
-    jvs(5) = jvs(5) - jvs(2) * jvs(4)
-    jvs(6) = jvs(6) - jvs(3) * jvs(4)
 !   i = 3
-    jvs(7) = (jvs(7)) / jvs(1) 
-    a = 0.0; a = a  - jvs(2) * jvs(7)
-    jvs(8) = (jvs(8) + a) / jvs(5) 
-    jvs(9) = jvs(9) - jvs(3) * jvs(7) - jvs(6) * jvs(8)
+!   i = 4
+!   i = 5
+!   i = 6
+!   i = 7
+    jvs(9) = (jvs(9)) / jvs(6) 
+    jvs(10) = jvs(10) - jvs(7) * jvs(9)
+    jvs(11) = jvs(11) - jvs(8) * jvs(9)
+!   i = 8
+    jvs(12) = (jvs(12)) / jvs(6) 
+    a = 0.0; a = a  - jvs(7) * jvs(12)
+    jvs(13) = (jvs(13) + a) / jvs(10) 
+    jvs(14) = jvs(14) - jvs(8) * jvs(12) - jvs(11) * jvs(13)
     RETURN                                                            
                                                                       
