在Fortran代码中,若要输出Tecplot格式结果,主要是要注意Tecplot文件的头部格式。

代码示例:

program main
    implicit none
    integer(kind=4),parameter :: N=100
    integer(kind=4) :: i,j
    real(kind=8) :: H
    real(kind=8) :: x(1:N+1,1:N+1),y(1:N+1,1:N+1),phi(1:N+1,1:N+1)
   
   H=2.D0/100
    do j=1,N+1,1
       do i=1,N+1,1
           x(i,j)=real(i-1,8)*H
           y(i,j)=real(j-1,8)*H
       end do
    end do
   phi=1.D0
   
    call output1(phi,x,y,N+1)
    call output2(phi,x,y,N+1)
    call output3(phi,x,y,N+1)
    call output4(phi,x,y,N+1)
    call output5(phi,x,y,N+1)
   
    stop
    end program main

形式1:
    subroutine output1(phi,x,y,M)
    implicit none  
   integer(kind=4) :: i,j,M
    real(kind=8) :: x(M,M),y(M,M),phi(M,M)
   
   open(unit=99,file="Tecplot.dat")
    write(99,*) 'title="Tecplot"'
    write(99,*) 'variables="x" "y" "phi"'
    write(99,*) 'zone t="Fortran"  i=',M,' j=',M,' f=point'
    do j=1,M,1
       do i=1,M,1
           write(99,*) x(i,j),y(i,j),phi(i,j)
       end do
    end do
   close(99)

return
    end subroutine output1

形式2:
    subroutine output2(phi,x,y,M)
    implicit none  
   integer(kind=4) :: i,j,M
    real(kind=8) :: x(M,M),y(M,M),phi(M,M)
   
   open(unit=99,file="Tecplot.dat")
    write(99,*) 'title="Tecplot"'
    write(99,*) 'variables="x" "y" "phi"'
    write(99,*) 'zone t="Fortran"  i=',M,' j=',M,' f=point'
    write(99,*) ((x(i,j),y(i,j),phi(i,j),i=1,M,1),j=1,M,1)
   close(99)

return
    end subroutine output2

形式3:
    subroutine output3(phi,x,y,M)
    implicit none  
   integer(kind=4),intent(in) :: M
   real(kind=8),intent(in) :: x(M,M),y(M,M),phi(M,M)
   integer(kind=4) :: i,j
   
   open(unit=99,file="Tecplot.dat")
    write(99,*) 'title="Tecplot"'
    write(99,*) 'variables="x" "y" "phi"'
    write(99,*) 'zone t="Fortran"  i=',M,' j=',M,' f=point'
   write(99,100) ((x(i,j),y(i,j),phi(i,j),i=1,M,1),j=1,M,1)
   close(99)
   
100 format(F10.7,3X,F10.7,3X,F10.7)

return
    end subroutine output3

形式4:
    subroutine output4(phi,x,y,M)
    implicit none  
   integer(kind=4),intent(in) :: M
   real(kind=8),intent(in) :: x(M,M),y(M,M),phi(M,M)
   integer(kind=4) :: i,j
   
   open(unit=99,file="Tecplot.dat")
   write(99,"('title=""Tecplot""',A20)")
   write(99,"('variables=""x"",""y"",""phi""',A20)")
   write(99,"('zone t=""Fortran"",i=',I3,',j=',I3,',f=point',A20)") M,M
   write(99,"(F10.7,3X,F10.7,3X,F10.7)") ((x(i,j),y(i,j),phi(i,j),i=1,M,1),j=1,M,1)
   close(99)

return
    end subroutine output4

形式5:
    subroutine output5(phi,x,y,M)
    implicit none  
   integer(kind=4),intent(in) :: M
   real(kind=8),intent(in) :: x(M,M),y(M,M),phi(M,M)
   integer(kind=4) :: i,j
   character(len=100) :: Fortran,outpath="D:\路径..\"
   
   write(Fortran,*) M
   open(unit=99,file="Tecplot.dat")
   !open(unit=99,file=trim(adjustl(outpath))//"Tecplot.dat")
   write(99,"('title=""Tecplot""',A20)")
   write(99,"('variables=""x"",""y"",""phi""',A20)")
   write(99,"('zone t=',A8,',i=',I3,',j=',I3,',f=point',A20)") 'Num'//trim(adjustl(Fortran)),M,M
   write(99,"(F10.7,3X,F10.7,3X,F10.7)") ((x(i,j),y(i,j),phi(i,j),i=1,M,1),j=1,M,1)
   close(99)

return
    end subroutine output5
   !注:在输出Tecplot格式时,注意在第三行中“t=”后面第一个字符不能为数字。

Fortran中输出Tecplot格式相关推荐

  1. 在JSP页面中输出JSON格式数据

    JSON-taglib是一套使在JSP页面中输出JSON格式数据的标签库. JSON-taglib主页: http://json-taglib.sourceforge.net/index.html J ...

  2. .net mvc 在 cshtml 中输出 html 格式问题

    在 cshtml 中输出 html ,如果html里带有格式,在直接输出的时候,就会出现问题. 例如: 在controller中定义: ViewBag.Content = "<p> ...

  3. 输出Tecplot格式的数据文件

    Tecplot输出文件格式 如果想将你的云图数据输出,对于整块的块状结构数据,我的输出方法如下: #include <fstream> string fileName;//你的文件名 in ...

  4. matlab输出pcm格式文件

    用cooledit打开的话,要用matlab输出为PCM格式. 在matlab中输出pcm格式要怎么做呢? 用法: fwrite(fileid,参数,格式): 为了用cooledit正确地打开,我们应 ...

  5. 取消c++所设置的cout中setprecision输出的格式

    取消c++所设置的cout中setprecision输出的格式 C++11中可以这样写: std::cout << std::defaultfloat; C++11以前是这样写的: std ...

  6. 7-100 简单求阶乘问题 (10 分)本题要求编写程序,计算N的阶乘。输入格式:输入在一行中给出一个不超过12的正整数N。输出格式:在一行中输出阶乘的值。输入样例:4结尾无空行

    7-100 简单求阶乘问题 (10 分) 本题要求编写程序,计算N的阶乘. 输入格式: 输入在一行中给出一个不超过12的正整数N. 输出格式: 在一行中输出阶乘的值. 样例">输入样例 ...

  7. java中时间输出的格式_Java 打印日期/时间格式

    Java格式 - Java 打印日期/时间格式 Java 打印日期/时间格式处理日期,时间和日期时间值. Java 打印日期/时间格式可以应用于格式值为long,Long,java.util.Cale ...

  8. matlab数据转换为tecplot格式[ASCII码格式下的plt文件]

    matlab数据转换为tecplot格式[ASCII码格式下的plt文件] 1 tecplot能读取的的常见ASCII格式 1.1 文件格式与文件头 1.2 zone相关的格式 2 一维数据 3 二维 ...

  9. fortran中类型

    - 由于 GNU 的 Fortran 和 C 语言二者的函数彼此可以直接相互调用,所以混合编程可以非常容易地实现.只要你足够仔细,确保函数调用时传递的参数类型正确,函数就可以在两种语言间来回调用,就像 ...

最新文章

  1. facebook新无监督论文-Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
  2. ubuntu server中的一些小知识(个人收集贴)
  3. 阿里云媒体转码MTS使用教程
  4. Eigen入门之密集矩阵 3 - Array操作
  5. 【TI-ONE系列教程(二)】如何使用 TI-ONE 平台内置算子玩转算法大赛
  6. SQL Server中的快照隔离
  7. APT 组织将目标锁定Linux
  8. PHP与Unicode签名(BOM)
  9. 线性代数之 伪逆矩阵
  10. Windows XP 电脑桌面图标后面有蓝色阴影怎么去除
  11. javascript从入门到跑路-----小文的js学习笔记(11)--------字符串以及字符串的常见方法!
  12. HDLC和PPP协议总结
  13. 深入理解Risk aversion||风险偏好||Risk utility function
  14. JQuery从入门到实战
  15. 中关村e谷为产业搭台:中关村论坛(空天专场)黑科技亮相现场
  16. UI设计必备工具有哪些?
  17. [原创]使用FleaPHP框架构建简单留言本应用
  18. 《Adobe InDesign CS5中文版经典教程》—第1课1.2节工作区简介
  19. 2016年8月16日 星期二 --出埃及记 Exodus 16:17
  20. CCF考试——201412-4最优灌溉

热门文章

  1. 西安交通大学计算机考研资料汇总
  2. 用jQuery实现复选框全选、反选与获取选中的复选框的值
  3. 51单片机的温湿度控制系统
  4. Geospark电火花使用再记录
  5. 新技术的福音:瘫痪者也能用眼睛写“微博”
  6. 西南科技大学 Python程序设计 班长选举
  7. matlab ifft取实部,[合集] matlab中IFFT的问题
  8. i了i了,这简直就是2020全网最全最强的MyBatis面试题!
  9. python单词怎么写_python 写的查单词的脚本
  10. 关闭各种广告弹窗……