subroutine inimufi(ptimestep) use callkeys_mod, only : call_haze_prod_pCH4, haze_p_prod, haze_tx_prod, haze_rc_prod, & haze_rm, haze_df, haze_rho, air_rad, & callmuclouds use tracer_h use comcstfi_mod, only : g, rad, mugaz use datafile_mod ! Microphysical model MP2M use mp2m_intgcm implicit none !============================================================================ ! ! Purpose ! ------- ! This routine call mm_initialize which perform the global initialization ! for the microphysical YAMMS model. ! It also performs some sanity checks on microphysical tracer names. ! ! Authors ! ------- ! B. de Batz de Trenquelléon (11/2024) ! !============================================================================ !---------------- ! 0. Declarations !---------------- integer :: i,idx real, intent(in) :: ptimestep ! Timestep (s) character(len=30), dimension(4), parameter :: aernames = & (/"mu_m0as ", "mu_m3as ", & "mu_m0af ", "mu_m3af "/) CHARACTER(len=30), DIMENSION(2), PARAMETER :: ccnnames = & (/"mu_m0ccn ", "mu_m3ccn "/) logical :: err !-------------------------- ! 1. Check names of tracers !-------------------------- err = .false. DO i=1,size(aernames) idx = indexOfTracer(TRIM(aernames(i)),.false.) IF (idx <= 0) THEN WRITE(*,*) "inimufi: '"//TRIM(aernames(i))//"' not found in tracers table." err = .true. ENDIF ENDDO IF (callmuclouds) THEN DO i=1,size(ccnnames) idx = indexOfTracer(TRIM(ccnnames(i)),.false.) IF (idx <= 0) THEN WRITE(*,*) "inimufi: '"//TRIM(ccnnames(i))//"' not found in tracers table." err = .true. ENDIF ENDDO ENDIF IF (err) THEN WRITE(*,*) "You loose in inimufi.F90.... Try again" STOP ENDIF !-------------------------------------------------- ! 2. Call microphysical model global initialization !-------------------------------------------------- ! /!\ mugaz [g/mol] --> [kg/mol] !! call mm_initialize(ptimestep,call_haze_prod_pCH4,haze_p_prod,haze_tx_prod,haze_rc_prod, & haze_rm,haze_df,haze_rho,rad,g,air_rad,mugaz*1e-3, & callmuclouds,config_mufi) !----------------- ! 3. Sanity checks !----------------- ! Haze model initialization ! ------------------------- write(*,*) 'Number of microphysical tracer nmicro = ',nmicro call dumptracers(micro_indx) ! Cloud model initialization ! -------------------------- if (callmuclouds) then do i = 1, nmicro_ices ! Setup micro_ice_indx: idx = indexOfTracer("mu_m3"//TRIM(mm_spcname(i)),.false.) if (idx <= 0) then write(*,*) "inimufi: 'mu_m3"//TRIM(mm_spcname(i))//"' not found in tracers table." err = .true. else micro_ice_indx(i) = idx endif ! Setup micro_gas_indx: idx = indexOfTracer(TRIM(mm_spcname(i))//"_mugas",.false.) if (idx <= 0) then write(*,*) "inimufi: '"//TRIM(mm_spcname(i))//"' not found in tracers table." err = .true. else micro_gas_indx(i) = idx endif enddo ! Check for errors if (err) then write(*,*) "Error in inimufi: tracer not found in table!" STOP endif if (nmicro_ices.ne.mm_nesp) then write(*,*) "Error in inimufi: nmicro_ices not equal to mm_nesp!" STOP endif write(*,*) 'Number of microphysical ice tracer nmicro_ices = ',nmicro_ices write(*,*) 'Ices:' call dumptracers(micro_ice_indx) write(*,*) 'Condensable gases:' call dumptracers(micro_gas_indx) endif ! end of callmuclouds end subroutine inimufi