|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
STARCD4.06与STARCD3.X系列相比,由于求解器的改变,计算中的数据结构发生了巨大的变化,因此posdat.f的使用方法也发生了很大的改变。近来对STARCD4.06的posdat.f做了点研究,发出来跟大家共享一下:
下面是给定四个单元编号(prostar), 按步取出二维流场中u,v,p的小例子。其中比较特别一点的地方是采用了一段小代码实现prostar单元编号到star单元编号的转换,因为posdat.f是直接对STAR求解器中间存储数据的读取,所以必须进行转换。
哪位高手如果发现有什么问题,欢迎指出,共同探讨。
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-定义数组,存储4个prostar单元编号
INTEGER monis(4) c-定义数组,存储对应的star单元编号
DATA moni/111,112,113,114/ c -给定4个prostar单元编号
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='unknown')
open(86,file='MonitV',form='formatted',status='unknown')
open(87,file='MonitP',form='formatted',status='unknown')
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 |
|