[22] | 1 | !********************************************************************** |
---|
| 2 | ! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 * |
---|
| 3 | ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, * |
---|
| 4 | ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann * |
---|
| 5 | ! * |
---|
| 6 | ! This file is part of FLEXPART. * |
---|
| 7 | ! * |
---|
| 8 | ! FLEXPART is free software: you can redistribute it and/or modify * |
---|
| 9 | ! it under the terms of the GNU General Public License as published by* |
---|
| 10 | ! the Free Software Foundation, either version 3 of the License, or * |
---|
| 11 | ! (at your option) any later version. * |
---|
| 12 | ! * |
---|
| 13 | ! FLEXPART is distributed in the hope that it will be useful, * |
---|
| 14 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
| 15 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
| 16 | ! GNU General Public License for more details. * |
---|
| 17 | ! * |
---|
| 18 | ! You should have received a copy of the GNU General Public License * |
---|
| 19 | ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. * |
---|
| 20 | !********************************************************************** |
---|
| 21 | |
---|
| 22 | subroutine calcmatrix(lconv,delt,cbmf) |
---|
| 23 | ! o i o |
---|
| 24 | !***************************************************************************** |
---|
| 25 | ! * |
---|
| 26 | ! This subroutine calculates the matrix describing convective * |
---|
| 27 | ! redistribution of mass in a grid column, using the subroutine * |
---|
| 28 | ! convect43c.f provided by Kerry Emanuel. * |
---|
| 29 | ! * |
---|
| 30 | ! Petra Seibert, Bernd C. Krueger, 2000-2001 * |
---|
| 31 | ! * |
---|
| 32 | ! changed by C. Forster, November 2003 - February 2004 * |
---|
| 33 | ! array fmassfrac(nconvlevmax,nconvlevmax) represents * |
---|
| 34 | ! the convective redistribution matrix for the particles * |
---|
| 35 | ! * |
---|
| 36 | ! lconv indicates whether there is convection in this cell, or not * |
---|
| 37 | ! delt time step for convection [s] * |
---|
| 38 | ! cbmf cloud base mass flux * |
---|
| 39 | ! * |
---|
| 40 | !***************************************************************************** |
---|
| 41 | |
---|
| 42 | use par_mod |
---|
| 43 | use com_mod |
---|
| 44 | use conv_mod |
---|
| 45 | |
---|
| 46 | implicit none |
---|
| 47 | |
---|
| 48 | real :: rlevmass,summe |
---|
| 49 | |
---|
| 50 | integer :: iflag, k, kk, kuvz |
---|
| 51 | |
---|
| 52 | !1-d variables for convection |
---|
| 53 | !variables for redistribution matrix |
---|
| 54 | real :: cbmfold, precip, qprime |
---|
| 55 | real :: tprime, wd, f_qvsat |
---|
| 56 | real :: delt,cbmf |
---|
| 57 | logical :: lconv |
---|
| 58 | |
---|
| 59 | lconv = .false. |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | ! calculate pressure at eta levels for use in convect |
---|
| 63 | ! and assign temp & spec. hum. to 1D workspace |
---|
| 64 | ! ------------------------------------------------------- |
---|
| 65 | |
---|
| 66 | ! pconv(1) is the pressure at the first level above ground |
---|
| 67 | ! phconv(k) is the pressure between levels k-1 and k |
---|
| 68 | ! dpr(k) is the pressure difference "around" tconv(k) |
---|
| 69 | ! phconv(kmax) must also be defined 1/2 level above pconv(kmax) |
---|
| 70 | ! Therefore, we define k = kuvz-1 and let kuvz start from 2 |
---|
| 71 | ! top layer cannot be used for convection because p at top of this layer is |
---|
| 72 | ! not given |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | phconv(1) = psconv |
---|
| 76 | ! Emanuel subroutine needs pressure in hPa, therefore convert all pressures |
---|
| 77 | do kuvz = 2,nuvz |
---|
| 78 | k = kuvz-1 |
---|
| 79 | pconv(k) = (akz(kuvz) + bkz(kuvz)*psconv) |
---|
| 80 | phconv(kuvz) = (akm(kuvz) + bkm(kuvz)*psconv) |
---|
| 81 | dpr(k) = phconv(k) - phconv(kuvz) |
---|
| 82 | qsconv(k) = f_qvsat( pconv(k), tconv(k) ) |
---|
| 83 | |
---|
| 84 | ! initialize mass fractions |
---|
| 85 | do kk=1,nconvlev |
---|
| 86 | fmassfrac(k,kk)=0. |
---|
| 87 | enddo |
---|
| 88 | enddo |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | !note that Emanuel says it is important |
---|
| 92 | !a. to set this =0. every grid point |
---|
| 93 | !b. to keep this value in the calling programme in the iteration |
---|
| 94 | |
---|
| 95 | ! CALL CONVECTION |
---|
| 96 | !****************** |
---|
| 97 | |
---|
| 98 | cbmfold = cbmf |
---|
| 99 | ! Convert pressures to hPa, as required by Emanuel scheme |
---|
| 100 | !******************************************************** |
---|
| 101 | !!$ do k=1,nconvlev !old |
---|
| 102 | do k=1,nconvlev+1 !bugfix |
---|
| 103 | pconv_hpa(k)=pconv(k)/100. |
---|
| 104 | phconv_hpa(k)=phconv(k)/100. |
---|
| 105 | end do |
---|
| 106 | phconv_hpa(nconvlev+1)=phconv(nconvlev+1)/100. |
---|
| 107 | call convect(nconvlevmax, nconvlev, delt, iflag, & |
---|
| 108 | precip, wd, tprime, qprime, cbmf) |
---|
| 109 | |
---|
| 110 | ! do not update fmassfrac and cloudbase massflux |
---|
| 111 | ! if no convection takes place or |
---|
| 112 | ! if a CFL criterion is violated in convect43c.f |
---|
| 113 | if (iflag .ne. 1 .and. iflag .ne. 4) then |
---|
| 114 | cbmf=cbmfold |
---|
| 115 | goto 200 |
---|
| 116 | endif |
---|
| 117 | |
---|
| 118 | ! do not update fmassfrac and cloudbase massflux |
---|
| 119 | ! if the old and the new cloud base mass |
---|
| 120 | ! fluxes are zero |
---|
| 121 | if (cbmf.le.0..and.cbmfold.le.0.) then |
---|
| 122 | cbmf=cbmfold |
---|
| 123 | goto 200 |
---|
| 124 | endif |
---|
| 125 | |
---|
| 126 | ! Update fmassfrac |
---|
| 127 | ! account for mass displaced from level k to level k |
---|
| 128 | |
---|
| 129 | lconv = .true. |
---|
| 130 | do k=1,nconvtop |
---|
| 131 | rlevmass = dpr(k)/ga |
---|
| 132 | summe = 0. |
---|
| 133 | do kk=1,nconvtop |
---|
| 134 | fmassfrac(k,kk) = delt*fmass(k,kk) |
---|
| 135 | summe = summe + fmassfrac(k,kk) |
---|
| 136 | end do |
---|
| 137 | fmassfrac(k,k)=fmassfrac(k,k) + rlevmass - summe |
---|
| 138 | end do |
---|
| 139 | |
---|
| 140 | 200 continue |
---|
| 141 | |
---|
| 142 | end subroutine calcmatrix |
---|