CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CD (http://www.cfd-online.com/Forums/star-cd/)
-   -   posdat file to record heat release (http://www.cfd-online.com/Forums/star-cd/97416-posdat-file-record-heat-release.html)

Robert_B February 16, 2012 11:15

posdat file to record heat release
 
Hello

I'm running a transient reacting simulation. I want to be able to plot contours of heat release rate throughout my domain.

I know that I need to write a subroutine in posdat.f in order to calculate and store values of heat release rate from each of my cells. Has anyone managed to do this successfully, and if yes, would you mind sharing your posdat.f file with me?

Cheers
Rob

skylent February 20, 2012 21:38

c************************************************* ************************
subroutine posdat(level)
c Post-process data
C************************************************* ************************
C--------------------------------------------------------------------------*
C STAR-CD VERSION 4.06.000
C--------------------------------------------------------------------------*
USE allmod
IMPLICIT NONE
INCLUDE 'std.inc'
c
c Argument variables
INTEGER level
C-------------------------------------------------------------------------
C
C This subroutine enables the user to output data and is called
C at the beginning and at the end of each iteration/time step,
C i.e.
C if (level.eq.1) then
c.> called at the beginning of iteration/time step
C else if (level.eq.2) then
c.> called at the end of iteration/time step
C end if
C Any user code which is not enclosed in the IF condition will
C be executed for both calls
C
C Note: 1. File units available to the users for opening their own
C files are from 84 to 89. Users may write to unit 6 or 60
C if they want to see their output on the terminal or
C the run file.
C 2. All variables passed to this routine use STAR cell
C numbering, which is different from pro-STAR cell numbers.
C pro-STAR cell number can be obtained from a STAR cell
C number ICSTAR by ICPROSTAR=ICLMAP(ICSTAR)
C-------------------------------------------------------------------------
c Local variables
INTEGER nd,nset,i,j,k,icprostar
INTEGER moni(4) c-
定义数组,存储4prostar单元编号
INTEGER monis(4) c-
定义数组,存储对应的star单元编号
DATA moni/111,112,113,114/ c -
给定4prostar单元编号
DATA monis/0,0,0,0/
c&&&

if (intflg(128).eq.0) then
CC--- Find out cell id of star from cell id of prostar
,找出与prostar单元编号对应的star单元编号
call cset(cs,0,ND_ALL,NSD_ALL,INTERNAL)
do nset=1, cs%no
do i=cs%ns(nset),cs%ne(nset)
icprostar=iclmap(i)
do j=1,4
if(icprostar.eq.moni(j))then
monis(j)=i
write(6,*)'monitor',j,'icprostar=',icprostar,
& 'icstar=',monis(j)
write(60,*)'monitor',j,'icprostar=',icprostar,
& 'icstar=',monis(j)
exit
end if
end do
end do
end do
CC---------------------------------------------------
C first iteration, so open files
第一步,打开三个文件,用于存储u,v,p
if (.not.parrun) then
open(85,file='MonitU',form='formatted',status='unk nown')
open(86,file='MonitV',form='formatted',status='unk nown')
open(87,file='MonitP',form='formatted',status='unk nown')
end if
intflg(128)=1
c else files already open
end if
c
if (level.eq.1) return
c
CC--
获取u,v,p,并写入文件。
if (.not.parrun) then
write(85,800) iter,(u(1,monis(k)),k=1,4)
write(86,800) iter,(u(2,monis(k)),k=1,4)
write(87,800) iter,(pabs(monis(k)),k=1,4)
end if
800 format(i8,1p,5e11.3)

end
C

Robert_B February 21, 2012 12:17

Thanks Skylent, but I really need it all in western script. StarCD can't understand the Chinese symbols and unfortunately neither can I.

Any chance of a translation?

Cheers
Rob

Robert_B March 1, 2012 12:24

Ah sorry Skylent - I just realised that the non-Western characters only appear in comment lines. So the compiler doesn't need to read them.

I'm a Fortran novice, so please excuse me.

I've now got my simulation running with the posdat.f subroutine. I'll see over the next few days whether I've set it up properly.

Cheers
Rob


All times are GMT -4. The time now is 17:58.