| Directory: | ./ |
|---|---|
| File: | phys/cv3_buoy.f90 |
| Date: | 2022-01-11 19:19:34 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 35 | 49 | 71.4% |
| Branches: | 42 | 66 | 63.6% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | 480 | SUBROUTINE cv3_buoy(nloc, ncum, nd, icb, inb, pbase, plcl, p, ph, ale, cin, & | |
| 2 | 240 | tv, tvp, buoy) | |
| 3 | ! ************************************************************** | ||
| 4 | ! * | ||
| 5 | ! CV3_BUOY * | ||
| 6 | ! Buoyancy corrections to account for ALE * | ||
| 7 | ! * | ||
| 8 | ! written by : MOREAU Cecile, 07/08/2003, 15.55.48 * | ||
| 9 | ! modified by : * | ||
| 10 | ! ************************************************************** | ||
| 11 | |||
| 12 | IMPLICIT NONE | ||
| 13 | |||
| 14 | include "cvthermo.h" | ||
| 15 | include "cv3param.h" | ||
| 16 | include "YOMCST2.h" | ||
| 17 | |||
| 18 | ! input: | ||
| 19 | INTEGER ncum, nd, nloc | ||
| 20 | INTEGER icb(nloc), inb(nloc) | ||
| 21 | REAL pbase(nloc), plcl(nloc) | ||
| 22 | REAL p(nloc, nd), ph(nloc, nd+1) | ||
| 23 | REAL ale(nloc), cin(nloc) | ||
| 24 | REAL tv(nloc, nd), tvp(nloc, nd) | ||
| 25 | |||
| 26 | ! output: | ||
| 27 | REAL buoy(nloc, nd) | ||
| 28 | |||
| 29 | ! local variables: | ||
| 30 | INTEGER il, k | ||
| 31 | 480 | INTEGER kmx(nloc) | |
| 32 | 480 | REAL bll(nloc), bmx(nloc) | |
| 33 | 480 | REAL gamma(nloc) | |
| 34 | 480 | LOGICAL ok(nloc) | |
| 35 | |||
| 36 | REAL dgamma | ||
| 37 | REAL buoymin | ||
| 38 | PARAMETER (dgamma=2.E-03) !dgamma gamma | ||
| 39 | PARAMETER (buoymin=2.) | ||
| 40 | |||
| 41 | LOGICAL fixed_bll | ||
| 42 | SAVE fixed_bll | ||
| 43 | DATA fixed_bll/.TRUE./ | ||
| 44 | !$OMP THREADPRIVATE(fixed_bll) | ||
| 45 | |||
| 46 | |||
| 47 | ! print *,' Ale+cin ',ale(1)+cin(1) | ||
| 48 | ! -------------------------------------------------------------- | ||
| 49 | ! Recompute buoyancies | ||
| 50 | ! -------------------------------------------------------------- | ||
| 51 |
2/2✓ Branch 0 taken 6480 times.
✓ Branch 1 taken 240 times.
|
6720 | DO k = 1, nl |
| 52 |
2/2✓ Branch 0 taken 3431619 times.
✓ Branch 1 taken 6480 times.
|
3438339 | DO il = 1, ncum |
| 53 | 3438099 | buoy(il, k) = tvp(il, k) - tv(il, k) | |
| 54 | END DO | ||
| 55 | END DO | ||
| 56 | |||
| 57 | ! ------------------------------------------------------------- | ||
| 58 | ! -- Compute low level buoyancy ( function of Ale+Cin ) | ||
| 59 | ! ------------------------------------------------------------- | ||
| 60 |
1/2✓ Branch 0 taken 240 times.
✗ Branch 1 not taken.
|
240 | IF (fixed_bll) THEN |
| 61 | |||
| 62 |
2/2✓ Branch 0 taken 127097 times.
✓ Branch 1 taken 240 times.
|
127337 | DO il = 1, ncum |
| 63 | 127337 | bll(il) = 0.5 | |
| 64 | END DO | ||
| 65 | ELSE | ||
| 66 | |||
| 67 | ✗ | DO il = 1, ncum | |
| 68 | ✗ | IF (ale(il)+cin(il)>0.) THEN | |
| 69 | gamma(il) = 4.*buoy(il, icb(il))**2 + 8.*dgamma*(ale(il)+cin(il))*tv( & | ||
| 70 | ✗ | il, icb(il))/grav | |
| 71 | ✗ | gamma(il) = max(gamma(il), 1.E-10) | |
| 72 | END IF | ||
| 73 | END DO | ||
| 74 | |||
| 75 | ✗ | DO il = 1, ncum | |
| 76 | ✗ | IF (ale(il)+cin(il)>0.) THEN | |
| 77 | bll(il) = 4.*dgamma*(ale(il)+cin(il))*tv(il, icb(il))/ & | ||
| 78 | ✗ | (grav*(abs(buoy(il,icb(il))+0.5*sqrt(gamma(il))))) | |
| 79 | END IF | ||
| 80 | END DO | ||
| 81 | |||
| 82 | ✗ | DO il = 1, ncum | |
| 83 | ✗ | IF (ale(il)+cin(il)>0.) THEN | |
| 84 | ✗ | bll(il) = min(bll(il), buoymin) | |
| 85 | END IF | ||
| 86 | END DO | ||
| 87 | |||
| 88 | END IF !(fixed_bll) | ||
| 89 | |||
| 90 | |||
| 91 | ! ------------------------------------------------------------- | ||
| 92 | ! --Get highest buoyancy among levels below LCL-200hPa | ||
| 93 | ! ------------------------------------------------------------- | ||
| 94 | |||
| 95 |
2/2✓ Branch 0 taken 127097 times.
✓ Branch 1 taken 240 times.
|
127337 | DO il = 1, ncum |
| 96 | 127097 | bmx(il) = -1000. | |
| 97 | 127097 | kmx(il) = icb(il) | |
| 98 | 127337 | ok(il) = .TRUE. | |
| 99 | END DO | ||
| 100 | |||
| 101 |
2/2✓ Branch 0 taken 6480 times.
✓ Branch 1 taken 240 times.
|
6720 | DO k = 1, nl |
| 102 |
2/2✓ Branch 0 taken 3431619 times.
✓ Branch 1 taken 6480 times.
|
3438339 | DO il = 1, ncum |
| 103 |
4/4✓ Branch 0 taken 935145 times.
✓ Branch 1 taken 2496474 times.
✓ Branch 2 taken 251129 times.
✓ Branch 3 taken 684016 times.
|
3438099 | IF (ale(il)+cin(il)>0. .AND. ok(il)) THEN |
| 104 |
4/4✓ Branch 0 taken 76736 times.
✓ Branch 1 taken 174393 times.
✓ Branch 2 taken 68010 times.
✓ Branch 3 taken 8726 times.
|
251129 | IF (k>icb(il) .AND. k<=inb(il)) THEN |
| 105 | ! c print *,'k,p(il,k),plcl(il)-200. ', | ||
| 106 | ! k,p(il,k),plcl(il)-200. | ||
| 107 |
2/2✓ Branch 0 taken 66347 times.
✓ Branch 1 taken 1663 times.
|
68010 | IF (p(il,k)>plcl(il)-200.) THEN |
| 108 |
2/2✓ Branch 0 taken 65754 times.
✓ Branch 1 taken 593 times.
|
66347 | IF (buoy(il,k)>bmx(il)) THEN |
| 109 | 65754 | bmx(il) = buoy(il, k) | |
| 110 | 65754 | kmx(il) = k | |
| 111 |
2/2✓ Branch 0 taken 34029 times.
✓ Branch 1 taken 31725 times.
|
65754 | IF (bmx(il)>=bll(il)) ok(il) = .FALSE. |
| 112 | END IF | ||
| 113 | END IF | ||
| 114 | END IF | ||
| 115 | END IF | ||
| 116 | END DO | ||
| 117 | END DO | ||
| 118 | |||
| 119 | ! print *,' ==cv3_buoy== bll(1),bmx(1),icb(1),kmx(1) ' | ||
| 120 | ! $ ,bll(1),bmx(1),icb(1),kmx(1) | ||
| 121 | |||
| 122 | ! ------------------------------------------------------------- | ||
| 123 | ! --Calculate modified buoyancies | ||
| 124 | ! ------------------------------------------------------------- | ||
| 125 | |||
| 126 |
2/2✓ Branch 0 taken 127097 times.
✓ Branch 1 taken 240 times.
|
127337 | DO il = 1, ncum |
| 127 |
2/2✓ Branch 0 taken 34635 times.
✓ Branch 1 taken 92462 times.
|
127337 | IF (ale(il)+cin(il)>0.) THEN |
| 128 | 34635 | bll(il) = min(bll(il), bmx(il)) | |
| 129 | END IF | ||
| 130 | END DO | ||
| 131 | |||
| 132 |
2/2✓ Branch 0 taken 6480 times.
✓ Branch 1 taken 240 times.
|
6720 | DO k = 1, nl |
| 133 |
2/2✓ Branch 0 taken 3431619 times.
✓ Branch 1 taken 6480 times.
|
3438339 | DO il = 1, ncum |
| 134 |
2/2✓ Branch 0 taken 935145 times.
✓ Branch 1 taken 2496474 times.
|
3438099 | IF (ale(il)+cin(il)>0.) THEN |
| 135 |
4/4✓ Branch 0 taken 795387 times.
✓ Branch 1 taken 139758 times.
✓ Branch 2 taken 65810 times.
✓ Branch 3 taken 729577 times.
|
935145 | IF (k>=icb(il) .AND. k<=kmx(il)-1) THEN |
| 136 | 65810 | buoy(il, k) = bll(il) | |
| 137 | END IF | ||
| 138 | END IF | ||
| 139 | END DO | ||
| 140 | END DO | ||
| 141 | |||
| 142 | !CR:Correction of buoy for what comes next | ||
| 143 | !keep flag or to modify in all cases? | ||
| 144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 240 times.
|
240 | IF (iflag_mix_adiab.eq.1) THEN |
| 145 | ✗ | DO k = 1, nl | |
| 146 | ✗ | DO il = 1, ncum | |
| 147 | ✗ | IF ((k>=kmx(il)) .AND. (k<=inb(il)) .AND. (buoy(il,k).lt.0.)) THEN | |
| 148 | ✗ | buoy(il,k)=buoy(il,k-1) | |
| 149 | END IF | ||
| 150 | ENDDO | ||
| 151 | ENDDO | ||
| 152 | ENDIF | ||
| 153 | |||
| 154 | 240 | RETURN | |
| 155 | END SUBROUTINE cv3_buoy | ||
| 156 |