无法打开 cgns 文件
好吧,这不是一个核心编程问题;而是一个核心问题。这更多是关于cgns(CFD通用符号系统)API的问题。
我从 ANSYS Fluent(首次在 Gambit 2.46 中创建)导出了一个网格/网格文件,并且编写了一个非常简单的 Fortran 程序来打开和关闭它(不执行任何其他操作)。为了检查文件是否损坏,我在 Tecplot 中绘制了它。
因此,当我使用 gfortran 和上述 cgns 进行编译并运行程序时,我收到此错误(作为 cg_error_exit_f() 的一部分)
ADF_Database_Open:文件不存在或不是 HDF5 文件
这是程序
program cavity
include "/usr/include/cgnslib_f.h"
call cg_open_f("Cavity.cgns",CG_MODE_READ,index_file,ier)
!check for error if so exit
if (ier .ne. CG_OK) then
call cg_error_exit_f()
end if
write(*,*)"I kind of opened the file?"
call cg_close_f(index_file,ier)
stop
end program cavity
我能够以 cgns 格式编写结构化和非结构化网格,没有任何问题。
我怀疑我正在使用的 cgns 库(Fedora 15 和 Scientific linux 6.1 中打包的版本 2.5.5)是为了仅支持 HDF5 而构建的,而导出的网格文件是以 ADF 格式编写的。
有什么办法可以避免这个问题或者添加 ADF 吗?顺便说一下,这两个发行版中都没有打包。还有其他与 cgns 版本 2.5.5 兼容的网格生成器吗?
我希望我说清楚了。需要任何进一步的信息,我会提供。
Okey, this is not a core programming question; it is more of a question regarding cgns (CFD general notational system) API.
I've exported a grid/mesh file from ANSYS Fluent (which was first created in Gambit 2.46), and I wrote a very simple Fortran program to open and close it (doing nothing else). To check the file is not corrupt I plotted it in Tecplot.
So, when I compiled using gfortran with the mentioned cgns and ran the program I got this error (as part of cg_error_exit_f())
ADF_Database_Open:File does not exist or is not a HDF5 file
Here is the program
program cavity
include "/usr/include/cgnslib_f.h"
call cg_open_f("Cavity.cgns",CG_MODE_READ,index_file,ier)
!check for error if so exit
if (ier .ne. CG_OK) then
call cg_error_exit_f()
end if
write(*,*)"I kind of opened the file?"
call cg_close_f(index_file,ier)
stop
end program cavity
I'm able to write both structured and unstructured grids in cgns format, without any problem.
I suspect the cgns library I'm using(version 2.5.5 packaged in Fedora 15 and Scientific linux 6.1) is built to support only HDF5, while the exported grid file is written in ADF format.
Any ideas to circumvent this or perhaps adding ADF? Which by the way is not packaged in both the distributions. Any other grid generator which is compatible with cgns version 2.5.5?
I hope I was clear. Any further info required, I would provide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有太多可能出错的地方,恐怕你没有完全缩小问题的范围。
您说您从 Fluent 导出了一个文件(它是什么类型的文件?确定!)。 cg_error_exit_f() 给您列出了一个错误。我假设您有上述例程的来源?在程序中包含一个 cgnslib_f.h 文件 - 里面有什么?我假设程序编译时没有任何类型的错误,因此这是一个文件格式问题,而不是 Fortran 问题。
再次验证 Fluent 生成的文件类型。
There is so much that could've gone wrong in here, and I'm afraid you didn't exactly narrow the problem down.
You said you exported a file from Fluent (what kind of a file is it? Be sure!). cg_error_exit_f() gave you an error listed. I'm assuming you have the source of the mentioned routines? In the program you include a cgnslib_f.h file - what's in it? I'm assumming the program compiled without errors of any kind, making this a file format question, not a fortran question.
Again, verify what kind of file Fluent produced.
当我遇到这种情况时,我发现了以下工具:
HDF2ADF
adf2hdf
它们位于 Ubuntu 上的 cgns-convert 软件包中,并且可能也可用于您的发行版。
When I ran into this situation, I discovered the following tools:
hdf2adf
adf2hdf
They are in the cgns-convert package on Ubuntu and are probably available for your distribution as well.