Changeset 3582 for palm/trunk/SOURCE/salsa_mod.f90
 Timestamp:
 Nov 29, 2018 7:16:36 PM (3 years ago)
 Location:
 palm/trunk/SOURCE
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE
 Property svn:mergeinfo changed
/palm/branches/salsa/SOURCE merged: 3493,35033504,3519,3566,3576
 Property svn:mergeinfo changed

palm/trunk/SOURCE/salsa_mod.f90
r3524 r3582 15 15 ! PALM. If not, see <http://www.gnu.org/licenses/>. 16 16 ! 17 ! Copyright 20182018 University of Helsinki 17 18 ! Copyright 19972018 Leibniz Universitaet Hannover 18 19 !! … … 20 21 ! Current revisions: 21 22 !  22 ! 23 ! 23 !  Moved the control parameter "salsa" from salsa_mod.f90 to control_parameters 24 !  Updated salsa_rrd_local and salsa_wrd_local 25 !  Add target attribute 26 !  Revise initialization in case of restarts 27 !  Revise masked data output 28 ! 24 29 ! Former revisions: 25 30 !  … … 44 49 ! Authors: 45 50 !  46 ! @author monakurppa47 ! 51 ! @author Mona Kurppa (University of Helsinki) 52 ! 48 53 ! 49 54 ! Description: … … 60 65 !> 61 66 !> @todo Implement turbulent inflow of aerosols in inflow_turbulence. 62 !> @todo Deposition on walls and horizontal surfaces calculated from the aerosol63 !> dry radius, not wet64 67 !> @todo Deposition on subgrid scale vegetation 65 68 !> @todo Deposition on vegetation calculated by default for deciduous broadleaf … … 197 200 !< chemical components 198 201 LOGICAL :: read_restart_data_salsa = .FALSE. !< read restart data for salsa 199 LOGICAL :: salsa = .FALSE. !< SALSA master switch200 202 LOGICAL :: salsa_gases_from_chem = .FALSE. !< Transfer the gaseous 201 203 !< components to SALSA from … … 420 422 !< OC 421 423 ! Integrated: 422 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: LDSA_av !< lung deposited 423 !< surface area 424 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: Ntot_av !< total number conc. 425 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: PM25_av !< PM2.5 426 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: PM10_av !< PM10 424 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: LDSA_av !< lung 425 !< deposited 426 !< surface area 427 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: Ntot_av !< total number 428 !< conc. 429 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: PM25_av !< PM2.5 430 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: PM10_av !< PM10 427 431 ! In the particle phase: 428 432 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: s_BC_av !< black carbon … … 435 439 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: s_SS_av !< sea salt 436 440 ! Bins: 437 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: mbins_av !< bin mass 438 !< concentration 439 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: Nbins_av !< bin number 440 !< concentration 441 441 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: mbins_av !< bin mass 442 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: Nbins_av !< bin number 443 444 442 445 ! 443 446 ! PALM interfaces: … … 564 567 mconc_2, nbins, ncc, ncc_tot, nclim, nconc_2, ngast, prtcl, Ra_dry, & 565 568 salsa_gas, sedim_vd 569 566 570 567 571 CONTAINS … … 688 692 689 693 ! 690 ! Set flag that indicates that the new module is switched on 691 ! Note that this parameter needs to be declared in modules.f90 694 ! Enable salsa (salsa switch in modules.f90) 692 695 salsa = .TRUE. 693 696 … … 1230 1233 ENDDO 1231 1234 1232 IF ( nldepo ) sedim_vd = 0.0_wp 1235 IF ( nldepo ) sedim_vd = 0.0_wp 1236 1237 DO b = 1, nbins 1238 IF ( .NOT. read_restart_data_salsa ) aerosol_number(b)%conc = nclim 1239 aerosol_number(b)%conc_p = 0.0_wp 1240 aerosol_number(b)%tconc_m = 0.0_wp 1241 aerosol_number(b)%flux_s = 0.0_wp 1242 aerosol_number(b)%diss_s = 0.0_wp 1243 aerosol_number(b)%flux_l = 0.0_wp 1244 aerosol_number(b)%diss_l = 0.0_wp 1245 aerosol_number(b)%init = nclim 1246 aerosol_number(b)%sums_ws_l = 0.0_wp 1247 ENDDO 1248 DO c = 1, ncc_tot*nbins 1249 IF ( .NOT. read_restart_data_salsa ) aerosol_mass(c)%conc = mclim 1250 aerosol_mass(c)%conc_p = 0.0_wp 1251 aerosol_mass(c)%tconc_m = 0.0_wp 1252 aerosol_mass(c)%flux_s = 0.0_wp 1253 aerosol_mass(c)%diss_s = 0.0_wp 1254 aerosol_mass(c)%flux_l = 0.0_wp 1255 aerosol_mass(c)%diss_l = 0.0_wp 1256 aerosol_mass(c)%init = mclim 1257 aerosol_mass(c)%sums_ws_l = 0.0_wp 1258 ENDDO 1259 1260 IF ( .NOT. salsa_gases_from_chem ) THEN 1261 DO g = 1, ngast 1262 salsa_gas(g)%conc_p = 0.0_wp 1263 salsa_gas(g)%tconc_m = 0.0_wp 1264 salsa_gas(g)%flux_s = 0.0_wp 1265 salsa_gas(g)%diss_s = 0.0_wp 1266 salsa_gas(g)%flux_l = 0.0_wp 1267 salsa_gas(g)%diss_l = 0.0_wp 1268 salsa_gas(g)%sums_ws_l = 0.0_wp 1269 ENDDO 1270 IF ( .NOT. read_restart_data_salsa ) THEN 1271 salsa_gas(1)%conc = H2SO4_init 1272 salsa_gas(2)%conc = HNO3_init 1273 salsa_gas(3)%conc = NH3_init 1274 salsa_gas(4)%conc = OCNV_init 1275 salsa_gas(5)%conc = OCSV_init 1276 ENDIF 1277 ! 1278 ! Set initial value for gas compound tracers and initial values 1279 salsa_gas(1)%init = H2SO4_init 1280 salsa_gas(2)%init = HNO3_init 1281 salsa_gas(3)%init = NH3_init 1282 salsa_gas(4)%init = OCNV_init 1283 salsa_gas(5)%init = OCSV_init 1284 ENDIF 1285 ! 1286 ! Aerosol radius in each bin: dry and wet (m) 1287 Ra_dry = 1.0E10_wp 1233 1288 ! 1234 ! Initilisation actions that are NOT conducted for restart runs 1235 IF ( .NOT. read_restart_data_salsa ) THEN 1236 1237 DO b = 1, nbins 1238 aerosol_number(b)%conc = nclim 1239 aerosol_number(b)%conc_p = 0.0_wp 1240 aerosol_number(b)%tconc_m = 0.0_wp 1241 aerosol_number(b)%flux_s = 0.0_wp 1242 aerosol_number(b)%diss_s = 0.0_wp 1243 aerosol_number(b)%flux_l = 0.0_wp 1244 aerosol_number(b)%diss_l = 0.0_wp 1245 aerosol_number(b)%init = nclim 1246 aerosol_number(b)%sums_ws_l = 0.0_wp 1289 ! Initialise aerosol tracers 1290 aero(:)%vhilim = 0.0_wp 1291 aero(:)%vlolim = 0.0_wp 1292 aero(:)%vratiohi = 0.0_wp 1293 aero(:)%vratiolo = 0.0_wp 1294 aero(:)%dmid = 0.0_wp 1295 ! 1296 ! Initialise the sectional particle size distribution 1297 CALL set_sizebins() 1298 ! 1299 ! Initialise locationdependent aerosol size distributions and 1300 ! chemical compositions: 1301 CALL aerosol_init 1302 ! 1303 ! Initalisation run of SALSA 1304 DO i = nxl, nxr 1305 DO j = nys, nyn 1306 CALL salsa_driver( i, j, 1 ) 1307 CALL salsa_diagnostics( i, j ) 1247 1308 ENDDO 1248 DO c = 1, ncc_tot*nbins 1249 aerosol_mass(c)%conc = mclim 1250 aerosol_mass(c)%conc_p = 0.0_wp 1251 aerosol_mass(c)%tconc_m = 0.0_wp 1252 aerosol_mass(c)%flux_s = 0.0_wp 1253 aerosol_mass(c)%diss_s = 0.0_wp 1254 aerosol_mass(c)%flux_l = 0.0_wp 1255 aerosol_mass(c)%diss_l = 0.0_wp 1256 aerosol_mass(c)%init = mclim 1257 aerosol_mass(c)%sums_ws_l = 0.0_wp 1258 ENDDO 1259 1260 IF ( .NOT. salsa_gases_from_chem ) THEN 1261 DO g = 1, ngast 1262 salsa_gas(g)%conc_p = 0.0_wp 1263 salsa_gas(g)%tconc_m = 0.0_wp 1264 salsa_gas(g)%flux_s = 0.0_wp 1265 salsa_gas(g)%diss_s = 0.0_wp 1266 salsa_gas(g)%flux_l = 0.0_wp 1267 salsa_gas(g)%diss_l = 0.0_wp 1268 salsa_gas(g)%sums_ws_l = 0.0_wp 1269 ENDDO 1270 1271 ! 1272 ! Set initial value for gas compound tracers and initial values 1273 salsa_gas(1)%conc = H2SO4_init 1274 salsa_gas(1)%init = H2SO4_init 1275 salsa_gas(2)%conc = HNO3_init 1276 salsa_gas(2)%init = HNO3_init 1277 salsa_gas(3)%conc = NH3_init 1278 salsa_gas(3)%init = NH3_init 1279 salsa_gas(4)%conc = OCNV_init 1280 salsa_gas(4)%init = OCNV_init 1281 salsa_gas(5)%conc = OCSV_init 1282 salsa_gas(5)%init = OCSV_init 1283 ENDIF 1284 ! 1285 ! Aerosol radius in each bin: dry and wet (m) 1286 Ra_dry = 1.0E10_wp 1287 ! 1288 ! Initialise aerosol tracers 1289 aero(:)%vhilim = 0.0_wp 1290 aero(:)%vlolim = 0.0_wp 1291 aero(:)%vratiohi = 0.0_wp 1292 aero(:)%vratiolo = 0.0_wp 1293 aero(:)%dmid = 0.0_wp 1294 ! 1295 ! Initialise the sectional particle size distribution 1296 CALL set_sizebins() 1297 ! 1298 ! Initialise locationdependent aerosol size distributions and 1299 ! chemical compositions: 1300 CALL aerosol_init 1301 ! 1302 ! Initalisation run of SALSA 1303 DO i = nxl, nxr 1304 DO j = nys, nyn 1305 CALL salsa_driver( i, j, 1 ) 1306 CALL salsa_diagnostics( i, j ) 1307 ENDDO 1308 ENDDO 1309 ENDIF 1309 ENDDO 1310 1310 ! 1311 1311 ! Set the aerosol and gas sources … … 1419 1419 1420 1420 USE netcdf_data_input_mod, & 1421 ONLY: get_attribute, netcdf_data_input_get_dimension_length,&1422 get_variable, open_read_file1421 ONLY: get_attribute, get_variable, & 1422 netcdf_data_input_get_dimension_length, open_read_file 1423 1423 1424 1424 IMPLICIT NONE … … 1485 1485 ! 1486 1486 ! Input heights 1487 CALL netcdf_data_input_get_dimension_length( id_faero, nz_file, "profile_z" ) 1487 CALL netcdf_data_input_get_dimension_length( id_faero, nz_file, & 1488 "profile_z" ) 1488 1489 1489 1490 ALLOCATE( pr_z(nz_file), pr_mass_fracs_a(maxspec,nz_file), & … … 1628 1629 ! 1629 1630 ! Input heights 1630 CALL netcdf_data_input_get_dimension_length( id_fchem, nz_file, "profile_z" ) 1631 CALL netcdf_data_input_get_dimension_length( id_fchem, nz_file, & 1632 "profile_z" ) 1631 1633 ALLOCATE( pr_z(nz_file), pr_gas(ngast,nz_file) ) 1632 1634 CALL get_variable( id_fchem, 'profile_z', pr_z ) … … 2025 2027 !> This routine reads the respective restart data. 2026 2028 !! 2027 SUBROUTINE salsa_rrd_local 2029 SUBROUTINE salsa_rrd_local( i, k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, & 2030 nxr_on_file, nynf, nync, nyn_on_file, nysf, & 2031 nysc, nys_on_file, tmp_3d, found ) 2028 2032 2029 2033 … … 2035 2039 INTEGER(iwp) :: g !< 2036 2040 INTEGER(iwp) :: i !< 2037 INTEGER(iwp) :: j !< 2038 INTEGER(iwp) :: k !< 2041 INTEGER(iwp) :: k !< 2042 INTEGER(iwp) :: nxlc !< 2043 INTEGER(iwp) :: nxlf !< 2044 INTEGER(iwp) :: nxl_on_file !< 2045 INTEGER(iwp) :: nxrc !< 2046 INTEGER(iwp) :: nxrf !< 2047 INTEGER(iwp) :: nxr_on_file !< 2048 INTEGER(iwp) :: nync !< 2049 INTEGER(iwp) :: nynf !< 2050 INTEGER(iwp) :: nyn_on_file !< 2051 INTEGER(iwp) :: nysc !< 2052 INTEGER(iwp) :: nysf !< 2053 INTEGER(iwp) :: nys_on_file !< 2054 2055 LOGICAL, INTENT(OUT) :: found 2056 2057 REAL(wp), & 2058 DIMENSION(nzb:nzt+1,nys_on_filenbgp:nyn_on_file+nbgp,nxl_on_filenbgp:nxr_on_file+nbgp) :: tmp_3d !< 2059 2060 found = .FALSE. 2039 2061 2040 2062 IF ( read_restart_data_salsa ) THEN 2041 READ ( 13 ) field_char 2042 2043 DO WHILE ( TRIM( field_char ) /= '*** end salsa ***' ) 2063 2064 SELECT CASE ( restart_string(1:length) ) 2044 2065 2045 DO b = 1, nbins 2046 READ ( 13 ) aero(b)%vlolim 2047 READ ( 13 ) aero(b)%vhilim 2048 READ ( 13 ) aero(b)%dmid 2049 READ ( 13 ) aero(b)%vratiohi 2050 READ ( 13 ) aero(b)%vratiolo 2051 ENDDO 2052 2053 DO i = nxl, nxr 2054 DO j = nys, nyn 2055 DO k = nzb+1, nzt 2056 DO b = 1, nbins 2057 READ ( 13 ) aerosol_number(b)%conc(k,j,i) 2058 DO c = 1, ncc_tot 2059 READ ( 13 ) aerosol_mass((c1)*nbins+b)%conc(k,j,i) 2060 ENDDO 2061 ENDDO 2062 IF ( .NOT. salsa_gases_from_chem ) THEN 2063 DO g = 1, ngast 2064 READ ( 13 ) salsa_gas(g)%conc(k,j,i) 2065 ENDDO 2066 ENDIF 2067 ENDDO 2066 CASE ( 'aerosol_number' ) 2067 DO b = 1, nbins 2068 IF ( k == 1 ) READ ( 13 ) tmp_3d 2069 aerosol_number(b)%conc(:,nyscnbgp:nync+nbgp,nxlcnbgp:nxrc+nbgp) = & 2070 tmp_3d(:,nysfnbgp:nynf+nbgp,nxlfnbgp:nxrf+nbgp) 2071 found = .TRUE. 2068 2072 ENDDO 2069 ENDDO2070 2071 READ ( 13 ) field_char2072 2073 ENDDO2074 2073 2074 CASE ( 'aerosol_mass' ) 2075 DO c = 1, ncc_tot * nbins 2076 IF ( k == 1 ) READ ( 13 ) tmp_3d 2077 aerosol_mass(c)%conc(:,nyscnbgp:nync+nbgp,nxlcnbgp:nxrc+nbgp) = & 2078 tmp_3d(:,nysfnbgp:nynf+nbgp,nxlfnbgp:nxrf+nbgp) 2079 found = .TRUE. 2080 ENDDO 2081 2082 CASE ( 'salsa_gas' ) 2083 DO g = 1, ngast 2084 IF ( k == 1 ) READ ( 13 ) tmp_3d 2085 salsa_gas(g)%conc(:,nyscnbgp:nync+nbgp,nxlcnbgp:nxrc+nbgp) = & 2086 tmp_3d(:,nysfnbgp:nynf+nbgp,nxlfnbgp:nxrf+nbgp) 2087 found = .TRUE. 2088 ENDDO 2089 2090 CASE DEFAULT 2091 found = .FALSE. 2092 2093 END SELECT 2075 2094 ENDIF 2076 2095 … … 2093 2112 INTEGER(iwp) :: c !< 2094 2113 INTEGER(iwp) :: g !< 2095 INTEGER(iwp) :: i !<2096 INTEGER(iwp) :: j !<2097 INTEGER(iwp) :: k !<2098 2114 2099 2115 IF ( write_binary .AND. write_binary_salsa ) THEN 2100 2101 DO b = 1, nbins 2102 WRITE ( 14 ) aero(b)%vlolim 2103 WRITE ( 14 ) aero(b)%vhilim 2104 WRITE ( 14 ) aero(b)%dmid 2105 WRITE ( 14 ) aero(b)%vratiohi 2106 WRITE ( 14 ) aero(b)%vratiolo 2116 2117 CALL wrd_write_string( 'aerosol_number' ) 2118 DO b = 1, nbins 2119 WRITE ( 14 ) aerosol_number(b)%conc 2107 2120 ENDDO 2108 2121 2109 DO i = nxl, nxr 2110 DO j = nys, nyn 2111 DO k = nzb+1, nzt 2112 DO b = 1, nbins 2113 WRITE ( 14 ) aerosol_number(b)%conc(k,j,i) 2114 DO c = 1, ncc_tot 2115 WRITE ( 14 ) aerosol_mass((c1)*nbins+b)%conc(k,j,i) 2116 ENDDO 2117 ENDDO 2118 IF ( .NOT. salsa_gases_from_chem ) THEN 2119 DO g = 1, ngast 2120 WRITE ( 14 ) salsa_gas(g)%conc(k,j,i) 2121 ENDDO 2122 ENDIF 2123 ENDDO 2124 ENDDO 2122 CALL wrd_write_string( 'aerosol_mass' ) 2123 DO c = 1, nbins*ncc_tot 2124 WRITE ( 14 ) aerosol_mass(c)%conc 2125 2125 ENDDO 2126 2126 2127 WRITE ( 14 ) '*** end salsa *** ' 2127 CALL wrd_write_string( 'salsa_gas' ) 2128 DO g = 1, ngast 2129 WRITE ( 14 ) salsa_gas(g)%conc 2130 ENDDO 2128 2131 2129 2132 ENDIF … … 2765 2768 USE arrays_3d, & 2766 2769 ONLY: p, pt, q, zu 2767 2770 2768 2771 USE basic_constants_and_equations_mod, & 2769 ONLY: barometric_formula, exner_function, ideal_gas_law_rho, magnus 2770 2772 ONLY: barometric_formula, exner_function, ideal_gas_law_rho, magnus 2773 2771 2774 USE control_parameters, & 2772 2775 ONLY: pt_surface, surface_pressure 2773 2776 2774 2777 IMPLICIT NONE 2775 2778 2776 2779 INTEGER(iwp), INTENT(in) :: i 2777 INTEGER(iwp), INTENT(in) :: j 2780 INTEGER(iwp), INTENT(in) :: j 2778 2781 REAL(wp), DIMENSION(:), INTENT(inout) :: adn_ij 2779 REAL(wp), DIMENSION(:), INTENT(inout) :: p_ij 2782 REAL(wp), DIMENSION(:), INTENT(inout) :: p_ij 2780 2783 REAL(wp), DIMENSION(:), INTENT(inout) :: temp_ij 2781 2784 REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL :: cw_ij 2782 REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL :: cs_ij 2783 REAL(wp), DIMENSION(nzb:nzt+1) :: e_s !< saturation vapour pressure 2785 REAL(wp), DIMENSION(:), INTENT(inout), OPTIONAL :: cs_ij 2786 REAL(wp), DIMENSION(nzb:nzt+1) :: e_s !< saturation vapour pressure 2784 2787 !< over water (Pa) 2785 2788 REAL(wp) :: t_surface !< absolute surface temperature (K) 2786 2789 ! 2787 2790 ! Pressure p_ijk (Pa) = hydrostatic pressure + perturbation pressure (p) 2788 t_surface = pt_surface * exner_function( surface_pressure )2789 p_ij(:) = 100.0_wp * barometric_formula( zu, t_surface, surface_pressure) &2791 t_surface = pt_surface * exner_function( surface_pressure * 100.0_wp ) 2792 p_ij(:) = barometric_formula( zu, t_surface, surface_pressure * 100.0_wp ) & 2790 2793 + p(:,j,i) 2791 2794 ! 2792 2795 ! Absolute ambient temperature (K) 2793 temp_ij(:) = pt(:,j,i) * exner_function( p_ij(:) ) 2794 ! 2795 ! Air density 2796 temp_ij(:) = pt(:,j,i) * exner_function( p_ij(:) ) 2797 ! 2798 ! Air density 2796 2799 adn_ij(:) = ideal_gas_law_rho( p_ij(:), temp_ij(:) ) 2797 2800 ! … … 2803 2806 ! Saturation mixing ratio r_s (kg/kg) from vapour pressure at temp (Pa) 2804 2807 IF ( PRESENT( cs_ij ) ) THEN 2805 e_s(:) = magnus( temp_ij(:) ) 2806 cs_ij(:) = ( 0.622_wp * e_s / ( p_ij(:)  e_s(:) ) ) * adn_ij(:) 2808 e_s(:) = 611.0_wp * EXP( alv_d_rv * ( 3.6609E3_wp  1.0_wp / & 2809 temp_ij(:) ) )! magnus( temp_ij(:) ) 2810 cs_ij(:) = ( 0.622_wp * e_s / ( p_ij(:)  e_s(:) ) ) * adn_ij(:) 2807 2811 ENDIF 2808 2812 2809 2813 END SUBROUTINE salsa_thrm_ij 2810 2814 … … 7877 7881 7878 7882 USE netcdf_data_input_mod, & 7879 ONLY: get_attribute, netcdf_data_input_get_dimension_length,&7880 get_variable, open_read_file7883 ONLY: get_attribute, get_variable, & 7884 netcdf_data_input_get_dimension_length, open_read_file 7881 7885 7882 7886 USE surface_mod, & … … 7985 7989 ! 7986 7990 ! Index of gaseous compounds 7987 CALL netcdf_data_input_get_dimension_length( id_fchem, ng_file, "nspecies" ) 7991 CALL netcdf_data_input_get_dimension_length( id_fchem, ng_file, & 7992 "nspecies" ) 7988 7993 IF ( ng_file < 5 ) THEN 7989 7994 message_string = 'Some gaseous emissions missing.' … … 8200 8205 ! 8201 8206 ! Emission time step 8202 CALL netcdf_data_input_get_dimension_length( id_faero, n_dt, 'dt_emission' ) 8207 CALL netcdf_data_input_get_dimension_length( id_faero, n_dt, & 8208 'dt_emission' ) 8203 8209 IF ( n_dt > 1 ) THEN 8204 8210 CALL location_message( ' salsa_set_source: hourly emission data'//& … … 8410 8416 DO n = 1, ncat_emission 8411 8417 DO g = 1, ngast 8412 IF ( .NOT. salsa_gas(g)%source(n,j,i) >0.0_wp ) THEN8418 IF ( salsa_gas(g)%source(n,j,i) < 0.0_wp ) THEN 8413 8419 salsa_gas(g)%source(n,j,i) = 0.0_wp 8414 8420 CYCLE … … 9138 9144 DO j = nysg, nyng 9139 9145 DO k = nzb, nzt+1 9140 PM25_av(k,j,i) = PM25_av(k,j,i) 9141 /REAL( average_count_3d, KIND=wp )9146 PM25_av(k,j,i) = PM25_av(k,j,i) / & 9147 REAL( average_count_3d, KIND=wp ) 9142 9148 ENDDO 9143 9149 ENDDO … … 9148 9154 DO j = nysg, nyng 9149 9155 DO k = nzb, nzt+1 9150 PM10_av(k,j,i) = PM10_av(k,j,i) 9151 /REAL( average_count_3d, KIND=wp )9156 PM10_av(k,j,i) = PM10_av(k,j,i) / & 9157 REAL( average_count_3d, KIND=wp ) 9152 9158 ENDDO 9153 9159 ENDDO … … 9168 9174 DO j = nysg, nyng 9169 9175 DO k = nzb, nzt+1 9170 to_be_resorted(k,j,i) = to_be_resorted(k,j,i) 9171 /REAL( average_count_3d, KIND=wp )9176 to_be_resorted(k,j,i) = to_be_resorted(k,j,i) / & 9177 REAL( average_count_3d, KIND=wp ) 9172 9178 ENDDO 9173 9179 ENDDO … … 9188 9194 !> Subroutine defining 2D output variables 9189 9195 !! 9190 SUBROUTINE salsa_data_output_2d( av, variable, found, grid, mode, 9191 local_pf, two_d)9196 SUBROUTINE salsa_data_output_2d( av, variable, found, grid, mode, local_pf, & 9197 two_d, nzb_do, nzt_do ) 9192 9198 9193 9199 USE indices 9194 9200 9195 9201 USE kinds 9202 9196 9203 9197 9204 IMPLICIT NONE … … 9202 9209 CHARACTER (LEN=5) :: vari !< trimmed format of variable 9203 9210 9204 INTEGER(iwp) :: av !< 9205 INTEGER(iwp) :: b !< 9206 INTEGER(iwp) :: c !< 9207 INTEGER(iwp) :: i !< 9208 INTEGER(iwp) :: icc !< index of a chemical compound 9209 INTEGER(iwp) :: j !< 9210 INTEGER(iwp) :: k !< 9211 9212 LOGICAL :: found !< 9213 LOGICAL :: two_d !< flag parameter that indicates 2D variables 9214 !< (horizontal cross sections) 9215 9216 REAL(wp) :: df !< For calculating LDSA: fraction of particles 9217 !< depositing in the alveolar (or tracheobronchial) 9218 !< region of the lung. Depends on the particle size 9219 REAL(wp) :: mean_d !< Particle diameter in micrometres 9220 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 9221 REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< local 9222 !< array to which output data is resorted to 9223 REAL(wp) :: temp_bin !< 9224 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< points to 9225 !< selected output variable 9211 INTEGER(iwp) :: av !< 9212 INTEGER(iwp) :: b !< running index: size bins 9213 INTEGER(iwp) :: c !< running index: mass bins 9214 INTEGER(iwp) :: i !< 9215 INTEGER(iwp) :: icc !< index of a chemical compound 9216 INTEGER(iwp) :: j !< 9217 INTEGER(iwp) :: k !< 9218 INTEGER(iwp) :: nzb_do !< 9219 INTEGER(iwp) :: nzt_do !< 9220 9221 LOGICAL :: found !< 9222 LOGICAL :: two_d !< flag parameter that indicates 2D variables 9223 !< (horizontal cross sections) 9224 9225 REAL(wp) :: df !< For calculating LDSA: fraction of particles 9226 !< depositing in the alveolar (or tracheobronchial) 9227 !< region of the lung. Depends on the particle size 9228 REAL(wp) :: fill_value = 9999.0_wp !< value for the _FillValue attribute 9229 REAL(wp) :: mean_d !< Particle diameter in micrometres 9230 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 9231 REAL(wp) :: temp_bin !< temporary array for calculating output variables 9232 9233 REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< output 9234 9235 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< pointer 9236 9226 9237 9227 9238 found = .TRUE. … … 9238 9249 DO i = nxl, nxr 9239 9250 DO j = nys, nyn 9240 DO k = nzb , nzt+19251 DO k = nzb_do, nzt_do 9241 9252 local_pf(i,j,k) = MERGE( salsa_gas(icc)%conc(k,j,i), & 9242 REAL( 999.0_wp, KIND = wp ),&9253 REAL( fill_value, KIND = wp ), & 9243 9254 BTEST( wall_flags_0(k,j,i), 0 ) ) 9244 9255 ENDDO … … 9253 9264 DO i = nxl, nxr 9254 9265 DO j = nys, nyn 9255 DO k = nzb , nzt+19266 DO k = nzb_do, nzt_do 9256 9267 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), & 9257 REAL( 999.0_wp, KIND = wp ),&9268 REAL( fill_value, KIND = wp ), & 9258 9269 BTEST( wall_flags_0(k,j,i), 0 ) ) 9259 9270 ENDDO … … 9268 9279 DO i = nxl, nxr 9269 9280 DO j = nys, nyn 9270 DO k = nzb , nzt+19281 DO k = nzb_do, nzt_do 9271 9282 temp_bin = 0.0_wp 9272 9283 DO b = 1, nbins … … 9286 9297 temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc 9287 9298 ENDDO 9288 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9289 KIND =wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9299 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = & 9300 wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9290 9301 ENDDO 9291 9302 ENDDO … … 9294 9305 DO i = nxl, nxr 9295 9306 DO j = nys, nyn 9296 DO k = nzb, nzt+1 9297 local_pf(i,j,k) = MERGE( LDSA_av(k,j,i), REAL( 999.0_wp, & 9298 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9307 DO k = nzb_do, nzt_do 9308 local_pf(i,j,k) = MERGE( LDSA_av(k,j,i), REAL( fill_value, & 9309 KIND = wp ), BTEST( & 9310 wall_flags_0(k,j,i), 0 ) ) 9299 9311 ENDDO 9300 9312 ENDDO … … 9303 9315 9304 9316 IF ( mode == 'xy' ) grid = 'zu' 9305 9306 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin1' ) THEN 9317 9318 ELSEIF ( TRIM( variable(1:5) ) == 'N_bin' ) THEN 9319 9320 vari = TRIM( variable( 6:LEN( TRIM( variable ) )  3 ) ) 9321 9322 IF ( TRIM( vari ) == '1' ) b = 1 9323 IF ( TRIM( vari ) == '2' ) b = 2 9324 IF ( TRIM( vari ) == '3' ) b = 3 9325 IF ( TRIM( vari ) == '4' ) b = 4 9326 IF ( TRIM( vari ) == '5' ) b = 5 9327 IF ( TRIM( vari ) == '6' ) b = 6 9328 IF ( TRIM( vari ) == '7' ) b = 7 9329 IF ( TRIM( vari ) == '8' ) b = 8 9330 IF ( TRIM( vari ) == '9' ) b = 9 9331 IF ( TRIM( vari ) == '10' ) b = 10 9332 IF ( TRIM( vari ) == '11' ) b = 11 9333 IF ( TRIM( vari ) == '12' ) b = 12 9334 9307 9335 IF ( av == 0 ) THEN 9308 9336 DO i = nxl, nxr 9309 9337 DO j = nys, nyn 9310 DO k = nzb , nzt+19311 local_pf(i,j,k) = MERGE( aerosol_number( 1)%conc(k,j,i), &9312 REAL( 999.0_wp, KIND = wp ),&9338 DO k = nzb_do, nzt_do 9339 local_pf(i,j,k) = MERGE( aerosol_number(b)%conc(k,j,i), & 9340 REAL( fill_value, KIND = wp ), & 9313 9341 BTEST( wall_flags_0(k,j,i), 0 ) ) 9314 9342 ENDDO … … 9318 9346 DO i = nxl, nxr 9319 9347 DO j = nys, nyn 9320 DO k = nzb , nzt+19321 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i, 1), &9322 REAL( 999.0_wp, KIND = wp ),&9348 DO k = nzb_do, nzt_do 9349 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,b), & 9350 REAL( fill_value, KIND = wp ), & 9323 9351 BTEST( wall_flags_0(k,j,i), 0 ) ) 9324 9352 ENDDO … … 9326 9354 ENDDO 9327 9355 ENDIF 9328 9329 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin2' ) THEN 9356 9357 IF ( mode == 'xy' ) grid = 'zu' 9358 9359 ELSEIF ( TRIM( variable(1:4) ) == 'Ntot' ) THEN 9330 9360 IF ( av == 0 ) THEN 9331 9361 DO i = nxl, nxr 9332 9362 DO j = nys, nyn 9333 DO k = nzb, nzt+1 9334 local_pf(i,j,k) = MERGE( aerosol_number(2)%conc(k,j,i), & 9335 REAL( 999.0_wp, KIND = wp ), & 9336 BTEST( wall_flags_0(k,j,i), 0 ) ) 9363 DO k = nzb_do, nzt_do 9364 temp_bin = 0.0_wp 9365 DO b = 1, nbins 9366 temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i) 9367 ENDDO 9368 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = & 9369 wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9337 9370 ENDDO 9338 9371 ENDDO … … 9341 9374 DO i = nxl, nxr 9342 9375 DO j = nys, nyn 9343 DO k = nzb , nzt+19344 local_pf(i,j,k) = MERGE( N bins_av(k,j,i,2),&9345 REAL( 999.0_wp, KIND = wp ),&9346 BTEST(wall_flags_0(k,j,i), 0 ) )9376 DO k = nzb_do, nzt_do 9377 local_pf(i,j,k) = MERGE( Ntot_av(k,j,i), REAL( fill_value, & 9378 KIND = wp ), BTEST( & 9379 wall_flags_0(k,j,i), 0 ) ) 9347 9380 ENDDO 9348 9381 ENDDO 9349 9382 ENDDO 9350 9383 ENDIF 9384 9385 IF ( mode == 'xy' ) grid = 'zu' 9386 9387 9388 ELSEIF ( TRIM( variable(1:5) ) == 'm_bin' ) THEN 9351 9389 9352 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin3' ) THEN 9390 vari = TRIM( variable( 6:LEN( TRIM( variable ) )  3 ) ) 9391 9392 IF ( TRIM( vari ) == '1' ) b = 1 9393 IF ( TRIM( vari ) == '2' ) b = 2 9394 IF ( TRIM( vari ) == '3' ) b = 3 9395 IF ( TRIM( vari ) == '4' ) b = 4 9396 IF ( TRIM( vari ) == '5' ) b = 5 9397 IF ( TRIM( vari ) == '6' ) b = 6 9398 IF ( TRIM( vari ) == '7' ) b = 7 9399 IF ( TRIM( vari ) == '8' ) b = 8 9400 IF ( TRIM( vari ) == '9' ) b = 9 9401 IF ( TRIM( vari ) == '10' ) b = 10 9402 IF ( TRIM( vari ) == '11' ) b = 11 9403 IF ( TRIM( vari ) == '12' ) b = 12 9404 9353 9405 IF ( av == 0 ) THEN 9354 9406 DO i = nxl, nxr 9355 9407 DO j = nys, nyn 9356 DO k = nzb, nzt+1 9357 local_pf(i,j,k) = MERGE( aerosol_number(3)%conc(k,j,i), & 9358 REAL( 999.0_wp, KIND = wp ), & 9359 BTEST( wall_flags_0(k,j,i), 0 ) ) 9408 DO k = nzb_do, nzt_do 9409 temp_bin = 0.0_wp 9410 DO c = b, ncc_tot * nbins, nbins 9411 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 9412 ENDDO 9413 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, & 9414 KIND = wp ), BTEST( & 9415 wall_flags_0(k,j,i), 0 ) ) 9360 9416 ENDDO 9361 9417 ENDDO … … 9364 9420 DO i = nxl, nxr 9365 9421 DO j = nys, nyn 9366 DO k = nzb , nzt+19367 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,3),&9368 REAL( 999.0_wp, KIND = wp ),&9369 BTEST(wall_flags_0(k,j,i), 0 ) )9422 DO k = nzb_do, nzt_do 9423 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,b), REAL( fill_value,& 9424 KIND = wp ), BTEST( & 9425 wall_flags_0(k,j,i), 0 ) ) 9370 9426 ENDDO 9371 9427 ENDDO 9372 9428 ENDDO 9373 9429 ENDIF 9374 9375 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin4' ) THEN9376 IF ( av == 0 ) THEN9377 DO i = nxl, nxr9378 DO j = nys, nyn9379 DO k = nzb, nzt+19380 local_pf(i,j,k) = MERGE( aerosol_number(4)%conc(k,j,i), &9381 REAL( 999.0_wp, KIND = wp ), &9382 BTEST( wall_flags_0(k,j,i), 0 ) )9383 ENDDO9384 ENDDO9385 ENDDO9386 ELSE9387 DO i = nxl, nxr9388 DO j = nys, nyn9389 DO k = nzb, nzt+19390 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,4), &9391 REAL( 999.0_wp, KIND = wp ), &9392 BTEST( wall_flags_0(k,j,i), 0 ) )9393 ENDDO9394 ENDDO9395 ENDDO9396 ENDIF9397 9430 9398 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin5' ) THEN9399 IF ( av == 0 ) THEN9400 DO i = nxl, nxr9401 DO j = nys, nyn9402 DO k = nzb, nzt+19403 local_pf(i,j,k) = MERGE( aerosol_number(5)%conc(k,j,i), &9404 REAL( 999.0_wp, KIND = wp ), &9405 BTEST( wall_flags_0(k,j,i), 0 ) )9406 ENDDO9407 ENDDO9408 ENDDO9409 ELSE9410 DO i = nxl, nxr9411 DO j = nys, nyn9412 DO k = nzb, nzt+19413 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,5), &9414 REAL( 999.0_wp, KIND = wp ), &9415 BTEST( wall_flags_0(k,j,i), 0 ) )9416 ENDDO9417 ENDDO9418 ENDDO9419 ENDIF9420 9421 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin6' ) THEN9422 IF ( av == 0 ) THEN9423 DO i = nxl, nxr9424 DO j = nys, nyn9425 DO k = nzb, nzt+19426 local_pf(i,j,k) = MERGE( aerosol_number(6)%conc(k,j,i), &9427 REAL( 999.0_wp, KIND = wp ), &9428 BTEST( wall_flags_0(k,j,i), 0 ) )9429 ENDDO9430 ENDDO9431 ENDDO9432 ELSE9433 DO i = nxl, nxr9434 DO j = nys, nyn9435 DO k = nzb, nzt+19436 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,6), &9437 REAL( 999.0_wp, KIND = wp ), &9438 BTEST( wall_flags_0(k,j,i), 0 ) )9439 ENDDO9440 ENDDO9441 ENDDO9442 ENDIF9443 9444 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin7' ) THEN9445 IF ( av == 0 ) THEN9446 DO i = nxl, nxr9447 DO j = nys, nyn9448 DO k = nzb, nzt+19449 local_pf(i,j,k) = MERGE( aerosol_number(7)%conc(k,j,i), &9450 REAL( 999.0_wp, KIND = wp ), &9451 BTEST( wall_flags_0(k,j,i), 0 ) )9452 ENDDO9453 ENDDO9454 ENDDO9455 ELSE9456 DO i = nxl, nxr9457 DO j = nys, nyn9458 DO k = nzb, nzt+19459 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,7), &9460 REAL( 999.0_wp, KIND = wp ), &9461 BTEST( wall_flags_0(k,j,i), 0 ) )9462 ENDDO9463 ENDDO9464 ENDDO9465 ENDIF9466 9467 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin8' ) THEN9468 IF ( av == 0 ) THEN9469 DO i = nxl, nxr9470 DO j = nys, nyn9471 DO k = nzb, nzt+19472 local_pf(i,j,k) = MERGE( aerosol_number(8)%conc(k,j,i), &9473 REAL( 999.0_wp, KIND = wp ), &9474 BTEST( wall_flags_0(k,j,i), 0 ) )9475 ENDDO9476 ENDDO9477 ENDDO9478 ELSE9479 DO i = nxl, nxr9480 DO j = nys, nyn9481 DO k = nzb, nzt+19482 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,8), &9483 REAL( 999.0_wp, KIND = wp ), &9484 BTEST( wall_flags_0(k,j,i), 0 ) )9485 ENDDO9486 ENDDO9487 ENDDO9488 ENDIF9489 9490 ELSEIF ( TRIM( variable(1:6) ) == 'N_bin9' ) THEN9491 IF ( av == 0 ) THEN9492 DO i = nxl, nxr9493 DO j = nys, nyn9494 DO k = nzb, nzt+19495 local_pf(i,j,k) = MERGE( aerosol_number(9)%conc(k,j,i), &9496 REAL( 999.0_wp, KIND = wp ), &9497 BTEST( wall_flags_0(k,j,i), 0 ) )9498 ENDDO9499 ENDDO9500 ENDDO9501 ELSE9502 DO i = nxl, nxr9503 DO j = nys, nyn9504 DO k = nzb, nzt+19505 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,9), &9506 REAL( 999.0_wp, KIND = wp ), &9507 BTEST( wall_flags_0(k,j,i), 0 ) )9508 ENDDO9509 ENDDO9510 ENDDO9511 ENDIF9512 9513 ELSEIF ( TRIM( variable(1:7) ) == 'N_bin10' ) THEN9514 IF ( av == 0 ) THEN9515 DO i = nxl, nxr9516 DO j = nys, nyn9517 DO k = nzb, nzt+19518 local_pf(i,j,k) = MERGE( aerosol_number(10)%conc(k,j,i), &9519 REAL( 999.0_wp, KIND = wp ), &9520 BTEST( wall_flags_0(k,j,i), 0 ) )9521 ENDDO9522 ENDDO9523 ENDDO9524 ELSE9525 DO i = nxl, nxr9526 DO j = nys, nyn9527 DO k = nzb, nzt+19528 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,10), &9529 REAL( 999.0_wp, KIND = wp ), &9530 BTEST( wall_flags_0(k,j,i), 0 ) )9531 ENDDO9532 ENDDO9533 ENDDO9534 ENDIF9535 9536 ELSEIF ( TRIM( variable(1:7) ) == 'N_bin11' ) THEN9537 IF ( av == 0 ) THEN9538 DO i = nxl, nxr9539 DO j = nys, nyn9540 DO k = nzb, nzt+19541 local_pf(i,j,k) = MERGE( aerosol_number(11)%conc(k,j,i), &9542 REAL( 999.0_wp, KIND = wp ), &9543 BTEST( wall_flags_0(k,j,i), 0 ) )9544 ENDDO9545 ENDDO9546 ENDDO9547 ELSE9548 DO i = nxl, nxr9549 DO j = nys, nyn9550 DO k = nzb, nzt+19551 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,11), &9552 REAL( 999.0_wp, KIND = wp ), &9553 BTEST( wall_flags_0(k,j,i), 0 ) )9554 ENDDO9555 ENDDO9556 ENDDO9557 ENDIF9558 9559 ELSEIF ( TRIM( variable(1:7) ) == 'N_bin12' ) THEN9560 IF ( av == 0 ) THEN9561 DO i = nxl, nxr9562 DO j = nys, nyn9563 DO k = nzb, nzt+19564 local_pf(i,j,k) = MERGE( aerosol_number(12)%conc(k,j,i), &9565 REAL( 999.0_wp, KIND = wp ), &9566 BTEST( wall_flags_0(k,j,i), 0 ) )9567 ENDDO9568 ENDDO9569 ENDDO9570 ELSE9571 DO i = nxl, nxr9572 DO j = nys, nyn9573 DO k = nzb, nzt+19574 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,12), &9575 REAL( 999.0_wp, KIND = wp ), &9576 BTEST( wall_flags_0(k,j,i), 0 ) )9577 ENDDO9578 ENDDO9579 ENDDO9580 ENDIF9581 9582 ELSEIF ( TRIM( variable(1:4) ) == 'Ntot' ) THEN9583 IF ( av == 0 ) THEN9584 DO i = nxl, nxr9585 DO j = nys, nyn9586 DO k = nzb, nzt+19587 temp_bin = 0.0_wp9588 DO b = 1, nbins9589 temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i)9590 ENDDO9591 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9592 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9593 ENDDO9594 ENDDO9595 ENDDO9596 ELSE9597 DO i = nxl, nxr9598 DO j = nys, nyn9599 DO k = nzb, nzt+19600 local_pf(i,j,k) = MERGE( Ntot_av(k,j,i), REAL( 999.0_wp, &9601 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9602 ENDDO9603 ENDDO9604 ENDDO9605 ENDIF9606 9607 9431 IF ( mode == 'xy' ) grid = 'zu' 9608 9609 9610 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin1' ) THEN9611 IF ( av == 0 ) THEN9612 DO i = nxl, nxr9613 DO j = nys, nyn9614 DO k = nzb, nzt+19615 temp_bin = 0.0_wp9616 DO c = 1, ncc_tot*nbins, nbins9617 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9618 ENDDO9619 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9620 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9621 ENDDO9622 ENDDO9623 ENDDO9624 ELSE9625 DO i = nxl, nxr9626 DO j = nys, nyn9627 DO k = nzb, nzt+19628 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,1), REAL( 999.0_wp,&9629 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9630 ENDDO9631 ENDDO9632 ENDDO9633 ENDIF9634 9635 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin2' ) THEN9636 IF ( av == 0 ) THEN9637 DO i = nxl, nxr9638 DO j = nys, nyn9639 DO k = nzb, nzt+19640 temp_bin = 0.0_wp9641 DO c = 2, ncc_tot*nbins, nbins9642 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9643 ENDDO9644 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9645 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9646 ENDDO9647 ENDDO9648 ENDDO9649 ELSE9650 DO i = nxl, nxr9651 DO j = nys, nyn9652 DO k = nzb, nzt+19653 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,2), REAL( 999.0_wp,&9654 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9655 ENDDO9656 ENDDO9657 ENDDO9658 ENDIF9659 9660 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin3' ) THEN9661 IF ( av == 0 ) THEN9662 DO i = nxl, nxr9663 DO j = nys, nyn9664 DO k = nzb, nzt+19665 temp_bin = 0.0_wp9666 DO c = 3, ncc_tot*nbins, nbins9667 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9668 ENDDO9669 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9670 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9671 ENDDO9672 ENDDO9673 ENDDO9674 ELSE9675 DO i = nxl, nxr9676 DO j = nys, nyn9677 DO k = nzb, nzt+19678 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,3), REAL( 999.0_wp,&9679 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9680 ENDDO9681 ENDDO9682 ENDDO9683 ENDIF9684 9685 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin4' ) THEN9686 IF ( av == 0 ) THEN9687 DO i = nxl, nxr9688 DO j = nys, nyn9689 DO k = nzb, nzt+19690 temp_bin = 0.0_wp9691 DO c = 4, ncc_tot*nbins, nbins9692 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9693 ENDDO9694 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9695 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9696 ENDDO9697 ENDDO9698 ENDDO9699 ELSE9700 DO i = nxl, nxr9701 DO j = nys, nyn9702 DO k = nzb, nzt+19703 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,4), REAL( 999.0_wp,&9704 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9705 ENDDO9706 ENDDO9707 ENDDO9708 ENDIF9709 9710 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin5' ) THEN9711 IF ( av == 0 ) THEN9712 DO i = nxl, nxr9713 DO j = nys, nyn9714 DO k = nzb, nzt+19715 temp_bin = 0.0_wp9716 DO c = 5, ncc_tot*nbins, nbins9717 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9718 ENDDO9719 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9720 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9721 ENDDO9722 ENDDO9723 ENDDO9724 ELSE9725 DO i = nxl, nxr9726 DO j = nys, nyn9727 DO k = nzb, nzt+19728 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,5), REAL( 999.0_wp,&9729 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9730 ENDDO9731 ENDDO9732 ENDDO9733 ENDIF9734 9735 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin6' ) THEN9736 IF ( av == 0 ) THEN9737 DO i = nxl, nxr9738 DO j = nys, nyn9739 DO k = nzb, nzt+19740 temp_bin = 0.0_wp9741 DO c = 6, ncc_tot*nbins, nbins9742 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9743 ENDDO9744 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9745 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9746 ENDDO9747 ENDDO9748 ENDDO9749 ELSE9750 DO i = nxl, nxr9751 DO j = nys, nyn9752 DO k = nzb, nzt+19753 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,6), REAL( 999.0_wp,&9754 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9755 ENDDO9756 ENDDO9757 ENDDO9758 ENDIF9759 9760 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin7' ) THEN9761 IF ( av == 0 ) THEN9762 DO i = nxl, nxr9763 DO j = nys, nyn9764 DO k = nzb, nzt+19765 temp_bin = 0.0_wp9766 DO c = 7, ncc_tot*nbins, nbins9767 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9768 ENDDO9769 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9770 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9771 ENDDO9772 ENDDO9773 ENDDO9774 ELSE9775 DO i = nxl, nxr9776 DO j = nys, nyn9777 DO k = nzb, nzt+19778 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,7), REAL( 999.0_wp,&9779 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9780 ENDDO9781 ENDDO9782 ENDDO9783 ENDIF9784 9785 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin8' ) THEN9786 IF ( av == 0 ) THEN9787 DO i = nxl, nxr9788 DO j = nys, nyn9789 DO k = nzb, nzt+19790 temp_bin = 0.0_wp9791 DO c = 8, ncc_tot*nbins, nbins9792 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9793 ENDDO9794 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9795 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9796 ENDDO9797 ENDDO9798 ENDDO9799 ELSE9800 DO i = nxl, nxr9801 DO j = nys, nyn9802 DO k = nzb, nzt+19803 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,8), REAL( 999.0_wp,&9804 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9805 ENDDO9806 ENDDO9807 ENDDO9808 ENDIF9809 9810 ELSEIF ( TRIM( variable(1:6) ) == 'm_bin9' ) THEN9811 IF ( av == 0 ) THEN9812 DO i = nxl, nxr9813 DO j = nys, nyn9814 DO k = nzb, nzt+19815 temp_bin = 0.0_wp9816 DO c = 9, ncc_tot*nbins, nbins9817 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9818 ENDDO9819 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9820 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9821 ENDDO9822 ENDDO9823 ENDDO9824 ELSE9825 DO i = nxl, nxr9826 DO j = nys, nyn9827 DO k = nzb, nzt+19828 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,9), REAL( 999.0_wp,&9829 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9830 ENDDO9831 ENDDO9832 ENDDO9833 ENDIF9834 9835 ELSEIF ( TRIM( variable(1:7) ) == 'm_bin10' ) THEN9836 IF ( av == 0 ) THEN9837 DO i = nxl, nxr9838 DO j = nys, nyn9839 DO k = nzb, nzt+19840 temp_bin = 0.0_wp9841 DO c = 10, ncc_tot*nbins, nbins9842 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9843 ENDDO9844 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9845 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9846 ENDDO9847 ENDDO9848 ENDDO9849 ELSE9850 DO i = nxl, nxr9851 DO j = nys, nyn9852 DO k = nzb, nzt+19853 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,10), REAL( &9854 999.0_wp, KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9855 ENDDO9856 ENDDO9857 ENDDO9858 ENDIF9859 9860 ELSEIF ( TRIM( variable(1:7) ) == 'm_bin11' ) THEN9861 IF ( av == 0 ) THEN9862 DO i = nxl, nxr9863 DO j = nys, nyn9864 DO k = nzb, nzt+19865 temp_bin = 0.0_wp9866 DO c = 11, ncc_tot*nbins, nbins9867 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9868 ENDDO9869 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9870 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9871 ENDDO9872 ENDDO9873 ENDDO9874 ELSE9875 DO i = nxl, nxr9876 DO j = nys, nyn9877 DO k = nzb, nzt+19878 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,11), REAL( &9879 999.0_wp, KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9880 ENDDO9881 ENDDO9882 ENDDO9883 ENDIF9884 9885 ELSEIF ( TRIM( variable(1:7) ) == 'm_bin12' ) THEN9886 IF ( av == 0 ) THEN9887 DO i = nxl, nxr9888 DO j = nys, nyn9889 DO k = nzb, nzt+19890 temp_bin = 0.0_wp9891 DO c = 12, ncc_tot*nbins, nbins9892 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i)9893 ENDDO9894 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, &9895 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9896 ENDDO9897 ENDDO9898 ENDDO9899 ELSE9900 DO i = nxl, nxr9901 DO j = nys, nyn9902 DO k = nzb, nzt+19903 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,12), REAL( &9904 999.0_wp, KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )9905 ENDDO9906 ENDDO9907 ENDDO9908 ENDIF9909 9432 9910 9433 ELSEIF ( TRIM( variable(1:5) ) == 'PM2.5' ) THEN … … 9912 9435 DO i = nxl, nxr 9913 9436 DO j = nys, nyn 9914 DO k = nzb , nzt+19437 DO k = nzb_do, nzt_do 9915 9438 temp_bin = 0.0_wp 9916 9439 DO b = 1, nbins … … 9921 9444 ENDIF 9922 9445 ENDDO 9923 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, & 9924 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9446 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, & 9447 KIND = wp ), BTEST( & 9448 wall_flags_0(k,j,i), 0 ) ) 9925 9449 ENDDO 9926 9450 ENDDO … … 9929 9453 DO i = nxl, nxr 9930 9454 DO j = nys, nyn 9931 DO k = nzb, nzt+1 9932 local_pf(i,j,k) = MERGE( PM25_av(k,j,i), REAL( 999.0_wp, & 9933 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9455 DO k = nzb_do, nzt_do 9456 local_pf(i,j,k) = MERGE( PM25_av(k,j,i), REAL( fill_value, & 9457 KIND = wp ), BTEST( & 9458 wall_flags_0(k,j,i), 0 ) ) 9934 9459 ENDDO 9935 9460 ENDDO … … 9944 9469 DO i = nxl, nxr 9945 9470 DO j = nys, nyn 9946 DO k = nzb , nzt+19471 DO k = nzb_do, nzt_do 9947 9472 temp_bin = 0.0_wp 9948 9473 DO b = 1, nbins … … 9953 9478 ENDIF 9954 9479 ENDDO 9955 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, & 9956 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9480 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, & 9481 KIND = wp ), BTEST( & 9482 wall_flags_0(k,j,i), 0 ) ) 9957 9483 ENDDO 9958 9484 ENDDO … … 9961 9487 DO i = nxl, nxr 9962 9488 DO j = nys, nyn 9963 DO k = nzb, nzt+1 9964 local_pf(i,j,k) = MERGE( PM10_av(k,j,i), REAL( 999.0_wp, & 9965 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9489 DO k = nzb_do, nzt_do 9490 local_pf(i,j,k) = MERGE( PM10_av(k,j,i), REAL( fill_value, & 9491 KIND = wp ), BTEST( & 9492 wall_flags_0(k,j,i), 0 ) ) 9966 9493 ENDDO 9967 9494 ENDDO … … 9978 9505 DO i = nxl, nxr 9979 9506 DO j = nys, nyn 9980 DO k = nzb , nzt+19507 DO k = nzb_do, nzt_do 9981 9508 temp_bin = 0.0_wp 9982 9509 DO c = ( icc1 )*nbins+1, icc*nbins, 1 9983 9510 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 9984 9511 ENDDO 9985 local_pf(i,j,k) = MERGE( temp_bin, REAL( 999.0_wp, & 9986 KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) ) 9512 local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, & 9513 KIND = wp ), BTEST( & 9514 wall_flags_0(k,j,i), 0 ) ) 9987 9515 ENDDO 9988 9516 ENDDO … … 9998 9526 DO i = nxl, nxr 9999 9527 DO j = nys, nyn 10000 DO k = nzb , nzt+19528 DO k = nzb_do, nzt_do 10001 9529 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), & 10002 REAL( 999.0_wp, KIND = wp ),&9530 REAL( fill_value, KIND = wp ), & 10003 9531 BTEST( wall_flags_0(k,j,i), 0 ) ) 10004 9532 ENDDO … … 10007 9535 ENDIF 10008 9536 ELSE 10009 local_pf = 0.0_wp9537 local_pf = fill_value 10010 9538 ENDIF 10011 9539 … … 10027 9555 !> Subroutine defining 3D output variables 10028 9556 !! 10029 SUBROUTINE salsa_data_output_3d( av, variable, found, local_pf ) 9557 SUBROUTINE salsa_data_output_3d( av, variable, found, local_pf, nzb_do, & 9558 nzt_do ) 10030 9559 10031 9560 USE indices 10032 9561 10033 9562 USE kinds 9563 10034 9564 10035 9565 IMPLICIT NONE … … 10037 9567 CHARACTER (LEN=*), INTENT(in) :: variable !< 10038 9568 10039 INTEGER(iwp) :: av !< 10040 INTEGER(iwp) :: c !< 10041 INTEGER(iwp) :: i !< 10042 INTEGER(iwp) :: icc !< index of a chemical compound 10043 INTEGER(iwp) :: j !< 10044 INTEGER(iwp) :: k !< 10045 INTEGER(iwp) :: n !< 10046 10047 LOGICAL :: found !< 10048 REAL(wp) :: df !< For calculating LDSA: fraction of particles 10049 !< depositing in the alveolar (or tracheobronchial) 10050 !< region of the lung. Depends on the particle size 10051 REAL(wp) :: mean_d !< Particle diameter in micrometres 10052 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 10053 10054 REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< local 10055 !< array to which output data is resorted to 10056 REAL(wp) :: temp_bin !< 10057 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< points to 10058 !< selected output variable 9569 INTEGER(iwp) :: av !< 9570 INTEGER(iwp) :: b !< running index: size bins 9571 INTEGER(iwp) :: c !< running index: mass bins 9572 INTEGER(iwp) :: i !< 9573 INTEGER(iwp) :: icc !< index of a chemical compound 9574 INTEGER(iwp) :: j !< 9575 INTEGER(iwp) :: k !< 9576 INTEGER(iwp) :: nzb_do !< 9577 INTEGER(iwp) :: nzt_do !< 9578 9579 LOGICAL :: found !< 9580 9581 REAL(wp) :: df !< For calculating LDSA: fraction of particles 9582 !< depositing in the alveolar (or tracheobronchial) 9583 !< region of the lung. Depends on the particle size 9584 REAL(wp) :: fill_value = 9999.0_wp !< value for the _FillValue attribute 9585 REAL(wp) :: mean_d !< Particle diameter in micrometres 9586 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 9587 REAL(wp) :: temp_bin !< temporary array for calculating output variables 9588 9589 REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< local 9590 9591 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< pointer 9592 10059 9593 10060 9594 found = .TRUE. … … 10073 9607 DO i = nxl, nxr 10074 9608 DO j = nys, nyn 10075 DO k = nzb , nzt+19609 DO k = nzb_do, nzt_do 10076 9610 local_pf(i,j,k) = MERGE( salsa_gas(icc)%conc(k,j,i), & 10077 REAL( 999.0_wp, KIND = wp ),&9611 REAL( fill_value, KIND = wp ), & 10078 9612 BTEST( wall_flags_0(k,j,i), 0 ) ) 10079 9613 ENDDO … … 10088 9622 DO i = nxl, nxr 10089 9623 DO j = nys, nyn 10090 DO k = nzb , nzt+19624 DO k = nzb_do, nzt_do 10091 9625 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), & 10092 REAL( 999.0_wp, KIND = wp ),&9626 REAL( fill_value, KIND = wp ), & 10093 9627 BTEST( wall_flags_0(k,j,i), 0 ) ) 10094 9628 ENDDO … … 10101 9635 DO i = nxl, nxr 10102 9636 DO j = nys, nyn 10103 DO k = nzb , nzt+19637 DO k = nzb_do, nzt_do 10104 9638 temp_bin = 0.0_wp 10105 DO n= 1, nbins9639 DO b = 1, nbins 10106 9640 ! 10107 9641 ! Diameter in micrometres 10108 mean_d = 1.0E+6_wp * Ra_dry(k,j,i, n) * 2.0_wp9642 mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp 10109 9643 ! 10110 9644 ! Deposition factor: alveolar 10111 9645 df = ( 0.01555_wp / mean_d ) * ( EXP( 0.416_wp * & 10112 ( LOG( mean_d ) + 2.84_wp )**2.0_wp )&10113 + 19.11_wp * EXP( 0.482_wp *&10114 ( LOG( mean_d )  1.362_wp)**2.0_wp ) )9646 ( LOG( mean_d ) + 2.84_wp )**2.0_wp ) + 19.11_wp & 9647 * EXP( 0.482_wp * ( LOG( mean_d )  1.362_wp & 9648 )**2.0_wp ) ) 10115 9649 ! 10116 9650 ! Number concentration in 1/cm3 10117 nc = 1.0E6_wp * aerosol_number( n)%conc(k,j,i)9651 nc = 1.0E6_wp * aerosol_number(b)%conc(k,j,i) 10118 9652 ! 10119 9653 ! Lungdeposited surface area LDSA (units mum2/cm3) … … 10121 9655 ENDDO 10122 9656 local_pf(i,j,k) = MERGE( temp_bin, & 10123 REAL( 999.0_wp, KIND = wp ),&9657 REAL( fill_value, KIND = wp ), & 10124 9658 BTEST( wall_flags_0(k,j,i), 0 ) ) 10125 9659 ENDDO … … 10129 9663 DO i = nxl, nxr 10130 9664 DO j = nys, nyn 10131 DO k = nzb , nzt+19665 DO k = nzb_do, nzt_do 10132 9666 local_pf(i,j,k) = MERGE( LDSA_av(k,j,i), & 10133 REAL( 999.0_wp, KIND = wp ), & 9667 REAL( fill_value, KIND = wp ), & 9668 BTEST( wall_flags_0(k,j,i), 0 ) ) 9669 ENDDO 9670 ENDDO 9671 ENDDO 9672 ENDIF 9673 9674 CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', & 9675 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' ) 9676 IF ( TRIM( variable(6:) ) == '1' ) b = 1 9677 IF ( TRIM( variable(6:) ) == '2' ) b = 2 9678 IF ( TRIM( variable(6:) ) == '3' ) b = 3 9679 IF ( TRIM( variable(6:) ) == '4' ) b = 4 9680 IF ( TRIM( variable(6:) ) == '5' ) b = 5 9681 IF ( TRIM( variable(6:) ) == '6' ) b = 6 9682 IF ( TRIM( variable(6:) ) == '7' ) b = 7 9683 IF ( TRIM( variable(6:) ) == '8' ) b = 8 9684 IF ( TRIM( variable(6:) ) == '9' ) b = 9 9685 IF ( TRIM( variable(6:) ) == '10' ) b = 10 9686 IF ( TRIM( variable(6:) ) == '11' ) b = 11 9687 IF ( TRIM( variable(6:) ) == '12' ) b = 12 9688 9689 IF ( av == 0 ) THEN 9690 DO i = nxl, nxr 9691 DO j = nys, nyn 9692 DO k = nzb_do, nzt_do 9693 local_pf(i,j,k) = MERGE( aerosol_number(b)%conc(k,j,i), & 9694 REAL( fill_value, KIND = wp ), & 9695 BTEST( wall_flags_0(k,j,i), 0 ) ) 9696 ENDDO 9697 ENDDO 9698 ENDDO 9699 ELSE 9700 DO i = nxl, nxr 9701 DO j = nys, nyn 9702 DO k = nzb_do, nzt_do 9703 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,b), & 9704 REAL( fill_value, KIND = wp ), & 10134 9705 BTEST( wall_flags_0(k,j,i), 0 ) ) 10135 9706 ENDDO … … 10142 9713 DO i = nxl, nxr 10143 9714 DO j = nys, nyn 10144 DO k = nzb , nzt+19715 DO k = nzb_do, nzt_do 10145 9716 temp_bin = 0.0_wp 10146 DO n= 1, nbins10147 temp_bin = temp_bin + aerosol_number( n)%conc(k,j,i)9717 DO b = 1, nbins 9718 temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i) 10148 9719 ENDDO 10149 9720 local_pf(i,j,k) = MERGE( temp_bin, & 10150 REAL( 999.0_wp, KIND = wp ),&9721 REAL( fill_value, KIND = wp ), & 10151 9722 BTEST( wall_flags_0(k,j,i), 0 ) ) 10152 9723 ENDDO … … 10156 9727 DO i = nxl, nxr 10157 9728 DO j = nys, nyn 10158 DO k = nzb , nzt+19729 DO k = nzb_do, nzt_do 10159 9730 local_pf(i,j,k) = MERGE( Ntot_av(k,j,i), & 10160 REAL( 999.0_wp, KIND = wp ), & 9731 REAL( fill_value, KIND = wp ), & 9732 BTEST( wall_flags_0(k,j,i), 0 ) ) 9733 ENDDO 9734 ENDDO 9735 ENDDO 9736 ENDIF 9737 9738 CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', & 9739 'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' ) 9740 IF ( TRIM( variable(6:) ) == '1' ) b = 1 9741 IF ( TRIM( variable(6:) ) == '2' ) b = 2 9742 IF ( TRIM( variable(6:) ) == '3' ) b = 3 9743 IF ( TRIM( variable(6:) ) == '4' ) b = 4 9744 IF ( TRIM( variable(6:) ) == '5' ) b = 5 9745 IF ( TRIM( variable(6:) ) == '6' ) b = 6 9746 IF ( TRIM( variable(6:) ) == '7' ) b = 7 9747 IF ( TRIM( variable(6:) ) == '8' ) b = 8 9748 IF ( TRIM( variable(6:) ) == '9' ) b = 9 9749 IF ( TRIM( variable(6:) ) == '10' ) b = 10 9750 IF ( TRIM( variable(6:) ) == '11' ) b = 11 9751 IF ( TRIM( variable(6:) ) == '12' ) b = 12 9752 9753 IF ( av == 0 ) THEN 9754 DO i = nxl, nxr 9755 DO j = nys, nyn 9756 DO k = nzb_do, nzt_do 9757 temp_bin = 0.0_wp 9758 DO c = b, ncc_tot * nbins, nbins 9759 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 9760 ENDDO 9761 local_pf(i,j,k) = MERGE( temp_bin, & 9762 REAL( fill_value, KIND = wp ), & 9763 BTEST( wall_flags_0(k,j,i), 0 ) ) 9764 ENDDO 9765 ENDDO 9766 ENDDO 9767 ELSE 9768 DO i = nxl, nxr 9769 DO j = nys, nyn 9770 DO k = nzb_do, nzt_do 9771 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,b), & 9772 REAL( fill_value, KIND = wp ), & 10161 9773 BTEST( wall_flags_0(k,j,i), 0 ) ) 10162 9774 ENDDO … … 10169 9781 DO i = nxl, nxr 10170 9782 DO j = nys, nyn 10171 DO k = nzb , nzt+19783 DO k = nzb_do, nzt_do 10172 9784 temp_bin = 0.0_wp 10173 DO n= 1, nbins10174 IF ( 2.0_wp * Ra_dry(k,j,i, n) <= 2.5E6_wp ) THEN10175 DO c = n, nbins*ncc, nbins9785 DO b = 1, nbins 9786 IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E6_wp ) THEN 9787 DO c = b, nbins * ncc, nbins 10176 9788 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10177 9789 ENDDO … … 10179 9791 ENDDO 10180 9792 local_pf(i,j,k) = MERGE( temp_bin, & 10181 REAL( 999.0_wp, KIND = wp ),&9793 REAL( fill_value, KIND = wp ), & 10182 9794 BTEST( wall_flags_0(k,j,i), 0 ) ) 10183 9795 ENDDO … … 10187 9799 DO i = nxl, nxr 10188 9800 DO j = nys, nyn 10189 DO k = nzb , nzt+19801 DO k = nzb_do, nzt_do 10190 9802 local_pf(i,j,k) = MERGE( PM25_av(k,j,i), & 10191 REAL( 999.0_wp, KIND = wp ),&9803 REAL( fill_value, KIND = wp ), & 10192 9804 BTEST( wall_flags_0(k,j,i), 0 ) ) 10193 9805 ENDDO … … 10200 9812 DO i = nxl, nxr 10201 9813 DO j = nys, nyn 10202 DO k = nzb , nzt+19814 DO k = nzb_do, nzt_do 10203 9815 temp_bin = 0.0_wp 10204 DO n= 1, nbins10205 IF ( 2.0_wp * Ra_dry(k,j,i, n) <= 10.0E6_wp ) THEN10206 DO c = n, nbins*ncc, nbins9816 DO b = 1, nbins 9817 IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E6_wp ) THEN 9818 DO c = b, nbins * ncc, nbins 10207 9819 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10208 9820 ENDDO … … 10210 9822 ENDDO 10211 9823 local_pf(i,j,k) = MERGE( temp_bin, & 10212 REAL( 999.0_wp, KIND = wp ),&9824 REAL( fill_value, KIND = wp ), & 10213 9825 BTEST( wall_flags_0(k,j,i), 0 ) ) 10214 9826 ENDDO … … 10218 9830 DO i = nxl, nxr 10219 9831 DO j = nys, nyn 10220 DO k = nzb , nzt+19832 DO k = nzb_do, nzt_do 10221 9833 local_pf(i,j,k) = MERGE( PM10_av(k,j,i), & 10222 REAL( 999.0_wp, KIND = wp ), & 10223 BTEST( wall_flags_0(k,j,i), 0 ) ) 10224 ENDDO 10225 ENDDO 10226 ENDDO 10227 ENDIF 10228 10229 CASE ( 'N_bin1' ) 10230 IF ( av == 0 ) THEN 10231 DO i = nxl, nxr 10232 DO j = nys, nyn 10233 DO k = nzb, nzt+1 10234 local_pf(i,j,k) = MERGE( aerosol_number(1)%conc(k,j,i), & 10235 REAL( 999.0_wp, KIND = wp ), & 10236 BTEST( wall_flags_0(k,j,i), 0 ) ) 10237 ENDDO 10238 ENDDO 10239 ENDDO 10240 ELSE 10241 DO i = nxl, nxr 10242 DO j = nys, nyn 10243 DO k = nzb, nzt+1 10244 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,1), & 10245 REAL( 999.0_wp, KIND = wp ), & 10246 BTEST( wall_flags_0(k,j,i), 0 ) ) 10247 ENDDO 10248 ENDDO 10249 ENDDO 10250 ENDIF 10251 10252 CASE ( 'N_bin2' ) 10253 IF ( av == 0 ) THEN 10254 DO i = nxl, nxr 10255 DO j = nys, nyn 10256 DO k = nzb, nzt+1 10257 local_pf(i,j,k) = MERGE( aerosol_number(2)%conc(k,j,i), & 10258 REAL( 999.0_wp, KIND = wp ), & 10259 BTEST( wall_flags_0(k,j,i), 0 ) ) 10260 ENDDO 10261 ENDDO 10262 ENDDO 10263 ELSE 10264 DO i = nxl, nxr 10265 DO j = nys, nyn 10266 DO k = nzb, nzt+1 10267 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,2), & 10268 REAL( 999.0_wp, KIND = wp ), & 10269 BTEST( wall_flags_0(k,j,i), 0 ) ) 10270 ENDDO 10271 ENDDO 10272 ENDDO 10273 ENDIF 10274 10275 CASE ( 'N_bin3' ) 10276 IF ( av == 0 ) THEN 10277 DO i = nxl, nxr 10278 DO j = nys, nyn 10279 DO k = nzb, nzt+1 10280 local_pf(i,j,k) = MERGE( aerosol_number(3)%conc(k,j,i), & 10281 REAL( 999.0_wp, KIND = wp ), & 10282 BTEST( wall_flags_0(k,j,i), 0 ) ) 10283 ENDDO 10284 ENDDO 10285 ENDDO 10286 ELSE 10287 DO i = nxl, nxr 10288 DO j = nys, nyn 10289 DO k = nzb, nzt+1 10290 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,3), & 10291 REAL( 999.0_wp, KIND = wp ), & 10292 BTEST( wall_flags_0(k,j,i), 0 ) ) 10293 ENDDO 10294 ENDDO 10295 ENDDO 10296 ENDIF 10297 10298 CASE ( 'N_bin4' ) 10299 IF ( av == 0 ) THEN 10300 DO i = nxl, nxr 10301 DO j = nys, nyn 10302 DO k = nzb, nzt+1 10303 local_pf(i,j,k) = MERGE( aerosol_number(4)%conc(k,j,i), & 10304 REAL( 999.0_wp, KIND = wp ), & 10305 BTEST( wall_flags_0(k,j,i), 0 ) ) 10306 ENDDO 10307 ENDDO 10308 ENDDO 10309 ELSE 10310 DO i = nxl, nxr 10311 DO j = nys, nyn 10312 DO k = nzb, nzt+1 10313 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,4), & 10314 REAL( 999.0_wp, KIND = wp ), & 10315 BTEST( wall_flags_0(k,j,i), 0 ) ) 10316 ENDDO 10317 ENDDO 10318 ENDDO 10319 ENDIF 10320 10321 CASE ( 'N_bin5' ) 10322 IF ( av == 0 ) THEN 10323 DO i = nxl, nxr 10324 DO j = nys, nyn 10325 DO k = nzb, nzt+1 10326 local_pf(i,j,k) = MERGE( aerosol_number(5)%conc(k,j,i), & 10327 REAL( 999.0_wp, KIND = wp ), & 10328 BTEST( wall_flags_0(k,j,i), 0 ) ) 10329 ENDDO 10330 ENDDO 10331 ENDDO 10332 ELSE 10333 DO i = nxl, nxr 10334 DO j = nys, nyn 10335 DO k = nzb, nzt+1 10336 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,5), & 10337 REAL( 999.0_wp, KIND = wp ), & 10338 BTEST( wall_flags_0(k,j,i), 0 ) ) 10339 ENDDO 10340 ENDDO 10341 ENDDO 10342 ENDIF 10343 10344 CASE ( 'N_bin6' ) 10345 IF ( av == 0 ) THEN 10346 DO i = nxl, nxr 10347 DO j = nys, nyn 10348 DO k = nzb, nzt+1 10349 local_pf(i,j,k) = MERGE( aerosol_number(6)%conc(k,j,i), & 10350 REAL( 999.0_wp, KIND = wp ), & 10351 BTEST( wall_flags_0(k,j,i), 0 ) ) 10352 ENDDO 10353 ENDDO 10354 ENDDO 10355 ELSE 10356 DO i = nxl, nxr 10357 DO j = nys, nyn 10358 DO k = nzb, nzt+1 10359 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,6), & 10360 REAL( 999.0_wp, KIND = wp ), & 10361 BTEST( wall_flags_0(k,j,i), 0 ) ) 10362 ENDDO 10363 ENDDO 10364 ENDDO 10365 ENDIF 10366 10367 CASE ( 'N_bin7' ) 10368 IF ( av == 0 ) THEN 10369 DO i = nxl, nxr 10370 DO j = nys, nyn 10371 DO k = nzb, nzt+1 10372 local_pf(i,j,k) = MERGE( aerosol_number(7)%conc(k,j,i), & 10373 REAL( 999.0_wp, KIND = wp ), & 10374 BTEST( wall_flags_0(k,j,i), 0 ) ) 10375 ENDDO 10376 ENDDO 10377 ENDDO 10378 ELSE 10379 DO i = nxl, nxr 10380 DO j = nys, nyn 10381 DO k = nzb, nzt+1 10382 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,7), & 10383 REAL( 999.0_wp, KIND = wp ), & 10384 BTEST( wall_flags_0(k,j,i), 0 ) ) 10385 ENDDO 10386 ENDDO 10387 ENDDO 10388 ENDIF 10389 10390 CASE ( 'N_bin8' ) 10391 IF ( av == 0 ) THEN 10392 DO i = nxl, nxr 10393 DO j = nys, nyn 10394 DO k = nzb, nzt+1 10395 local_pf(i,j,k) = MERGE( aerosol_number(8)%conc(k,j,i), & 10396 REAL( 999.0_wp, KIND = wp ), & 10397 BTEST( wall_flags_0(k,j,i), 0 ) ) 10398 ENDDO 10399 ENDDO 10400 ENDDO 10401 ELSE 10402 DO i = nxl, nxr 10403 DO j = nys, nyn 10404 DO k = nzb, nzt+1 10405 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,8), & 10406 REAL( 999.0_wp, KIND = wp ), & 10407 BTEST( wall_flags_0(k,j,i), 0 ) ) 10408 ENDDO 10409 ENDDO 10410 ENDDO 10411 ENDIF 10412 10413 CASE ( 'N_bin9' ) 10414 IF ( av == 0 ) THEN 10415 DO i = nxl, nxr 10416 DO j = nys, nyn 10417 DO k = nzb, nzt+1 10418 local_pf(i,j,k) = MERGE( aerosol_number(9)%conc(k,j,i), & 10419 REAL( 999.0_wp, KIND = wp ), & 10420 BTEST( wall_flags_0(k,j,i), 0 ) ) 10421 ENDDO 10422 ENDDO 10423 ENDDO 10424 ELSE 10425 DO i = nxl, nxr 10426 DO j = nys, nyn 10427 DO k = nzb, nzt+1 10428 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,9), & 10429 REAL( 999.0_wp, KIND = wp ), & 10430 BTEST( wall_flags_0(k,j,i), 0 ) ) 10431 ENDDO 10432 ENDDO 10433 ENDDO 10434 ENDIF 10435 10436 CASE ( 'N_bin10' ) 10437 IF ( av == 0 ) THEN 10438 DO i = nxl, nxr 10439 DO j = nys, nyn 10440 DO k = nzb, nzt+1 10441 local_pf(i,j,k) = MERGE( aerosol_number(10)%conc(k,j,i), & 10442 REAL( 999.0_wp, KIND = wp ), & 10443 BTEST( wall_flags_0(k,j,i), 0 ) ) 10444 ENDDO 10445 ENDDO 10446 ENDDO 10447 ELSE 10448 DO i = nxl, nxr 10449 DO j = nys, nyn 10450 DO k = nzb, nzt+1 10451 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,10), & 10452 REAL( 999.0_wp, KIND = wp ), & 10453 BTEST( wall_flags_0(k,j,i), 0 ) ) 10454 ENDDO 10455 ENDDO 10456 ENDDO 10457 ENDIF 10458 10459 CASE ( 'N_bin11' ) 10460 IF ( av == 0 ) THEN 10461 DO i = nxl, nxr 10462 DO j = nys, nyn 10463 DO k = nzb, nzt+1 10464 local_pf(i,j,k) = MERGE( aerosol_number(11)%conc(k,j,i), & 10465 REAL( 999.0_wp, KIND = wp ), & 10466 BTEST( wall_flags_0(k,j,i), 0 ) ) 10467 ENDDO 10468 ENDDO 10469 ENDDO 10470 ELSE 10471 DO i = nxl, nxr 10472 DO j = nys, nyn 10473 DO k = nzb, nzt+1 10474 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,11), & 10475 REAL( 999.0_wp, KIND = wp ), & 10476 BTEST( wall_flags_0(k,j,i), 0 ) ) 10477 ENDDO 10478 ENDDO 10479 ENDDO 10480 ENDIF 10481 10482 CASE ( 'N_bin12' ) 10483 IF ( av == 0 ) THEN 10484 DO i = nxl, nxr 10485 DO j = nys, nyn 10486 DO k = nzb, nzt+1 10487 local_pf(i,j,k) = MERGE( aerosol_number(12)%conc(k,j,i), & 10488 REAL( 999.0_wp, KIND = wp ), & 10489 BTEST( wall_flags_0(k,j,i), 0 ) ) 10490 ENDDO 10491 ENDDO 10492 ENDDO 10493 ELSE 10494 DO i = nxl, nxr 10495 DO j = nys, nyn 10496 DO k = nzb, nzt+1 10497 local_pf(i,j,k) = MERGE( Nbins_av(k,j,i,12), & 10498 REAL( 999.0_wp, KIND = wp ), & 10499 BTEST( wall_flags_0(k,j,i), 0 ) ) 10500 ENDDO 10501 ENDDO 10502 ENDDO 10503 ENDIF 10504 10505 CASE ( 'm_bin1' ) 10506 IF ( av == 0 ) THEN 10507 DO i = nxl, nxr 10508 DO j = nys, nyn 10509 DO k = nzb, nzt+1 10510 temp_bin = 0.0_wp 10511 DO c = 1, ncc_tot*nbins, nbins 10512 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10513 ENDDO 10514 local_pf(i,j,k) = MERGE( temp_bin, & 10515 REAL( 999.0_wp, KIND = wp ), & 10516 BTEST( wall_flags_0(k,j,i), 0 ) ) 10517 ENDDO 10518 ENDDO 10519 ENDDO 10520 ELSE 10521 DO i = nxl, nxr 10522 DO j = nys, nyn 10523 DO k = nzb, nzt+1 10524 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,1), & 10525 REAL( 999.0_wp, KIND = wp ), & 10526 BTEST( wall_flags_0(k,j,i), 0 ) ) 10527 ENDDO 10528 ENDDO 10529 ENDDO 10530 ENDIF 10531 10532 CASE ( 'm_bin2' ) 10533 IF ( av == 0 ) THEN 10534 DO i = nxl, nxr 10535 DO j = nys, nyn 10536 DO k = nzb, nzt+1 10537 temp_bin = 0.0_wp 10538 DO c = 2, ncc_tot*nbins, nbins 10539 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10540 ENDDO 10541 local_pf(i,j,k) = MERGE( temp_bin, & 10542 REAL( 999.0_wp, KIND = wp ), & 10543 BTEST( wall_flags_0(k,j,i), 0 ) ) 10544 ENDDO 10545 ENDDO 10546 ENDDO 10547 ELSE 10548 DO i = nxl, nxr 10549 DO j = nys, nyn 10550 DO k = nzb, nzt+1 10551 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,2), & 10552 REAL( 999.0_wp, KIND = wp ), & 10553 BTEST( wall_flags_0(k,j,i), 0 ) ) 10554 ENDDO 10555 ENDDO 10556 ENDDO 10557 ENDIF 10558 10559 CASE ( 'm_bin3' ) 10560 IF ( av == 0 ) THEN 10561 DO i = nxl, nxr 10562 DO j = nys, nyn 10563 DO k = nzb, nzt+1 10564 temp_bin = 0.0_wp 10565 DO c = 3, ncc_tot*nbins, nbins 10566 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10567 ENDDO 10568 local_pf(i,j,k) = MERGE( temp_bin, & 10569 REAL( 999.0_wp, KIND = wp ), & 10570 BTEST( wall_flags_0(k,j,i), 0 ) ) 10571 ENDDO 10572 ENDDO 10573 ENDDO 10574 ELSE 10575 DO i = nxl, nxr 10576 DO j = nys, nyn 10577 DO k = nzb, nzt+1 10578 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,3), & 10579 REAL( 999.0_wp, KIND = wp ), & 10580 BTEST( wall_flags_0(k,j,i), 0 ) ) 10581 ENDDO 10582 ENDDO 10583 ENDDO 10584 ENDIF 10585 10586 CASE ( 'm_bin4' ) 10587 IF ( av == 0 ) THEN 10588 DO i = nxl, nxr 10589 DO j = nys, nyn 10590 DO k = nzb, nzt+1 10591 temp_bin = 0.0_wp 10592 DO c = 4, ncc_tot*nbins, nbins 10593 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10594 ENDDO 10595 local_pf(i,j,k) = MERGE( temp_bin, & 10596 REAL( 999.0_wp, KIND = wp ), & 10597 BTEST( wall_flags_0(k,j,i), 0 ) ) 10598 ENDDO 10599 ENDDO 10600 ENDDO 10601 ELSE 10602 DO i = nxl, nxr 10603 DO j = nys, nyn 10604 DO k = nzb, nzt+1 10605 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,4), & 10606 REAL( 999.0_wp, KIND = wp ), & 10607 BTEST( wall_flags_0(k,j,i), 0 ) ) 10608 ENDDO 10609 ENDDO 10610 ENDDO 10611 ENDIF 10612 10613 CASE ( 'm_bin5' ) 10614 IF ( av == 0 ) THEN 10615 DO i = nxl, nxr 10616 DO j = nys, nyn 10617 DO k = nzb, nzt+1 10618 temp_bin = 0.0_wp 10619 DO c = 5, ncc_tot*nbins, nbins 10620 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10621 ENDDO 10622 local_pf(i,j,k) = MERGE( temp_bin, & 10623 REAL( 999.0_wp, KIND = wp ), & 10624 BTEST( wall_flags_0(k,j,i), 0 ) ) 10625 ENDDO 10626 ENDDO 10627 ENDDO 10628 ELSE 10629 DO i = nxl, nxr 10630 DO j = nys, nyn 10631 DO k = nzb, nzt+1 10632 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,5), & 10633 REAL( 999.0_wp, KIND = wp ), & 10634 BTEST( wall_flags_0(k,j,i), 0 ) ) 10635 ENDDO 10636 ENDDO 10637 ENDDO 10638 ENDIF 10639 10640 CASE ( 'm_bin6' ) 10641 IF ( av == 0 ) THEN 10642 DO i = nxl, nxr 10643 DO j = nys, nyn 10644 DO k = nzb, nzt+1 10645 temp_bin = 0.0_wp 10646 DO c = 6, ncc_tot*nbins, nbins 10647 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10648 ENDDO 10649 local_pf(i,j,k) = MERGE( temp_bin, & 10650 REAL( 999.0_wp, KIND = wp ), & 10651 BTEST( wall_flags_0(k,j,i), 0 ) ) 10652 ENDDO 10653 ENDDO 10654 ENDDO 10655 ELSE 10656 DO i = nxl, nxr 10657 DO j = nys, nyn 10658 DO k = nzb, nzt+1 10659 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,6), & 10660 REAL( 999.0_wp, KIND = wp ), & 10661 BTEST( wall_flags_0(k,j,i), 0 ) ) 10662 ENDDO 10663 ENDDO 10664 ENDDO 10665 ENDIF 10666 10667 CASE ( 'm_bin7' ) 10668 IF ( av == 0 ) THEN 10669 DO i = nxl, nxr 10670 DO j = nys, nyn 10671 DO k = nzb, nzt+1 10672 temp_bin = 0.0_wp 10673 DO c = 7, ncc_tot*nbins, nbins 10674 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10675 ENDDO 10676 local_pf(i,j,k) = MERGE( temp_bin, & 10677 REAL( 999.0_wp, KIND = wp ), & 10678 BTEST( wall_flags_0(k,j,i), 0 ) ) 10679 ENDDO 10680 ENDDO 10681 ENDDO 10682 ELSE 10683 DO i = nxl, nxr 10684 DO j = nys, nyn 10685 DO k = nzb, nzt+1 10686 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,7), & 10687 REAL( 999.0_wp, KIND = wp ), & 10688 BTEST( wall_flags_0(k,j,i), 0 ) ) 10689 ENDDO 10690 ENDDO 10691 ENDDO 10692 ENDIF 10693 10694 CASE ( 'm_bin8' ) 10695 IF ( av == 0 ) THEN 10696 DO i = nxl, nxr 10697 DO j = nys, nyn 10698 DO k = nzb, nzt+1 10699 temp_bin = 0.0_wp 10700 DO c = 8, ncc_tot*nbins, nbins 10701 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10702 ENDDO 10703 local_pf(i,j,k) = MERGE( temp_bin, & 10704 REAL( 999.0_wp, KIND = wp ), & 10705 BTEST( wall_flags_0(k,j,i), 0 ) ) 10706 ENDDO 10707 ENDDO 10708 ENDDO 10709 ELSE 10710 DO i = nxl, nxr 10711 DO j = nys, nyn 10712 DO k = nzb, nzt+1 10713 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,8), & 10714 REAL( 999.0_wp, KIND = wp ), & 10715 BTEST( wall_flags_0(k,j,i), 0 ) ) 10716 ENDDO 10717 ENDDO 10718 ENDDO 10719 ENDIF 10720 10721 CASE ( 'm_bin9' ) 10722 IF ( av == 0 ) THEN 10723 DO i = nxl, nxr 10724 DO j = nys, nyn 10725 DO k = nzb, nzt+1 10726 temp_bin = 0.0_wp 10727 DO c = 9, ncc_tot*nbins, nbins 10728 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10729 ENDDO 10730 local_pf(i,j,k) = MERGE( temp_bin, & 10731 REAL( 999.0_wp, KIND = wp ), & 10732 BTEST( wall_flags_0(k,j,i), 0 ) ) 10733 ENDDO 10734 ENDDO 10735 ENDDO 10736 ELSE 10737 DO i = nxl, nxr 10738 DO j = nys, nyn 10739 DO k = nzb, nzt+1 10740 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,9), & 10741 REAL( 999.0_wp, KIND = wp ), & 10742 BTEST( wall_flags_0(k,j,i), 0 ) ) 10743 ENDDO 10744 ENDDO 10745 ENDDO 10746 ENDIF 10747 10748 CASE ( 'm_bin10' ) 10749 IF ( av == 0 ) THEN 10750 DO i = nxl, nxr 10751 DO j = nys, nyn 10752 DO k = nzb, nzt+1 10753 temp_bin = 0.0_wp 10754 DO c = 10, ncc_tot*nbins, nbins 10755 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10756 ENDDO 10757 local_pf(i,j,k) = MERGE( temp_bin, & 10758 REAL( 999.0_wp, KIND = wp ), & 10759 BTEST( wall_flags_0(k,j,i), 0 ) ) 10760 ENDDO 10761 ENDDO 10762 ENDDO 10763 ELSE 10764 DO i = nxl, nxr 10765 DO j = nys, nyn 10766 DO k = nzb, nzt+1 10767 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,10), & 10768 REAL( 999.0_wp, KIND = wp ), & 10769 BTEST( wall_flags_0(k,j,i), 0 ) ) 10770 ENDDO 10771 ENDDO 10772 ENDDO 10773 ENDIF 10774 10775 CASE ( 'm_bin11' ) 10776 IF ( av == 0 ) THEN 10777 DO i = nxl, nxr 10778 DO j = nys, nyn 10779 DO k = nzb, nzt+1 10780 temp_bin = 0.0_wp 10781 DO c = 11, ncc_tot*nbins, nbins 10782 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10783 ENDDO 10784 local_pf(i,j,k) = MERGE( temp_bin, & 10785 REAL( 999.0_wp, KIND = wp ), & 10786 BTEST( wall_flags_0(k,j,i), 0 ) ) 10787 ENDDO 10788 ENDDO 10789 ENDDO 10790 ELSE 10791 DO i = nxl, nxr 10792 DO j = nys, nyn 10793 DO k = nzb, nzt+1 10794 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,11), & 10795 REAL( 999.0_wp, KIND = wp ), & 10796 BTEST( wall_flags_0(k,j,i), 0 ) ) 10797 ENDDO 10798 ENDDO 10799 ENDDO 10800 ENDIF 10801 10802 CASE ( 'm_bin12' ) 10803 IF ( av == 0 ) THEN 10804 DO i = nxl, nxr 10805 DO j = nys, nyn 10806 DO k = nzb, nzt+1 10807 temp_bin = 0.0_wp 10808 DO c = 12, ncc_tot*nbins, nbins 10809 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10810 ENDDO 10811 local_pf(i,j,k) = MERGE( temp_bin, & 10812 REAL( 999.0_wp, KIND = wp ), & 10813 BTEST( wall_flags_0(k,j,i), 0 ) ) 10814 ENDDO 10815 ENDDO 10816 ENDDO 10817 ELSE 10818 DO i = nxl, nxr 10819 DO j = nys, nyn 10820 DO k = nzb, nzt+1 10821 local_pf(i,j,k) = MERGE( mbins_av(k,j,i,12), & 10822 REAL( 999.0_wp, KIND = wp ), & 9834 REAL( fill_value, KIND = wp ), & 10823 9835 BTEST( wall_flags_0(k,j,i), 0 ) ) 10824 9836 ENDDO … … 10833 9845 DO i = nxl, nxr 10834 9846 DO j = nys, nyn 10835 DO k = nzb , nzt+19847 DO k = nzb_do, nzt_do 10836 9848 temp_bin = 0.0_wp 10837 9849 DO c = ( icc1 )*nbins+1, icc*nbins … … 10839 9851 ENDDO 10840 9852 local_pf(i,j,k) = MERGE( temp_bin, & 10841 REAL( 999.0_wp, KIND = wp ),&9853 REAL( fill_value, KIND = wp ), & 10842 9854 BTEST( wall_flags_0(k,j,i), 0 ) ) 10843 9855 ENDDO … … 10854 9866 DO i = nxl, nxr 10855 9867 DO j = nys, nyn 10856 DO k = nzb , nzt+19868 DO k = nzb_do, nzt_do 10857 9869 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), & 10858 REAL( 999.0_wp, KIND = wp ),&9870 REAL( fill_value, KIND = wp ), & 10859 9871 BTEST( wall_flags_0(k,j,i), 0 ) ) 10860 9872 ENDDO … … 10878 9890 SUBROUTINE salsa_data_output_mask( av, variable, found, local_pf ) 10879 9891 9892 USE arrays_3d, & 9893 ONLY: tend 9894 10880 9895 USE control_parameters, & 10881 ONLY: mask_size_l, mid 9896 ONLY: mask_size_l, mask_surface, mid 9897 9898 USE surface_mod, & 9899 ONLY: get_topography_top_index_ji 10882 9900 10883 9901 IMPLICIT NONE 10884 9902 10885 CHARACTER (LEN=*) :: variable !< 10886 10887 INTEGER(iwp) :: av !< 10888 INTEGER(iwp) :: c !< 10889 INTEGER(iwp) :: i !< 10890 INTEGER(iwp) :: icc !< index of a chemical compound 10891 INTEGER(iwp) :: j !< 10892 INTEGER(iwp) :: k !< 10893 INTEGER(iwp) :: n !< 10894 10895 LOGICAL :: found !< 10896 REAL(wp) :: df !< For calculating LDSA: fraction of particles 10897 !< depositing in the alveolar (or tracheobronchial) 10898 !< region of the lung. Depends on the particle size 10899 REAL(wp) :: mean_d !< Particle diameter in micrometres 10900 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 10901 10902 REAL(wp), & 10903 DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) :: & 10904 local_pf !< 10905 REAL(wp) :: temp_bin !< 10906 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< points to 10907 !< selected output variable 9903 CHARACTER(LEN=5) :: grid !< flag to distinquish between staggered grid 9904 CHARACTER(LEN=*) :: variable !< 9905 CHARACTER(LEN=7) :: vari !< trimmed format of variable 9906 9907 INTEGER(iwp) :: av !< 9908 INTEGER(iwp) :: b !< loop index for aerosol size number bins 9909 INTEGER(iwp) :: c !< loop index for chemical components 9910 INTEGER(iwp) :: i !< loop index in xdirection 9911 INTEGER(iwp) :: icc !< index of a chemical compound 9912 INTEGER(iwp) :: j !< loop index in ydirection 9913 INTEGER(iwp) :: k !< loop index in zdirection 9914 INTEGER(iwp) :: topo_top_ind !< k index of highest horizontal surface 9915 9916 LOGICAL :: found !< 9917 LOGICAL :: resorted !< 9918 9919 REAL(wp) :: df !< For calculating LDSA: fraction of particles 9920 !< depositing in the alveolar (or tracheobronchial) 9921 !< region of the lung. Depends on the particle size 9922 REAL(wp) :: mean_d !< Particle diameter in micrometres 9923 REAL(wp) :: nc !< Particle number concentration in units 1/cm**3 9924 REAL(wp) :: temp_bin !< temporary array for calculating output variables 9925 9926 REAL(wp), DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) :: local_pf !< 9927 9928 REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< pointer 10908 9929 10909 9930 found = .TRUE. 9931 resorted = .FALSE. 9932 grid = 's' 10910 9933 temp_bin = 0.0_wp 10911 9934 … … 10913 9936 10914 9937 CASE ( 'g_H2SO4', 'g_HNO3', 'g_NH3', 'g_OCNV', 'g_OCSV' ) 9938 vari = TRIM( variable ) 10915 9939 IF ( av == 0 ) THEN 10916 IF ( TRIM( variable ) == 'g_H2SO4') icc = 1 10917 IF ( TRIM( variable ) == 'g_HNO3') icc = 2 10918 IF ( TRIM( variable ) == 'g_NH3') icc = 3 10919 IF ( TRIM( variable ) == 'g_OCNV') icc = 4 10920 IF ( TRIM( variable ) == 'g_OCSV') icc = 5 10921 10922 DO i = 1, mask_size_l(mid,1) 10923 DO j = 1, mask_size_l(mid,2) 10924 DO k = 1, mask_size_l(mid,3) 10925 local_pf(i,j,k) = salsa_gas(icc)%conc(mask_k(mid,k), & 10926 mask_j(mid,j),mask_i(mid,i)) 10927 ENDDO 10928 ENDDO 10929 ENDDO 9940 IF ( vari == 'g_H2SO4') to_be_resorted => salsa_gas(1)%conc 9941 IF ( vari == 'g_HNO3') to_be_resorted => salsa_gas(2)%conc 9942 IF ( vari == 'g_NH3') to_be_resorted => salsa_gas(3)%conc 9943 IF ( vari == 'g_OCNV') to_be_resorted => salsa_gas(4)%conc 9944 IF ( vari == 'g_OCSV') to_be_resorted => salsa_gas(5)%conc 10930 9945 ELSE 10931 IF ( TRIM( variable(3:) ) == 'H2SO4' ) to_be_resorted => g_H2SO4_av 10932 IF ( TRIM( variable(3:) ) == 'HNO3' ) to_be_resorted => g_HNO3_av 10933 IF ( TRIM( variable(3:) ) == 'NH3' ) to_be_resorted => g_NH3_av 10934 IF ( TRIM( variable(3:) ) == 'OCNV' ) to_be_resorted => g_OCNV_av 10935 IF ( TRIM( variable(3:) ) == 'OCSV' ) to_be_resorted => g_OCSV_av 10936 DO i = 1, mask_size_l(mid,1) 10937 DO j = 1, mask_size_l(mid,2) 10938 DO k = 1, mask_size_l(mid,3) 10939 local_pf(i,j,k) = to_be_resorted(mask_k(mid,k), & 10940 mask_j(mid,j),mask_i(mid,i)) 10941 ENDDO 10942 ENDDO 10943 ENDDO 9946 IF ( vari == 'g_H2SO4') to_be_resorted => g_H2SO4_av 9947 IF ( vari == 'g_HNO3') to_be_resorted => g_HNO3_av 9948 IF ( vari == 'g_NH3') to_be_resorted => g_NH3_av 9949 IF ( vari == 'g_OCNV') to_be_resorted => g_OCNV_av 9950 IF ( vari == 'g_OCSV') to_be_resorted => g_OCSV_av 10944 9951 ENDIF 10945 9952 10946 9953 CASE ( 'LDSA' ) 10947 9954 IF ( av == 0 ) THEN 10948 DO i = 1, mask_size_l(mid,1)10949 DO j = 1, mask_size_l(mid,2)10950 DO k = 1, mask_size_l(mid,3)9955 DO i = nxl, nxr 9956 DO j = nys, nyn 9957 DO k = nzb, nz_do3d 10951 9958 temp_bin = 0.0_wp 10952 DO n= 1, nbins9959 DO b = 1, nbins 10953 9960 ! 10954 9961 ! Diameter in micrometres 10955 mean_d = 1.0E+6_wp * Ra_dry(mask_k(mid,k), & 10956 mask_j(mid,j),mask_i(mid,i),n) * 2.0_wp 9962 mean_d = 1.0E+6_wp * Ra_dry(k,j,i,b) * 2.0_wp 10957 9963 ! 10958 ! Deposition factor: alveolar (use Ra_dry for the size??)9964 ! Deposition factor: alveolar 10959 9965 df = ( 0.01555_wp / mean_d ) * ( EXP( 0.416_wp * & 10960 ( LOG( mean_d ) + 2.84_wp )**2.0_wp )&10961 + 19.11_wp * EXP( 0.482_wp *&10962 ( LOG( mean_d )  1.362_wp)**2.0_wp ) )9966 ( LOG( mean_d ) + 2.84_wp )**2.0_wp ) + 19.11_wp & 9967 * EXP( 0.482_wp * ( LOG( mean_d )  1.362_wp & 9968 )**2.0_wp ) ) 10963 9969 ! 10964 9970 ! Number concentration in 1/cm3 10965 nc = 1.0E6_wp * aerosol_number(n)%conc(mask_k(mid,k),& 10966 mask_j(mid,j),mask_i(mid,i)) 9971 nc = 1.0E6_wp * aerosol_number(b)%conc(k,j,i) 10967 9972 ! 10968 9973 ! Lungdeposited surface area LDSA (units mum2/cm3) 10969 9974 temp_bin = temp_bin + pi * mean_d**2.0_wp * df * nc 10970 9975 ENDDO 10971 local_pf(i,j,k) = temp_bin9976 tend(k,j,i) = temp_bin 10972 9977 ENDDO 10973 9978 ENDDO 10974 9979 ENDDO 10975 ELSE 10976 DO i = 1, mask_size_l(mid,1) 10977 DO j = 1, mask_size_l(mid,2) 10978 DO k = 1, mask_size_l(mid,3) 10979 local_pf(i,j,k) = LDSA_av(mask_k(mid,k), & 10980 mask_j(mid,j),mask_i(mid,i)) 9980 IF ( .NOT. mask_surface(mid) ) THEN 9981 DO i = 1, mask_size_l(mid,1) 9982 DO j = 1, mask_size_l(mid,2) 9983 DO k = 1, mask_size_l(mid,3) 9984 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j),& 9985 mask_i(mid,i) ) 9986 ENDDO 10981 9987 ENDDO 10982 9988 ENDDO 10983 ENDDO 9989 ELSE 9990 DO i = 1, mask_size_l(mid,1) 9991 DO j = 1, mask_size_l(mid,2) 9992 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 9993 mask_i(mid,i),& 9994 grid ) 9995 DO k = 1, mask_size_l(mid,3) 9996 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 9997 nzt+1 ), & 9998 mask_j(mid,j), mask_i(mid,i) ) 9999 ENDDO 10000 ENDDO 10001 ENDDO 10002 ENDIF 10003 resorted = .TRUE. 10004 ELSE 10005 to_be_resorted => LDSA_av 10984 10006 ENDIF 10985 10007 10008 CASE ( 'N_bin1', 'N_bin2', 'N_bin3', 'N_bin4', 'N_bin5', 'N_bin6', & 10009 'N_bin7', 'N_bin8', 'N_bin9', 'N_bin10' , 'N_bin11', 'N_bin12' ) 10010 IF ( TRIM( variable(6:) ) == '1' ) b = 1 10011 IF ( TRIM( variable(6:) ) == '2' ) b = 2 10012 IF ( TRIM( variable(6:) ) == '3' ) b = 3 10013 IF ( TRIM( variable(6:) ) == '4' ) b = 4 10014 IF ( TRIM( variable(6:) ) == '5' ) b = 5 10015 IF ( TRIM( variable(6:) ) == '6' ) b = 6 10016 IF ( TRIM( variable(6:) ) == '7' ) b = 7 10017 IF ( TRIM( variable(6:) ) == '8' ) b = 8 10018 IF ( TRIM( variable(6:) ) == '9' ) b = 9 10019 IF ( TRIM( variable(6:) ) == '10' ) b = 10 10020 IF ( TRIM( variable(6:) ) == '11' ) b = 11 10021 IF ( TRIM( variable(6:) ) == '12' ) b = 12 10022 10023 IF ( av == 0 ) THEN 10024 IF ( .NOT. mask_surface(mid) ) THEN 10025 DO i = 1, mask_size_l(mid,1) 10026 DO j = 1, mask_size_l(mid,2) 10027 DO k = 1, mask_size_l(mid,3) 10028 local_pf(i,j,k) = aerosol_number(b)%conc( mask_k(mid,k),& 10029 mask_j(mid,j),& 10030 mask_i(mid,i) ) 10031 ENDDO 10032 ENDDO 10033 ENDDO 10034 ELSE 10035 DO i = 1, mask_size_l(mid,1) 10036 DO j = 1, mask_size_l(mid,2) 10037 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10038 mask_i(mid,i),& 10039 grid ) 10040 DO k = 1, mask_size_l(mid,3) 10041 local_pf(i,j,k) = aerosol_number(b)%conc( & 10042 MIN( topo_top_ind+mask_k(mid,k), & 10043 nzt+1 ), & 10044 mask_j(mid,j), mask_i(mid,i) ) 10045 ENDDO 10046 ENDDO 10047 ENDDO 10048 ENDIF 10049 resorted = .TRUE. 10050 ELSE 10051 to_be_resorted => Nbins_av(:,:,:,b) 10052 ENDIF 10053 10986 10054 CASE ( 'Ntot' ) 10987 10055 IF ( av == 0 ) THEN 10988 DO i = 1, mask_size_l(mid,1)10989 DO j = 1, mask_size_l(mid,2)10990 DO k = 1, mask_size_l(mid,3)10056 DO i = nxl, nxr 10057 DO j = nys, nyn 10058 DO k = nzb, nz_do3d 10991 10059 temp_bin = 0.0_wp 10992 DO n = 1, nbins 10993 temp_bin = temp_bin + aerosol_number(n)%conc( & 10994 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 10060 DO b = 1, nbins 10061 temp_bin = temp_bin + aerosol_number(b)%conc(k,j,i) 10995 10062 ENDDO 10996 local_pf(i,j,k) = temp_bin10063 tend(k,j,i) = temp_bin 10997 10064 ENDDO 10998 10065 ENDDO 10999 ENDDO 11000 ELSE 11001 DO i = 1, mask_size_l(mid,1) 11002 DO j = 1, mask_size_l(mid,2) 11003 DO k = 1, mask_size_l(mid,3) 11004 local_pf(i,j,k) = Ntot_av(mask_k(mid,k), & 11005 mask_j(mid,j),mask_i(mid,i)) 10066 ENDDO 10067 IF ( .NOT. mask_surface(mid) ) THEN 10068 DO i = 1, mask_size_l(mid,1) 10069 DO j = 1, mask_size_l(mid,2) 10070 DO k = 1, mask_size_l(mid,3) 10071 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j),& 10072 mask_i(mid,i) ) 10073 ENDDO 11006 10074 ENDDO 11007 10075 ENDDO 11008 ENDDO 10076 ELSE 10077 DO i = 1, mask_size_l(mid,1) 10078 DO j = 1, mask_size_l(mid,2) 10079 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10080 mask_i(mid,i),& 10081 grid ) 10082 DO k = 1, mask_size_l(mid,3) 10083 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 10084 nzt+1 ), & 10085 mask_j(mid,j), mask_i(mid,i) ) 10086 ENDDO 10087 ENDDO 10088 ENDDO 10089 ENDIF 10090 resorted = .TRUE. 10091 ELSE 10092 to_be_resorted => Ntot_av 10093 ENDIF 10094 10095 CASE ( 'm_bin1', 'm_bin2', 'm_bin3', 'm_bin4', 'm_bin5', 'm_bin6', & 10096 'm_bin7', 'm_bin8', 'm_bin9', 'm_bin10' , 'm_bin11', 'm_bin12' ) 10097 IF ( TRIM( variable(6:) ) == '1' ) b = 1 10098 IF ( TRIM( variable(6:) ) == '2' ) b = 2 10099 IF ( TRIM( variable(6:) ) == '3' ) b = 3 10100 IF ( TRIM( variable(6:) ) == '4' ) b = 4 10101 IF ( TRIM( variable(6:) ) == '5' ) b = 5 10102 IF ( TRIM( variable(6:) ) == '6' ) b = 6 10103 IF ( TRIM( variable(6:) ) == '7' ) b = 7 10104 IF ( TRIM( variable(6:) ) == '8' ) b = 8 10105 IF ( TRIM( variable(6:) ) == '9' ) b = 9 10106 IF ( TRIM( variable(6:) ) == '10' ) b = 10 10107 IF ( TRIM( variable(6:) ) == '11' ) b = 11 10108 IF ( TRIM( variable(6:) ) == '12' ) b = 12 10109 10110 IF ( av == 0 ) THEN 10111 DO i = nxl, nxr 10112 DO j = nys, nyn 10113 DO k = nzb, nz_do3d 10114 temp_bin = 0.0_wp 10115 DO c = b, ncc_tot*nbins, nbins 10116 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 10117 ENDDO 10118 tend(k,j,i) = temp_bin 10119 ENDDO 10120 ENDDO 10121 ENDDO 10122 IF ( .NOT. mask_surface(mid) ) THEN 10123 DO i = 1, mask_size_l(mid,1) 10124 DO j = 1, mask_size_l(mid,2) 10125 DO k = 1, mask_size_l(mid,3) 10126 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j),& 10127 mask_i(mid,i) ) 10128 ENDDO 10129 ENDDO 10130 ENDDO 10131 ELSE 10132 DO i = 1, mask_size_l(mid,1) 10133 DO j = 1, mask_size_l(mid,2) 10134 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10135 mask_i(mid,i),& 10136 grid ) 10137 DO k = 1, mask_size_l(mid,3) 10138 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 10139 nzt+1 ), & 10140 mask_j(mid,j), mask_i(mid,i) ) 10141 ENDDO 10142 ENDDO 10143 ENDDO 10144 ENDIF 10145 resorted = .TRUE. 10146 ELSE 10147 to_be_resorted => mbins_av(:,:,:,b) 11009 10148 ENDIF 11010 10149 11011 10150 CASE ( 'PM2.5' ) 11012 10151 IF ( av == 0 ) THEN 11013 DO i = 1, mask_size_l(mid,1)11014 DO j = 1, mask_size_l(mid,2)11015 DO k = 1, mask_size_l(mid,3)10152 DO i = nxl, nxr 10153 DO j = nys, nyn 10154 DO k = nzb, nz_do3d 11016 10155 temp_bin = 0.0_wp 11017 DO n = 1, nbins 11018 IF ( 2.0_wp * Ra_dry(mask_k(mid,k),mask_j(mid,j), & 11019 mask_i(mid,i),n) <= 2.5E6_wp ) THEN 11020 DO c = n, nbins*ncc, nbins 11021 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11022 mask_k(mid,k), mask_j(mid,j),mask_i(mid,i)) 10156 DO b = 1, nbins 10157 IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 2.5E6_wp ) THEN 10158 DO c = b, nbins * ncc, nbins 10159 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 11023 10160 ENDDO 11024 10161 ENDIF 11025 10162 ENDDO 11026 local_pf(i,j,k) = temp_bin10163 tend(k,j,i) = temp_bin 11027 10164 ENDDO 11028 10165 ENDDO 11029 ENDDO 11030 ELSE 11031 DO i = 1, mask_size_l(mid,1) 11032 DO j = 1, mask_size_l(mid,2) 11033 DO k = 1, mask_size_l(mid,3) 11034 local_pf(i,j,k) = PM25_av(mask_k(mid,k), & 11035 mask_j(mid,j),mask_i(mid,i)) 10166 ENDDO 10167 IF ( .NOT. mask_surface(mid) ) THEN 10168 DO i = 1, mask_size_l(mid,1) 10169 DO j = 1, mask_size_l(mid,2) 10170 DO k = 1, mask_size_l(mid,3) 10171 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j),& 10172 mask_i(mid,i) ) 10173 ENDDO 11036 10174 ENDDO 11037 10175 ENDDO 11038 ENDDO 10176 ELSE 10177 DO i = 1, mask_size_l(mid,1) 10178 DO j = 1, mask_size_l(mid,2) 10179 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10180 mask_i(mid,i),& 10181 grid ) 10182 DO k = 1, mask_size_l(mid,3) 10183 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 10184 nzt+1 ), & 10185 mask_j(mid,j), mask_i(mid,i) ) 10186 ENDDO 10187 ENDDO 10188 ENDDO 10189 ENDIF 10190 resorted = .TRUE. 10191 ELSE 10192 to_be_resorted => PM25_av 11039 10193 ENDIF 11040 10194 11041 10195 CASE ( 'PM10' ) 11042 10196 IF ( av == 0 ) THEN 11043 DO i = 1, mask_size_l(mid,1)11044 DO j = 1, mask_size_l(mid,2)11045 DO k = 1, mask_size_l(mid,3)10197 DO i = nxl, nxr 10198 DO j = nys, nyn 10199 DO k = nzb, nz_do3d 11046 10200 temp_bin = 0.0_wp 11047 DO n = 1, nbins 11048 IF ( 2.0_wp * Ra_dry(mask_k(mid,k),mask_j(mid,j), & 11049 mask_i(mid,i),n) <= 10.0E6_wp ) THEN 11050 DO c = n, nbins*ncc, nbins 11051 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11052 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 10201 DO b = 1, nbins 10202 IF ( 2.0_wp * Ra_dry(k,j,i,b) <= 10.0E6_wp ) THEN 10203 DO c = b, nbins * ncc, nbins 10204 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 11053 10205 ENDDO 11054 10206 ENDIF 11055 10207 ENDDO 11056 local_pf(i,j,k) = temp_bin10208 tend(k,j,i) = temp_bin 11057 10209 ENDDO 11058 10210 ENDDO 11059 ENDDO 11060 ELSE 11061 DO i = 1, mask_size_l(mid,1) 11062 DO j = 1, mask_size_l(mid,2) 11063 DO k = 1, mask_size_l(mid,3) 11064 local_pf(i,j,k) = PM10_av(mask_k(mid,k), & 11065 mask_j(mid,j),mask_i(mid,i)) 10211 ENDDO 10212 IF ( .NOT. mask_surface(mid) ) THEN 10213 DO i = 1, mask_size_l(mid,1) 10214 DO j = 1, mask_size_l(mid,2) 10215 DO k = 1, mask_size_l(mid,3) 10216 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j),& 10217 mask_i(mid,i) ) 10218 ENDDO 11066 10219 ENDDO 11067 10220 ENDDO 11068 ENDDO 11069 ENDIF 11070 11071 CASE ( 'N_bin1' ) 11072 IF ( av == 0 ) THEN 11073 DO i = 1, mask_size_l(mid,1) 11074 DO j = 1, mask_size_l(mid,2) 11075 DO k = 1, mask_size_l(mid,3) 11076 local_pf(i,j,k) = aerosol_number(1)%conc(mask_k(mid,k), & 11077 mask_j(mid,j),mask_i(mid,i)) 10221 ELSE 10222 DO i = 1, mask_size_l(mid,1) 10223 DO j = 1, mask_size_l(mid,2) 10224 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10225 mask_i(mid,i),& 10226 grid ) 10227 DO k = 1, mask_size_l(mid,3) 10228 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 10229 nzt+1 ), & 10230 mask_j(mid,j), mask_i(mid,i) ) 10231 ENDDO 11078 10232 ENDDO 11079 10233 ENDDO 11080 ENDDO 10234 ENDIF 10235 resorted = .TRUE. 11081 10236 ELSE 11082 DO i = 1, mask_size_l(mid,1) 11083 DO j = 1, mask_size_l(mid,2) 11084 DO k = 1, mask_size_l(mid,3) 11085 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11086 mask_j(mid,j),mask_i(mid,i),1) 11087 ENDDO 11088 ENDDO 11089 ENDDO 11090 ENDIF 11091 11092 CASE ( 'N_bin2' ) 11093 IF ( av == 0 ) THEN 11094 DO i = 1, mask_size_l(mid,1) 11095 DO j = 1, mask_size_l(mid,2) 11096 DO k = 1, mask_size_l(mid,3) 11097 local_pf(i,j,k) = aerosol_number(2)%conc(mask_k(mid,k), & 11098 mask_j(mid,j),mask_i(mid,i)) 11099 ENDDO 11100 ENDDO 11101 ENDDO 11102 ELSE 11103 DO i = 1, mask_size_l(mid,1) 11104 DO j = 1, mask_size_l(mid,2) 11105 DO k = 1, mask_size_l(mid,3) 11106 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11107 mask_j(mid,j),mask_i(mid,i),2) 11108 ENDDO 11109 ENDDO 11110 ENDDO 11111 ENDIF 11112 11113 CASE ( 'N_bin3' ) 11114 IF ( av == 0 ) THEN 11115 DO i = 1, mask_size_l(mid,1) 11116 DO j = 1, mask_size_l(mid,2) 11117 DO k = 1, mask_size_l(mid,3) 11118 local_pf(i,j,k) = aerosol_number(3)%conc(mask_k(mid,k), & 11119 mask_j(mid,j),mask_i(mid,i)) 11120 ENDDO 11121 ENDDO 11122 ENDDO 11123 ELSE 11124 DO i = 1, mask_size_l(mid,1) 11125 DO j = 1, mask_size_l(mid,2) 11126 DO k = 1, mask_size_l(mid,3) 11127 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11128 mask_j(mid,j),mask_i(mid,i),3) 11129 ENDDO 11130 ENDDO 11131 ENDDO 11132 ENDIF 11133 11134 CASE ( 'N_bin4' ) 11135 IF ( av == 0 ) THEN 11136 DO i = 1, mask_size_l(mid,1) 11137 DO j = 1, mask_size_l(mid,2) 11138 DO k = 1, mask_size_l(mid,3) 11139 local_pf(i,j,k) = aerosol_number(4)%conc(mask_k(mid,k), & 11140 mask_j(mid,j),mask_i(mid,i)) 11141 ENDDO 11142 ENDDO 11143 ENDDO 11144 ELSE 11145 DO i = 1, mask_size_l(mid,1) 11146 DO j = 1, mask_size_l(mid,2) 11147 DO k = 1, mask_size_l(mid,3) 11148 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11149 mask_j(mid,j),mask_i(mid,i),4) 11150 ENDDO 11151 ENDDO 11152 ENDDO 11153 ENDIF 11154 11155 CASE ( 'N_bin5' ) 11156 IF ( av == 0 ) THEN 11157 DO i = 1, mask_size_l(mid,1) 11158 DO j = 1, mask_size_l(mid,2) 11159 DO k = 1, mask_size_l(mid,3) 11160 local_pf(i,j,k) = aerosol_number(5)%conc(mask_k(mid,k), & 11161 mask_j(mid,j),mask_i(mid,i)) 11162 ENDDO 11163 ENDDO 11164 ENDDO 11165 ELSE 11166 DO i = 1, mask_size_l(mid,1) 11167 DO j = 1, mask_size_l(mid,2) 11168 DO k = 1, mask_size_l(mid,3) 11169 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11170 mask_j(mid,j),mask_i(mid,i),5) 11171 ENDDO 11172 ENDDO 11173 ENDDO 11174 ENDIF 11175 11176 CASE ( 'N_bin6' ) 11177 IF ( av == 0 ) THEN 11178 DO i = 1, mask_size_l(mid,1) 11179 DO j = 1, mask_size_l(mid,2) 11180 DO k = 1, mask_size_l(mid,3) 11181 local_pf(i,j,k) = aerosol_number(6)%conc(mask_k(mid,k), & 11182 mask_j(mid,j),mask_i(mid,i)) 11183 ENDDO 11184 ENDDO 11185 ENDDO 11186 ELSE 11187 DO i = 1, mask_size_l(mid,1) 11188 DO j = 1, mask_size_l(mid,2) 11189 DO k = 1, mask_size_l(mid,3) 11190 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11191 mask_j(mid,j),mask_i(mid,i),6) 11192 ENDDO 11193 ENDDO 11194 ENDDO 11195 ENDIF 11196 11197 CASE ( 'N_bin7' ) 11198 IF ( av == 0 ) THEN 11199 DO i = 1, mask_size_l(mid,1) 11200 DO j = 1, mask_size_l(mid,2) 11201 DO k = 1, mask_size_l(mid,3) 11202 local_pf(i,j,k) = aerosol_number(7)%conc(mask_k(mid,k), & 11203 mask_j(mid,j),mask_i(mid,i)) 11204 ENDDO 11205 ENDDO 11206 ENDDO 11207 ELSE 11208 DO i = 1, mask_size_l(mid,1) 11209 DO j = 1, mask_size_l(mid,2) 11210 DO k = 1, mask_size_l(mid,3) 11211 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11212 mask_j(mid,j),mask_i(mid,i),7) 11213 ENDDO 11214 ENDDO 11215 ENDDO 11216 ENDIF 11217 11218 CASE ( 'N_bin8' ) 11219 IF ( av == 0 ) THEN 11220 DO i = 1, mask_size_l(mid,1) 11221 DO j = 1, mask_size_l(mid,2) 11222 DO k = 1, mask_size_l(mid,3) 11223 local_pf(i,j,k) = aerosol_number(8)%conc(mask_k(mid,k), & 11224 mask_j(mid,j),mask_i(mid,i)) 11225 ENDDO 11226 ENDDO 11227 ENDDO 11228 ELSE 11229 DO i = 1, mask_size_l(mid,1) 11230 DO j = 1, mask_size_l(mid,2) 11231 DO k = 1, mask_size_l(mid,3) 11232 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11233 mask_j(mid,j),mask_i(mid,i),8) 11234 ENDDO 11235 ENDDO 11236 ENDDO 11237 ENDIF 11238 11239 CASE ( 'N_bin9' ) 11240 IF ( av == 0 ) THEN 11241 DO i = 1, mask_size_l(mid,1) 11242 DO j = 1, mask_size_l(mid,2) 11243 DO k = 1, mask_size_l(mid,3) 11244 local_pf(i,j,k) = aerosol_number(9)%conc(mask_k(mid,k), & 11245 mask_j(mid,j),mask_i(mid,i)) 11246 ENDDO 11247 ENDDO 11248 ENDDO 11249 ELSE 11250 DO i = 1, mask_size_l(mid,1) 11251 DO j = 1, mask_size_l(mid,2) 11252 DO k = 1, mask_size_l(mid,3) 11253 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11254 mask_j(mid,j),mask_i(mid,i),9) 11255 ENDDO 11256 ENDDO 11257 ENDDO 11258 ENDIF 11259 11260 CASE ( 'N_bin10' ) 11261 IF ( av == 0 ) THEN 11262 DO i = 1, mask_size_l(mid,1) 11263 DO j = 1, mask_size_l(mid,2) 11264 DO k = 1, mask_size_l(mid,3) 11265 local_pf(i,j,k) = aerosol_number(10)%conc(mask_k(mid,k), & 11266 mask_j(mid,j),mask_i(mid,i)) 11267 ENDDO 11268 ENDDO 11269 ENDDO 11270 ELSE 11271 DO i = 1, mask_size_l(mid,1) 11272 DO j = 1, mask_size_l(mid,2) 11273 DO k = 1, mask_size_l(mid,3) 11274 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11275 mask_j(mid,j),mask_i(mid,i),10) 11276 ENDDO 11277 ENDDO 11278 ENDDO 11279 ENDIF 11280 11281 CASE ( 'N_bin11' ) 11282 IF ( av == 0 ) THEN 11283 DO i = 1, mask_size_l(mid,1) 11284 DO j = 1, mask_size_l(mid,2) 11285 DO k = 1, mask_size_l(mid,3) 11286 local_pf(i,j,k) = aerosol_number(11)%conc(mask_k(mid,k), & 11287 mask_j(mid,j),mask_i(mid,i)) 11288 ENDDO 11289 ENDDO 11290 ENDDO 11291 ELSE 11292 DO i = 1, mask_size_l(mid,1) 11293 DO j = 1, mask_size_l(mid,2) 11294 DO k = 1, mask_size_l(mid,3) 11295 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11296 mask_j(mid,j),mask_i(mid,i),11) 11297 ENDDO 11298 ENDDO 11299 ENDDO 11300 ENDIF 11301 11302 CASE ( 'N_bin12' ) 11303 IF ( av == 0 ) THEN 11304 DO i = 1, mask_size_l(mid,1) 11305 DO j = 1, mask_size_l(mid,2) 11306 DO k = 1, mask_size_l(mid,3) 11307 local_pf(i,j,k) = aerosol_number(12)%conc(mask_k(mid,k), & 11308 mask_j(mid,j),mask_i(mid,i)) 11309 ENDDO 11310 ENDDO 11311 ENDDO 11312 ELSE 11313 DO i = 1, mask_size_l(mid,1) 11314 DO j = 1, mask_size_l(mid,2) 11315 DO k = 1, mask_size_l(mid,3) 11316 local_pf(i,j,k) = Nbins_av(mask_k(mid,k), & 11317 mask_j(mid,j),mask_i(mid,i),12) 11318 ENDDO 11319 ENDDO 11320 ENDDO 11321 ENDIF 11322 11323 CASE ( 'm_bin1' ) 11324 IF ( av == 0 ) THEN 11325 DO i = 1, mask_size_l(mid,1) 11326 DO j = 1, mask_size_l(mid,2) 11327 DO k = 1, mask_size_l(mid,3) 11328 temp_bin = 0.0_wp 11329 DO c = 1, ncc_tot*nbins, nbins 11330 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11331 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11332 ENDDO 11333 local_pf(i,j,k) = temp_bin 11334 ENDDO 11335 ENDDO 11336 ENDDO 11337 ELSE 11338 DO i = 1, mask_size_l(mid,1) 11339 DO j = 1, mask_size_l(mid,2) 11340 DO k = 1, mask_size_l(mid,3) 11341 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11342 mask_j(mid,j),mask_i(mid,i),1) 11343 ENDDO 11344 ENDDO 11345 ENDDO 11346 ENDIF 11347 11348 CASE ( 'm_bin2' ) 11349 IF ( av == 0 ) THEN 11350 DO i = 1, mask_size_l(mid,1) 11351 DO j = 1, mask_size_l(mid,2) 11352 DO k = 1, mask_size_l(mid,3) 11353 temp_bin = 0.0_wp 11354 DO c = 2, ncc_tot*nbins, nbins 11355 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11356 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11357 ENDDO 11358 local_pf(i,j,k) = temp_bin 11359 ENDDO 11360 ENDDO 11361 ENDDO 11362 ELSE 11363 DO i = 1, mask_size_l(mid,1) 11364 DO j = 1, mask_size_l(mid,2) 11365 DO k = 1, mask_size_l(mid,3) 11366 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11367 mask_j(mid,j),mask_i(mid,i),2) 11368 ENDDO 11369 ENDDO 11370 ENDDO 11371 ENDIF 11372 11373 CASE ( 'm_bin3' ) 11374 IF ( av == 0 ) THEN 11375 DO i = 1, mask_size_l(mid,1) 11376 DO j = 1, mask_size_l(mid,2) 11377 DO k = 1, mask_size_l(mid,3) 11378 temp_bin = 0.0_wp 11379 DO c = 3, ncc_tot*nbins, nbins 11380 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11381 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11382 ENDDO 11383 local_pf(i,j,k) = temp_bin 11384 ENDDO 11385 ENDDO 11386 ENDDO 11387 ELSE 11388 DO i = 1, mask_size_l(mid,1) 11389 DO j = 1, mask_size_l(mid,2) 11390 DO k = 1, mask_size_l(mid,3) 11391 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11392 mask_j(mid,j),mask_i(mid,i),3) 11393 ENDDO 11394 ENDDO 11395 ENDDO 11396 ENDIF 11397 11398 CASE ( 'm_bin4' ) 11399 IF ( av == 0 ) THEN 11400 DO i = 1, mask_size_l(mid,1) 11401 DO j = 1, mask_size_l(mid,2) 11402 DO k = 1, mask_size_l(mid,3) 11403 temp_bin = 0.0_wp 11404 DO c = 4, ncc_tot*nbins, nbins 11405 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11406 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11407 ENDDO 11408 local_pf(i,j,k) = temp_bin 11409 ENDDO 11410 ENDDO 11411 ENDDO 11412 ELSE 11413 DO i = 1, mask_size_l(mid,1) 11414 DO j = 1, mask_size_l(mid,2) 11415 DO k = 1, mask_size_l(mid,3) 11416 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11417 mask_j(mid,j),mask_i(mid,i),4) 11418 ENDDO 11419 ENDDO 11420 ENDDO 11421 ENDIF 11422 11423 CASE ( 'm_bin5' ) 11424 IF ( av == 0 ) THEN 11425 DO i = 1, mask_size_l(mid,1) 11426 DO j = 1, mask_size_l(mid,2) 11427 DO k = 1, mask_size_l(mid,3) 11428 temp_bin = 0.0_wp 11429 DO c = 5, ncc_tot*nbins, nbins 11430 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11431 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11432 ENDDO 11433 local_pf(i,j,k) = temp_bin 11434 ENDDO 11435 ENDDO 11436 ENDDO 11437 ELSE 11438 DO i = 1, mask_size_l(mid,1) 11439 DO j = 1, mask_size_l(mid,2) 11440 DO k = 1, mask_size_l(mid,3) 11441 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11442 mask_j(mid,j),mask_i(mid,i),5) 11443 ENDDO 11444 ENDDO 11445 ENDDO 11446 ENDIF 11447 11448 CASE ( 'm_bin6' ) 11449 IF ( av == 0 ) THEN 11450 DO i = 1, mask_size_l(mid,1) 11451 DO j = 1, mask_size_l(mid,2) 11452 DO k = 1, mask_size_l(mid,3) 11453 temp_bin = 0.0_wp 11454 DO c = 6, ncc_tot*nbins, nbins 11455 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11456 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11457 ENDDO 11458 local_pf(i,j,k) = temp_bin 11459 ENDDO 11460 ENDDO 11461 ENDDO 11462 ELSE 11463 DO i = 1, mask_size_l(mid,1) 11464 DO j = 1, mask_size_l(mid,2) 11465 DO k = 1, mask_size_l(mid,3) 11466 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11467 mask_j(mid,j),mask_i(mid,i),6) 11468 ENDDO 11469 ENDDO 11470 ENDDO 11471 ENDIF 11472 11473 CASE ( 'm_bin7' ) 11474 IF ( av == 0 ) THEN 11475 DO i = 1, mask_size_l(mid,1) 11476 DO j = 1, mask_size_l(mid,2) 11477 DO k = 1, mask_size_l(mid,3) 11478 temp_bin = 0.0_wp 11479 DO c = 7, ncc_tot*nbins, nbins 11480 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11481 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11482 ENDDO 11483 local_pf(i,j,k) = temp_bin 11484 ENDDO 11485 ENDDO 11486 ENDDO 11487 ELSE 11488 DO i = 1, mask_size_l(mid,1) 11489 DO j = 1, mask_size_l(mid,2) 11490 DO k = 1, mask_size_l(mid,3) 11491 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11492 mask_j(mid,j),mask_i(mid,i),7) 11493 ENDDO 11494 ENDDO 11495 ENDDO 11496 ENDIF 11497 11498 CASE ( 'm_bin8' ) 11499 IF ( av == 0 ) THEN 11500 DO i = 1, mask_size_l(mid,1) 11501 DO j = 1, mask_size_l(mid,2) 11502 DO k = 1, mask_size_l(mid,3) 11503 temp_bin = 0.0_wp 11504 DO c = 8, ncc_tot*nbins, nbins 11505 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11506 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11507 ENDDO 11508 local_pf(i,j,k) = temp_bin 11509 ENDDO 11510 ENDDO 11511 ENDDO 11512 ELSE 11513 DO i = 1, mask_size_l(mid,1) 11514 DO j = 1, mask_size_l(mid,2) 11515 DO k = 1, mask_size_l(mid,3) 11516 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11517 mask_j(mid,j),mask_i(mid,i),8) 11518 ENDDO 11519 ENDDO 11520 ENDDO 11521 ENDIF 11522 11523 CASE ( 'm_bin9' ) 11524 IF ( av == 0 ) THEN 11525 DO i = 1, mask_size_l(mid,1) 11526 DO j = 1, mask_size_l(mid,2) 11527 DO k = 1, mask_size_l(mid,3) 11528 temp_bin = 0.0_wp 11529 DO c = 9, ncc_tot*nbins, nbins 11530 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11531 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11532 ENDDO 11533 local_pf(i,j,k) = temp_bin 11534 ENDDO 11535 ENDDO 11536 ENDDO 11537 ELSE 11538 DO i = 1, mask_size_l(mid,1) 11539 DO j = 1, mask_size_l(mid,2) 11540 DO k = 1, mask_size_l(mid,3) 11541 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11542 mask_j(mid,j),mask_i(mid,i),9) 11543 ENDDO 11544 ENDDO 11545 ENDDO 11546 ENDIF 11547 11548 CASE ( 'm_bin10' ) 11549 IF ( av == 0 ) THEN 11550 DO i = 1, mask_size_l(mid,1) 11551 DO j = 1, mask_size_l(mid,2) 11552 DO k = 1, mask_size_l(mid,3) 11553 temp_bin = 0.0_wp 11554 DO c = 10, ncc_tot*nbins, nbins 11555 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11556 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11557 ENDDO 11558 local_pf(i,j,k) = temp_bin 11559 ENDDO 11560 ENDDO 11561 ENDDO 11562 ELSE 11563 DO i = 1, mask_size_l(mid,1) 11564 DO j = 1, mask_size_l(mid,2) 11565 DO k = 1, mask_size_l(mid,3) 11566 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11567 mask_j(mid,j),mask_i(mid,i),10) 11568 ENDDO 11569 ENDDO 11570 ENDDO 11571 ENDIF 11572 11573 CASE ( 'm_bin11' ) 11574 IF ( av == 0 ) THEN 11575 DO i = 1, mask_size_l(mid,1) 11576 DO j = 1, mask_size_l(mid,2) 11577 DO k = 1, mask_size_l(mid,3) 11578 temp_bin = 0.0_wp 11579 DO c = 11, ncc_tot*nbins, nbins 11580 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11581 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11582 ENDDO 11583 local_pf(i,j,k) = temp_bin 11584 ENDDO 11585 ENDDO 11586 ENDDO 11587 ELSE 11588 DO i = 1, mask_size_l(mid,1) 11589 DO j = 1, mask_size_l(mid,2) 11590 DO k = 1, mask_size_l(mid,3) 11591 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11592 mask_j(mid,j),mask_i(mid,i),11) 11593 ENDDO 11594 ENDDO 11595 ENDDO 11596 ENDIF 11597 11598 CASE ( 'm_bin12' ) 11599 IF ( av == 0 ) THEN 11600 DO i = 1, mask_size_l(mid,1) 11601 DO j = 1, mask_size_l(mid,2) 11602 DO k = 1, mask_size_l(mid,3) 11603 temp_bin = 0.0_wp 11604 DO c = 12, ncc_tot*nbins, nbins 11605 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11606 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 11607 ENDDO 11608 local_pf(i,j,k) = temp_bin 11609 ENDDO 11610 ENDDO 11611 ENDDO 11612 ELSE 11613 DO i = 1, mask_size_l(mid,1) 11614 DO j = 1, mask_size_l(mid,2) 11615 DO k = 1, mask_size_l(mid,3) 11616 local_pf(i,j,k) = mbins_av(mask_k(mid,k), & 11617 mask_j(mid,j),mask_i(mid,i),12) 11618 ENDDO 11619 ENDDO 11620 ENDDO 10237 to_be_resorted => PM10_av 11621 10238 ENDIF 11622 10239 11623 10240 CASE ( 's_BC', 's_DU', 's_NH', 's_NO', 's_OC', 's_SO4', 's_SS' ) 11624 IF ( is_used( prtcl, TRIM( variable(3:) ) )) THEN11625 icc = get_index( prtcl, TRIM( variable(3:) ) )11626 IF ( av == 0 ) THEN11627 DO i = 1, mask_size_l(mid,1)11628 DO j = 1, mask_size_l(mid,2)11629 DO k = 1, mask_size_l(mid,3)10241 IF ( av == 0 ) THEN 10242 IF ( is_used( prtcl, TRIM( variable(3:) ) ) ) THEN 10243 icc = get_index( prtcl, TRIM( variable(3:) ) ) 10244 DO i = nxl, nxr 10245 DO j = nys, nyn 10246 DO k = nzb, nz_do3d 11630 10247 temp_bin = 0.0_wp 11631 10248 DO c = ( icc1 )*nbins+1, icc*nbins 11632 temp_bin = temp_bin + aerosol_mass(c)%conc( & 11633 mask_k(mid,k),mask_j(mid,j),mask_i(mid,i)) 10249 temp_bin = temp_bin + aerosol_mass(c)%conc(k,j,i) 11634 10250 ENDDO 11635 local_pf(i,j,k) = temp_bin10251 tend(k,j,i) = temp_bin 11636 10252 ENDDO 11637 10253 ENDDO 11638 10254 ENDDO 11639 10255 ELSE 11640 IF ( TRIM( variable(3:) ) == 'BC' ) to_be_resorted => s_BC_av 11641 IF ( TRIM( variable(3:) ) == 'DU' ) to_be_resorted => s_DU_av 11642 IF ( TRIM( variable(3:) ) == 'NH' ) to_be_resorted => s_NH_av 11643 IF ( TRIM( variable(3:) ) == 'NO' ) to_be_resorted => s_NO_av 11644 IF ( TRIM( variable(3:) ) == 'OC' ) to_be_resorted => s_OC_av 11645 IF ( TRIM( variable(3:) ) == 'SO4' ) to_be_resorted => s_SO4_av 11646 IF ( TRIM( variable(3:) ) == 'SS' ) to_be_resorted => s_SS_av 10256 tend = 0.0_wp 10257 ENDIF 10258 IF ( .NOT. mask_surface(mid) ) THEN 11647 10259 DO i = 1, mask_size_l(mid,1) 11648 10260 DO j = 1, mask_size_l(mid,2) 11649 DO k = 1, mask_size_l(mid,3) 11650 local_pf(i,j,k) = to_be_resorted(mask_k(mid,k), & 11651 mask_j(mid,j),mask_i(mid,i)) 10261 DO k = 1, mask_size_l(mid,3) 10262 local_pf(i,j,k) = tend( mask_k(mid,k), mask_j(mid,j), & 10263 mask_i(mid,i) ) 10264 ENDDO 10265 ENDDO 10266 ENDDO 10267 ELSE 10268 DO i = 1, mask_size_l(mid,1) 10269 DO j = 1, mask_size_l(mid,2) 10270 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j),& 10271 mask_i(mid,i),& 10272 grid ) 10273 DO k = 1, mask_size_l(mid,3) 10274 local_pf(i,j,k) = tend( MIN( topo_top_ind+mask_k(mid,k),& 10275 nzt+1 ),& 10276 mask_j(mid,j), mask_i(mid,i) ) 11652 10277 ENDDO 11653 10278 ENDDO 11654 10279 ENDDO 11655 10280 ENDIF 10281 resorted = .TRUE. 10282 ELSE 10283 IF ( TRIM( variable(3:) ) == 'BC' ) to_be_resorted => s_BC_av 10284 IF ( TRIM( variable(3:) ) == 'DU' ) to_be_resorted => s_DU_av 10285 IF ( TRIM( variable(3:) ) == 'NH' ) to_be_resorted => s_NH_av 10286 IF ( TRIM( variable(3:) ) == 'NO' ) to_be_resorted => s_NO_av 10287 IF ( TRIM( variable(3:) ) == 'OC' ) to_be_resorted => s_OC_av 10288 IF ( TRIM( variable(3:) ) == 'SO4' ) to_be_resorted => s_SO4_av 10289 IF ( TRIM( variable(3:) ) == 'SS' ) to_be_resorted => s_SS_av 11656 10290 ENDIF 11657 10291 … … 11661 10295 END SELECT 11662 10296 10297 10298 IF ( .NOT. resorted ) THEN 10299 IF ( .NOT. mask_surface(mid) ) THEN 10300 ! 10301 ! Default masked output 10302 DO i = 1, mask_size_l(mid,1) 10303 DO j = 1, mask_size_l(mid,2) 10304 DO k = 1, mask_size_l(mid,3) 10305 local_pf(i,j,k) = to_be_resorted( mask_k(mid,k), & 10306 mask_j(mid,j),mask_i(mid,i) ) 10307 ENDDO 10308 ENDDO 10309 ENDDO 10310 ELSE 10311 ! 10312 ! Terrainfollowing masked output 10313 DO i = 1, mask_size_l(mid,1) 10314 DO j = 1, mask_size_l(mid,2) 10315 ! 10316 ! Get k index of highest horizontal surface 10317 topo_top_ind = get_topography_top_index_ji( mask_j(mid,j), & 10318 mask_i(mid,i), grid ) 10319 ! 10320 ! Save output array 10321 DO k = 1, mask_size_l(mid,3) 10322 local_pf(i,j,k) = to_be_resorted( MIN( topo_top_ind+mask_k(mid,k),& 10323 nzt+1 ), & 10324 mask_j(mid,j), mask_i(mid,i) ) 10325 ENDDO 10326 ENDDO 10327 ENDDO 10328 ENDIF 10329 ENDIF 10330 11663 10331 END SUBROUTINE salsa_data_output_mask 11664 10332
Note: See TracChangeset
for help on using the changeset viewer.