Ignore:
Timestamp:
Mar 29, 2022, 10:50:19 AM (2 years ago)
Author:
idelkadi
Message:

Implementation of Ecrad in LMDZ (continued) :

  • Switch to the first call only in the configuration and initializations part of Ecrad
  • Added instructions for parallelization
  • Initializations


File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/ecrad/radiation_scheme.F90

    r4031 r4115  
    9696
    9797! Modules from radiation library
    98 ! AI ATTENTION
    99 !use radiation_config,         only : config_type
    10098USE radiation_single_level,   ONLY : single_level_type
    10199USE radiation_thermodynamics, ONLY : thermodynamics_type
     
    106104USE radiation_interface,      ONLY : radiation, set_gas_units
    107105USE radiation_save,           ONLY : save_inputs
     106
     107USE mod_phys_lmdz_para
    108108
    109109IMPLICIT NONE
     
    297297logical :: loutput=.true.
    298298logical :: lprint_input=.false.
    299 logical :: lprint_config=.true.
     299logical :: lprint_config=.false.
     300logical, save :: debut_ecrad=.true.
     301!$OMP THREADPRIVATE(debut_ecrad)
    300302
    301303! Import time functions for iseed calculation
     
    335337  print*,'PAEROSOL_OLD, PAEROSOL =', PAEROSOL_OLD, PAEROSOL
    336338endif
    337 ! AI ATTENTION lecture de namelist
    338 ! alternative a l appel de radiation_setup ifs
    339 !file_name="namelist_ecrad"
    340 !call rad_config%read(file_name=file_name)
    341 ! Setup the radiation scheme: load the coefficients for gas and
    342 ! cloud optics, currently from RRTMG
    343 !call setup_radiation(rad_config)
    344339
    345340IF (LHOOK) CALL DR_HOOK('RADIATION_SCHEME',0,ZHOOK_HANDLE)
    346341print*,'Entree dans radiation_scheme'
     342
     343!$OMP MASTER
     344if (debut_ecrad) then
    347345! AI appel radiation_setup
    348346call SETUP_RADIATION_SCHEME(loutput)
    349 !! Les 6 bandes SW pour l'albedo :
    350 !! 0.185-0.25, 0.25-0.4, 0.4-0.69 , 0.69-1.19, 1.19-2.38, 2.38-4.00 micro-metre
    351   call rad_config%define_sw_albedo_intervals(6, &
    352              &  (/ 0.25e-6_jprb, 0.44e-6_jprb, 1.19e-6_jprb, &
    353              &     2.38e-6_jprb, 4.00e-6_jprb /),  (/ 1,2,3,4,5,6 /))
    354 
    355 if (lprint_config) then
     347
     348 if (lprint_config) then
    356349  print*,'************* Parametres de configuration  ********************'
    357350  print*,'rad_config%iverbosesetup = ',rad_config%iverbosesetup
     
    378371  print*,'n_bands_lw =', rad_config%n_bands_lw
    379372  print*,'rad_config%i_emiss_from_band_lw =', rad_config%i_emiss_from_band_lw
    380 endif
    381 
     373 endif
     374 debut_ecrad=.false.
     375endif
     376!$OMP END MASTER
     377!$OMP BARRIER
     378! Fin partie initialisation et configuration
     379
     380! AI : allocation des tableaux pour chaque partie (thermo, ...)
     381!      passage des champs LMDZ aux structures Ecrad
     382!      calculs Ecrad
    382383! AI ATTENTION
    383384! Allocate memory in radiation objects
     385! emissivite avec une seule bande
    384386CALL single_level%allocate(KLON, NSW, 1, &
    385387     &                     use_sw_albedo_direct=.TRUE.)
     
    388390! Set thermodynamic profiles: simply copy over the half-level
    389391! pressure and temperature
    390 print*,'Appel allocate thermo'
     392!print*,'Appel allocate thermo'
    391393CALL thermodynamics%allocate(KLON, KLEV, use_h2o_sat=.true.)
    392 print*,'Definir les champs thermo'
     394!print*,'Definir les champs thermo'
    393395! AI
    394396! pressure_hl > paprs
     
    397399thermodynamics%temperature_hl(KIDIA:KFDIA,:) = PTEMPERATURE_H(KIDIA:KFDIA,:)
    398400
    399 ! IFS currently sets the half-level temperature at the surface to be
    400 ! equal to the skin temperature. The radiation scheme takes as input
    401 ! only the half-level temperatures and assumes the Planck function to
    402 ! vary linearly in optical depth between half levels. In the lowest
    403 ! atmospheric layer, where the atmospheric temperature can be much
    404 ! cooler than the skin temperature, this can lead to significant
    405 ! differences between the effective temperature of this lowest layer
    406 ! and the true value in the model.
    407 !
    408 ! We may approximate the temperature profile in the lowest model level
    409 ! as piecewise linear between the top of the layer T[k-1/2], the
    410 ! centre of the layer T[k] and the base of the layer Tskin.  The mean
    411 ! temperature of the layer is then 0.25*T[k-1/2] + 0.5*T[k] +
    412 ! 0.25*Tskin, which can be achieved by setting the atmospheric
    413 ! temperature at the half-level corresponding to the surface as
    414 ! follows:
    415 !thermodynamics%temperature_hl(KIDIA:KFDIA,KLEV+1) &
    416 !     &  = PTEMPERATURE(KIDIA:KFDIA,KLEV) &
    417 !     &  + 0.5_JPRB * (PTEMPERATURE_H(KIDIA:KFDIA,KLEV+1) &
    418 !     &               -PTEMPERATURE_H(KIDIA:KFDIA,KLEV))
    419 
    420 ! Alternatively we respect the model's atmospheric temperature in the
    421 ! lowest model level by setting the temperature at the lowest
    422 ! half-level such that the mean temperature of the layer is correct:
    423 !thermodynamics%temperature_hl(KIDIA:KFDIA,KLEV+1) &
    424 !     &  = 2.0_JPRB * PTEMPERATURE(KIDIA:KFDIA,KLEV) &
    425 !     &             - PTEMPERATURE_H(KIDIA:KFDIA,KLEV)
    426 
     401!print*,'Compute saturation specific humidity'
    427402! Compute saturation specific humidity, used to hydrate aerosols. The
    428403! "2" for the last argument indicates that the routine is not being
    429404! called from within the convection scheme.
    430405!CALL SATUR(KIDIA, KFDIA, KLON, 1, KLEV, &
    431 !     &  PPRESSURE, PTEMPERATURE, thermodynamics%h2o_sat_liq, 2) 
     406!     &  PPRESSURE, PTEMPERATURE, thermodynamics%h2o_sat_liq, 2)
    432407! Alternative approximate version using temperature and pressure from
    433408! the thermodynamics structure
    434 print*,'Compute saturation specific humidity'
    435409CALL thermodynamics%calc_saturation_wrt_liquid(KIDIA, KFDIA)
    436410
     
    440414! Set single-level fileds
    441415single_level%solar_irradiance              = PSOLAR_IRRADIANCE
    442 !allocate(single_level%cos_sza(KIDIA:KFDIA))
    443416single_level%cos_sza(KIDIA:KFDIA)          = PMU0(KIDIA:KFDIA)
    444 !allocate(single_level%skin_temperature(KIDIA:KFDIA))
    445417single_level%skin_temperature(KIDIA:KFDIA) = PTEMPERATURE_SKIN(KIDIA:KFDIA)
    446 !allocate(single_level%sw_albedo(KIDIA:KFDIA,1))
    447418single_level%sw_albedo(KIDIA:KFDIA,:)      = PALBEDO_DIF(KIDIA:KFDIA,:)
    448 !single_level%sw_albedo(KIDIA:KFDIA,:)      = 0.2_JPRB
    449 !allocate(single_level%sw_albedo_direct(KIDIA:KFDIA,1))
    450419single_level%sw_albedo_direct(KIDIA:KFDIA,:)=PALBEDO_DIR(KIDIA:KFDIA,:)
    451 !single_level%sw_albedo_direct(KIDIA:KFDIA,:)=0.2_JPRB
    452 ! Longwave emissivity is in two bands
    453 !allocate(single_level%lw_emissivity(KIDIA:KFDIA,1))
    454 !single_level%lw_emissivity(KIDIA:KFDIA,1)  = 1.0_JPRB
    455420single_level%lw_emissivity(KIDIA:KFDIA,1)  = PEMIS(KIDIA:KFDIA)
    456421!single_level%lw_emissivity(KIDIA:KFDIA,2)  = PEMIS_WINDOW(KIDIA:KFDIA)
     
    480445
    481446print*,'********** CLOUDS (allocate + input) *******************************************'
    482 print*,'Appel Allocate clouds'
     447!print*,'Appel Allocate clouds'
    483448CALL cloud%allocate(KLON, KLEV)
    484449! Set cloud fields
     
    487452cloud%fraction(KIDIA:KFDIA,:) = PCLOUD_FRAC(KIDIA:KFDIA,:)
    488453
     454!AI ATTENTION a voir avec JL
    489455! Compute effective radii and convert to metres
    490456!CALL LIQUID_EFFECTIVE_RADIUS(KIDIA, KFDIA, KLON, KLEV, &
     
    506472!CALL CLOUD_OVERLAP_DECORR_LEN(KIDIA, KFDIA, KLON, PGEMU, YRERAD%NDECOLAT, &
    507473!     &    ZDECORR_LEN_KM, PDECORR_LEN_RATIO=ZDECORR_LEN_RATIO)
    508 ! AI ATTENTION a revoir
    509 ZDECORR_LEN_RATIO = 0.5_JPRB
    510 rad_config%cloud_inhom_decorr_scaling = ZDECORR_LEN_RATIO
     474
     475! AI ATTENTION (valeur lue dans namelist)
     476!ZDECORR_LEN_RATIO = 0.5_JPRB
     477!rad_config%cloud_inhom_decorr_scaling = ZDECORR_LEN_RATIO
     478!AI ATTENTION meme valeur que dans offline
    511479ZDECORR_LEN_KM = 2000.0_JPRB
    512480DO JLON = KIDIA,KFDIA
     
    520488! hard coded at 1.0.
    521489!CALL cloud%create_fractional_std(KLON, KLEV, YRERAD%RCLOUD_FRAC_STD)
     490! AI ATTENTION frac_std=0.75 meme valeur que dans la version offline
    522491CALL cloud%create_fractional_std(KLON, KLEV, frac_std)
    523492
     493! AI ! Read cloud properties needed by SPARTACUS
    524494! By default mid and high cloud effective size is 10 km
    525 CALL cloud%create_inv_cloud_effective_size(KLON,KLEV,1.0_JPRB/10000.0_JPRB)
     495!CALL cloud%create_inv_cloud_effective_size(KLON,KLEV,1.0_JPRB/10000.0_JPRB)
    526496! But for boundary clouds (eta > 0.8) we set it to 1 km
    527 DO JLEV = 1,KLEV
    528   DO JLON = KIDIA,KFDIA
    529     IF (PPRESSURE(JLON,JLEV) > 0.8_JPRB * PPRESSURE_H(JLON,KLEV+1)) THEN
    530       cloud%inv_cloud_effective_size(JLON,JLEV) = 1.0e-3_JPRB
    531     ENDIF
    532   ENDDO
    533 ENDDO
     497!DO JLEV = 1,KLEV
     498!  DO JLON = KIDIA,KFDIA
     499!    IF (PPRESSURE(JLON,JLEV) > 0.8_JPRB * PPRESSURE_H(JLON,KLEV+1)) THEN
     500!      cloud%inv_cloud_effective_size(JLON,JLEV) = 1.0e-3_JPRB
     501!    ENDIF
     502!  ENDDO
     503!ENDDO
    534504!AI ATTENTION meme traitement dans le version offline
    535 !call cloud%create_inv_cloud_effective_size_eta(ncol, nlev, &
    536 !               &  thermodynamics%pressure_hl, &
    537 !               &  low_inv_effective_size, &
    538 !               &  middle_inv_effective_size, &
    539 !               &  high_inv_effective_size, 0.8_jprb, 0.45_jprb)     
     505call cloud%create_inv_cloud_effective_size_eta(KLON, KLEV, &
     506               &  thermodynamics%pressure_hl, &
     507               &  0.005_JPRB, &
     508               &  0.0001_JPRB, &
     509               &  0.0001, 0.8_jprb, 0.45_jprb)     
    540510
    541511print*,'******** AEROSOLS (allocate + input) **************************************'
     
    596566
    597567print*,'********** GAS (allocate + input) ************************************************'
    598 print*,'Appel Allocate gas'
     568!print*,'Appel Allocate gas'
    599569CALL gas%allocate(KLON, KLEV)
    600570
     
    609579
    610580!  Insert gas mixing ratios
    611 print*,'Insert gas mixing ratios'
     581!print*,'Insert gas mixing ratios'
    612582CALL gas%put(IH2O,    IMassMixingRatio, PQ)
    613583CALL gas%put(IO3,     IMassMixingRatio, PO3)
    614 CALL gas%put_well_mixed(ICO2,    IVolumeMixingRatio, PCO2)
    615 CALL gas%put_well_mixed(ICH4,    IVolumeMixingRatio, PCH4)
    616 CALL gas%put_well_mixed(IN2O,    IVolumeMixingRatio, PN2O)
    617 CALL gas%put_well_mixed(ICFC11,  IVolumeMixingRatio, PCFC11)
    618 CALL gas%put_well_mixed(ICFC12,  IVolumeMixingRatio, PCFC12)
    619 CALL gas%put_well_mixed(IHCFC22, IVolumeMixingRatio, PHCFC22)
    620 CALL gas%put_well_mixed(ICCL4,   IVolumeMixingRatio, PCCL4)
    621 CALL gas%put_well_mixed(IO2,     IVolumeMixingRatio, PO2)
     584CALL gas%put_well_mixed(ICO2,    IMAssMixingRatio, PCO2)
     585CALL gas%put_well_mixed(ICH4,    IMassMixingRatio, PCH4)
     586CALL gas%put_well_mixed(IN2O,    IMassMixingRatio, PN2O)
     587CALL gas%put_well_mixed(ICFC11,  IMassMixingRatio, PCFC11)
     588CALL gas%put_well_mixed(ICFC12,  IMassMixingRatio, PCFC12)
     589CALL gas%put_well_mixed(IHCFC22, IMassMixingRatio, PHCFC22)
     590CALL gas%put_well_mixed(ICCL4,   IMassMixingRatio, PCCL4)
     591CALL gas%put_well_mixed(IO2,     IMassMixingRatio, PO2)
    622592! Ensure the units of the gas mixing ratios are what is required by
    623593! the gas absorption model
     
    675645! Compute UV fluxes as weighted sum of appropriate shortwave bands
    676646PFLUX_UV       (KIDIA:KFDIA) = 0.0_JPRB
    677 ! AI ATTENTION
    678 !DO JBAND = 1,NWEIGHT_UV
    679 !  PFLUX_UV(KIDIA:KFDIA) = PFLUX_UV(KIDIA:KFDIA) + WEIGHT_UV(JBAND) &
    680 !       &  * flux%sw_dn_surf_band(IBAND_UV(JBAND),KIDIA:KFDIA)
    681 !ENDDO
     647DO JBAND = 1,NWEIGHT_UV
     648  PFLUX_UV(KIDIA:KFDIA) = PFLUX_UV(KIDIA:KFDIA) + WEIGHT_UV(JBAND) &
     649       &  * flux%sw_dn_surf_band(IBAND_UV(JBAND),KIDIA:KFDIA)
     650ENDDO
    682651
    683652! Compute photosynthetically active radiation similarly
    684653PFLUX_PAR      (KIDIA:KFDIA) = 0.0_JPRB
    685654PFLUX_PAR_CLEAR(KIDIA:KFDIA) = 0.0_JPRB
    686 !AI ATTENTION
    687 !DO JBAND = 1,NWEIGHT_PAR
    688 !  PFLUX_PAR(KIDIA:KFDIA) = PFLUX_PAR(KIDIA:KFDIA) + WEIGHT_PAR(JBAND) &
    689 !       &  * flux%sw_dn_surf_band(IBAND_PAR(JBAND),KIDIA:KFDIA)
    690 !  PFLUX_PAR_CLEAR(KIDIA:KFDIA) = PFLUX_PAR_CLEAR(KIDIA:KFDIA) &
    691 !       &  + WEIGHT_PAR(JBAND) &
    692 !       &  * flux%sw_dn_surf_clear_band(IBAND_PAR(JBAND),KIDIA:KFDIA)
    693 !ENDDO
     655DO JBAND = 1,NWEIGHT_PAR
     656  PFLUX_PAR(KIDIA:KFDIA) = PFLUX_PAR(KIDIA:KFDIA) + WEIGHT_PAR(JBAND) &
     657       &  * flux%sw_dn_surf_band(IBAND_PAR(JBAND),KIDIA:KFDIA)
     658  PFLUX_PAR_CLEAR(KIDIA:KFDIA) = PFLUX_PAR_CLEAR(KIDIA:KFDIA) &
     659       &  + WEIGHT_PAR(JBAND) &
     660       &  * flux%sw_dn_surf_clear_band(IBAND_PAR(JBAND),KIDIA:KFDIA)
     661ENDDO
    694662
    695663! Compute effective broadband emissivity
     
    702670
    703671! Copy longwave derivatives
     672! AI ATTENTION
    704673!IF (YRERAD%LAPPROXLWUPDATE) THEN
    705674IF (rad_config%do_lw_derivatives) THEN
     
    708677
    709678! Store the shortwave downwelling fluxes in each albedo band
     679!AI ATTENTION
    710680!IF (YRERAD%LAPPROXSWUPDATE) THEN
    711681IF (rad_config%do_surface_sw_spectral_flux) THEN
Note: See TracChangeset for help on using the changeset viewer.