24小时热门版块排行榜    

查看: 4680  |  回复: 3

lhy0xmc

新虫 (初入文坛)

[求助] fortran程序中输出tecplot二进制文件

下面这段程序是我在某大神德基础上修改的binary二进制文件的输出程序,得到的文件会提示“invalid header in the binary datafile!” (见附件“捕获.JPG”) 程序改了好多遍,都没解决问题。希望各位前辈,师兄指点一下。
"捕获2.JPG"是我想输出的三维图形,就是一个网格,没有其他的东西。
f90文件是我的程序节选。
open(99,file="tecbin.plt",form="binary"
!----1.1 Magic number, Version number
write(99) "#!TDV101"
!---1.2. Integer value of 1.----------------------------------------------------------
!       +-----------+
!       | INT32     |       This is used to determine the byte order
!       +-----------+       of the reader relative to the writer.
write(99) 1
!---1.3. Title and variable names.-------------------------------------------------
  
!---1.3.1. The TITLE. (See note 1.)
write(99) ICHAR('A')            
write(99) 0   
  
  
!---1.3.2 Number of variables (NumVar) in the datafile.
  
write(99) 3
  
!----1.3.3 Variable names. N = L[1] + L[2] + .... L[NumVar]
  
     write(99) ichar('X')            ! name of variables (NumVar) in the datafile
     write(99) 0
     write(99) ichar('Y')
     write(99) 0
     write(99) ichar('Z')
     write(99) 0
  
  
  
  
!---1.4. Zones-------------------------------------------------------------------
  
!---1.4.1 Zone 1+++++++++++++++++++++++++++++++++++++++++++
  
     write(99) 299.0                 ! Zone marker. Value = 299.0
     write(99) ichar('Z')            ! Zone name. (See note 1.) N = length of zone name + 1.
     write(99) ichar('O')
     write(99) ichar('N')
     write(99) ichar('E')
     write(99) ichar('0')
     write(99) ichar('1')
     write(99) 0
  
     write(99) -1                    !-------Zone Color (set to -1 if you want tecplot todetermine).
     write(99) 0                     !-------ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK
     write(99) 1                     !-------DataPacking 0=Block, 1=Point
     write(99) 0                     !-------Specify Var Location. 0 = Don't specify, all data is located at the nodes. 1 = Specify
  
     write(99) 0                     !-------Number of user defined face neighbor connections (value >= 0)
  
     write(99) IMax                  !-------IMax,JMax,KMax
     write(99) JMax
     write(99) KMax
        
     write(99) 0                     ! 1=Auxiliary name/value pair to follow 0=No more Auxiliar name/value pairs
                                      ! 0=No more Auxiliar name/value pairs
!---1.4.2 Zone 2+++++++++++++++++++++++++++++++++++++++++++
  
     write(99) 299.0                 ! Zone marker. Value = 299.0
     write(99) ichar('Z')            ! Zone name. (See note 1.) N = length of zone name + 1.
     write(99) ichar('O')
     write(99) ichar('N')
     write(99) ichar('E')
     write(99) ichar('0')
     write(99) ichar('1')
     write(99) 0
  
     write(99) -1                    !-------Zone Color (set to -1 if you want tecplot todetermine).
     write(99) 0                     !-------ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK
     write(99) 1                     !-------DataPacking 0=Block, 1=Point
     write(99) 0                     !-------Specify Var Location. 0 = Don't specify, all data is located at the nodes. 1 = Specify
  
     write(99) 0                     !-------Number of user defined face neighbor connections (value >= 0)
  
     write(99) IMax                  !-------IMax=10,JMax=10,KMax=30. the same value as follows
     write(99) JMax
     write(99) KMax
        
     write(99) 0                     ! 1=Auxiliary name/value pair to follow 0=No more Auxiliar name/value pairs
                                      ! 0=No more Auxiliar name/value pairs
                                    
                                    
                                    
!---1.4.3 Zone 3+++++++++++++++++++++++++++++++++++++++++++
  
     write(99) 299.0                 ! Zone marker. Value = 299.0
     write(99) ichar('Z')            ! Zone name. (See note 1.) N = length of zone name + 1.
     write(99) ichar('O')
     write(99) ichar('N')
     write(99) ichar('E')
     write(99) ichar('0')
     write(99) ichar('1')
     write(99) 0
  
     write(99) -1                    !-------Zone Color (set to -1 if you want tecplot todetermine).
     write(99) 0                     !-------ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE,3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK
     write(99) 1                     !-------DataPacking 0=Block, 1=Point
     write(99) 0                     !-------Specify Var Location. 0 = Don't specify, all data is located at the nodes. 1 = Specify
  
     write(99) 0                     !-------Number of user defined face neighbor connections (value >= 0)
  
     write(99) IMax                  !-------IMax,JMax,KMax
     write(99) JMax
     write(99) KMax
        
     write(99) 0                     ! 1=Auxiliary name/value pair to follow 0=No more Auxiliar name/value pairs
                                      ! 0=No more Auxiliar name/value pairs
  
  
  
!---2---------data  section-----------------------------
  
     write(99) 357.0                 !      EOHMARKER, value=357.0
!---2.1------zone 1++++++++++++++++++     
      
     write(99) 299.0                 ! Zone marker  Value = 299.0
  
      
     write(99) 2                     ! variable data format, N=Total number of vars
     write(99) 2                     ! 1=Float, 2=Double, 3=LongInt, 4=ShortInt, 5=Byte, 6=Bit
     write(99) 2
      
     write(99) 0                     ! Has passive variables: 0 = no, 1 = yes.
     write(99) -1                    ! Zero based zone number to share connectivity list with (-1 = no sharing)
  
     do k=1,kmax                                                
         do j=1,jmax
             do i=1,imax      
             write(99) xg(i,j,k,1),yg(i,j,k,1),zg(i,j,k,1)  !--------Zone Data. Each variable is in data format asspecified above.
             end do
         end do  
     end do
      
!---2.2------zone 2 +++++++++++++++++     
     write(99) 299.0                 ! Zone marker  Value = 299.0
  
      
     write(99) 2                     ! variable data format, N=Total number of vars
     write(99) 2                     ! 1=Float, 2=Double, 3=LongInt, 4=ShortInt, 5=Byte, 6=Bit
     write(99) 2
      
     write(99) 0                     ! Has passive variables: 0 = no, 1 = yes.
     write(99) -1                    ! Zero based zone number to share connectivity list with (-1 = no sharing)
  
     do k=1,kmax                                                
         do j=1,jmax
             do i=1,imax      
             write(99) xg(i,j,k,2),yg(i,j,k,2),zg(i,j,k,2)  !--------Zone Data. Each variable is in data format asspecified above.
             end do
         end do  
     end do
      
     !---2.3------zone 3 +++++++++++++   
     write(99) 299.0                 ! Zone marker  Value = 299.0
  
      
     write(99) 2                     ! variable data format, N=Total number of vars
     write(99) 2                     ! 1=Float, 2=Double, 3=LongInt, 4=ShortInt, 5=Byte, 6=Bit
     write(99) 2
      
     write(99) 0                     ! Has passive variables: 0 = no, 1 = yes.
     write(99) -1                    ! Zero based zone number to share connectivity list with (-1 = no sharing)
  
     do k=1,kmax                                                
         do j=1,jmax
             do i=1,imax      
             write(99) xg(i,j,k,3),yg(i,j,k,3),zg(i,j,k,3)  !--------Zone Data. Each variable is in data format asspecified above.
             end do
         end do  
     end do
  
close(99)

fortran程序中输出tecplot二进制文件
捕获.JPG


fortran程序中输出tecplot二进制文件-1
捕获2.JPG
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

安靖

银虫 (正式写手)

就是你输出的二进制文件格式错了。
这个只能自己对照tecplot二进制的格式说明仔细检查了
2楼2014-07-21 23:44:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lhy0xmc

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by 安靖 at 2014-07-21 23:44:43
就是你输出的二进制文件格式错了。
这个只能自己对照tecplot二进制的格式说明仔细检查了

关于tecplot二进制文件的中文详细说明在哪可以找到?
3楼2014-07-22 08:56:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

安靖

银虫 (正式写手)

引用回帖:
3楼: Originally posted by lhy0xmc at 2014-07-22 08:56:47
关于tecplot二进制文件的中文详细说明在哪可以找到?...

在tecplot的官网上可以下载到
一个叫preplot.cpp的源文件里有说明,没有中文,只有英文的。
你只要对照着程序改就行了
4楼2014-07-22 11:30:17
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 lhy0xmc 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 281求调剂(0805) +3 烟汐忆海 2026-03-16 7/350 2026-03-17 20:16 by peike
[考研] 070300化学319求调剂 +4 锦鲤0909 2026-03-17 4/200 2026-03-17 18:21 by 重科小霸王
[考研] 一志愿,福州大学材料专硕339分求调剂 +3 木子momo青争 2026-03-15 3/150 2026-03-17 07:52 by laoshidan
[基金申请] 今年的国基金是打分制吗? 50+3 zhanghaozhu 2026-03-14 3/150 2026-03-16 17:07 by 北京莱茵润色
[考研] 311求调剂 +5 26研0 2026-03-15 5/250 2026-03-16 16:21 by a不易
[考研] 070300化学学硕求调剂 +6 太想进步了0608 2026-03-16 6/300 2026-03-16 16:13 by kykm678
[考研] 085600材料与化工 求调剂 +13 enenenhui 2026-03-13 14/700 2026-03-16 15:19 by 了了了了。。
[考研] 一志愿华中师范071000,325求调剂 +6 RuitingC 2026-03-12 6/300 2026-03-16 14:50 by 可淡不可忘
[考研] 0856求调剂 +3 刘梦微 2026-03-15 3/150 2026-03-16 10:00 by houyaoxu
[考研] 材料工程327求调剂 +3 xiaohe12w 2026-03-11 3/150 2026-03-14 20:20 by ms629
[考研] 297求调剂 +4 学海漂泊 2026-03-13 4/200 2026-03-14 11:51 by 热情沙漠
[考研] 308 085701 四六级已过求调剂 +7 温乔乔乔乔 2026-03-12 14/700 2026-03-14 10:49 by JourneyLucky
[考研] 学硕285求调剂 +13 Wisjxn 2026-03-12 46/2300 2026-03-14 10:33 by JourneyLucky
[考研] 材料371求调剂 +9 鳄鱼? 2026-03-11 11/550 2026-03-13 22:53 by JourneyLucky
[考研] 0703,333分求调剂 一志愿郑州大学-物理化学 +3 李魔女斗篷 2026-03-11 3/150 2026-03-13 22:24 by JourneyLucky
[考研] 304求调剂 +6 Mochaaaa 2026-03-12 7/350 2026-03-13 22:18 by 星空星月
[考研] 材料与化工求调剂一志愿 985 总分 295 +8 dream…… 2026-03-12 8/400 2026-03-13 22:17 by 星空星月
[考研] 求调剂 +3 程雨杭 2026-03-12 3/150 2026-03-13 15:06 by JourneyLucky
[考研] 材料301分求调剂 +5 Liyouyumairs 2026-03-12 5/250 2026-03-13 14:42 by JourneyLucky
[考研] 081200-11408-276学硕求调剂 +3 崔wj 2026-03-12 4/200 2026-03-12 19:33 by 求调剂zz
信息提示
请填处理意见