SUBROUTINE TFINXACT(XB,YB,XL,YL,XT,YT,XR,YR,M,N,X,Y) C***BEGIN PROLOGUE TFINXACT C***DATE WRITTEN 980828 (YYMMDD) C***REVISION DATE 981007 (YYMMDD) C***CATEGORY NO. C***KEYWORDS TRANSFINITE BILINEAR INTERPOLATION, BLENDING FUNCTION C INTERPOLATION, ALGEBRAIC GRID GENERATION, BOUNDARY-FITTED C GRID GENERATION, NUMERICAL GRID GENERATION, CURVILINEAR C COORDINATE SYSTEM C C***AUTHOR SAUNDERS,B.V., (NIST) C***PURPOSE Generates a two dimensional boundary-fitted grid by C using transfinite bilinear interpolation. All boundary C grid points are fixed to be the points input by the user. C C C***DESCRIPTION C C TFINXACT generates a two dimensional boundary-fitted grid by C transfinite bilinear interpolation. In effect, TFINXACT creates C a curvilinear coordinate system that maps the unit square onto C a region whose boundary is input by the user. The boundary must be C divided into four sides: bottom, left, top, right. All boundary C grid points are fixed to be the boundary points input by the user C so that the boundary is interpolated accurately. This restriction is C loosened in routines TFINTB, TFINLR and TFINBLIN. The number C of points, M, on the top and bottom boundaries must be the same. C The number of points, N, on the left and right boundaries must be C the same. C (Also see TFINLR, TFINTB, TFINBLIN) C C Advantage: C Boundary grid points interpolate user inputted boundary C points exactly. C C Disadvantage: C Size of grid completely determined by number of boundary points C input. C C INPUT C C XB,YB REAL(M), REAL(M) C Real vectors containing abcissas, ordinates C for bottom boundary points. C C XL,YL REAL(N),REAL(N) C Real vectors containing abcissas, ordinates C for left boundary points. C C XT,YT REAL(M),REAL(M) C Real vectors containing abcissas, ordinates C for top boundary points. C C XR,YR REAL(N),REAL(N) C Real vectors containing abcissas, ordinates C for right boundary points. C C M INTEGER C Number of bottom(top) boundary points. M must be C less than or equal to NMAXBP. C C N INTEGER C Number of left(right) boundary points. N must be C less than or equal to NMAXBP. C C C C OUTPUT C C X,Y REAL(M,N),REAL(M,N) C Matrices containing abcissas, ordinates of C grid points. First row of grid points would C be (X(1,1),Y(1,1)),....,(X(M,1),Y(M,1)). C Last row of grid points would be C (X(1,N),Y(1,N)),....,(X(M,N),Y(M,N)) C C C PARAMETER C CONSTANT C C NMAXBP INTEGER C Maximum number of boundary points allowed C as input on any side of the domain. If size C insufficient for the needs of the user, user C can globally change parameter statement and C recompile. C C EXAMPLE PROGRAM C C PROGRAM TESTXACT CC CC Sample driver for TFINXACT. Computes NBT x NLR grid for nonconvex figure CC whose boundary data is in file input.data . CC C PARAMETER(NBT=3,NLR=4) C REAL X(NBT,NLR),Y(NBT,NLR),XB(100),YB(100),XL(100), C * YL(100),XT(100),YT(100),XR(100),YR(100) C OPEN(10, FILE='input.data') C OPEN(17, FILE='output.data') CC CC INPUT NUMBER OF POINTS ON EACH BOUNDARY CURVE. CC NUMBER OF POINTS ON TOP AND BOTTOM CURVES MUST BE THE CC SAME. CC NUMBER OF POINTS ON LEFT AND RIGHT CURVES MUST BE THE CC SAME. CC CC CC INPUT BOUNDARY POINTS CC C READ(10,*) M,N C READ(10,*) (XB(J),J=1,M) C READ(10,*) (YB(J),J=1,M) C READ(10,*) (XL(J),J=1,N) C READ(10,*) (YL(J),J=1,N) C READ(10,*) (XT(J),J=1,M) C READ(10,*) (YT(J),J=1,M) C READ(10,*) (XR(J),J=1,N) C READ(10,*) (YR(J),J=1,N) CC CC CHECK TO MAKE SURE NBT=M AND NLR =N. IF NOT PRINT CC ERROR MESSAGE AND STOP. CC C IF(M.NE.NBT.OR.N.NE.NLR) THEN C PRINT*,'M MUST EQUAL NBT AND N MUST EQUAL NLR' C STOP C ENDIF C CALL TFINXACT(XB,YB,XL,YL,XT,YT,XR,YR,M,N,X,Y) C DO 500 J=1,N C DO 400 I=1,M C WRITE(17,*) X(I,J),Y(I,J) C 400 CONTINUE C WRITE(17,*) C 500 CONTINUE C STOP C END C C C input.data C C 3 4 C -2 0 4 C -3 0 2 C -2 -3 -3.5 -4 C -3 0 2 6 C -4 0 6 C 6 6 6 C 4 4.5 5 6 C 2 4 5 6 C C C output.data C C -2.000000 -3.000000 C 0.0000000E+00 0.0000000E+00 C 4.000000 2.000000 C C -3.000000 0.0000000E+00 C -0.2500000 2.333333 C 4.500000 4.000000 C C -3.500000 2.000000 C -0.2500001 3.666667 C 5.000000 4.999999 C C -4.000000 6.000000 C 0.0000000E+00 6.000000 C 6.000000 6.000000 C C C***REFERENCES Knupp,P., Steinberg, S., Fundamentals of Grid C Generation, CRC Press, 1993. C Thompson, J.F., Warsi, Z.U.A., Mastin, C.W., C Numerical Grid Generation: Foundations and C Applications, Elsevier, 1985. C Gordon, W.J. and Hall, C.A., "Constructions of C Curvilinear Coordinate Systems and Applications C to Mesh Generation," Int. Journal for Numer. C Methods in Eng., Vol. 7, 461-477, 1963. C C C C***END PROLOGUE TFINXACT C PARAMETER(NMAXBP=500) REAL XB(M),YB(M),XL(N),YL(N),XT(M),YT(M),XR(N), * YR(N),X(M,N),Y(M,N),A(NMAXBP),B(NMAXBP) C C COMPUTE VECTORS A AND B C A(1)=0.0 A(M)=1.0 DO 160 I=2,M-1 A(I)=FLOAT(I-1)/FLOAT(M-1) 160 CONTINUE B(1)=0.0 B(N)=1.0 DO 170 J=2,N-1 B(J)=FLOAT(J-1)/FLOAT(N-1) 170 CONTINUE C C C******************TRANSFINITE MAPPING ******************** C DO 500 J=1,N ETA = B(J) DO 400 I=1,M XI = A(I) X(I,J) = (1.0-XI)*XL(J)+XI*XR(J) * + (1.0-ETA)*XB(I)+ETA*XT(I) * -(1.0-XI)*(1.0-ETA)*XB(1)-(1.0-XI)*ETA*XT(1) * -XI*(1.0-ETA)*XB(M)-XI*ETA*XT(M) Y(I,J) = (1.0-XI)*YL(J)+XI*YR(J) * +(1.0-ETA)*YB(I)+ETA*YT(I) * -(1.0-XI)*(1.0-ETA)*YB(1)-(1.0-XI)*ETA*YT(1) * -XI*(1.0-ETA)*YB(M)-XI*ETA*YT(M) 400 CONTINUE 500 CONTINUE RETURN END