[2060] | 1 | ! |
---|
| 2 | ! |
---|
| 3 | ! |
---|
[2127] | 4 | SUBROUTINE thermcell_dq(ngrid,nlay,ptimestep,fm,entr,detr,masse, & |
---|
| 5 | q,dq,qa,lmin) |
---|
[2060] | 6 | |
---|
| 7 | |
---|
[2127] | 8 | !=============================================================================== |
---|
| 9 | ! Purpose: Calcul du transport verticale dans la couche limite en presence de |
---|
| 10 | ! "thermiques" explicitement representes |
---|
| 11 | ! Calcul du dq/dt une fois qu'on connait les ascendances |
---|
| 12 | ! |
---|
[2060] | 13 | ! Modif 2013/01/04 (FH hourdin@lmd.jussieu.fr) |
---|
[2127] | 14 | ! Introduction of an implicit computation of vertical advection in the environ- |
---|
| 15 | ! ment of thermal plumes in thermcell_dq |
---|
[2060] | 16 | ! |
---|
[2127] | 17 | ! Modif 2019/04 (AB alexandre.boissinot@lmd.jussieu.fr) |
---|
| 18 | ! dqimpl = 1 : implicit scheme |
---|
| 19 | ! dqimpl = 0 : explicit scheme |
---|
| 20 | ! |
---|
| 21 | !=============================================================================== |
---|
[2060] | 22 | |
---|
[2102] | 23 | USE print_control_mod, ONLY: prt_level |
---|
[2127] | 24 | USe thermcell_mod, ONLY: dqimpl |
---|
[2102] | 25 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | |
---|
| 28 | |
---|
[2127] | 29 | !=============================================================================== |
---|
[2060] | 30 | ! Declaration |
---|
[2127] | 31 | !=============================================================================== |
---|
[2060] | 32 | |
---|
[2127] | 33 | ! Inputs: |
---|
| 34 | ! ------- |
---|
[2060] | 35 | |
---|
[2102] | 36 | INTEGER ngrid, nlay |
---|
[2060] | 37 | INTEGER lmin(ngrid) |
---|
| 38 | |
---|
| 39 | REAL ptimestep |
---|
[2102] | 40 | REAL masse(ngrid,nlay) |
---|
| 41 | REAL fm(ngrid,nlay+1) |
---|
[2060] | 42 | REAL entr(ngrid,nlay) |
---|
[2102] | 43 | REAL detr(ngrid,nlay) |
---|
[2060] | 44 | REAL q(ngrid,nlay) |
---|
| 45 | |
---|
[2127] | 46 | ! Outputs: |
---|
| 47 | ! -------- |
---|
[2060] | 48 | |
---|
| 49 | REAL dq(ngrid,nlay) |
---|
[2127] | 50 | REAL qa(ngrid,nlay) |
---|
[2060] | 51 | |
---|
[2127] | 52 | ! Local: |
---|
| 53 | ! ------ |
---|
[2060] | 54 | |
---|
[2143] | 55 | INTEGER ig, l, k |
---|
[2102] | 56 | INTEGER niter, iter |
---|
[2060] | 57 | |
---|
| 58 | REAL cfl |
---|
[2102] | 59 | REAL qold(ngrid,nlay) |
---|
| 60 | REAL fqa(ngrid,nlay+1) |
---|
[2060] | 61 | REAL zzm |
---|
| 62 | |
---|
[2127] | 63 | !=============================================================================== |
---|
[2060] | 64 | ! Initialization |
---|
[2127] | 65 | !=============================================================================== |
---|
[2060] | 66 | |
---|
[2127] | 67 | qold(:,:) = q(:,:) |
---|
[2060] | 68 | |
---|
[2127] | 69 | !=============================================================================== |
---|
| 70 | ! Tracer variation computation |
---|
| 71 | !=============================================================================== |
---|
[2060] | 72 | |
---|
[2127] | 73 | !------------------------------------------------------------------------------- |
---|
[2102] | 74 | ! CFL criterion computation for advection in downdraft |
---|
[2127] | 75 | !------------------------------------------------------------------------------- |
---|
[2060] | 76 | |
---|
| 77 | cfl = 0. |
---|
| 78 | |
---|
[2102] | 79 | DO l=1,nlay |
---|
[2060] | 80 | DO ig=1,ngrid |
---|
[2102] | 81 | zzm = masse(ig,l) / ptimestep |
---|
| 82 | cfl = max(cfl, fm(ig,l) / zzm) |
---|
[2060] | 83 | |
---|
[2102] | 84 | IF (entr(ig,l).gt.zzm) THEN |
---|
[2060] | 85 | print *, 'ERROR: entrainment is greater than the layer mass!' |
---|
[2102] | 86 | print *, 'ig,l,entr', ig, l, entr(ig,l) |
---|
[2143] | 87 | print *, 'lmin', lmin(ig) |
---|
[2102] | 88 | print *, '-------------------------------' |
---|
| 89 | print *, 'entr*dt,mass', entr(ig,l)*ptimestep, masse(ig,l) |
---|
| 90 | print *, '-------------------------------' |
---|
[2143] | 91 | DO k=nlay,1,-1 |
---|
| 92 | print *, 'fm ', fm(ig,k+1) |
---|
| 93 | print *, 'entr,detr', entr(ig,k), detr(ig,k) |
---|
| 94 | ENDDO |
---|
| 95 | print *, 'fm ', fm(ig,1) |
---|
| 96 | print *, '-------------------------------' |
---|
[2127] | 97 | CALL abort |
---|
[2060] | 98 | ENDIF |
---|
| 99 | ENDDO |
---|
| 100 | ENDDO |
---|
| 101 | |
---|
[2127] | 102 | !------------------------------------------------------------------------------- |
---|
[2060] | 103 | ! Computation of tracer concentrations in the ascending plume |
---|
[2127] | 104 | !------------------------------------------------------------------------------- |
---|
[2060] | 105 | |
---|
| 106 | DO ig=1,ngrid |
---|
[2102] | 107 | DO l=1,lmin(ig) |
---|
| 108 | qa(ig,l) = q(ig,l) |
---|
[2060] | 109 | ENDDO |
---|
| 110 | ENDDO |
---|
| 111 | |
---|
| 112 | DO ig=1,ngrid |
---|
[2102] | 113 | DO l=lmin(ig)+1,nlay |
---|
[2127] | 114 | IF ((fm(ig,l+1)+detr(ig,l))*ptimestep.gt.1.e-6*masse(ig,l)) THEN |
---|
[2102] | 115 | qa(ig,l) = (fm(ig,l) * qa(ig,l-1) + entr(ig,l) * q(ig,l)) & |
---|
| 116 | & / (fm(ig,l+1) + detr(ig,l)) |
---|
[2127] | 117 | ELSE |
---|
[2102] | 118 | qa(ig,l) = q(ig,l) |
---|
[2127] | 119 | ENDIF |
---|
[2060] | 120 | ENDDO |
---|
| 121 | ENDDO |
---|
| 122 | |
---|
[2127] | 123 | !------------------------------------------------------------------------------- |
---|
| 124 | ! Plume vertical flux of tracer |
---|
| 125 | !------------------------------------------------------------------------------- |
---|
[2060] | 126 | |
---|
[2102] | 127 | DO l=2,nlay-1 |
---|
| 128 | fqa(:,l) = fm(:,l) * qa(:,l-1) |
---|
[2060] | 129 | ENDDO |
---|
| 130 | |
---|
| 131 | fqa(:,1) = 0. |
---|
| 132 | fqa(:,nlay) = 0. |
---|
| 133 | |
---|
[2127] | 134 | !------------------------------------------------------------------------------- |
---|
[2060] | 135 | ! Trace species evolution |
---|
[2127] | 136 | !------------------------------------------------------------------------------- |
---|
[2060] | 137 | |
---|
[2144] | 138 | IF (dqimpl) THEN |
---|
[2127] | 139 | DO l=nlay-1,1,-1 |
---|
[2102] | 140 | q(:,l) = ( q(:,l) + ptimestep / masse(:,l) & |
---|
| 141 | & * ( fqa(:,l) - fqa(:,l+1) + fm(:,l+1) * q(:,l+1) ) ) & |
---|
| 142 | & / ( 1. + fm(:,l) * ptimestep / masse(:,l) ) |
---|
[2060] | 143 | ENDDO |
---|
[2127] | 144 | ELSE |
---|
[2144] | 145 | DO l=1,nlay-1 |
---|
| 146 | q(:,l) = q(:,l) + (fqa(:,l) - fqa(:,l+1) - fm(:,l) * q(:,l) & |
---|
| 147 | & + fm(:,l+1) * q(:,l+1)) * ptimestep / masse(:,l) |
---|
| 148 | ENDDO |
---|
[2060] | 149 | ENDIF |
---|
| 150 | |
---|
[2127] | 151 | !=============================================================================== |
---|
[2060] | 152 | ! Tendencies |
---|
[2127] | 153 | !=============================================================================== |
---|
[2060] | 154 | |
---|
[2102] | 155 | DO l=1,nlay |
---|
[2060] | 156 | DO ig=1,ngrid |
---|
[2102] | 157 | dq(ig,l) = (q(ig,l) - qold(ig,l)) / ptimestep |
---|
| 158 | q(ig,l) = qold(ig,l) |
---|
[2060] | 159 | ENDDO |
---|
| 160 | ENDDO |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | RETURN |
---|
| 164 | END |
---|