Changeset 4758 for LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad
- Timestamp:
- Dec 1, 2023, 10:09:29 PM (14 months ago)
- Location:
- LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/CHANGELOG
r4728 r4758 13 13 saves look-up table averaged to the bands of the radiation scheme 14 14 (general cloud optics only) 15 - Increased security value in single-precision SW 16 reflectance-transmittance calculation from 1e-12 to 1e-6 15 17 16 18 version 1.6.0 (27 April 2023) -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_aerosol_optics.F90
r4728 r4758 37 37 use yomhook, only : lhook, dr_hook, jphook 38 38 use radiation_config, only : config_type 39 use radiation_aerosol_optics_data, only : aerosol_optics_type, & 40 data_setup_aerosol_optics => setup_aerosol_optics 39 use radiation_aerosol_optics_data, only : aerosol_optics_type 41 40 use radiation_io, only : nulerr, radiation_abort 42 41 … … 58 57 ! Read file containing optical properties already in the bands 59 58 ! of the gas-optics scheme 60 if (.not. associated(config%aerosol_optics%setup)) &61 config%aerosol_optics%setup => data_setup_aerosol_optics62 59 call config%aerosol_optics%setup(trim(config%aerosol_optics_file_name), & 63 60 & iverbose=config%iverbosesetup) … … 346 343 use easy_netcdf, only : netcdf_file 347 344 use radiation_config, only : config_type 348 use radiation_aerosol_optics_data, only : aerosol_optics_type, & 349 data_setup_aerosol_optics => setup_aerosol_optics 345 use radiation_aerosol_optics_data, only : aerosol_optics_type 350 346 use radiation_spectral_definition, only : SolarReferenceTemperature, & 351 347 & TerrestrialReferenceTemperature … … 374 370 if (lhook) call dr_hook('radiation_aerosol_optics:setup_general_aerosol_optics_legacy',0,hook_handle) 375 371 ao => config%aerosol_optics 376 ao_legacy%setup => data_setup_aerosol_optics377 372 378 373 ! Load file into a local structure -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_aerosol_optics_data.F90
r4728 r4758 135 135 logical :: use_monochromatic = .false. 136 136 137 procedure(setup_aerosol_optics), pointer:: setup => null()138 139 137 contains 138 procedure :: setup => setup_aerosol_optics 140 139 procedure :: save => save_aerosol_optics 141 140 procedure :: allocate -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_cloud.F90
r4728 r4758 64 64 ! gridbox area for use in representing 3D effects. This variable 65 65 ! is dimensioned (ncol,nlev). 66 real(jprb), allocatable, dimension(:,:) :: inv_cloud_effective_size ! m-166 real(jprb), allocatable, dimension(:,:) :: inv_cloud_effective_size ! m-1 67 67 68 68 ! Similarly for the in-cloud heterogeneities, used to compute the … … 606 606 607 607 use yomhook, only : lhook, dr_hook, jphook 608 ! USE mod_phys_lmdz_para 608 609 609 610 class(cloud_type), intent(inout) :: this -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_cloud_generator.F90
r4728 r4758 540 540 use radiation_pdf_sampler, only : pdf_sampler_type 541 541 implicit none 542 #if defined(__GFORTRAN__) || defined(__PGI) || defined(__NEC__)543 #else544 !$omp declare simd(sample_from_pdf_simd) uniform(this) &545 !$omp linear(ref(fsd)) linear(ref(cdf))546 #endif542 !#if defined(__GFORTRAN__) || defined(__PGI) || defined(__NEC__) 543 !#else 544 ! !$omp declare simd(sample_from_pdf_simd) uniform(this) & 545 ! !$omp linear(ref(fsd)) linear(ref(cdf)) 546 !#endif 547 547 type(pdf_sampler_type), intent(in) :: this 548 548 -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_ecckd_interface.F90
r4728 r4758 57 57 end if 58 58 59 if (allocated(config%i_band_from_g_sw)) deallocate(config%i_band_from_g_sw) 60 allocate(config%i_band_from_g_sw (config%n_g_sw)) 61 if (allocated(config%i_band_from_reordered_g_sw)) deallocate(config%i_band_from_reordered_g_sw) 62 allocate(config%i_band_from_reordered_g_sw(config%n_g_sw)) 63 if (allocated(config%i_g_from_reordered_g_sw)) deallocate(config%i_g_from_reordered_g_sw) 64 allocate(config%i_g_from_reordered_g_sw (config%n_g_sw)) 59 ! if (allocated(config%i_band_from_g_sw)) deallocate(config%i_band_from_g_sw) 60 ! allocate(config%i_band_from_g_sw(config%n_g_sw)) 61 ! if (allocated(config%i_band_from_reordered_g_sw)) deallocate(config%i_band_from_reordered_g_sw) 62 ! allocate(config%i_band_from_reordered_g_sw(config%n_g_sw)) 63 ! if (allocated(config%i_g_from_reordered_g_sw)) deallocate(config%i_g_from_reordered_g_sw) 64 ! allocate(config%i_g_from_reordered_g_sw(config%n_g_sw)) 65 if (.not.allocated(config%i_band_from_g_sw)) & 66 allocate(config%i_band_from_g_sw(config%n_g_sw)) 67 if (.not.allocated(config%i_band_from_reordered_g_sw)) & 68 allocate(config%i_band_from_reordered_g_sw(config%n_g_sw)) 69 if (.not.allocated(config%i_g_from_reordered_g_sw)) & 70 allocate(config%i_g_from_reordered_g_sw(config%n_g_sw)) 65 71 66 72 if (config%do_cloud_aerosol_per_sw_g_point) then … … 105 111 end if 106 112 107 if (allocated(config%i_band_from_g_lw)) deallocate(config%i_band_from_g_lw) 108 allocate(config%i_band_from_g_lw (config%n_g_lw)) 109 if (allocated(config%i_band_from_reordered_g_lw)) deallocate(config%i_band_from_reordered_g_lw) 110 allocate(config%i_band_from_reordered_g_lw(config%n_g_lw)) 111 if (allocated(config%i_g_from_reordered_g_lw)) deallocate(config%i_g_from_reordered_g_lw) 112 allocate(config%i_g_from_reordered_g_lw (config%n_g_lw)) 113 ! if (allocated(config%i_band_from_g_lw)) deallocate(config%i_band_from_g_lw) 114 ! allocate(config%i_band_from_g_lw (config%n_g_lw)) 115 ! if (allocated(config%i_band_from_reordered_g_lw)) deallocate(config%i_band_from_reordered_g_lw) 116 ! allocate(config%i_band_from_reordered_g_lw(config%n_g_lw)) 117 ! if (allocated(config%i_g_from_reordered_g_lw)) deallocate(config%i_g_from_reordered_g_lw) 118 ! allocate(config%i_g_from_reordered_g_lw (config%n_g_lw)) 119 if (.not.allocated(config%i_band_from_g_lw)) & 120 allocate(config%i_band_from_g_lw (config%n_g_lw)) 121 if (.not.allocated(config%i_band_from_reordered_g_lw)) & 122 allocate(config%i_band_from_reordered_g_lw(config%n_g_lw)) 123 if (.not.allocated(config%i_g_from_reordered_g_lw)) & 124 allocate(config%i_g_from_reordered_g_lw (config%n_g_lw)) 125 113 126 114 127 if (config%do_cloud_aerosol_per_lw_g_point) then -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_general_cloud_optics.F90
r4728 r4758 75 75 ! Allocate structures 76 76 if (config%do_sw) then 77 if (allocated(config%cloud_optics_sw)) deallocate(config%cloud_optics_sw)77 if (allocated(config%cloud_optics_sw)) deallocate(config%cloud_optics_sw) 78 78 allocate(config%cloud_optics_sw(config%n_cloud_types)) 79 79 end if 80 80 81 81 if (config%do_lw) then 82 if (allocated(config%cloud_optics_lw)) deallocate(config%cloud_optics_lw)82 if (allocated(config%cloud_optics_lw)) deallocate(config%cloud_optics_lw) 83 83 allocate(config%cloud_optics_lw(config%n_cloud_types)) 84 84 end if -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_interface.F90
r4728 r4758 227 227 use radiation_general_cloud_optics, only : general_cloud_optics 228 228 use radiation_aerosol_optics, only : add_aerosol_optics 229 USE mod_phys_lmdz_para 230 229 231 230 232 ! Inputs … … 236 238 type(thermodynamics_type),intent(in) :: thermodynamics 237 239 type(gas_type), intent(in) :: gas 238 type(cloud_type), 240 type(cloud_type), intent(inout):: cloud 239 241 type(aerosol_type), intent(in) :: aerosol 240 242 ! Output … … 295 297 296 298 real(jphook) :: hook_handle 299 integer :: jcol, jlev 297 300 298 301 if (lhook) call dr_hook('radiation_interface:radiation',0,hook_handle) 302 303 if (config%i_solver_sw == ISolverSPARTACUS) then 304 print*,'Dans radiation, mpi_rank, omp_rank, size, chape inv_cloud = ',& 305 mpi_rank, omp_rank, & 306 shape(cloud%inv_cloud_effective_size), & 307 size(cloud%inv_cloud_effective_size) 308 ! do jcol=istartcol, iendcol 309 ! do jlev=1,nlev 310 ! print*,'Entree radiation_interf, mpi_rank, omp_rank, jcol, jlev & 311 ! & cloud%inv_cloud_effective_size =',mpi_rank, omp_rank, jcol, jlev, & 312 ! & cloud%inv_cloud_effective_size(jcol,jlev) 313 ! enddo 314 ! enddo 315 endif 316 ! cloud%inv_cloud_effective_size=0.05_jprb 299 317 300 318 if (thermodynamics%pressure_hl(istartcol,2) & … … 456 474 else if (config%i_solver_sw == ISolverSPARTACUS) then 457 475 ! Compute fluxes using the SPARTACUS shortwave solver 476 ! cloud%inv_cloud_effective_size=0.05_jprb 477 ! do jcol=istartcol, iendcol 478 ! do jlev=1,nlev 479 ! print*,'jcol, jlev, dans radiation_interf i & 480 ! & cloud%inv_cloud_effective_size =',jcol, jlev, & 481 ! cloud%inv_cloud_effective_size(jcol,jlev) 482 ! enddo 483 ! enddo 458 484 call solver_spartacus_sw(nlev,istartcol,iendcol, & 459 485 & config, single_level, thermodynamics, cloud, & -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_spartacus_sw.F90
r4728 r4758 87 87 use radiation_constants, only : Pi, GasConstantDryAir, & 88 88 & AccelDueToGravity 89 USE mod_phys_lmdz_para 89 90 90 91 implicit none … … 326 327 write(nulout,'(a)',advance='no') ' Processing columns' 327 328 end if 329 330 print*,'Dans radiation_spartacus, mpi_rank, omp_rank, & 331 size, chape inv_cloud = ',& 332 mpi_rank, omp_rank, & 333 shape(cloud%inv_cloud_effective_size), & 334 size(cloud%inv_cloud_effective_size) 328 335 329 336 ! Main loop over columns … … 497 504 & .not. (nreg == 2 .and. cloud%fraction(jcol,jlev) & 498 505 & > 1.0-config%cloud_fraction_threshold)) then 506 ! print*,' Dans radiation_spartacus mpi_rank, omp_rank, jcol, jlev, & 507 ! & cloud%inv_cloud_effective_size =', mpi_rank, & 508 ! & omp_rank, jcol, jlev, & 509 ! & cloud%inv_cloud_effective_size(jcol,jlev) 499 510 if (cloud%inv_cloud_effective_size(jcol,jlev) > 0.0_jprb) then 500 511 ! 3D effects are only simulated if -
LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/radiation/radiation_two_stream.F90
r4728 r4758 20 20 ! 2021-02-19 R Hogan Security for shortwave singularity 21 21 ! 2022-11-22 P Ukkonen/R Hogan Single precision uses no double precision 22 ! 2023-09-28 R Hogan Increased security for single-precision SW "k" 22 23 23 24 module radiation_two_stream … … 212 213 if (od(jg) > 1.0e-3_jprd) then 213 214 k_exponent = sqrt(max((gamma1(jg) - gamma2(jg)) * (gamma1(jg) + gamma2(jg)), & 214 1. E-12_jprd)) ! Eq 18 of Meador & Weaver (1980)215 1.0e-12_jprd)) ! Eq 18 of Meador & Weaver (1980) 215 216 exponential = exp_fast(-k_exponent*od(jg)) 216 217 exponential2 = exponential*exponential … … 235 236 else 236 237 k_exponent = sqrt(max((gamma1(jg) - gamma2(jg)) * (gamma1(jg) + gamma2(jg)), & 237 1. E-12_jprd)) ! Eq 18 of Meador & Weaver (1980)238 1.0e-12_jprd)) ! Eq 18 of Meador & Weaver (1980) 238 239 reflectance(jg) = gamma2(jg) * od(jg) 239 240 transmittance(jg) = (1.0_jprb - k_exponent*od(jg)) / (1.0_jprb + od(jg)*(gamma1(jg)-k_exponent)) … … 312 313 gamma2 = factor * (1.0_jprb - asymmetry(jg)) 313 314 k_exponent = sqrt(max((gamma1 - gamma2) * (gamma1 + gamma2), & 314 1. E-12_jprb)) ! Eq 18 of Meador & Weaver (1980)315 1.0e-12_jprb)) ! Eq 18 of Meador & Weaver (1980) 315 316 if (od(jg) > 1.0e-3_jprb) then 316 317 exponential = exp_fast(-k_exponent*od(jg)) … … 646 647 alpha2(jg) = gamma1(jg)*gamma3(jg) + gamma2(jg)*gamma4(jg) ! Eq. 17 647 648 ! The following line crashes inexplicably with gfortran 8.5.0 in 648 ! single precision - try a later version 649 ! single precision - try a later version. Note that the minimum 650 ! value is needed to produce correct results for single 651 ! scattering albedos very close to or equal to one. 652 #ifdef PARKIND1_SINGLE 653 k_exponent(jg) = sqrt(max((gamma1(jg) - gamma2(jg)) * (gamma1(jg) + gamma2(jg)), & 654 & 1.0e-6_jprb)) ! Eq 18 655 #else 649 656 k_exponent(jg) = sqrt(max((gamma1(jg) - gamma2(jg)) * (gamma1(jg) + gamma2(jg)), & 650 657 & 1.0e-12_jprb)) ! Eq 18 658 #endif 651 659 end do 652 660 … … 665 673 ! Meador & Weaver (1980) Eq. 25 666 674 ref_diff(jg) = gamma2(jg) * (1.0_jprb - exponential2) * reftrans_factor 667 668 ! Meador & Weaver (1980) Eq. 26 669 trans_diff(jg) = k_2_exponential * reftrans_factor 670 675 !ref_diff(jg) = max(0.0_jprb, min(ref_diff(jg)), 1.0_jprb) 676 677 ! Meador & Weaver (1980) Eq. 26, with security (which is 678 ! sometimes needed, but apparently not on ref_diff) 679 trans_diff(jg) = max(0.0_jprb, min(k_2_exponential * reftrans_factor, 1.0_jprb-ref_diff(jg))) 680 671 681 ! Here we need mu0 even though it wasn't in Meador and Weaver 672 682 ! because we are assuming the incoming direct flux is defined to … … 694 704 ref_dir(jg) = max(0.0_jprb, min(ref_dir(jg), mu0*(1.0_jprb-trans_dir_dir(jg)))) 695 705 trans_dir_diff(jg) = max(0.0_jprb, min(trans_dir_diff(jg), mu0*(1.0_jprb-trans_dir_dir(jg))-ref_dir(jg))) 696 697 706 end do 698 707
Note: See TracChangeset
for help on using the changeset viewer.