Changeset 2720 for trunk/LMDZ.GENERIC


Ignore:
Timestamp:
Jun 21, 2022, 11:05:44 AM (3 years ago)
Author:
aslmd
Message:

new module to get back indexes of cond tracers

Location:
trunk/LMDZ.GENERIC/libf/phystd
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/condensation_generic_mod.F90

    r2717 r2720  
    1010        USE tracer_h
    1111        USE mod_phys_lmdz_para, only: is_master
     12        use generic_tracer_index_mod, only: generic_tracer_index
    1213        IMPLICIT none
    1314
     
    4546!       Options :
    4647        real, save :: metallicity !metallicity of planet
    47 !$OMP THREADPRIVATE(metallicity)
     48        REAL, SAVE :: qvap_deep   ! deep mixing ratio of water vapor when simulating bottom less planets
     49!$OMP THREADPRIVATE(metallicity, qvap_deep)
    4850
    4951!       Local variables
     52
     53        ! to call only one time the ice/vap pair of a tracer
     54        logical one_call_ice_vap_generic
     55
    5056        INTEGER i, k , nn, iq
    5157        INTEGER,PARAMETER :: nitermax=5000
     58        INTEGER,PARAMETER :: tau=14400.
    5259        DOUBLE PRECISION,PARAMETER :: alpha=.1,qthreshold=1.d-8
    5360        ! JL13: if "careful, T<Tmin in psat water" appears often, you may want to stabilise the model by
     
    7279                call getin_p("metallicity",metallicity)
    7380                write(*,*) " metallicity = ",metallicity
     81
     82                write(*,*) "Deep water vapor mixing ratio ? (no effect if negative) "
     83                qvap_deep=-1. ! default value
     84                call getin_p("qvap_deep",qvap_deep)
     85                write(*,*) " qvap_deep = ",qvap_deep   
     86
    7487                firstcall = .false.
    7588        ENDIF
     
    8497        ! Let's loop on tracers
    8598        do iq=1,nq
    86                 if((is_condensable(iq)==1) .and. (index(noms(iq),"vap") .ne. 0)) then
    87                         if (is_master) then
    88                                 write(*,*) "There is a specie which is condensable, for generic condensation : ", noms(iq)
    89                         endif
    90 !                       Let's get the index of our tracers (we look for igcm _generic_vap and igcm_generic_ice)
    91                         igcm_generic_vap=iq
    92                         igcm_generic_ice = -1
     99                one_call_ice_vap_generic = .false.
    93100
    94                         ! We look for the corresponding ice traceur (before or after in the list of traceurs, maybe could be generalised to the whole list)
    95                         if (iq .ne. nq) then
    96                                 if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq+1)(1:len(trim(noms(iq+1)))-4)) .and. (index(noms(iq+1),"ice") .ne. 0)) then
    97                                         igcm_generic_ice = iq+1
    98                                 end if
    99                         end if
    100                         if ((iq .gt. 1)) then
    101                                 if ((noms(iq)(1:len(trim(noms(iq)))-4) .eq. noms(iq-1)(1:len(trim(noms(iq-1)))-4)) .and. (index(noms(iq-1),"ice") .ne. 0)) then
    102                                         igcm_generic_ice = iq-1
    103                                 end if
    104                         end if
    105                         if (igcm_generic_ice .eq. -1) then
    106                                 write(*,*) "ERROR : You set a vap traceur but you forgot to set the corresponding ice traceur, &
    107                                 or the pair vap/ice is not written one after another in traceur.def"
    108                         endif
     101                call generic_tracer_index(nq,iq,igcm_generic_vap,igcm_generic_ice,one_call_ice_vap_generic)
    109102
     103                if(one_call_ice_vap_generic) then ! to call only one time the ice/vap pair of a tracer
    110104                        m=constants_mass(iq)
    111105                        delta_vapH=constants_delta_vapH(iq)
     
    154148
    155149                        Enddo ! k= nlayer, 1, -1
    156                 endif !(is_condensable(iq)==1) .and. (index(noms(iq),"vap") .ne. 0))
     150
     151                        if (qvap_deep >= 0.) then
     152                                !brings lower generic vapor ratio to a fixed value.
     153                                ! tau=3600. seems too fast
     154                                pdqvaplsc(1:ngrid,1,igcm_generic_vap) = (qvap_deep - pq(1:ngrid,1,igcm_generic_vap))/tau - pdq(1:ngrid,1,igcm_generic_vap)
     155                        endif
     156                endif !if(one_call_ice_vap_generic)
    157157        enddo ! iq=1,nq
    158158
Note: See TracChangeset for help on using the changeset viewer.