PostProcess

I struggled some time to write code to output files for tecplot. So this article summerizes the data format.

Tecplot format

Output a plane(1 block)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
open(1,file='plane01.dat',type='unknown')
write(1,1111)
write(1,2222) in,kk0
do k=1,kk0
do j= 1,1 ! output a the surface plane of the aircraft
do i=1,in
write(1,3333) xx(i,j,k),yy(i,j,k),zz(i,j,k),uu(i,j,k), &
vv(i,j,k),ww(i,j,k),pp(i,j,k),dd(i,j,k), fc1(i,j,k),fc2(i,j,k),fc3(i,j,k),fc4(i,j,k),fc5(i,j,k)
enddo
enddo
enddo
close(1)
1111 format('VARIABLES = "X","Y","Z","U","V","W","PRESSURE","DENSITY",
& "O2","N2","N","O","NO"')
2222 format('ZONE I=',I6,', J=',I6,', F=POINT')
3333 format(8f12.5,5e15.8)

Output the whole flow field

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open(10,file='plotall.dat',form='formatted')
write(10,*)'variables="x","y","z","p","d","u","v","w"'
do n=1,nblock
B=>block(n)
nx=B%nx;ny=B%ny;nz=B%nz
allocate(Qtemp(Nvar,nx,ny,nz),STAT=ierr)
call intpc2v(n,Qtemp) ! interpolate the value in cell center to vertice
write(10,*)'zone f=point,i=',nx,',j=',ny,',k=',nz
do k=1,kn
do j=1,jn
do i=1,in
write(10,"(8g15.7)") B%x(i,j,k),B%y(i,j,k),B%z(i,j,k), & (Qtemp(ivar,i,j,k),ivar=1,nvar)
enddo
enddo
enddo
enddo

Plot3d format

When treat multiblock problem, I find that tecplot format files are neither efficently nor conveniently. The CFL3D use plot3d format flie. So I read the Plot3d manual and summerize the data file formats.

Extension

  • Grid file : .x .xy .xyz .g
  • Solution file : .q
  • Function file : .f
    Also, each file can be formatted or unformatted. For fmt files, substitute (UNIT, *) for (IUNIT), and use the /FORMATTED qualifier with the READ command.

Grid file

Single block

1
2
3
4
5
! 3D (/WHOLE) :
READ (IUNIT) IDIM, JDIM, KDIM
READ(IUNIT) (((X(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM), &
(((Y(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM), &
(((Z(I,J,K),I=1,IDIM),J=1,JDIM),K=1,KDIM)
1
2
3
4
5
6
7
! 3D (/PLANES) :
READ (IUNIT) IDIM, JDIM, KDIM
DO K= 1,KDIM
READ(IUNIT) ((X(I,J,K),I=1,IDIM),J=1,JDIM),
((Y(I,J,K),I=1,IDIM),J=1,JDIM),
((Z(I,J,K),I=1,IDIM),J=1,JDIM)
ENDDO

multiblock

1
2
3
4
5
6
7
8
9
! 3D (/WHOLE) :
READ(IUNIT) NGRID
READ(IUNIT) (IDIM(IGRID), JDIM(IGRID) ,KDIM(IGRID), IGRID=1, NGRID)
DO 10 IGRID= 1, NGRID
READ (IUNIT) &
(((X(I,J,K),I=1,IDIM(IGRID)), J=1,JDIM(IGRID)),K=1, KDIM(IGRID)),
(((Y(I,J,K),I=1,IDIM(IGRID)), J=1,JDIM(IGRID)),K=1, KDIM(IGRID)),
(((Z(I,J,K),I=1,IDIM(IGRID)), J=1,JDIM(IGRID)),K=1, KDIM(IGRID))
ENDDO

Planes file are similar.

Solution Q files (3D, Whole, Unformatted, Multi-Block Grid and Solution)

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
real mach ! freestream Mach number
real alpha ! freestream angle-of-attack
real reyn ! freestream Reynolds number
real time ! time
real x(imax,jmax,kmax,nbmax)
real y(imax,jmax,kmax,nbmax)
real z(imax,jmax,kmax,nbmax)
real q(imax,jmax,kmax,nbmax,5)
open ( unit=7, form='unformatted', file='3D.x' )
open ( unit=8, form='unformatted', file='3D.q' )
read(7) nblocks
read(7) ( ni(m), nj(m), nk(m), m = 1, nblocks )
do m = 1, nblocks
read(7)
& ((( x(i,j,k,m), i=1,ni(m)), j=1,nj(m)), k=1,nk(m)),
& ((( y(i,j,k,m), i=1,ni(m)), j=1,nj(m)), k=1,nk(m)),
& ((( z(i,j,k,m), i=1,ni(m)), j=1,nj(m)), k=1,nk(m))
enddo
read(8) nblocks
read(8) ( ni(m), nj(m), nk(m), m = 1, nblocks )
do m = 1, nblocks
read(8) mach, alpha, reyn, time
read(8)
& (((( q(i,j,k,m,n), i=1,ni(m)), j=1,nj(m)), k=1,nk(m)), n=1,5)
enddo

Function files (multiblock)

1
2
3
4
5
6
7
! 3D (/WHOLE) :
READ (IUNIT) NGRID
READ (IUNIT) (IDIM(IGR1D), JDIM(IGR1D), KDIM(1GRID), NVAR(IGRID), IGRID=1, NGRID)
DO IGRID = 1, NGRID
READ (IUNIT) ((((F(I,J,K,NX), I=1,IDIM(IGRID)), J=1,JDIM(IGRID)), &
K=1,KDIM(IGRID)), NX= 1,NVAR(IGRID))
ENDDO

Boundary condition files

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
tempL=.false. ! I donnot know that's this
open(93,file='plot3d.g.fvbnd', form='formatted')
write(93,*) " FVBND 1 4" ! I donnot know what's this
write(93,*) " No_Boundary_Condition" ! 10 boundary type in gridgen
write(93,*) " Solid_Surface" ! #2
write(93,*) " Symmetry" ! #3
write(93,*) " Farfield" ! #4
write(93,*) " Inflow" ! #5
write(93,*) " Outflow" ! #6
write(93,*) " Pole" ! #7
write(93,*) " Generic_#1" ! #8
write(93,*) " Generic_#2" ! #9
write(93,*) " Generic_#3" ! #10
write(93,*) " BOUNDARIES"
do m=1,NB
B => Block(m)
do ksub=1,B%subface
Bc => B%bc_msg(ksub)
!include solid_surface, symmetry, and outflow boundaries.
if(Bc%bc==2.or.Bc%bc==3.or.Bc%bc==6)then
write(93,"(8I7,L7,I7)") Bc%bc,m,Bc%ib,Bc%ie,Bc%jb,Bc%je,Bc%kb,Bc%ke,tempL,0
endif
enddo
enddo
close(93)

name files

test.nam (a file giving the names of the variables in the .f file)

NAME FILE is a file for specifying a variable name of a function file and a variable to be a vector. After loading the function file, a dialog box will be displayed asking if you want to load this file, so you can specify there. The format of this file is very simple and you can easily create it manually with your editor (Word pad etc). The file name extension must be. Nam.

■ Format of NAME FILE

1
2
3
4
5
P1
U1; X-Velocity
V1; Y-Velocity
W1; Z-Velocity
C1

We will enter variable names in order from the first line. This corresponds to the order of the variables stored in the FUNCTION file.
For those you want to use as variables for the velocity vector, add a semicolon after the variable name and enter X - Velocity, Y - Velocity, or Z - Velocity. X - Velocity represents the speed vector in the X direction, Y - Velocity represents the velocity vector in the Y direction, and Z - Velocity represents the velocity vector in the Z direction.
■ When there is a

Q file Q The next variable in the file is automatically recognized as a vector variable. In this case, do not set “; * - Velocity” in NAME FILE.

X-momentum
Y-momentum
Z-momentum