| 1 | !Mars importe directement de la version martienne |
|---|
| 2 | subroutine groupeun(jjmax,llmax,q) |
|---|
| 3 | implicit none |
|---|
| 4 | |
|---|
| 5 | c ********************************************************* |
|---|
| 6 | c lissage fort des champs aux poles pour permettre |
|---|
| 7 | c de tourner avec plafond haut. |
|---|
| 8 | c F. Hourdin, 1997. |
|---|
| 9 | c (commentaire et test sur ngroup par Francois Forget, 05/2000) |
|---|
| 10 | c |
|---|
| 11 | c Technique : |
|---|
| 12 | c |
|---|
| 13 | c 1) Les points sont regroupes par paquet de 2**ngroup |
|---|
| 14 | c aux poles (e.g. ngroup=3 -> paquet de 8), puis 2**(ngroup-1) |
|---|
| 15 | c 2**(ngroup-2), etc... aux latitude plus basse en s'eloignant du pole |
|---|
| 16 | c |
|---|
| 17 | c 2) Plus ngroup est eleve, plus le lissage est efficace |
|---|
| 18 | c |
|---|
| 19 | c 3) MAIS, il faut iim divisible par 2**ngroup !!! |
|---|
| 20 | c |
|---|
| 21 | c |
|---|
| 22 | c ********************************************************* |
|---|
| 23 | |
|---|
| 24 | #include "dimensions.h" |
|---|
| 25 | #include "paramet.h" |
|---|
| 26 | #include "comgeom2.h" |
|---|
| 27 | |
|---|
| 28 | integer jjmax,llmax |
|---|
| 29 | real q(iip1,jjmax,llmax) |
|---|
| 30 | |
|---|
| 31 | integer ngroup |
|---|
| 32 | parameter (ngroup=2) |
|---|
| 33 | |
|---|
| 34 | logical intensive |
|---|
| 35 | |
|---|
| 36 | real airen,airecn,qn |
|---|
| 37 | real aires,airecs,qs |
|---|
| 38 | |
|---|
| 39 | integer i,j,l,ig,j1,j2,i0,jd |
|---|
| 40 | logical firstcall |
|---|
| 41 | DATA firstcall/.true./ |
|---|
| 42 | |
|---|
| 43 | c ------------------------------------------------------- |
|---|
| 44 | c test sur ngroup : |
|---|
| 45 | |
|---|
| 46 | if (firstcall) then |
|---|
| 47 | IF(MOD(iim,2**ngroup).NE.0) then |
|---|
| 48 | write(*,*) 'Problem in groupeun.F' |
|---|
| 49 | write(*,*) 'iim= ', iim, ' ngroup=', ngroup |
|---|
| 50 | write(*,*) 'iim must be divisible by par 2**ngroup= ', |
|---|
| 51 | & 2**ngroup |
|---|
| 52 | write(*,*) ' YOU must change ngroup in groupeun.F' |
|---|
| 53 | write(*,*) ' Have fun... ' |
|---|
| 54 | stop |
|---|
| 55 | END IF |
|---|
| 56 | write(*,*) 'in groupeun.F, ngroup=', ngroup |
|---|
| 57 | firstcall = .false. |
|---|
| 58 | end if |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | c Champs 3D |
|---|
| 62 | intensive=.true. |
|---|
| 63 | if (intensive) then |
|---|
| 64 | jd=jjp1-jjmax |
|---|
| 65 | do l=1,llmax |
|---|
| 66 | j1=1+jd |
|---|
| 67 | j2=2 |
|---|
| 68 | do ig=1,ngroup |
|---|
| 69 | do j=j1-jd,j2-jd |
|---|
| 70 | c print*,'groupe ',ig,' j= ',j,2**(ngroup-ig+1),'pts groupes' |
|---|
| 71 | do i0=1,iim,2**(ngroup-ig+1) |
|---|
| 72 | airen=0. |
|---|
| 73 | airecn=0. |
|---|
| 74 | qn=0. |
|---|
| 75 | aires=0. |
|---|
| 76 | airecs=0. |
|---|
| 77 | qs=0. |
|---|
| 78 | do i=i0,i0+2**(ngroup-ig+1)-1 |
|---|
| 79 | airen=airen+aire(i,j) |
|---|
| 80 | aires=aires+aire(i,jjp1-j+1) |
|---|
| 81 | qn=qn+q(i,j,l)*aire(i,j) |
|---|
| 82 | qs=qs+q(i,jjp1-j+1-jd,l)*aire(i,jjp1-j+1) |
|---|
| 83 | enddo |
|---|
| 84 | airecn=0. |
|---|
| 85 | airecs=0. |
|---|
| 86 | do i=i0,i0+2**(ngroup-ig+1)-1 |
|---|
| 87 | q(i,j,l)=qn/airen |
|---|
| 88 | q(i,jjp1-j+1-jd,l)=qs/aires |
|---|
| 89 | enddo |
|---|
| 90 | enddo |
|---|
| 91 | q(iip1,j,l)=q(1,j,l) |
|---|
| 92 | q(iip1,jjp1-j+1-jd,l)=q(1,jjp1-j+1-jd,l) |
|---|
| 93 | enddo |
|---|
| 94 | j1=j2+1 |
|---|
| 95 | j2=j2+2**ig |
|---|
| 96 | enddo |
|---|
| 97 | enddo |
|---|
| 98 | |
|---|
| 99 | c --------------- |
|---|
| 100 | else |
|---|
| 101 | c Cas sans multiplication par les aires. |
|---|
| 102 | c --------------- |
|---|
| 103 | |
|---|
| 104 | jd=jjp1-jjmax |
|---|
| 105 | do l=1,llmax |
|---|
| 106 | j1=1+jd |
|---|
| 107 | j2=2 |
|---|
| 108 | do ig=1,ngroup |
|---|
| 109 | do j=j1-jd,j2-jd |
|---|
| 110 | c print*,'groupe ',ig,' j= ',j,2**(ngroup-ig+1),'pts groupes' |
|---|
| 111 | do i0=1,iim,2**(ngroup-ig+1) |
|---|
| 112 | airen=0. |
|---|
| 113 | airecn=0. |
|---|
| 114 | qn=0. |
|---|
| 115 | aires=0. |
|---|
| 116 | airecs=0. |
|---|
| 117 | qs=0. |
|---|
| 118 | do i=i0,i0+2**(ngroup-ig+1)-1 |
|---|
| 119 | airen=airen+aire(i,j) |
|---|
| 120 | aires=aires+aire(i,jjp1-j+1) |
|---|
| 121 | qn=qn+q(i,j,l) |
|---|
| 122 | qs=qs+q(i,jjp1-j+1-jd,l) |
|---|
| 123 | enddo |
|---|
| 124 | airecn=0. |
|---|
| 125 | airecs=0. |
|---|
| 126 | do i=i0,i0+2**(ngroup-ig+1)-1 |
|---|
| 127 | q(i,j,l)=qn*aire(i,j)/airen |
|---|
| 128 | q(i,jjp1-j+1-jd,l)=qs*aire(i,jjp1-j+1)/aires |
|---|
| 129 | enddo |
|---|
| 130 | enddo |
|---|
| 131 | q(iip1,j,l)=q(1,j,l) |
|---|
| 132 | q(iip1,jjp1-j+1-jd,l)=q(1,jjp1-j+1-jd,l) |
|---|
| 133 | enddo |
|---|
| 134 | j1=j2+1 |
|---|
| 135 | j2=j2+2**ig |
|---|
| 136 | enddo |
|---|
| 137 | enddo |
|---|
| 138 | |
|---|
| 139 | endif |
|---|
| 140 | |
|---|
| 141 | c print*,'On groupe jusque j=',j1-1,rlatu(j1-1)*180./pi |
|---|
| 142 | |
|---|
| 143 | return |
|---|
| 144 | end |
|---|