1 | SUBROUTINE minmaxsource(zq, qmin, qmax, comment) |
---|
2 | |
---|
3 | USE dimphy |
---|
4 | USE infotrac |
---|
5 | USE lmdz_libmath, ONLY: ismax, ismin |
---|
6 | |
---|
7 | INCLUDE "dimensions.h" |
---|
8 | |
---|
9 | ! CHARACTER*20 comment |
---|
10 | CHARACTER(LEN = *) :: comment |
---|
11 | REAL :: qmin, qmax |
---|
12 | REAL :: zq(klon, nbtr) |
---|
13 | |
---|
14 | INTEGER :: ijmin, lmin, ijlmin |
---|
15 | INTEGER :: ijmax, lmax, ijlmax |
---|
16 | |
---|
17 | ijlmin = ismin(klon * nbtr, zq, 1) |
---|
18 | lmin = (ijlmin - 1) / klon + 1 |
---|
19 | ijmin = ijlmin - (lmin - 1) * klon |
---|
20 | zqmin = zq(ijmin, lmin) |
---|
21 | |
---|
22 | ijlmax = ismax(klon * nbtr, zq, 1) |
---|
23 | lmax = (ijlmax - 1) / klon + 1 |
---|
24 | ijmax = ijlmax - (lmax - 1) * klon |
---|
25 | zqmax = zq(ijmax, lmax) |
---|
26 | |
---|
27 | IF(zqmin<qmin.OR.zqmax>qmax) & |
---|
28 | WRITE(*, 9999) comment, & |
---|
29 | ijmin, lmin, zqmin, ijmax, lmax, zqmax |
---|
30 | |
---|
31 | RETURN |
---|
32 | 9999 format(a20, 2(' q(', i4, ',', i2, ')=', e12.5)) |
---|
33 | END SUBROUTINE minmaxsource |
---|