Changeset 4392 for palm/trunk/SOURCE/radiation_model_mod.f90
- Timestamp:
- Jan 31, 2020 4:14:57 PM (5 years ago)
- Location:
- palm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk
- Property svn:mergeinfo changed
/palm/branches/resler merged: 4320,4322-4323,4333-4334,4344-4345,4348-4350,4352-4353,4357,4375-4376,4390-4391
- Property svn:mergeinfo changed
-
palm/trunk/SOURCE
- Property svn:mergeinfo changed
/palm/branches/resler/SOURCE merged: 4320,4322-4323,4333-4334,4344-4345,4348-4350,4352-4353,4357,4375-4376,4390-4391
- Property svn:mergeinfo changed
-
palm/trunk/SOURCE/radiation_model_mod.f90
- Property svn:mergeinfo changed
/palm/branches/resler/SOURCE/radiation_model_mod.f90 merged: 4320,4323,4344-4345,4375,4391
r4360 r4392 15 15 ! PALM. If not, see <http://www.gnu.org/licenses/>. 16 16 ! 17 ! Copyright 2015-20 19 Institute of Computer Science of the17 ! Copyright 2015-2020 Institute of Computer Science of the 18 18 ! Czech Academy of Sciences, Prague 19 19 ! Copyright 2015-2019 Czech Technical University in Prague … … 28 28 ! ----------------- 29 29 ! $Id$ 30 ! - Add debug tracing of large radiative fluxes (option trace_fluxes_above) 31 ! - Print exact counts of SVF and CSF if debut_output is enabled 32 ! - Update descriptions of RTM 3.0 and related comments 33 ! 34 ! 4360 2020-01-07 11:25:50Z suehring 30 35 ! Renamed pc_heating_rate, pc_transpiration_rate, pc_transpiration_rate to 31 36 ! pcm_heating_rate, pcm_latent_rate, pcm_transpiration_rate … … 214 219 ! Description: 215 220 ! ------------ 216 !> Radiation models and interfaces 217 !> @todo Replace dz(1) appropriatly to account for grid stretching 221 !> Radiation models and interfaces: 222 !> constant, simple and RRTMG models, interface to external radiation model 223 !> Radiative Transfer Model (RTM) version 3.0 for modelling of radiation 224 !> interactions within urban canopy or other surface layer in complex terrain 225 !> Integrations of RTM with other PALM-4U modules: 226 !> integration with RRTMG, USM, LSM, PCM, BIO modules 227 !> 218 228 !> @todo move variable definitions used in radiation_init only to the subroutine 219 229 !> as they are no longer required after initialization. 220 230 !> @todo Output of full column vertical profiles used in RRTMG 221 231 !> @todo Output of other rrtm arrays (such as volume mixing ratios) 222 !> @todo Check for mis-used NINT() calls in raytrace_2d223 !> RESULT: Original was correct (carefully verified formula), the change224 !> to INT broke raytracing -- P. Krc225 232 !> @todo Optimize radiation_tendency routines 226 !> @todo Consider rotated model domains (rotation_angle/=0.0)227 233 !> 228 234 !> @note Many variables have a leading dummy dimension (0:0) in order to … … 430 436 skip_time_do_radiation = 0.0_wp, & !< Radiation model is not called before this time 431 437 sky_trans, & !< sky transmissivity 432 time_radiation = 0.0_wp !< time since last call of radiation code 438 time_radiation = 0.0_wp, & !< time since last call of radiation code 439 trace_fluxes_above = -1.0_wp !< NAMELIST option for debug tracing of large radiative fluxes (W/m2;W/m3) 433 440 434 441 INTEGER(iwp) :: day_of_year !< day of the current year … … 1532 1539 ! Description: 1533 1540 ! ------------ 1534 !> Initialization of the radiation model 1541 !> Initialization of the radiation model and Radiative Transfer Model 1535 1542 !------------------------------------------------------------------------------! 1536 1543 SUBROUTINE radiation_init … … 3848 3855 ! Description: 3849 3856 ! ------------ 3850 !> Parin for &radiation_parameters for radiation model 3857 !> Parin for &radiation_parameters for radiation model and RTM 3851 3858 !------------------------------------------------------------------------------! 3852 3859 SUBROUTINE radiation_parin … … 3868 3875 raytrace_discrete_azims, & 3869 3876 raytrace_discrete_elevs, raytrace_mpi_rma, & 3877 trace_fluxes_above, & 3870 3878 skip_time_do_radiation, surface_reflections, & 3871 3879 svfnorm_report_thresh, sw_radiation, & … … 3884 3892 raytrace_discrete_azims, & 3885 3893 raytrace_discrete_elevs, raytrace_mpi_rma, & 3894 trace_fluxes_above, & 3886 3895 skip_time_do_radiation, surface_reflections, & 3887 3896 svfnorm_report_thresh, sw_radiation, & … … 5698 5707 ! Description: 5699 5708 ! ------------ 5700 !> This subroutine calculates interaction of the solar radiation 5709 !> Radiative Transfer Model (RTM) version 3.0 for modelling of radiation 5710 !> interactions within urban canopy or inside of surface layer in complex terrain. 5711 !> This subroutine calculates interaction of the solar SW and LW radiation 5701 5712 !> with urban and land surfaces and updates all surface heatfluxes. 5702 !> It calculates also the required parameters for RRTMG lower BC. 5713 !> It also calculates interactions of SW and LW radiation with resolved 5714 !> plant canopy and calculates the corresponding plant canopy heat fluxes. 5715 !> The subroutine also models spatial and temporal distribution of Mean 5716 !> Radiant Temperature (MRT). The resulting values are provided to other 5717 !> PALM-4U modules (RRTMG, USM, LSM, PCM and BIO). 5703 5718 !> 5704 !> For more info. see Resler et al. 2017 5719 !> The new version 3.0 was radically rewriten from version 1.0. 5720 !> The most significant changes include new angular discretization scheme, 5721 !> redesigned and significantly optimized raytracing scheme, new processes 5722 !> included in modelling (e.g. intetrations of LW radiation with PC), 5723 !> integrated calculation of Mean Radiant Temperature (MRT), and improved 5724 !> and enhanced output and debug capabilities. This new version significantly 5725 !> improves effectivity of the paralelization and the scalability of the model 5726 !> and allows simulation of extensive domain with appropriate HPC resources. 5705 5727 !> 5706 !> The new version 2.0 was radically rewriten, the discretization scheme 5707 !> has been changed. This new version significantly improves effectivity 5708 !> of the paralelization and the scalability of the model. 5728 !> More info about RTM v.1.0. see: 5729 !> Resler et al., GMD. 2017, https://doi.org/10.5194/gmd-10-3635-2017 5730 !> Info about RTM v. 3.0 see: 5731 !> Krc et al. 2020 (to appear in GMD), 5732 !> Maronga et al., GMDD 2019, https://doi.org/10.5194/gmd-2019-103 5733 !> 5734 5735 5709 5736 !------------------------------------------------------------------------------! 5710 5737 … … 5900 5927 ENDDO 5901 5928 5929 IF ( trace_fluxes_above >= 0._wp ) THEN 5930 CALL radiation_print_debug_surf( 'surfoutll before initial pass', surfoutll ) 5931 CALL radiation_print_debug_horz( 'rad_lw_in_diff before initial pass', rad_lw_in_diff ) 5932 CALL radiation_print_debug_horz( 'rad_sw_in_diff before initial pass', rad_sw_in_diff ) 5933 CALL radiation_print_debug_horz( 'rad_sw_in_dir before initial pass', rad_sw_in_dir ) 5934 ENDIF 5935 5902 5936 #if defined( __parallel ) 5903 5937 !-- might be optimized and gather only values relevant for current processor … … 6039 6073 ENDIF 6040 6074 6075 IF ( trace_fluxes_above >= 0._wp ) THEN 6076 CALL radiation_print_debug_surf( 'surfinl after initial pass', surfinl ) 6077 CALL radiation_print_debug_surf( 'surfinlwdif after initial pass', surfinlwdif ) 6078 CALL radiation_print_debug_surf( 'surfinswdif after initial pass', surfinswdif ) 6079 CALL radiation_print_debug_surf( 'surfinswdir after initial pass', surfinswdir ) 6080 IF ( npcbl > 0 ) THEN 6081 CALL radiation_print_debug_pcb( 'pcbinlw after initial pass', pcbinlw ) 6082 CALL radiation_print_debug_pcb( 'pcbinswdif after initial pass', pcbinswdif ) 6083 CALL radiation_print_debug_pcb( 'pcbinswdir after initial pass', pcbinswdir ) 6084 ENDIF 6085 ENDIF 6086 6041 6087 IF ( plant_lw_interact ) THEN 6042 6088 ! … … 6054 6100 ENDIF 6055 6101 6102 IF ( trace_fluxes_above >= 0._wp ) THEN 6103 CALL radiation_print_debug_surf( 'surfinl after PC emiss', surfinl ) 6104 ENDIF 6105 6056 6106 surfins = surfinswdir + surfinswdif 6057 6107 surfinl = surfinl + surfinlwdif … … 6081 6131 !-- for non-transparent surfaces, longwave albedo is 1 - emissivity 6082 6132 surfoutll = (1._wp - emiss_surf) * surfinl 6133 6134 IF ( trace_fluxes_above >= 0._wp ) THEN 6135 CALL radiation_print_debug_surf( 'surfoutll before reflective pass', surfoutll, refstep ) 6136 CALL radiation_print_debug_surf( 'surfoutsl before reflective pass', surfoutsl, refstep ) 6137 ENDIF 6083 6138 6084 6139 #if defined( __parallel ) … … 6148 6203 mrtinlw(imrt) = mrtinlw(imrt) + mrtf(imrtf) * surfoutl(isurfsrc) 6149 6204 ENDDO 6205 6206 IF ( trace_fluxes_above >= 0._wp ) THEN 6207 CALL radiation_print_debug_surf( 'surfinl after reflected pass', surfinl, refstep ) 6208 CALL radiation_print_debug_surf( 'surfins after reflected pass', surfins, refstep ) 6209 CALL radiation_print_debug_pcb( 'pcbinlw after reflected pass', pcbinlw, refstep ) 6210 CALL radiation_print_debug_pcb( 'pcbinsw after reflected pass', pcbinsw, refstep ) 6211 ENDIF 6150 6212 6151 6213 surfinsw = surfinsw + surfins … … 6582 6644 ! Description: 6583 6645 ! ------------ 6584 !> This subroutine splits direct and diffusion dw radiation 6646 !> This subroutine splits direct and diffusion dw radiation for RTM processing. 6585 6647 !> It sould not be called in case the radiation model already does it 6586 6648 !> It follows Boland, Ridley & Brown (2008) … … 6642 6704 END SUBROUTINE calc_diffusion_radiation 6643 6705 6706 !------------------------------------------------------------------------------! 6707 ! Description: 6708 ! ------------ 6709 !> Print consecutive radiative extremes if requested to trace early radiation 6710 !> interaction instabilities. 6711 !------------------------------------------------------------------------------! 6712 SUBROUTINE radiation_print_debug_surf( description, values, step ) 6713 6714 CHARACTER (LEN=*), INTENT(in) :: description 6715 REAL(wp), DIMENSION(:), INTENT(in) :: values 6716 INTEGER(iwp), INTENT(in), OPTIONAL :: step 6717 6718 CHARACTER (LEN=50) :: location 6719 CHARACTER (LEN=1024) :: debug_string 6720 INTEGER :: isurf 6721 REAL(wp) :: x 6722 6723 isurf = MAXLOC( values, DIM=1 ) 6724 x = values(isurf) 6725 IF ( x < trace_fluxes_above ) RETURN 6726 6727 IF ( PRESENT( step ) ) THEN 6728 WRITE( location, '(A," #",I0)' ) description, step 6729 ELSE 6730 location = description 6731 ENDIF 6732 6733 WRITE( debug_string, '("Maximum of ",A50," = ",F12.1," at coords ' // & 6734 'i=",I4,", j=",I4,", k=",I4,", d=",I1,". ' // & 6735 'Alb=",F7.3,", emis=",F7.3)' ) & 6736 location, x, surfl(ix,isurf), surfl(iy,isurf), & 6737 surfl(iz,isurf), surfl(id,isurf), albedo_surf(isurf), & 6738 emiss_surf(isurf) 6739 CALL debug_message( debug_string, 'info' ) 6740 6741 END SUBROUTINE 6742 6743 SUBROUTINE radiation_print_debug_pcb( description, values, step ) 6744 6745 CHARACTER (LEN=*), INTENT(in) :: description 6746 REAL(wp), DIMENSION(:), INTENT(in) :: values 6747 INTEGER(iwp), INTENT(in), OPTIONAL :: step 6748 6749 CHARACTER (LEN=50) :: location 6750 CHARACTER (LEN=1024) :: debug_string 6751 INTEGER :: ipcb 6752 REAL(wp) :: x 6753 6754 IF ( npcbl <= 0 ) RETURN 6755 ipcb = MAXLOC( values, DIM=1 ) 6756 x = values(ipcb) / (dx*dy*dz(1)) 6757 IF ( x < trace_fluxes_above ) RETURN 6758 6759 IF ( PRESENT( step ) ) THEN 6760 WRITE( location, '(A," #",I0)' ) description, step 6761 ELSE 6762 location = description 6763 ENDIF 6764 6765 WRITE( debug_string, '("Maximum of ",A50," = ",F12.1," at coords ' // & 6766 'i=",I4,", j=",I4,", k=",I4)' ) & 6767 location, x, pcbl(ix,ipcb), pcbl(iy,ipcb), pcbl(iz,ipcb) 6768 CALL debug_message( debug_string, 'info' ) 6769 6770 END SUBROUTINE 6771 6772 SUBROUTINE radiation_print_debug_horz( description, values, step ) 6773 6774 CHARACTER (LEN=*), INTENT(in) :: description 6775 REAL(wp), DIMENSION(:,:), INTENT(in) :: values 6776 INTEGER(iwp), INTENT(in), OPTIONAL :: step 6777 6778 CHARACTER (LEN=50) :: location 6779 CHARACTER (LEN=1024) :: debug_string 6780 INTEGER, DIMENSION(2) :: ji 6781 REAL(wp) :: x 6782 6783 ji = MAXLOC( values ) 6784 x = values(ji(1),ji(2)) 6785 IF ( x < trace_fluxes_above ) RETURN 6786 6787 IF ( PRESENT( step ) ) THEN 6788 WRITE( location, '(A," #",I0)' ) description, step 6789 ELSE 6790 location = description 6791 ENDIF 6792 6793 WRITE( debug_string, '("Maximum of ",A50," = ",F12.1," at coords ' // & 6794 'i=",I4,", j=",I4)' ) & 6795 location, x, ji(2), ji(1) 6796 CALL debug_message( debug_string, 'info' ) 6797 6798 END SUBROUTINE 6799 6644 6800 END SUBROUTINE radiation_interaction 6645 6801 … … 6647 6803 ! Description: 6648 6804 ! ------------ 6649 !> This subroutine initializes structures needed for radiative transfer6650 !> model. This model calculates transformation processes of the6805 !> This subroutine initializes structures needed for Radiative Transfer 6806 !> Model (RTM). This model calculates transformation processes of the 6651 6807 !> radiation inside urban and land canopy layer. The module includes also 6652 6808 !> the interaction of the radiation with the resolved plant canopy. 6653 !>6654 !> For more info. see Resler et al. 20176655 !>6656 !> The new version 2.0 was radically rewriten, the discretization scheme6657 !> has been changed. This new version significantly improves effectivity6658 !> of the paralelization and the scalability of the model.6659 6809 !> 6660 6810 !------------------------------------------------------------------------------! … … 7182 7332 !> Calculates shape view factors (SVF), plant sink canopy factors (PCSF), 7183 7333 !> sky-view factors, discretized path for direct solar radiation, MRT factors 7184 !> and other preprocessed data needed for radiation_interaction. 7334 !> and other preprocessed data needed for radiation_interaction inside RTM. 7335 !> This subroutine is called only one at the beginning of the simulation. 7336 !> The resulting factors can be stored to files and reused with other 7337 !> simulations utilizing the same surface and plant canopy structure. 7185 7338 !------------------------------------------------------------------------------! 7186 7339 SUBROUTINE radiation_calc_svf … … 7944 8097 7945 8098 IF ( rad_angular_discretization ) THEN 7946 IF ( debug_output ) CALL debug_message( 'Load svf from the structure array to plain arrays', 'info' ) 8099 IF ( debug_output ) THEN 8100 WRITE( debug_string, '("Load ",I0," SVFs from the structure array to plain arrays")' ) nsvfl 8101 CALL debug_message( debug_string, 'info' ) 8102 ENDIF 7947 8103 ALLOCATE( svf(ndsvf,nsvfl) ) 7948 8104 ALLOCATE( svfsurf(idsvf,nsvfl) ) … … 7958 8114 7959 8115 !< load svf from the structure array to plain arrays 7960 IF ( debug_output ) CALL debug_message( 'Load svf from the structure array to plain arrays', 'info' ) 8116 IF ( debug_output ) THEN 8117 WRITE( debug_string, '("Load ",I0," SVFs from the structure array to plain arrays")' ) nsvfl 8118 CALL debug_message( debug_string, 'info' ) 8119 ENDIF 7961 8120 ALLOCATE( svf(ndsvf,nsvfl) ) 7962 8121 ALLOCATE( svfsurf(idsvf,nsvfl) ) … … 8189 8348 DEALLOCATE( pcsflt_l ) 8190 8349 DEALLOCATE( kpcsflt_l ) 8191 IF ( debug_output ) CALL debug_message( 'End of aggregate csf', 'info' ) 8350 IF ( debug_output ) THEN 8351 WRITE( debug_string, '("Finished aggregating ",I0," CSFs.")') ncsfl 8352 CALL debug_message( debug_string, 'info' ) 8353 ENDIF 8192 8354 8193 8355 ENDIF … … 8212 8374 ! ------------ 8213 8375 !> Raytracing for detecting obstacles and calculating compound canopy sink 8214 !> factors . (A simple obstacle detection would only need to process faces in8215 !> 3 dimensions without any ordering.)8376 !> factors for RTM. (A simple obstacle detection would only need to process 8377 !> faces in 3 dimensions without any ordering.) 8216 8378 !> Assumtions: 8217 8379 !> ----------- … … 8410 8572 ! ------------ 8411 8573 !> A new, more efficient version of ray tracing algorithm that processes a whole 8412 !> arc instead of a single ray .8574 !> arc instead of a single ray (new in RTM version 2.5). 8413 8575 !> 8414 8576 !> In all comments, horizon means tangent of horizon angle, i.e. … … 8925 9087 ! ------------ 8926 9088 !> Calculates apparent solar positions for all timesteps and stores discretized 8927 !> positions .9089 !> positions for RTM. 8928 9090 !------------------------------------------------------------------------------! 8929 9091 SUBROUTINE radiation_presimulate_solar_pos … … 9013 9175 ! Description: 9014 9176 ! ------------ 9015 !> Determines whether two faces are oriented towards each other . Since the9177 !> Determines whether two faces are oriented towards each other in RTM. Since the 9016 9178 !> surfaces follow the gird box surfaces, it checks first whether the two surfaces 9017 9179 !> are directed in the same direction, then it checks if the two surfaces are … … 9074 9236 ! Description: 9075 9237 ! ------------ 9076 !> Reads svf, svfsurf, csf, csfsurf and mrt factors data from saved file 9077 !> SVF means sky view factors and CSF means canopy sink factors 9238 !> Reads svf, svfsurf, csf, csfsurf and mrt factors data from saved file. 9239 !> This allows to skip their calculation during of RTM init phase. 9240 !> SVF means sky view factors and CSF means canopy sink factors. 9078 9241 !------------------------------------------------------------------------------! 9079 9242 SUBROUTINE radiation_read_svf … … 9240 9403 ! ------------ 9241 9404 !> Subroutine stores svf, svfsurf, csf, csfsurf and mrt data to a file. 9405 !> The stored factors can be reused in future simulation with the same 9406 !> geometry structure of the surfaces and resolved plant canopy. 9242 9407 !------------------------------------------------------------------------------! 9243 9408 SUBROUTINE radiation_write_svf … … 9304 9469 ! Description: 9305 9470 ! ------------ 9306 !> Block of auxiliary subroutines :9471 !> Block of auxiliary subroutines for RTM: 9307 9472 !> 1. quicksort and corresponding comparison 9308 9473 !> 2. merge_and_grow_csf for implementation of "dynamical growing" … … 9440 9605 ! Description: 9441 9606 ! ------------ 9442 !> Grows the CSF array exponentially after it is full. During that, the ray9443 !> canopy sink factors with common source face and target plant canopy grid9444 !> cell are merged together so that the size doesn't grow out of control.9607 !> Grows the CSF array in RTM exponentially when it is full. During that, 9608 !> the ray canopy sink factors with common source face and target plant canopy 9609 !> grid cell are merged together so that the size doesn't grow out of control. 9445 9610 !------------------------------------------------------------------------------! 9446 9611 SUBROUTINE merge_and_grow_csf(newsize) - Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.