[2060] | 1 | ! |
---|
| 2 | ! |
---|
| 3 | ! |
---|
[2127] | 4 | SUBROUTINE thermcell_dq(ngrid,nlay,ptimestep,fm,entr,detr,masse, & |
---|
[2229] | 5 | q,dq,qa) |
---|
[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) |
---|
[2177] | 18 | ! dqimpl = true : implicit scheme |
---|
| 19 | ! dqimpl = false : explicit scheme |
---|
[2127] | 20 | ! |
---|
| 21 | !=============================================================================== |
---|
[2060] | 22 | |
---|
[2102] | 23 | USE print_control_mod, ONLY: prt_level |
---|
[2229] | 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 | |
---|
[2177] | 36 | INTEGER, INTENT(in) :: ngrid |
---|
| 37 | INTEGER, INTENT(in) :: nlay |
---|
[2060] | 38 | |
---|
[2177] | 39 | REAL, INTENT(in) :: ptimestep |
---|
| 40 | REAL, INTENT(in) :: masse(ngrid,nlay) |
---|
| 41 | REAL, INTENT(in) :: fm(ngrid,nlay+1) |
---|
| 42 | REAL, INTENT(in) :: entr(ngrid,nlay) |
---|
| 43 | REAL, INTENT(in) :: detr(ngrid,nlay) |
---|
[2060] | 44 | |
---|
[2127] | 45 | ! Outputs: |
---|
| 46 | ! -------- |
---|
[2060] | 47 | |
---|
[2177] | 48 | REAL, INTENT(inout) :: q(ngrid,nlay) |
---|
| 49 | REAL, INTENT(out) :: dq(ngrid,nlay) |
---|
| 50 | REAL, INTENT(out) :: 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 | |
---|
[2177] | 84 | IF (entr(ig,l) > zzm) THEN |
---|
[2060] | 85 | print *, 'ERROR: entrainment is greater than the layer mass!' |
---|
[2102] | 86 | print *, 'ig,l,entr', ig, l, entr(ig,l) |
---|
| 87 | print *, '-------------------------------' |
---|
| 88 | print *, 'entr*dt,mass', entr(ig,l)*ptimestep, masse(ig,l) |
---|
| 89 | print *, '-------------------------------' |
---|
[2143] | 90 | DO k=nlay,1,-1 |
---|
| 91 | print *, 'fm ', fm(ig,k+1) |
---|
| 92 | print *, 'entr,detr', entr(ig,k), detr(ig,k) |
---|
| 93 | ENDDO |
---|
| 94 | print *, 'fm ', fm(ig,1) |
---|
| 95 | print *, '-------------------------------' |
---|
[2127] | 96 | CALL abort |
---|
[2060] | 97 | ENDIF |
---|
| 98 | ENDDO |
---|
| 99 | ENDDO |
---|
| 100 | |
---|
[2127] | 101 | !------------------------------------------------------------------------------- |
---|
[2060] | 102 | ! Computation of tracer concentrations in the ascending plume |
---|
[2127] | 103 | !------------------------------------------------------------------------------- |
---|
[2060] | 104 | |
---|
| 105 | DO ig=1,ngrid |
---|
[2229] | 106 | DO l=1,nlay |
---|
| 107 | IF ((fm(ig,l+1)+detr(ig,l))*ptimestep > 1.e-6*masse(ig,l)) THEN |
---|
[2102] | 108 | qa(ig,l) = (fm(ig,l) * qa(ig,l-1) + entr(ig,l) * q(ig,l)) & |
---|
| 109 | & / (fm(ig,l+1) + detr(ig,l)) |
---|
[2127] | 110 | ELSE |
---|
[2102] | 111 | qa(ig,l) = q(ig,l) |
---|
[2127] | 112 | ENDIF |
---|
[2060] | 113 | ENDDO |
---|
| 114 | ENDDO |
---|
| 115 | |
---|
[2127] | 116 | !------------------------------------------------------------------------------- |
---|
| 117 | ! Plume vertical flux of tracer |
---|
| 118 | !------------------------------------------------------------------------------- |
---|
[2060] | 119 | |
---|
[2102] | 120 | DO l=2,nlay-1 |
---|
| 121 | fqa(:,l) = fm(:,l) * qa(:,l-1) |
---|
[2060] | 122 | ENDDO |
---|
| 123 | |
---|
| 124 | fqa(:,1) = 0. |
---|
| 125 | fqa(:,nlay) = 0. |
---|
| 126 | |
---|
[2127] | 127 | !------------------------------------------------------------------------------- |
---|
[2060] | 128 | ! Trace species evolution |
---|
[2127] | 129 | !------------------------------------------------------------------------------- |
---|
[2060] | 130 | |
---|
[2144] | 131 | IF (dqimpl) THEN |
---|
[2127] | 132 | DO l=nlay-1,1,-1 |
---|
[2102] | 133 | q(:,l) = ( q(:,l) + ptimestep / masse(:,l) & |
---|
| 134 | & * ( fqa(:,l) - fqa(:,l+1) + fm(:,l+1) * q(:,l+1) ) ) & |
---|
| 135 | & / ( 1. + fm(:,l) * ptimestep / masse(:,l) ) |
---|
[2060] | 136 | ENDDO |
---|
[2127] | 137 | ELSE |
---|
[2144] | 138 | DO l=1,nlay-1 |
---|
| 139 | q(:,l) = q(:,l) + (fqa(:,l) - fqa(:,l+1) - fm(:,l) * q(:,l) & |
---|
| 140 | & + fm(:,l+1) * q(:,l+1)) * ptimestep / masse(:,l) |
---|
| 141 | ENDDO |
---|
[2060] | 142 | ENDIF |
---|
| 143 | |
---|
[2127] | 144 | !=============================================================================== |
---|
[2060] | 145 | ! Tendencies |
---|
[2127] | 146 | !=============================================================================== |
---|
[2060] | 147 | |
---|
[2102] | 148 | DO l=1,nlay |
---|
[2060] | 149 | DO ig=1,ngrid |
---|
[2102] | 150 | dq(ig,l) = (q(ig,l) - qold(ig,l)) / ptimestep |
---|
| 151 | q(ig,l) = qold(ig,l) |
---|
[2060] | 152 | ENDDO |
---|
| 153 | ENDDO |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | RETURN |
---|
| 157 | END |
---|