Changeset 3737 for palm/trunk/SOURCE/nesting_offl_mod.f90
- Timestamp:
- Feb 12, 2019 4:57:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/nesting_offl_mod.f90
r3705 r3737 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Introduce mesoscale nesting for chemical species 28 ! 29 ! 3705 2019-01-29 19:56:39Z suehring 27 30 ! Formatting adjustments 28 31 ! … … 54 57 USE arrays_3d, & 55 58 ONLY: dzw, e, diss, pt, pt_init, q, q_init, s, u, u_init, ug, v, & 56 v_init, vg, w, zu, zw 59 v_init, vg, w, zu, zw 60 61 USE chemistry_model_mod, & 62 ONLY: chem_species 57 63 58 64 USE control_parameters, & 59 ONLY: bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, bc_dirichlet_s,&60 dt_3d, dz, constant_diffusion, humidity, message_string, &61 nesting_offline, neutral, passive_scalar, rans_mode, rans_tke_e,&62 time_since_reference_point, volume_flow65 ONLY: air_chemistry, bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r, & 66 bc_dirichlet_s, dt_3d, dz, constant_diffusion, humidity, & 67 message_string, nesting_offline, neutral, passive_scalar, & 68 rans_mode, rans_tke_e, time_since_reference_point, volume_flow 63 69 64 70 USE cpulog, & … … 235 241 INTEGER(iwp) :: j !< running index y-direction 236 242 INTEGER(iwp) :: k !< running index z-direction 243 INTEGER(iwp) :: n !< running index for chemical species 237 244 238 245 REAL(wp) :: fac_dt !< interpolation factor … … 335 342 ENDDO 336 343 ENDIF 344 345 IF ( air_chemistry ) THEN 346 DO n = 1, UBOUND( chem_species, 1 ) 347 IF ( nest_offl%chem_from_file_l(n) ) THEN 348 DO j = nys, nyn 349 DO k = nzb+1, nzt 350 chem_species(n)%conc(k,j,-1) = interpolate_in_time( & 351 nest_offl%chem_left(0,k,j,n),& 352 nest_offl%chem_left(1,k,j,n),& 353 fac_dt ) 354 ENDDO 355 ENDDO 356 ENDIF 357 ENDDO 358 ENDIF 337 359 338 360 ENDIF … … 395 417 ENDDO 396 418 ENDIF 419 420 IF ( air_chemistry ) THEN 421 DO n = 1, UBOUND( chem_species, 1 ) 422 IF ( nest_offl%chem_from_file_r(n) ) THEN 423 DO j = nys, nyn 424 DO k = nzb+1, nzt 425 chem_species(n)%conc(k,j,nxr+1) = interpolate_in_time(& 426 nest_offl%chem_right(0,k,j,n),& 427 nest_offl%chem_right(1,k,j,n),& 428 fac_dt ) 429 ENDDO 430 ENDDO 431 ENDIF 432 ENDDO 433 ENDIF 397 434 398 435 ENDIF … … 458 495 ENDDO 459 496 ENDIF 497 498 IF ( air_chemistry ) THEN 499 DO n = 1, UBOUND( chem_species, 1 ) 500 IF ( nest_offl%chem_from_file_s(n) ) THEN 501 DO i = nxl, nxr 502 DO k = nzb+1, nzt 503 chem_species(n)%conc(k,-1,i) = interpolate_in_time( & 504 nest_offl%chem_south(0,k,i,n),& 505 nest_offl%chem_south(1,k,i,n),& 506 fac_dt ) 507 ENDDO 508 ENDDO 509 ENDIF 510 ENDDO 511 ENDIF 460 512 461 513 ENDIF … … 520 572 ENDDO 521 573 ENDIF 574 575 IF ( air_chemistry ) THEN 576 DO n = 1, UBOUND( chem_species, 1 ) 577 IF ( nest_offl%chem_from_file_n(n) ) THEN 578 DO i = nxl, nxr 579 DO k = nzb+1, nzt 580 chem_species(n)%conc(k,nyn+1,i) = interpolate_in_time(& 581 nest_offl%chem_north(0,k,i,n),& 582 nest_offl%chem_north(1,k,i,n),& 583 fac_dt ) 584 ENDDO 585 ENDDO 586 ENDIF 587 ENDDO 588 ENDIF 522 589 523 590 ENDIF … … 579 646 ENDDO 580 647 ENDIF 648 649 IF ( air_chemistry ) THEN 650 DO n = 1, UBOUND( chem_species, 1 ) 651 IF ( nest_offl%chem_from_file_t(n) ) THEN 652 DO i = nxl, nxr 653 DO j = nys, nyn 654 chem_species(n)%conc(nzt+1,j,i) = interpolate_in_time( & 655 nest_offl%chem_north(0,j,i,n), & 656 nest_offl%chem_north(1,j,i,n), & 657 fac_dt ) 658 ENDDO 659 ENDDO 660 ENDIF 661 ENDDO 662 ENDIF 581 663 ! 582 664 !-- Moreover, set Neumann boundary condition for subgrid-scale TKE, … … 607 689 IF ( .NOT. neutral ) CALL exchange_horiz( pt, nbgp ) 608 690 IF ( humidity ) CALL exchange_horiz( q, nbgp ) 691 IF ( air_chemistry ) THEN 692 DO n = 1, UBOUND( chem_species, 1 ) 693 CALL exchange_horiz( chem_species(n)%conc, nbgp ) 694 ENDDO 695 ENDIF 696 609 697 ! 610 698 !-- In case of Rayleigh damping, where the profiles u_init, v_init … … 985 1073 986 1074 IMPLICIT NONE 1075 1076 INTEGER(iwp) :: n !< running index for chemical species 987 1077 988 1078 … … 1000 1090 IF ( humidity ) ALLOCATE( nest_offl%q_left(0:1,nzb+1:nzt,nys:nyn) ) 1001 1091 IF ( .NOT. neutral ) ALLOCATE( nest_offl%pt_left(0:1,nzb+1:nzt,nys:nyn) ) 1092 IF ( air_chemistry ) ALLOCATE( nest_offl%chem_left(0:1,nzb+1:nzt,nys:nyn,& 1093 1:UBOUND( chem_species, 1 )) ) 1002 1094 ENDIF 1003 1095 IF ( bc_dirichlet_r ) THEN … … 1007 1099 IF ( humidity ) ALLOCATE( nest_offl%q_right(0:1,nzb+1:nzt,nys:nyn) ) 1008 1100 IF ( .NOT. neutral ) ALLOCATE( nest_offl%pt_right(0:1,nzb+1:nzt,nys:nyn) ) 1101 IF ( air_chemistry ) ALLOCATE( nest_offl%chem_right(0:1,nzb+1:nzt,nys:nyn,& 1102 1:UBOUND( chem_species, 1 )) ) 1009 1103 ENDIF 1010 1104 IF ( bc_dirichlet_n ) THEN … … 1014 1108 IF ( humidity ) ALLOCATE( nest_offl%q_north(0:1,nzb+1:nzt,nxl:nxr) ) 1015 1109 IF ( .NOT. neutral ) ALLOCATE( nest_offl%pt_north(0:1,nzb+1:nzt,nxl:nxr) ) 1110 IF ( air_chemistry ) ALLOCATE( nest_offl%chem_north(0:1,nzb+1:nzt,nxl:nxr,& 1111 1:UBOUND( chem_species, 1 )) ) 1016 1112 ENDIF 1017 1113 IF ( bc_dirichlet_s ) THEN … … 1021 1117 IF ( humidity ) ALLOCATE( nest_offl%q_south(0:1,nzb+1:nzt,nxl:nxr) ) 1022 1118 IF ( .NOT. neutral ) ALLOCATE( nest_offl%pt_south(0:1,nzb+1:nzt,nxl:nxr) ) 1119 IF ( air_chemistry ) ALLOCATE( nest_offl%chem_south(0:1,nzb+1:nzt,nxl:nxr,& 1120 1:UBOUND( chem_species, 1 )) ) 1023 1121 ENDIF 1024 1122 … … 1028 1126 IF ( humidity ) ALLOCATE( nest_offl%q_top(0:1,nys:nyn,nxl:nxr) ) 1029 1127 IF ( .NOT. neutral ) ALLOCATE( nest_offl%pt_top(0:1,nys:nyn,nxl:nxr) ) 1030 1128 IF ( air_chemistry ) ALLOCATE( nest_offl%chem_top(0:1,nys:nyn,nxl:nxr, & 1129 1:UBOUND( chem_species, 1 )) ) 1130 ! 1131 !-- For chemical species, create the names of the variables. This is necessary 1132 !-- to identify the respective variable and write it onto the correct array 1133 !-- in the chem_species datatype. 1134 IF ( air_chemistry ) THEN 1135 ALLOCATE( nest_offl%chem_from_file_l(1:UBOUND( chem_species, 1 )) ) 1136 ALLOCATE( nest_offl%chem_from_file_n(1:UBOUND( chem_species, 1 )) ) 1137 ALLOCATE( nest_offl%chem_from_file_r(1:UBOUND( chem_species, 1 )) ) 1138 ALLOCATE( nest_offl%chem_from_file_s(1:UBOUND( chem_species, 1 )) ) 1139 ALLOCATE( nest_offl%chem_from_file_t(1:UBOUND( chem_species, 1 )) ) 1140 1141 ALLOCATE( nest_offl%var_names_chem_l(1:UBOUND( chem_species, 1 )) ) 1142 ALLOCATE( nest_offl%var_names_chem_n(1:UBOUND( chem_species, 1 )) ) 1143 ALLOCATE( nest_offl%var_names_chem_r(1:UBOUND( chem_species, 1 )) ) 1144 ALLOCATE( nest_offl%var_names_chem_s(1:UBOUND( chem_species, 1 )) ) 1145 ALLOCATE( nest_offl%var_names_chem_t(1:UBOUND( chem_species, 1 )) ) 1146 ! 1147 !-- Initialize flags that indicate whether the variable is on file or 1148 !-- not. Please note, this is only necessary for chemistry variables. 1149 nest_offl%chem_from_file_l(:) = .FALSE. 1150 nest_offl%chem_from_file_n(:) = .FALSE. 1151 nest_offl%chem_from_file_r(:) = .FALSE. 1152 nest_offl%chem_from_file_s(:) = .FALSE. 1153 nest_offl%chem_from_file_t(:) = .FALSE. 1154 1155 DO n = 1, UBOUND( chem_species, 1 ) 1156 nest_offl%var_names_chem_l(n) = nest_offl%char_l // & 1157 TRIM(chem_species(n)%name) 1158 nest_offl%var_names_chem_n(n) = nest_offl%char_n // & 1159 TRIM(chem_species(n)%name) 1160 nest_offl%var_names_chem_r(n) = nest_offl%char_r // & 1161 TRIM(chem_species(n)%name) 1162 nest_offl%var_names_chem_s(n) = nest_offl%char_s // & 1163 TRIM(chem_species(n)%name) 1164 nest_offl%var_names_chem_t(n) = nest_offl%char_t // & 1165 TRIM(chem_species(n)%name) 1166 ENDDO 1167 ENDIF 1031 1168 ! 1032 1169 !-- Read COSMO data at lateral and top boundaries … … 1041 1178 nest_offl%pt_left(0,nzb+1:nzt,nys:nyn) 1042 1179 IF ( humidity ) q(nzb+1:nzt,nys:nyn,-1) = & 1043 nest_offl%q_left(0,nzb+1:nzt,nys:nyn) 1180 nest_offl%q_left(0,nzb+1:nzt,nys:nyn) 1181 IF ( air_chemistry ) THEN 1182 DO n = 1, UBOUND( chem_species, 1 ) 1183 IF( nest_offl%chem_from_file_l(n) ) THEN 1184 chem_species(n)%conc(nzb+1:nzt,nys:nyn,-1) = & 1185 nest_offl%chem_left(0,nzb+1:nzt,nys:nyn,n) 1186 ENDIF 1187 ENDDO 1188 ENDIF 1044 1189 ENDIF 1045 1190 IF ( bc_dirichlet_r ) THEN … … 1051 1196 IF ( humidity ) q(nzb+1:nzt,nys:nyn,nxr+1) = & 1052 1197 nest_offl%q_right(0,nzb+1:nzt,nys:nyn) 1198 IF ( air_chemistry ) THEN 1199 DO n = 1, UBOUND( chem_species, 1 ) 1200 IF( nest_offl%chem_from_file_r(n) ) THEN 1201 chem_species(n)%conc(nzb+1:nzt,nys:nyn,nxr+1) = & 1202 nest_offl%chem_right(0,nzb+1:nzt,nys:nyn,n) 1203 ENDIF 1204 ENDDO 1205 ENDIF 1053 1206 ENDIF 1054 1207 IF ( bc_dirichlet_s ) THEN … … 1060 1213 IF ( humidity ) q(nzb+1:nzt,-1,nxl:nxr) = & 1061 1214 nest_offl%q_south(0,nzb+1:nzt,nxl:nxr) 1215 IF ( air_chemistry ) THEN 1216 DO n = 1, UBOUND( chem_species, 1 ) 1217 IF( nest_offl%chem_from_file_s(n) ) THEN 1218 chem_species(n)%conc(nzb+1:nzt,-1,nxl:nxr) = & 1219 nest_offl%chem_south(0,nzb+1:nzt,nxl:nxr,n) 1220 ENDIF 1221 ENDDO 1222 ENDIF 1062 1223 ENDIF 1063 1224 IF ( bc_dirichlet_n ) THEN … … 1069 1230 IF ( humidity ) q(nzb+1:nzt,nyn+1,nxl:nxr) = & 1070 1231 nest_offl%q_north(0,nzb+1:nzt,nxl:nxr) 1232 IF ( air_chemistry ) THEN 1233 DO n = 1, UBOUND( chem_species, 1 ) 1234 IF( nest_offl%chem_from_file_n(n) ) THEN 1235 chem_species(n)%conc(nzb+1:nzt,nyn+1,nxl:nxr) = & 1236 nest_offl%chem_north(0,nzb+1:nzt,nxl:nxr,n) 1237 ENDIF 1238 ENDDO 1239 ENDIF 1071 1240 ENDIF 1072 1241 !
Note: See TracChangeset
for help on using the changeset viewer.