Ignore:
Timestamp:
Feb 7, 2023, 4:13:21 PM (21 months ago)
Author:
jleconte
Message:

condensation generic optimized

comm variables for generic tracer for WRFV4

deleted useless comments & prints

Location:
trunk/LMDZ.GENERIC/libf/phystd
Files:
3 edited

Legend:

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

    r2889 r2890  
    122122      enddo
    123123
    124       !!!!!!! methane rayleigh verification
    125       tauconsti(igas_CH4) = 24.*pi**3/(1E5/(1.380648813E-23*273.15))**2 * 4./9. * 1E24 * (1/( g *16.04*1.6726*1E-27))  * scalep
    126                      !* (4.6662E-4+4.02E-6/0.55**2)**2 / 0.55**4
    127 
    128       write(*,*) 'methane rayleigh verification', 24.*pi**3/(1E5/(1.380648813E-23*273.15))**2 * 4./9. * 1E24 * (1/( g *16.04*1.6726*1E-27))  &
    129                *  (4.6662E-4+4.02E-6/0.55**2)**2 / 0.55**4
    130      
    131       !!!!!!! methane rayleigh verification
    132 
    133124      if(.not.typeknown)then
    134125         print*,'Rayleigh scattering is for a mixed gas atmosphere.'
     
    214205         print*,'sig_R = ',TAURAY(icantbewrong)*g*mugaz*1.67e-27*100, &
    215206               'cm^2 molecule^-1'
    216          !!!!!!! methane rayleigh verification
    217          print*,'methane rayleigh verification : tau_R_CH4 = ',TAURAYVAR(icantbewrong)*1013.25
    218          !!!!!!! methane rayleigh verification
    219207      ENDIF
    220208
  • trunk/LMDZ.GENERIC/libf/phystd/condensation_generic_mod.F90

    r2725 r2890  
    5757        INTEGER i, k , nn, iq
    5858        INTEGER,PARAMETER :: nitermax=5000
    59         INTEGER,PARAMETER :: tau=14400.
     59        INTEGER,PARAMETER :: tau=86400 ! tau is in seconds and must not be lower than the physical step time.
    6060        DOUBLE PRECISION,PARAMETER :: alpha=.1,qthreshold=1.d-8
    6161        ! JL13: if "careful, T<Tmin in psat water" appears often, you may want to stabilise the model by
     
    7373
    7474        DOUBLE PRECISION zx_q(ngrid)
     75        DOUBLE PRECISION zy_q(ngrid)
    7576        LOGICAL,SAVE :: firstcall=.true.
    7677!$OMP THREADPRIVATE(firstcall)
     
    125126                                        endif
    126127                                        zx_q(i) = pq(i,k,igcm_generic_vap)+pdq(i,k,igcm_generic_vap)*ptimestep
    127                                         ! iterative process to stabilize the scheme when large water amounts JL12
    128                                         zcond(i) = 0.0d0
    129                                         Do nn=1,nitermax 
    130                                                 call Psat_generic(zt(i),local_p,metallicity,psat_tmp,zqs_temp)
    131                                                 zqs(i)=zqs_temp
    132                                                 call Lcpdqsat_generic(zt(i),local_p,psat_tmp,zqs_temp,zdqs,dlnpsat_tmp)
    133                                                 zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs)
    134                                                 !zcond can be negative here
    135                                                 zx_q(i) = zx_q(i) - zcond_iter
    136                                                 zcond(i) = zcond(i) + zcond_iter
    137                                                 zt(i) = zt(i) + zcond_iter*Lcp
    138                                                 if (ABS(zcond_iter/alpha/zqs(i)).lt.qthreshold) exit
    139                                                 if (nn.eq.nitermax) print*,'itermax in largescale'
    140                                         End do ! niter
    141                                         zcond(i)=MAX(zcond(i),-(pq(i,k,igcm_generic_ice)+pdq(i,k,igcm_generic_ice)*ptimestep))
     128
     129                                        call Psat_generic(zt(i),local_p,metallicity,psat_tmp,zqs_temp)
     130                                        zy_q(i) = pq(i,k,igcm_generic_ice)+pdq(i,k,igcm_generic_ice)*ptimestep
     131                                       
     132                                        if ((zx_q(i) .le. zqs_temp) .and. (zy_q(i) .eq. 0.)) then
     133                                                ! if we are are not saturated and if there is no ice
     134                                                ! then no change
     135
     136                                                zcond(i) = 0.0d0
     137                                       
     138                                        else    ! if we are saturated : we must evaporate
     139                                                ! if there is ice : we must check if we can condensate
     140
     141                                                ! iterative process to stabilize the scheme when large water amounts JL12
     142                                                zcond(i) = 0.0d0
     143                                                Do nn=1,nitermax 
     144                                                        call Psat_generic(zt(i),local_p,metallicity,psat_tmp,zqs_temp)
     145                                                        zqs(i)=zqs_temp
     146                                                        call Lcpdqsat_generic(zt(i),local_p,psat_tmp,zqs_temp,zdqs,dlnpsat_tmp)
     147                                                        zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs)
     148                                                        !zcond can be negative here
     149                                                        zx_q(i) = zx_q(i) - zcond_iter
     150                                                        zcond(i) = zcond(i) + zcond_iter
     151                                                        zt(i) = zt(i) + zcond_iter*Lcp
     152                                                        if (ABS(zcond_iter/alpha/zqs(i)).lt.qthreshold) exit
     153                                                        if (nn.eq.nitermax) print*,'itermax in largescale'
     154                                                End do ! niter
     155
     156                                                ! if zcond(i) > 0, zcond(i) is the amount of vapor that we can condensate
     157                                                !                       because we are saturated. zcond(i) will not change below
     158                                                ! if zcond(i) < 0, zcond(i) is the amount of ice that we can evaporate.
     159                                                !                       We can not evaporate more than the existing ice,
     160                                                !                       so the line below is to check how much we can evaporate.
     161                                                !                       If there is no ice available, zcond(i) will be 0. (first condidition of "if")
     162
     163                                                zcond(i)=MAX(zcond(i),-(pq(i,k,igcm_generic_ice)+pdq(i,k,igcm_generic_ice)*ptimestep))
     164                                       
     165                                        endif
    142166
    143167                                        if (zcond(i) .gt. 0.) then
     
    159183                        if (qvap_deep >= 0.) then
    160184                                !brings lower generic vapor ratio to a fixed value.
    161                                 ! tau=3600. seems too fast
     185                                ! tau is in seconds and must not be lower than the physical step time.
    162186                                pdqvaplsc(1:ngrid,1,igcm_generic_vap) = (qvap_deep - pq(1:ngrid,1,igcm_generic_vap))/tau - pdq(1:ngrid,1,igcm_generic_vap)
    163187                        endif
  • trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90

    r2875 r2890  
    300300      ! For Atmospheric Temperatures : (K/s)   
    301301      real dtlscale(ngrid,nlayer)                             ! Largescale routine.
    302       real dtlscale_generic(ngrid,nlayer)                     ! condensation_generic routine.
     302      real dt_generic_condensation(ngrid,nlayer)              ! condensation_generic routine.
    303303      real zdtc(ngrid,nlayer)                                 ! Condense_co2 routine.
    304304      real zdtdif(ngrid,nlayer)                               ! Turbdiff/vdifc routines.
     
    424424!$OMP THREADPRIVATE(metallicity)
    425425
     426      real reffrad_generic_zeros_for_wrf(ngrid,nlayer) !  !!! this is temporary, it is only a list of zeros, it will be replaced when a generic aerosol will be implemented
     427
    426428      logical clearsky ! For double radiative transfer call. By BC
    427429     
     
    955957
    956958                     endif
    957                end do ! do iq=1,nq loop on tracers
     959                  end do ! do iq=1,nq loop on tracers
    958960               ! take into account generic condensable specie (GCS) effect on mean molecular weight
    959961               
     
    16191621         if (generic_condensation) then
    16201622            call condensation_generic(ngrid,nlayer,nq,ptimestep,pplev,pplay,   &
    1621                                           pt,pq,pdt,pdq,dtlscale_generic, &
     1623                                          pt,pq,pdt,pdq,dt_generic_condensation, &
    16221624                                          dqvaplscale_generic,dqcldlscale_generic,rneb_generic)
    1623             pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtlscale_generic(1:ngrid,1:nlayer)
     1625            pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dt_generic_condensation(1:ngrid,1:nlayer)
    16241626            pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq)+dqvaplscale_generic(1:ngrid,1:nlayer,1:nq)
    16251627            pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq)+dqcldlscale_generic(1:ngrid,1:nlayer,1:nq)
     
    16271629            if(enertest)then
    16281630               do ig=1,ngrid
    1629                   genericconddE(ig) = cpp*SUM(mass(:,:)*dtlscale_generic(:,:))
     1631                  genericconddE(ig) = cpp*SUM(mass(:,:)*dt_generic_condensation(:,:))
    16301632               enddo
    16311633
    1632                call planetwide_sumval(cpp*massarea(:,:)*dtlscale_generic(:,:)/totarea_planet,dEtot)
     1634               call planetwide_sumval(cpp*massarea(:,:)*dt_generic_condensation(:,:)/totarea_planet,dEtot)
    16331635
    16341636               if (is_master) print*,'In generic condensation atmospheric energy change =',dEtot,' W m-2'
     
    24692471
    24702472            call writediagfi(ngrid,"genericconddE","heat from generic condensation","W m-2",2,genericconddE)
     2473            call writediagfi(ngrid,"dt_generic_condensation","heating from generic condensation","K s-1",3,dt_generic_condensation)
    24712474         
    24722475         endif
     
    25932596     comm_DTLSC(1:ngrid,1:nlayer)=dtlscale(1:ngrid,1:nlayer)
    25942597     comm_RH(1:ngrid,1:nlayer)=RH(1:ngrid,1:nlayer)
     2598
     2599   else if ((tracer).and.(generic_condensation).and.(.not. water)) then
     2600
     2601      ! If you have set generic_condensation (and not water) and you have set several GCS
     2602      ! then the outputs given to WRF will be only the ones for the last generic tracer
     2603      ! (Because it is rewritten every tracer in the loop)
     2604      ! WRF can take only one moist tracer
     2605
     2606      do iq=1,nq
     2607         call generic_tracer_index(nq,iq,igcm_generic_vap,igcm_generic_ice,call_ice_vap_generic)
     2608                 
     2609         if (call_ice_vap_generic) then ! to call only one time the ice/vap pair of a tracer
     2610
     2611            reffrad_generic_zeros_for_wrf(:,:) = 1.
     2612
     2613            comm_CLOUDFRAC(1:ngrid,1:nlayer) = cloudfrac(1:ngrid,1:nlayer)
     2614            comm_TOTCLOUDFRAC(1:ngrid) = totcloudfrac(1:ngrid) !??????
     2615            comm_SURFRAIN(1:ngrid) = zdqsrain_generic(1:ngrid,iq)
     2616            comm_DQVAP(1:ngrid,1:nlayer) = pdq(1:ngrid,1:nlayer,igcm_generic_vap)
     2617            comm_DQICE(1:ngrid,1:nlayer)=pdq(1:ngrid,1:nlayer,igcm_generic_ice)
     2618            comm_H2OICE_REFF(1:ngrid,1:nlayer) = reffrad_generic_zeros_for_wrf(1:ngrid,1:nlayer) ! for now zeros !
     2619            !comm_H2OICE_REFF(1:ngrid,1:nlayer) = 0*zdtrain_generic(1:ngrid,1:nlayer) ! for now zeros !
     2620            comm_REEVAP(1:ngrid) = reevap_precip_generic(1:ngrid,iq)
     2621            comm_DTRAIN(1:ngrid,1:nlayer) = zdtrain_generic(1:ngrid,1:nlayer)
     2622            comm_DTLSC(1:ngrid,1:nlayer) = dt_generic_condensation(1:ngrid,1:nlayer)
     2623            comm_RH(1:ngrid,1:nlayer) = RH_generic(1:ngrid,1:nlayer,iq)
     2624
     2625         endif
     2626      end do ! do iq=1,nq loop on tracers
     2627
    25952628   else
    25962629      comm_CLOUDFRAC(1:ngrid,1:nlayer)=0.
     
    26042637      comm_DTLSC(1:ngrid,1:nlayer)=0.
    26052638      comm_RH(1:ngrid,1:nlayer)=0.
    2606    endif
     2639
     2640   endif ! if water, if generic_condensation, else
     2641
    26072642   comm_FLUXTOP_DN(1:ngrid)=fluxtop_dn(1:ngrid)
    26082643   comm_FLUXABS_SW(1:ngrid)=fluxabs_sw(1:ngrid)
Note: See TracChangeset for help on using the changeset viewer.