module condensation_generic_mod implicit none contains subroutine condensation_generic(ngrid,nlayer,nq,ptimestep, pplev, pplay, & pt, pq, pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb) use ioipsl_getin_p_mod, only: getin_p !-> to get the metallicity use generic_cloud_common_h USE tracer_h USE mod_phys_lmdz_para, only: is_master use generic_tracer_index_mod, only: generic_tracer_index IMPLICIT none !======================================================================= ! ! Purpose ! ------- ! Calculates large-scale condensation of generic tracer "tname". ! By convention, tname ends with the suffix "_gas", as it represents the ! gas phase of the generic tracer ! ! Authors ! ------- ! Adapted from largescale.F90 by Lucas Teinturier & Noé Clément (2022) ! largescale.F90 adapted from the LMDTERRE code by R. Wordsworth (2009) ! Original author Z. X. Li (1993) ! !========================================================================= INTEGER, intent(in) :: ngrid,nlayer,nq ! Arguments REAL, intent(in) :: ptimestep ! intervalle du temps (s) REAL, intent(in) :: pplev(ngrid,nlayer+1) ! pression a inter-couche REAL, intent(in) :: pplay(ngrid,nlayer) ! pression au milieu de couche REAL, intent(in) :: pt(ngrid,nlayer) ! temperature (K) REAL, intent(in) :: pq(ngrid,nlayer,nq) ! tracer mixing ratio (kg/kg) REAL, intent(in) :: pdt(ngrid,nlayer) ! physical temperature tendency (K/s) REAL, intent(in) :: pdq(ngrid,nlayer,nq) ! physical tracer tendency (K/s) ! CHARACTER(*), intent(in) :: tname_gas ! name of the tracer we consider. BY convention, it ends with _gas !!! REAL, intent(out) :: pdtlsc(ngrid,nlayer) ! incrementation de la temperature (K) REAL, intent(out) :: pdqvaplsc(ngrid,nlayer,nq) ! incrementation de la vapeur du traceur REAL, intent(out) :: pdqliqlsc(ngrid,nlayer,nq) ! incrementation du traceur liquide REAL, intent(out) :: rneb(ngrid,nlayer,nq) ! fraction nuageuse ! Options : real, save :: metallicity !metallicity of planet REAL, SAVE :: qvap_deep ! deep mixing ratio of vapor when simulating bottom less planets REAL, SAVE :: qvap_top ! top mixing ratio of vapor when simulating bottom less planets logical, save :: perfect_gas_profile !$OMP THREADPRIVATE(metallicity, qvap_deep, qvap_top, perfect_gas_profile) ! Local variables ! to call only one time the ice/vap pair of a tracer logical call_ice_gas_generic INTEGER i, k , nn, iq INTEGER,PARAMETER :: nitermax=5000 REAL tau ! tau is in seconds and must not be lower than the physical step time. integer k_cold_trap DOUBLE PRECISION,PARAMETER :: alpha=.1,qthreshold=1.d-8 ! JL13: if "careful, T= 0.) then tau = 10. * ptimestep ! tau must not be lower than the physical step time. ! brings lower generic vapor ratio to a fixed value. ! tau is in seconds and must not be lower than the physical step time. pdqvaplsc(1:ngrid,1,igcm_generic_gas) = (qvap_deep - pq(1:ngrid,1,igcm_generic_gas))/tau - pdq(1:ngrid,1,igcm_generic_gas) endif if (qvap_top >= 0.) then tau = 10. * ptimestep ! tau must not be lower than the physical step time. ! brings lower generic vapor ratio to a fixed value. ! tau is in seconds and must not be lower than the physical step time. pdqvaplsc(1:ngrid,nlayer,igcm_generic_gas) = (qvap_top - pq(1:ngrid,nlayer,igcm_generic_gas))/tau - pdq(1:ngrid,nlayer,igcm_generic_gas) endif endif !if(call_ice_gas_generic) enddo ! iq=1,nq end subroutine condensation_generic end module condensation_generic_mod