source: LMDZ.3.3/trunk/libf/dyn3d/inter_bary.F @ 264

Last change on this file since 264 was 259, checked in by lmdz, 24 years ago

Nouveaux programmes pour la creation des etats initiaux et des conditions aux limites. Levan
LF

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1C
2C $Header$
3C
4       SUBROUTINE inter_bary( jjm, jdatmax, yjdatt, fdatt  ,
5     ,                       jmodmax, yjmodd,  fmod      )
6c
7c    ...  Auteurs :  Robert Sadourny  , P. Le Van ...
8c
9       IMPLICIT NONE
10
11c  ----------------------------------------------------------
12c       INTERPOLATION BARYCENTRIQUE BASEE SUR LES AIRES  .
13c         VERSION UNIDIMENSIONNELLE  ,    EN LATITUDE  .
14c  ----------------------------------------------------------
15c
16c     jdat : indice du champ de donnees, de 1 a jdatmax
17c     jmod : indice du champ du modele,  de 1 a jmodmax
18c     fdatt(jdatmax) : champ de donnees (entrees)
19c     yjdatt(jdatmax): ordonnees des interfaces des mailles donnees
20c     yjmodd(jmodmax): ordonnees des interfaces des mailles modele
21c     fmod(jmodmax)  : champ du modele  (sorties)
22c
23c      ( L'indice 1 correspond a l'interface maille 1 / maille 2)
24c      ( Les ordonnees sont exprimees en degres)
25c
26c     jdatmax = nb. d'interfaces  donnees =  nombre de donnees - 1
27c     jmodmax = nb. d'interfaces  modele
28
29c     Si jmodmax = jjm , on veut interpoler sur les jjm+1 latitudes
30c       rlatu   du modele ( lat.  des scalaires et de U )
31c
32c     Si jmodmax = jjp1 , on veut interpoler sur les jjm latitudes
33c       rlatv du modele  ( lat.  de  V )
34
35c  ....  Arguments  en entree  .......
36c
37       INTEGER jjm , jdatmax, jmodmax
38       REAL    yjdatt( 1 ) , fdatt( 1 )
39       REAL    yjmodd( 1 )     
40
41c  ....  Arguments  en sortie  .......
42c
43       REAL    fmod( 1 )
44c
45c   ...... Variables locales  ......
46       LOGICAL    decrois
47       SAVE       decrois
48
49       REAL y0,dy,dym
50       INTEGER jdat, jmod,i
51
52       INTEGER     jmods
53       REAL , ALLOCATABLE :: fdat(:)
54       REAL , ALLOCATABLE :: yjdat(:)
55       REAL , ALLOCATABLE :: yjmod(:)
56       REAL , ALLOCATABLE :: fscrat(:)
57       ALLOCATE (fdat(jdatmax+1))
58       ALLOCATE (yjdat(jdatmax+1))
59       ALLOCATE (yjmod(jmodmax))
60       ALLOCATE (fscrat(jdatmax+1))
61c
62
63        DO i = 1, jdatmax +1
64         fdat (i) = fdatt (i)
65        ENDDO
66
67       CALL ord_coord (  jdatmax , yjdatt(1), yjdat(1), decrois )
68
69       IF( decrois )   THEN
70         DO i = 1,jdatmax + 1
71          fscrat(i) = fdat(i)
72         ENDDO
73         DO i = 1, jdatmax + 1
74          fdat(i) = fscrat( jdatmax + 2 -i )
75         ENDDO
76
77       ENDIF
78
79       CALL ord_coordm (jmodmax,yjmodd(1),yjmod(1),jjm,jmods,decrois )
80c
81c      Initialisation des variables
82c    --------------------------------
83
84       DO jmod = 1, jmods
85        fmod(jmod) = 0.
86       END DO
87
88       y0    = 0.
89       dym   = 0.
90       jmod  = 1
91       jdat  = 1
92c  --------------------
93c      Iteration
94c  --------------------
95
96100    IF ( yjmod(jmod).LT.yjdat(jdat) ) THEN
97        dy         = yjmod(jmod) - y0
98        dym        = dym + dy
99        fmod(jmod) = (fmod(jmod) + dy * fdat(jdat)) / dym
100        y0         = yjmod(jmod)
101        dym        = 0.
102        jmod       = jmod + 1
103        GO TO 100
104
105       ELSE IF ( yjmod(jmod).GT.yjdat(jdat) ) THEN
106        dy         = yjdat(jdat) - y0
107        dym        = dym + dy
108        fmod(jmod) = fmod(jmod) + dy * fdat(jdat)
109        y0         = yjdat(jdat)
110        jdat       = jdat + 1
111
112       GO TO 100
113
114       ELSE
115        dy         = yjmod(jmod) - y0
116        dym        = dym + dy
117        fmod(jmod) = (fmod(jmod) + dy * fdat(jdat)) / dym
118        y0         = yjmod(jmod)
119        dym        = 0.
120        jmod       = jmod + 1
121        jdat       = jdat + 1
122
123        IF ( jmod.LE.jmods ) GO TO 100
124       END IF
125c   ---------------------------------------------
126c    Le test de fin suppose que l'interface 0
127c    est commune aux deux grilles yjdat et yjmod.
128c   ----------------------------------------------
129       IF( decrois )  THEN
130         DO i = 1,jmods
131          fscrat(i) = fmod(i)
132         ENDDO
133         DO i = 1, jmods
134          fmod(i) = fscrat( jmods + 1 -i )
135         ENDDO
136       ENDIF
137
138       DEALLOCATE(fdat)
139       DEALLOCATE(yjdat)
140       DEALLOCATE(yjmod)
141       DEALLOCATE(fscrat)
142
143       RETURN
144       END
Note: See TracBrowser for help on using the repository browser.