Grid sub.f90
From CFD-Wiki
(Difference between revisions)
Revision as of 02:18, 19 September 2005
Subroutine Grid_rectangular
include 'icomm_1.f90'
x=0.
y=0.
SLx = 2.
SLy = 1.
Xbeg = -1.
Ybeg = 0.
! SLx = 1.
! SLy = 1.
! Xbeg = 0.
! Ybeg = 0.
NXmax = 121
NYmax = 61
NXmaxP = NXmax + 1
NYmaxP = NYmax + 1
!-------------------------------------------------------------------------------------------
DO 2 I=1, NXmax
DO 2 J=1, NYmax
X(I,J) = Xbeg + (SLx /(NXmax-1))* (i-1)
2 continue
DO 3 J=1, NYmax
DO 3 I=1, NXmax
Y(I,J) = Ybeg + (SLy /(NYmax-1))* (j-1)
3 continue
open (22,file='GRID.dat')
WRITE(22,*)'VARIABLES = "X", "Y" '
WRITE (22,*)' ZONE I=' ,NXmax, ', J=', NYmax, ', F=POINT'
DO 1 J=1, NYmax
DO 1 I=1, NXmax
WRITE (22,*) X(I,J), Y(I,J)
1 continue
open (21,file='GRID.txt')
write(21,*) NYmax,NXmax
DO 4 J=1, NYmax
DO 4 I=1, NXmax
WRITE (21,*) X(I,J), Y(I,J)
4 continue
close(21)
Return
End