Bonsoir
je veux interpolé les valeurs d'un champs, donné sur une grille régulière, dans une autre grille raffinée.
Pour ceci, j'ai essayé d'employer la subroutine de l'interpolation linéaire donnée dans ce site, mais je n'arrive pas à trouver des résultats.
Voici le l'exemple que j'ai utilisé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Program main
	implicit real*8(A-H,O-Z)
	Dimension xp(50),yp(50)
	dimension x1(100),y1(100)
	dimension u(100,100)
	dimension a(100),b(100)
	integer,dimension(2,2):: POSXY
	real(kind=8),dimension(size(xp)):: TEMPMAILLX
	real(kind=8),dimension(size(yp)):: TEMPMAILLY
	real(kind=8)::INTERPOL
	real(kind=8) :: HI,HJ,INTERPOL1,INTERPOL2
 
	write(6,*) 'read the value of n,m,nn,mm'
	read(5,*) n,m,nn,mm
 
	open(2,file='uregul.dat')
	open(3,file='INTERPOL.dat')		
	u(:,:)=0.0
	call grid(n,m,nn,mm,xp,yp,x1,y1)
Le champs donné
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
        do j=1,m
	do i=1,n
	u(i,j)=0.1*(1.-((2.*yp(j)/20.)-1.)**2.)
	write(2,*)xp(i),yp(j),u(i,j)
	end do
	end do
l'interpolation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
do j=1,mm
	do i=1,nn
 
	TEMPMAILLX=xp
	!POSXY(1,1)=minloc(abs(x1(i)-TEMPMAILLX),dim=1)
	!if(minval(abs(x1(i)-TEMPMAILLX))/=0.0) TEMPMAILLX(POSXY(1,1))=
  !   &      TEMPMAILLX(POSXY(1,1))-1.
 
		POSXY(1,1)=minloc(abs(x1(i)-xp),dim=1)
	if(minval(abs(x1(i)-xp))/=0.0) xp(POSXY(1,1))=
     &      xp(POSXY(1,1))-1.
 
	POSXY(2,1)=minloc(abs(x1(i)-TEMPMAILLX),dim=1)
 
	TEMPMAILLY=yp
	POSXY(1,2)=minloc(abs(y1(j)-TEMPMAILLY),dim=1)
	if(minval(abs(y1(j)-TEMPMAILLY))/=0.0) TEMPMAILLY(POSXY(1,2))=
     &	  TEMPMAILLY(POSXY(1,2))+0.5
	POSXY(2,2)=minloc(abs(y1(j)-TEMPMAILLY),dim=1)
 
	if(minval(abs(x1(i)-TEMPMAILLX))/=0.0) HI=-(xp(POSXY(1,1))-
     &      x1(i))/(xp(POSXY(2,1))-xp(POSXY(1,1)))
	if(minval(abs(y1(j)-TEMPMAILLY))/=0.0) HJ=-(yp(POSXY(1,2))-
     &      y1(j))/(yp(POSXY(2,2))-yp(POSXY(1,2)))
 
 
	INTERPOL1=(1-HI)*u(POSXY(1,1),POSXY(1,2))+HI*u(POSXY(2,1)
     &      ,POSXY(1,2))
 
	INTERPOL2=(1-HI)*u(POSXY(1,1),POSXY(2,2))+HI*u(POSXY(2,1)
     &      ,POSXY(2,2))
 
	INTERPOL=(1-HJ)*INTERPOL1+HJ*INTERPOL2
 
 
      !do i=1,nn
	!do j=1,mm
	!write(3,*)x1(i),y1(j),INTERPOL
	end do
	end do
 
stop
end
la grille régulière et grille raffinée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
 
 
 
	subroutine grid(n,m,nn,mm,xp,yp,x1,y1)
	implicit real*8(A-H,O-Z)
	Dimension xp(50), yp(50)
	dimension x1(100),y1(100)
 
*****generation des x ******
	do 21 i=1,n
	alpha= float(i-1)
	xp(i)=alpha
 21	 continue
	write(6,102)
102	format(15x,'		Horizontal coordinate		')
	write(6,100) (xp(j),j=1,n)
100	format(1x,6f12.6)
 
****	génération des cordonées y*****
 
	do 31 j=1,m
 
	alpha= float(j-1)
	yp(j)=alpha
31	continue
	write(6,103)
103	format(15x,'		longitudinal coordinate		')
	write(6,100)(yp(j),j=1,m)
 
 
***** maillage raffiné( insertion de nouveaux noeuds)******
 
	tdx=(xp(n)-xp(1))/float(nn-1)
	tdy=(yp(m)-yp(1))/float(mm-1)
	do 41 i=1,nn
41	x1(i)=float(i-1)*tdx
	do 51 j=1,mm
51	y1(j)=float(j-1)*tdy
 
 
	return 
	end
Merci de votre aide je suis nouveau sur fortran et je n'arrive pas à résoudre ce problème
Merci encore