Index: palm/trunk/SOURCE/chem_photolysis_mod.f90
===================================================================
--- palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 3824)
+++ palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 3838)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! some formatting and comments added 
+! 
+! 3824 2019-03-27 15:56:16Z pavelkrc
 ! unused variables removed
 ! 
@@ -53,5 +56,5 @@
 ! ------------
 !> photolysis models and interfaces (Adapted from photolysis_model_mod.f90)
-!> @todo Alles!
+!> @todo more complex scheme, add shading
 !------------------------------------------------------------------------------!
  MODULE chem_photolysis_mod
@@ -63,5 +66,6 @@
         ONLY:  time_since_reference_point
 
-    USE pegrid,             ONLY: myid, threads_per_task
+    USE pegrid,                                                                &
+        ONLY: myid, threads_per_task
 
     USE indices,                                                               &
@@ -102,42 +106,42 @@
 
 ! Names for predefined fixed photolysis frequencies at zenith angle 0
-    CHARACTER(LEN=10), PARAMETER, DIMENSION(nconst) :: names_c =  (/                    &
-                     'J_O31D    ','J_O33P    ','J_NO2     ','J_HNO3    ','J_RCHO    ', &
-                     'J         ','J         ','J         ','J         ','J         ', &
+    CHARACTER(LEN=10), PARAMETER, DIMENSION(nconst) :: names_c =  (/                     &
+                     'J_O31D    ','J_O33P    ','J_NO2     ','J_HNO3    ','J_RCHO    ',   &
+                     'J         ','J         ','J         ','J         ','J         ',   &
                      'J         ','J         ','J         ','J         ','J         ' /)
-! Photolysis frequency at zenith angle 0 in 1/s
-    REAL(wp), PARAMETER, DIMENSION(nconst) :: phot0 =  (/                             &
-                      2.489E-05_wp,3.556E-04_wp, 8.89E-03_wp,5.334E-07_wp,3.734E-05_wp, &
-                      0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp, &
+! Photolysis frequency at zenith angle 0 degrees in 1/s
+    REAL(wp), PARAMETER, DIMENSION(nconst) :: phot0 =  (/                                &
+                      2.489E-05_wp,3.556E-04_wp, 8.89E-03_wp,5.334E-07_wp,3.734E-05_wp,  &
+                      0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,  &
                       0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp /)
 
-
-!-- Parameters for simple photolysis frequencies
-    INTEGER,PARAMETER :: nsimple = 15               !< available predefined photolysis prequencies for simpel parameterisation
+!-- Parameters for simple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
+!-- Saunders et al., 2003, Atmos. Chem. Phys., 3, 161-180
+   INTEGER,PARAMETER :: nsimple = 15               !< available predefined photolysis prequencies for simple parameterisation
 ! Names for simple photolysis frequencies parameterisation (
-     CHARACTER(LEN=10), PARAMETER, DIMENSION(nsimple) :: names_s =  (/                 &
-                     'J_O31D    ','J_O33P    ','J_H2O2    ','J_NO2     ','J_NO3_A   ', &
-                     'J_NO3_B   ','J_HONO    ','J_HNO3    ','J_HCHO_A  ','J_HCHO_B  ', &
+    CHARACTER(LEN=10), PARAMETER, DIMENSION(nsimple) :: names_s =  (/                    &
+                     'J_O31D    ','J_O33P    ','J_H2O2    ','J_NO2     ','J_NO3_A   ',   &
+                     'J_NO3_B   ','J_HONO    ','J_HNO3    ','J_HCHO_A  ','J_HCHO_B  ',   &
                      'J_CH3CHO  ','J         ','J         ','J         ','J_RCHO    ' /)
 
-!-- Parameters for simeple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
-!-- Saunders et al., 2003, Atmos. Chem. Phys., 3, 161-180
-     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_l =  (/                             &
-                     6.073E-05_wp,4.775E-04_wp,1.041E-05_wp,1.165E-02_wp,2.485E-02_wp, &
-                     1.747E-01_wp,2.644E-03_wp,9.312E-07_wp,4.642E-05_wp,6.853E-05_wp, &
-                     7.344E-06_wp,0.0000E00_wp,0.0000E00_wp,0.000E00_wp, 6.853E-05_wp /)
-
-     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_m =  (/                             &
-                         1.743_wp,    0.298_wp,    0.723_wp,    0.244_wp,    0.168_wp, &
-                         0.155_wp,    0.261_wp,    1.230_wp,    0.762_wp,    0.477_wp, &
-                         1.202_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.477_wp /)
-
-     REAL(wp), PARAMETER, DIMENSION(nconst) :: par_n =  (/                             &
-                         0.474_wp,    0.080_wp,    0.279_wp,    0.267_wp,    0.108_wp, &
-                         0.125_wp,    0.288_wp,    0.307_wp,    0.353_wp,    0.323_wp, &
-                         0.417_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.323_wp /)
-
-
-    REAL(wp)     :: cosz = 0.7_wp                   !< cosine of Zenith angle (45 deg, if not specified otherwise)
+!-- Species dependent parameters for simple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
+!-- J = l*COSx@m*EXP(-n*SECx)  with l,m,n named par_l etc., x is the zenith angle
+   REAL(wp), PARAMETER, DIMENSION(nconst) :: par_l =  (/                                 &
+                       6.073E-05_wp,4.775E-04_wp,1.041E-05_wp,1.165E-02_wp,2.485E-02_wp, &
+                       1.747E-01_wp,2.644E-03_wp,9.312E-07_wp,4.642E-05_wp,6.853E-05_wp, &
+                       7.344E-06_wp,0.0000E00_wp,0.0000E00_wp,0.000E00_wp, 6.853E-05_wp /)
+
+   REAL(wp), PARAMETER, DIMENSION(nconst) :: par_m =  (/                                 &
+                           1.743_wp,    0.298_wp,    0.723_wp,    0.244_wp,    0.168_wp, &
+                           0.155_wp,    0.261_wp,    1.230_wp,    0.762_wp,    0.477_wp, &
+                           1.202_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.477_wp /)
+
+   REAL(wp), PARAMETER, DIMENSION(nconst) :: par_n =  (/                                 &
+                           0.474_wp,    0.080_wp,    0.279_wp,    0.267_wp,    0.108_wp, &
+                           0.125_wp,    0.288_wp,    0.307_wp,    0.353_wp,    0.323_wp, &
+                           0.417_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.323_wp /)
+
+
+    REAL(wp)     :: cosz = 0.7_wp                   !< cosine of fixed zenith angle (45 deg, if not specified otherwise)
 
 !
@@ -158,5 +162,4 @@
     END INTERFACE photolysis_control
 
-
     SAVE
 
@@ -166,5 +169,4 @@
 
     PUBLIC  photolysis_scheme
-!
 
  CONTAINS
@@ -176,25 +178,25 @@
 !> This subroutine controls the calls of the photolysis schemes
 !------------------------------------------------------------------------------!
-    SUBROUTINE photolysis_control
+ SUBROUTINE photolysis_control
  
-       IMPLICIT NONE
-
-       SELECT CASE ( TRIM( photolysis_scheme ) )
-
-          CASE ( 'constant' )
-             CALL photolysis_constant
+    IMPLICIT NONE
+
+    SELECT CASE ( TRIM( photolysis_scheme ) )
+
+       CASE ( 'constant' )
+          CALL photolysis_constant
           
-          CASE ( 'simple' )
-             CALL photolysis_simple
+       CASE ( 'simple' )
+          CALL photolysis_simple
        
-!         CASE ( 'fastj' )
-!            CALL photolysis_fastj
-
-          CASE DEFAULT
-
-       END SELECT
-
-
-    END SUBROUTINE photolysis_control
+!      CASE ( 'fastj' )
+!         CALL photolysis_fastj
+
+       CASE DEFAULT
+
+    END SELECT
+
+
+ END SUBROUTINE photolysis_control
 
 
@@ -205,59 +207,63 @@
 !> Default zenith angle is 45 deg
 !------------------------------------------------------------------------------!
-    SUBROUTINE photolysis_constant
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
-
-       DO iphot = 1,nphot
-          DO iav = 1,nconst
-             IF ( TRIM( names_c(iav) ) == TRIM( phot_names(iphot) ) ) then
-!--             Prescribe fixed photolysis frequencies  [1/s]
-                phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =    &
+ SUBROUTINE photolysis_constant
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
+
+    DO  iphot = 1, nphot
+       DO  iav = 1, nconst
+          IF ( TRIM( names_c(iav) ) == TRIM( phot_names(iphot) ) ) THEN
+!--  Prescribe fixed photolysis frequencies  [1/s]
+                phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =                      &
                              phot0(iav) * cosz
+          ENDIF
+       ENDDO
+    ENDDO
+
+
+ END SUBROUTINE photolysis_constant
+
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> This scheme applies a simple parameterisation for clear sky photolysis frequencies 
+!> from the Master Chemical Mechanism, MCM v3.2 (http://mcm.leeds.ac.uk/MCM).
+!> Reference: Saunders et al., Atmos. Chem. Phys., 3, 161, 2003
+!> J = l*COSx@m*EXP(-n*SECx)  with l,m,n named par_l etc., x is the zenith angle
+!------------------------------------------------------------------------------!
+ SUBROUTINE photolysis_simple
+
+    USE radiation_model_mod,                                                   &
+        ONLY:  calc_zenith, cos_zenith
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
+    REAL(wp)     :: coszi     !< 1./cosine of zenith angle
+
+    DO  iphot = 1, nphot
+       phot_frequen(iphot)%freq = 0.0_wp
+    ENDDO
+
+    CALL calc_zenith
+
+    IF ( cos_zenith > 0.0_wp ) THEN
+       coszi = 1. / cos_zenith
+
+       DO iphot = 1, nphot
+          DO iav = 1, nsimple
+             IF ( TRIM( names_s(iav) ) == TRIM( phot_names(iphot) ) ) then
+                phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =                                &
+                         par_l(iav) * cos_zenith**par_m(iav) * EXP( -par_n(iav) * coszi ) 
              ENDIF
           ENDDO
        ENDDO
-
-    END SUBROUTINE photolysis_constant
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> This scheme applies a simple parameterisation for clear sky photolysis frequencies 
-!> from the Master Chemical Mechanism, MCM v3.2 (http://mcm.leeds.ac.uk/MCM).
-!> Reference: Saunders et al., Atmos. Chem. Phys., 3, 161, 2003
-!------------------------------------------------------------------------------!
-    SUBROUTINE photolysis_simple
-
-       USE radiation_model_mod,                                                   &
-           ONLY:  calc_zenith, cos_zenith
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
-       REAL(wp)     :: coszi     !< 1./cosine of zenith angle
-
-       DO iphot = 1,nphot
-          phot_frequen(iphot)%freq = 0.0_wp
-       ENDDO
-
-       CALL calc_zenith
-
-       IF ( cos_zenith > 0.0_wp ) THEN
-          coszi = 1. / cos_zenith
-
-          DO iphot = 1,nphot
-             DO iav = 1,nsimple
-                IF ( TRIM( names_s(iav) ) == TRIM( phot_names(iphot) ) ) then
-                   phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =    &
-                                par_l(iav) * cos_zenith**par_m(iav) *  EXP( -par_n(iav) * coszi ) 
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDIF
-    END SUBROUTINE photolysis_simple
+    ENDIF
+
+
+ END SUBROUTINE photolysis_simple
 
  END MODULE chem_photolysis_mod
