Ignore:
Timestamp:
Mar 20, 2024, 4:29:25 PM (7 months ago)
Author:
jleconte
Message:

new flag align_strato_cold_trap (Noe C)

File:
1 edited

Legend:

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

    r3103 r3280  
    4949        REAL, SAVE :: qvap_deep   ! deep mixing ratio of vapor when simulating bottom less planets
    5050        REAL, SAVE :: qvap_top   ! top mixing ratio of vapor when simulating bottom less planets
    51         logical, save :: perfect_vap_profile
    52 !$OMP THREADPRIVATE(metallicity, qvap_deep, qvap_top, perfect_vap_profile)
     51        logical, save :: align_strato_cold_trap
     52!$OMP THREADPRIVATE(metallicity, qvap_deep, qvap_top, align_strato_cold_trap)
    5353
    5454!       Local variables
     
    6868        DOUBLE PRECISION zqs(ngrid)
    6969        real zt(ngrid),local_p,psat_tmp,dlnpsat_tmp,Lcp,zqs_temp,zdqs
    70         real zqs_temp_1, zqs_temp_2, zqs_temp_3
    71         integer igcm_generic_vap, igcm_generic_ice! index of the vap and ice of generic_tracer
    72         ! CHARACTER(len=*) :: tname_ice
     70        real zqs_temp_1, zqs_temp_2
     71        integer igcm_generic_vap, igcm_generic_ice ! index of the vap and ice of generic_tracer
    7372        ! evaporation calculations
    7473        REAL dqevap(ngrid,nlayer),dtevap(ngrid,nlayer)     
     
    9594                call getin_p("qvap_top",qvap_top)
    9695                write(*,*) " qvap_top = ",qvap_top
    97                
    98                 write(*,*) " perfect_vap_profile ? "
    99                 perfect_vap_profile=.false. ! default value
    100                 call getin_p("perfect_vap_profile",perfect_vap_profile)
    101                 write(*,*) " perfect_vap_profile = ",perfect_vap_profile
     96
     97                write(*,*) " align_strato_cold_trap ? "
     98                align_strato_cold_trap=.false. ! default value
     99                call getin_p("align_strato_cold_trap",align_strato_cold_trap)
     100                write(*,*) " align_strato_cold_trap = ",align_strato_cold_trap
    102101
    103102                firstcall = .false.
     
    195194                        Enddo ! k= nlayer, 1, -1
    196195
    197                         if ((perfect_vap_profile) .and. (ngrid.eq.1)) then
    198                                 ! perfect_vap_profile is a mode that should a priori only be used in 1D:
    199                                 ! as it is written below, it aims to force the vap profile:
    200                                 ! - below condensation, it is forced to qvap_deep
    201                                 ! - at condensation levels, it is forced to 99% of sat
    202                                 ! - above the cold trap, it is forced to the value allowed by the cold trap
    203 
    204                                 ! perfect_vap_profile can be customed as you want
    205                                
    206                                 tau = 10. * ptimestep ! tau must not be lower than the physical step time.
    207 
    208                                 k_cold_trap = 2
     196                        if (align_strato_cold_trap .and. (ngrid.eq.1)) then
     197                                ! aligns GCS vapor in the stratosphere to the quantity fixed by the cold trap
     198                                ! works only in 1D
     199                                tau = 10. * ptimestep
     200                                ! tau is in seconds and must not be lower than the physical step time.
     201
     202                                ! Look for the cold trap
     203                                k_cold_trap = 1 ! initialization of cold trap layer
     204                                zqs_temp_2  = 1 ! initialization of minimum of saturation
    209205                                do k=2,nlayer-1
    210 
    211                                         zt(1)=pt(1,k-1)+pdt(1,k-1)*ptimestep
    212                                         call Psat_generic(zt(1),pplay(1,k-1),metallicity,psat_tmp,zqs_temp_1)
    213                                         zt(1)=pt(1,k)+pdt(1,k)*ptimestep
    214                                         call Psat_generic(zt(1),pplay(1,k),metallicity,psat_tmp,zqs_temp_2)
    215                                         zt(1)=pt(1,k+1)+pdt(1,k+1)*ptimestep
    216                                         call Psat_generic(zt(1),pplay(1,k+1),metallicity,psat_tmp,zqs_temp_3)
    217 
    218                                         if ((zqs_temp_1 .gt. zqs_temp_2) .and. (zqs_temp_3 .gt. zqs_temp_2)) then
     206                                        zt(1) = pt(1,k)+pdt(1,k)*ptimestep
     207                                        call Psat_generic(zt(1),pplay(1,k),metallicity,psat_tmp,zqs_temp_1)
     208                                        if (zqs_temp_1 .lt. zqs_temp_2) then
    219209                                                k_cold_trap = k
    220                                                 exit
     210                                                zqs_temp_2 = zqs_temp_1
    221211                                        endif
    222212                                enddo
    223                                 if (k_cold_trap .lt. nlayer) then
    224                                         do k=k_cold_trap+1,nlayer
    225                                                 pdqvaplsc(1,k,igcm_generic_vap) = (pq(1,k_cold_trap,igcm_generic_vap) - pq(1,k,igcm_generic_vap))/tau - pdq(1,k,igcm_generic_vap)
    226                                         enddo
    227                                 endif
    228 
    229                                 do k=1,k_cold_trap
    230                                         zt(1)=pt(1,k)+pdt(1,k)*ptimestep
    231                                         call Psat_generic(zt(1),pplay(1,k),metallicity,psat_tmp,zqs_temp)
    232                                         if (zqs_temp .gt. qvap_deep) then
    233                                                 pdqvaplsc(1,k,igcm_generic_vap)  = (qvap_deep - pq(1,k,igcm_generic_vap))/tau - pdq(1,k,igcm_generic_vap)
    234                                         endif
    235                                         if (zqs_temp .lt. qvap_deep) then
    236                                                 pdqvaplsc(1,k,igcm_generic_vap)  = (0.99*zqs_temp - pq(1,k,igcm_generic_vap))/tau - pdq(1,k,igcm_generic_vap)
    237                                         endif
     213
     214                                ! aligning
     215                                do k=k_cold_trap,nlayer
     216                                        pdqvaplsc(1,k,igcm_generic_vap) = (zqs_temp_2 - pq(1,k,igcm_generic_vap))/tau - pdq(1,k,igcm_generic_vap)
     217                                        pdtlsc(1,k) = 0.
    238218                                enddo
    239 
    240                                 pdqliqlsc(1:ngrid,:,igcm_generic_ice) = 0.
    241                                 pdtlsc(1:ngrid,:)  = 0.
    242219                        endif
    243 
     220                       
    244221                        if (qvap_deep >= 0.) then
    245                                 tau = 10. * ptimestep ! tau must not be lower than the physical step time.
     222                                tau = 10. * ptimestep
    246223                                ! brings lower generic vapor ratio to a fixed value.
    247224                                ! tau is in seconds and must not be lower than the physical step time.
    248225                                pdqvaplsc(1:ngrid,1,igcm_generic_vap) = (qvap_deep - pq(1:ngrid,1,igcm_generic_vap))/tau - pdq(1:ngrid,1,igcm_generic_vap)
    249226                        endif
     227
    250228                        if (qvap_top >= 0.) then
    251                                 tau = 10. * ptimestep ! tau must not be lower than the physical step time.
     229                                tau = 10. * ptimestep
    252230                                ! brings lower generic vapor ratio to a fixed value.
    253231                                ! tau is in seconds and must not be lower than the physical step time.
    254232                                pdqvaplsc(1:ngrid,nlayer,igcm_generic_vap) = (qvap_top - pq(1:ngrid,nlayer,igcm_generic_vap))/tau - pdq(1:ngrid,nlayer,igcm_generic_vap)
    255233                        endif
     234                       
    256235                endif !if(call_ice_vap_generic)
    257236        enddo ! iq=1,nq
Note: See TracChangeset for help on using the changeset viewer.