Fortran中输出Tecplot格式
在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格式相关推荐
- 在JSP页面中输出JSON格式数据
JSON-taglib是一套使在JSP页面中输出JSON格式数据的标签库. JSON-taglib主页: http://json-taglib.sourceforge.net/index.html J ...
- .net mvc 在 cshtml 中输出 html 格式问题
在 cshtml 中输出 html ,如果html里带有格式,在直接输出的时候,就会出现问题. 例如: 在controller中定义: ViewBag.Content = "<p> ...
- 输出Tecplot格式的数据文件
Tecplot输出文件格式 如果想将你的云图数据输出,对于整块的块状结构数据,我的输出方法如下: #include <fstream> string fileName;//你的文件名 in ...
- matlab输出pcm格式文件
用cooledit打开的话,要用matlab输出为PCM格式. 在matlab中输出pcm格式要怎么做呢? 用法: fwrite(fileid,参数,格式): 为了用cooledit正确地打开,我们应 ...
- 取消c++所设置的cout中setprecision输出的格式
取消c++所设置的cout中setprecision输出的格式 C++11中可以这样写: std::cout << std::defaultfloat; C++11以前是这样写的: std ...
- 7-100 简单求阶乘问题 (10 分)本题要求编写程序,计算N的阶乘。输入格式:输入在一行中给出一个不超过12的正整数N。输出格式:在一行中输出阶乘的值。输入样例:4结尾无空行
7-100 简单求阶乘问题 (10 分) 本题要求编写程序,计算N的阶乘. 输入格式: 输入在一行中给出一个不超过12的正整数N. 输出格式: 在一行中输出阶乘的值. 样例">输入样例 ...
- java中时间输出的格式_Java 打印日期/时间格式
Java格式 - Java 打印日期/时间格式 Java 打印日期/时间格式处理日期,时间和日期时间值. Java 打印日期/时间格式可以应用于格式值为long,Long,java.util.Cale ...
- matlab数据转换为tecplot格式[ASCII码格式下的plt文件]
matlab数据转换为tecplot格式[ASCII码格式下的plt文件] 1 tecplot能读取的的常见ASCII格式 1.1 文件格式与文件头 1.2 zone相关的格式 2 一维数据 3 二维 ...
- fortran中类型
- 由于 GNU 的 Fortran 和 C 语言二者的函数彼此可以直接相互调用,所以混合编程可以非常容易地实现.只要你足够仔细,确保函数调用时传递的参数类型正确,函数就可以在两种语言间来回调用,就像 ...
最新文章
- facebook新无监督论文-Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
- ubuntu server中的一些小知识(个人收集贴)
- 阿里云媒体转码MTS使用教程
- Eigen入门之密集矩阵 3 - Array操作
- 【TI-ONE系列教程(二)】如何使用 TI-ONE 平台内置算子玩转算法大赛
- SQL Server中的快照隔离
- APT 组织将目标锁定Linux
- PHP与Unicode签名(BOM)
- 线性代数之 伪逆矩阵
- Windows XP 电脑桌面图标后面有蓝色阴影怎么去除
- javascript从入门到跑路-----小文的js学习笔记(11)--------字符串以及字符串的常见方法!
- HDLC和PPP协议总结
- 深入理解Risk aversion||风险偏好||Risk utility function
- JQuery从入门到实战
- 中关村e谷为产业搭台:中关村论坛(空天专场)黑科技亮相现场
- UI设计必备工具有哪些?
- [原创]使用FleaPHP框架构建简单留言本应用
- 《Adobe InDesign CS5中文版经典教程》—第1课1.2节工作区简介
- 2016年8月16日 星期二 --出埃及记 Exodus 16:17
- CCF考试——201412-4最优灌溉