Ignore:
Timestamp:
Jun 11, 2020 8:51:48 AM (4 years ago)
Author:
raasch
Message:

files re-formatted to follow the PALM coding standard

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/chem_photolysis_mod.f90

    r4481 r4559  
    11!> @file chem_photolysis_mod.f90
    2 !------------------------------------------------------------------------------!
     2!--------------------------------------------------------------------------------------------------!
    33! This file is part of the PALM model system.
    44!
    5 ! PALM is free software: you can redistribute it and/or modify it under the
    6 ! terms of the GNU General Public License as published by the Free Software
    7 ! Foundation, either version 3 of the License, or (at your option) any later
    8 ! version.
    9 !
    10 ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
    11 ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
    12 ! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
    13 !
    14 ! You should have received a copy of the GNU General Public License along with
    15 ! PALM. If not, see <http://www.gnu.org/licenses/>.
     5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
     6! Public License as published by the Free Software Foundation, either version 3 of the License, or
     7! (at your option) any later version.
     8!
     9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
     10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
     11! Public License for more details.
     12!
     13! You should have received a copy of the GNU General Public License along with PALM. If not, see
     14! <http://www.gnu.org/licenses/>.
    1615!
    1716! Copyright 2018-2020 Leibniz Universitaet Hannover
    1817! Copyright 2018-2020 Karlsruhe Institute of Technology
    19 !------------------------------------------------------------------------------!
     18!--------------------------------------------------------------------------------------------------!
    2019!
    2120! Current revisions:
     
    2625! -----------------
    2726! $Id$
     27! file re-formatted to follow the PALM coding standard
     28!
     29! 4481 2020-03-31 18:55:54Z maronga
    2830! Change call to calc_zenith
    29 ! 
     31!
    3032! 4223 2019-09-10 09:20:47Z gronemeier
    3133! Corrected "Former revisions" section
    32 ! 
     34!
    3335! 3876 2019-04-08 18:41:49Z knoop
    34 ! some formatting and comments added 
    35 ! 
     36! some formatting and comments added
     37!
    3638! 3824 2019-03-27 15:56:16Z pavelkrc
    3739! unused variables removed
    38 ! 
     40!
    3941! 2718 2018-01-02 08:49:38Z maronga
    4042! Initial revision
     
    4547! @author Renate Forkel
    4648!
    47 !------------------------------------------------------------------------------!
     49!--------------------------------------------------------------------------------------------------!
    4850! Description:
    4951! ------------
    5052!> photolysis models and interfaces (Adapted from photolysis_model_mod.f90)
    5153!> @todo more complex scheme, add shading
    52 !------------------------------------------------------------------------------!
     54!--------------------------------------------------------------------------------------------------!
    5355 MODULE chem_photolysis_mod
    5456
    55 !   USE arrays_3d,                                                             &
     57!   USE arrays_3d,                                                                                  &
    5658!       ONLY:  dzw, q, ql, zu, zw
    5759
    58     USE control_parameters,                                                    &
     60    USE control_parameters,                                                                        &
    5961        ONLY:  time_since_reference_point
    6062
    61     USE pegrid,                                                                &
     63    USE pegrid,                                                                                    &
    6264        ONLY: myid, threads_per_task
    6365
    64     USE indices,                                                               &
     66    USE indices,                                                                                   &
    6567        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
    6668
    67     USE control_parameters,                                                    &
    68         ONLY:  initializing_actions           
    69 
    70     USE chem_gasphase_mod,                                                     &
    71         ONLY: nphot, phot_names, phot
    72 
    73     USE chem_modules,                                                          &
     69    USE control_parameters,                                                                        &
     70        ONLY:  initializing_actions
     71
     72    USE chem_gasphase_mod,                                                                         &
     73        ONLY: nphot, phot, phot_names
     74
     75    USE chem_modules,                                                                              &
    7476        ONLY: phot_frequen, photolysis_scheme
    7577
    76     USE chem_modules,                                                          &
     78    USE chem_modules,                                                                              &
    7779        ONLY: chem_debug2
    7880
     
    8789
    8890
    89 !   LOGICAL ::  unscheduled_photolysis_calls = .TRUE., & !< flag parameter indicating whether additional calls of the photolysis code are allowed
    90 !               constant_albedo = .FALSE.,           & !< flag parameter indicating whether the albedo may change depending on zenith
    91 !               force_photolysis_call = .FALSE.,     & !< flag parameter for unscheduled photolysis calls
    92 !               photolysis = .FALSE.,                & !< flag parameter indicating whether the photolysis model is used
    93 !               sun_up    = .TRUE.,                  & !< flag parameter indicating whether the sun is up or down
    94 !               photolysis = .TRUE.,                 & !< flag parameter indicing whether photolysis shall be calculated
    95 !               sun_direction = .FALSE.                !< flag parameter indicing whether solar direction shall be calculated
     91!   LOGICAL ::  unscheduled_photolysis_calls = .TRUE., & !< flag parameter indicating whether
     92!                                                        !< additional calls of the photolysis code are allowed
     93!               constant_albedo = .FALSE.,             & !< flag parameter indicating whether the
     94!                                                        !< albedo may change depending on zenith
     95!               force_photolysis_call = .FALSE.,       & !< flag parameter for unscheduled photolysis
     96!                                                        !< calls
     97!               photolysis = .FALSE.,                  & !< flag parameter indicating whether the
     98!                                                        !< photolysis model is used
     99!               sun_up    = .TRUE.,                    & !< flag parameter indicating whether the sun
     100!                                                        !< is up or down
     101!               photolysis = .TRUE.,                   & !< flag parameter indicing whether
     102!                                                        !< photolysis shall be calculated
     103!               sun_direction = .FALSE.                  !< flag parameter indicing whether solar
     104!                                                        !< direction shall be calculated
    96105
    97106!-- Parameters for constant photolysis frequencies
    98     INTEGER,PARAMETER :: nconst  = 15               !< available predefined photolysis prequencies for constant
     107    INTEGER,PARAMETER :: nconst  = 15               !< available predefined photolysis prequencies
     108                                                    !< for constant
    99109
    100110! Names for predefined fixed photolysis frequencies at zenith angle 0
    101     CHARACTER(LEN=10), PARAMETER, DIMENSION(nconst) :: names_c =  (/                     &
    102                      'J_O31D    ','J_O33P    ','J_NO2     ','J_HNO3    ','J_RCHO    ',   &
    103                      'J         ','J         ','J         ','J         ','J         ',   &
     111    CHARACTER(LEN=10), PARAMETER, DIMENSION(nconst) :: names_c =  (/                               &
     112                     'J_O31D    ','J_O33P    ','J_NO2     ','J_HNO3    ','J_RCHO    ',             &
     113                     'J         ','J         ','J         ','J         ','J         ',             &
    104114                     'J         ','J         ','J         ','J         ','J         ' /)
    105115! Photolysis frequency at zenith angle 0 degrees in 1/s
    106     REAL(wp), PARAMETER, DIMENSION(nconst) :: phot0 =  (/                                &
    107                       2.489E-05_wp,3.556E-04_wp, 8.89E-03_wp,5.334E-07_wp,3.734E-05_wp,  &
    108                       0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,  &
    109                       0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp,0.0000E00_wp /)
     116    REAL(wp), PARAMETER, DIMENSION(nconst) :: phot0 =  (/                                          &
     117                      2.489E-05_wp, 3.556E-04_wp, 8.89E-03_wp,5.334E-07_wp, 3.734E-05_wp,          &
     118                      0.0000E00_wp, 0.0000E00_wp, 0.0000E00_wp,0.0000E00_wp, 0.0000E00_wp,         &
     119                      0.0000E00_wp, 0.0000E00_wp, 0.0000E00_wp,0.0000E00_wp, 0.0000E00_wp /)
    110120
    111121!-- Parameters for simple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
    112122!-- Saunders et al., 2003, Atmos. Chem. Phys., 3, 161-180
    113    INTEGER,PARAMETER :: nsimple = 15               !< available predefined photolysis prequencies for simple parameterisation
    114 ! Names for simple photolysis frequencies parameterisation (
    115     CHARACTER(LEN=10), PARAMETER, DIMENSION(nsimple) :: names_s =  (/                    &
    116                      'J_O31D    ','J_O33P    ','J_H2O2    ','J_NO2     ','J_NO3_A   ',   &
    117                      'J_NO3_B   ','J_HONO    ','J_HNO3    ','J_HCHO_A  ','J_HCHO_B  ',   &
     123    INTEGER,PARAMETER :: nsimple = 15               !< available predefined photolysis prequencies for simple parameterisation
     124!-- Names for simple photolysis frequencies parameterisation (
     125    CHARACTER(LEN=10), PARAMETER, DIMENSION(nsimple) :: names_s =  (/                              &
     126                     'J_O31D    ','J_O33P    ','J_H2O2    ','J_NO2     ','J_NO3_A   ',             &
     127                     'J_NO3_B   ','J_HONO    ','J_HNO3    ','J_HCHO_A  ','J_HCHO_B  ',             &
    118128                     'J_CH3CHO  ','J         ','J         ','J         ','J_RCHO    ' /)
    119129
    120 !-- Species dependent parameters for simple photolysis frequencies from MCM (http://mcm.leeds.ac.uk/MCM)
     130!-- Species dependent parameters for simple photolysis frequencies from MCM
     131!-- (http://mcm.leeds.ac.uk/MCM)
    121132!-- J = l*COSx@m*EXP(-n*SECx)  with l,m,n named par_l etc., x is the zenith angle
    122    REAL(wp), PARAMETER, DIMENSION(nconst) :: par_l =  (/                                 &
    123                        6.073E-05_wp,4.775E-04_wp,1.041E-05_wp,1.165E-02_wp,2.485E-02_wp, &
    124                        1.747E-01_wp,2.644E-03_wp,9.312E-07_wp,4.642E-05_wp,6.853E-05_wp, &
    125                        7.344E-06_wp,0.0000E00_wp,0.0000E00_wp,0.000E00_wp, 6.853E-05_wp /)
    126 
    127    REAL(wp), PARAMETER, DIMENSION(nconst) :: par_m =  (/                                 &
    128                            1.743_wp,    0.298_wp,    0.723_wp,    0.244_wp,    0.168_wp, &
    129                            0.155_wp,    0.261_wp,    1.230_wp,    0.762_wp,    0.477_wp, &
     133    REAL(wp), PARAMETER, DIMENSION(nconst) :: par_l =  (/                                          &
     134                       6.073E-05_wp, 4.775E-04_wp, 1.041E-05_wp, 1.165E-02_wp, 2.485E-02_wp,      &
     135                       1.747E-01_wp, 2.644E-03_wp, 9.312E-07_wp, 4.642E-05_wp, 6.853E-05_wp,      &
     136                       7.344E-06_wp, 0.0000E00_wp, 0.0000E00_wp, 0.000E00_wp, 6.853E-05_wp /)
     137
     138   REAL(wp), PARAMETER, DIMENSION(nconst) :: par_m =  (/                                           &
     139                           1.743_wp,    0.298_wp,    0.723_wp,    0.244_wp,    0.168_wp,           &
     140                           0.155_wp,    0.261_wp,    1.230_wp,    0.762_wp,    0.477_wp,           &
    130141                           1.202_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.477_wp /)
    131142
    132    REAL(wp), PARAMETER, DIMENSION(nconst) :: par_n =  (/                                 &
    133                            0.474_wp,    0.080_wp,    0.279_wp,    0.267_wp,    0.108_wp, &
    134                            0.125_wp,    0.288_wp,    0.307_wp,    0.353_wp,    0.323_wp, &
     143   REAL(wp), PARAMETER, DIMENSION(nconst) :: par_n =  (/                                           &
     144                           0.474_wp,    0.080_wp,    0.279_wp,    0.267_wp,    0.108_wp,           &
     145                           0.125_wp,    0.288_wp,    0.307_wp,    0.353_wp,    0.323_wp,           &
    135146                           0.417_wp,    0.000_wp,    0.000_wp,    0.000_wp,    0.323_wp /)
    136147
    137148
    138     REAL(wp)     :: cosz = 0.7_wp                   !< cosine of fixed zenith angle (45 deg, if not specified otherwise)
     149    REAL(wp)     :: cosz = 0.7_wp                   !< cosine of fixed zenith angle (45 deg, if not
     150                                                    !< specified otherwise)
    139151
    140152!
     
    142154       MODULE PROCEDURE photolysis_constant
    143155    END INTERFACE photolysis_constant
    144  
     156
    145157    INTERFACE photolysis_simple
    146158       MODULE PROCEDURE photolysis_simple
     
    166178
    167179
    168 !------------------------------------------------------------------------------!
    169 ! Description:
    170 ! ------------
    171 !> This subroutine controls the calls of the photolysis schemes
    172 !------------------------------------------------------------------------------!
     180!--------------------------------------------------------------------------------------------------!
     181! Description:
     182! ------------
     183!> This subroutine controls the calls of the photolysis schemes.
     184!--------------------------------------------------------------------------------------------------!
    173185 SUBROUTINE photolysis_control
    174  
     186
    175187    IMPLICIT NONE
    176188
     
    179191       CASE ( 'constant' )
    180192          CALL photolysis_constant
    181          
     193
    182194       CASE ( 'simple' )
    183195          CALL photolysis_simple
    184        
     196
    185197!      CASE ( 'fastj' )
    186198!         CALL photolysis_fastj
     
    194206
    195207
    196 !------------------------------------------------------------------------------!
    197 ! Description:
    198 ! ------------
    199 !> This scheme keeps the prescribed net radiation constant during the run
     208!--------------------------------------------------------------------------------------------------!
     209! Description:
     210! ------------
     211!> This scheme keeps the prescribed net radiation constant during the run.
    200212!> Default zenith angle is 45 deg
    201 !------------------------------------------------------------------------------!
     213!--------------------------------------------------------------------------------------------------!
    202214 SUBROUTINE photolysis_constant
    203215
    204216    IMPLICIT NONE
    205217
    206     INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
     218    INTEGER(iwp) :: iphot,iav !< loop index for photolysis reaction
    207219
    208220    DO  iphot = 1, nphot
    209221       DO  iav = 1, nconst
    210           IF ( TRIM( names_c(iav) ) == TRIM( phot_names(iphot) ) ) THEN
    211 !--  Prescribe fixed photolysis frequencies  [1/s]
    212                 phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =                      &
    213                              phot0(iav) * cosz
     222          IF ( TRIM( names_c(iav) ) == TRIM( phot_names(iphot) ) )  THEN
     223!--             Prescribe fixed photolysis frequencies  [1/s]
     224                phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =  phot0(iav) * cosz
    214225          ENDIF
    215226       ENDDO
     
    220231
    221232
    222 !------------------------------------------------------------------------------!
    223 ! Description:
    224 ! ------------
    225 !> This scheme applies a simple parameterisation for clear sky photolysis frequencies
    226 !> from the Master Chemical Mechanism, MCM v3.2 (http://mcm.leeds.ac.uk/MCM).
     233!--------------------------------------------------------------------------------------------------!
     234! Description:
     235! ------------
     236!> This scheme applies a simple parameterisation for clear sky photolysis frequencies from the
     237!> Master Chemical Mechanism, MCM v3.2 (http://mcm.leeds.ac.uk/MCM).
    227238!> Reference: Saunders et al., Atmos. Chem. Phys., 3, 161, 2003
    228239!> J = l*COSx@m*EXP(-n*SECx)  with l,m,n named par_l etc., x is the zenith angle
    229 !------------------------------------------------------------------------------!
     240!--------------------------------------------------------------------------------------------------!
    230241 SUBROUTINE photolysis_simple
    231242
    232     USE palm_date_time_mod,                                                    &
     243    USE palm_date_time_mod,                                                                        &
    233244        ONLY:  get_date_time
    234245
    235     USE radiation_model_mod,                                                   &
     246    USE radiation_model_mod,                                                                       &
    236247        ONLY:  calc_zenith, cos_zenith
    237248
     
    249260    ENDDO
    250261
    251     CALL get_date_time( time_since_reference_point, &
    252                         day_of_year=day_of_year, second_of_day=second_of_day )
     262    CALL get_date_time( time_since_reference_point, day_of_year = day_of_year,                     &
     263                        second_of_day=second_of_day )
    253264    CALL calc_zenith( day_of_year, second_of_day )
    254265
    255     IF ( cos_zenith > 0.0_wp ) THEN
    256        coszi = 1. / cos_zenith
     266    IF ( cos_zenith > 0.0_wp )  THEN
     267       coszi = 1.0_wp / cos_zenith
    257268
    258269       DO iphot = 1, nphot
    259270          DO iav = 1, nsimple
    260              IF ( TRIM( names_s(iav) ) == TRIM( phot_names(iphot) ) ) then
    261                 phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =                                &
    262                          par_l(iav) * cos_zenith**par_m(iav) * EXP( -par_n(iav) * coszi )
     271             IF ( TRIM( names_s(iav) ) == TRIM( phot_names(iphot) ) )  THEN
     272                phot_frequen(iphot)%freq(nzb+1:nzt,:,:) =  par_l(iav) * cos_zenith**par_m(iav) *   &
     273                                                           EXP( - par_n(iav) * coszi )
    263274             ENDIF
    264275          ENDDO
Note: See TracChangeset for help on using the changeset viewer.