24小时热门版块排行榜    

查看: 4838  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 今天系统多次维护,明天很可能放榜! +5 zju2000 2026-08-16 5/250 2026-08-16 23:23 by Haru815
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +32 医学老男孩 2026-08-13 74/3700 2026-08-16 21:05 by 医学老男孩
[论文投稿] 岩土工程学报什么时候才能终审完呐 25+3 yeager111 2026-08-10 4/200 2026-08-16 20:42 by tfang
[基金申请] 时间戳又变了8-15 +13 archvillain 2026-08-15 25/1250 2026-08-16 20:13 by zhaosm1982
[基金申请] 2027广东省杰青 +3 奶牛小黑 2026-08-15 6/300 2026-08-16 20:07 by 奶牛小黑
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +9 Ldrop2023 2026-08-13 9/450 2026-08-16 13:24 by wukun_007
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +10 majunge000 2026-08-11 12/600 2026-08-16 08:18 by xli1984
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +12 Tide man 2026-08-10 13/650 2026-08-15 16:34 by 氺木
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 分享一下我之前已中青C的计划书的filecode +4 布布和一二 2026-08-11 5/250 2026-08-13 12:56 by cratir
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 帮忙看看fileCode +7 wwncly 2026-08-10 13/650 2026-08-11 19:36 by 冰心玉壶晴
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
信息提示
请填处理意见