CGNS 格式

CGNS 格式简介及下载安装

CGNS 格式简介

CGNS (CFD General Notation System) 提供了通用、可移植、可扩展的标准, 用于存储和检索 CFD 分析数据. 该系统包含两部分:

  1. 用于记录数据的标准格式

  2. 读取、写入和修改数据的软件

CGNS 起源于1994年波音和 NASA 相关项目, 后于1999年移交给 CGNS Steering Committee. 其主要目标是可压缩粘性流动相关的数据,但也用于子集比如 Euler 流动、势流等.

Type Content
Grids Structured, unstructured, hybrid
Solution Data nodal, cell-centered, face-centered, edge-centered
Multizone Interface abutting, overset
Boundary condition
Equation flow equation, physical models
Time-Dependent Flow moving and deforming grids
unit dimensional or nondimensionalization
reference states
convergence history
cad geometry
user-defined data

CGNS 库通过 C 语言编写,不提供面向对象接口,更改后的源码必须明确标记

CGNS 库最初由 ADF (Advanced Data Format) 格式构建,但其缺少并行 IO 和数据压缩功能,因此后续转向 HDF5 并作为默认数据存储格式

CGNS 使用方法参考 CFD General Notation System Getting Started

CGNS 库下载安装

安装方法参考 (https://github.com/CGNS/CGNS)

  1. 下载源码包并解压
1
2
wget https://github.com/CGNS/CGNS/archive/refs/tags/v4.4.0.tar.gz
tar -xvf v4.4.0.tar.gz
  1. 检查 HDF5 是否已经安装,文档 (https://cgns.github.io/download.html) 中建议通过最新 HDF5 发行版编译 CGNS 库,不建议使用 1.10.0-patch1, 1.10.1 or 1.10.2 版本
1
2
$ apt list --installed | grep hdf5
libhdf5-dev/noble,now 1.10.10+repack-3.1ubuntu4 amd64 [installed,automatic]
  1. 编译 CGNS 包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd CGNS-4.4.0
# initialize the build tree
cmake .
# edit the control variables as needed (optional)
# CGNS_ENABLE_FORTRAN OFF => ON
# CMAKE_INSTALL_PREFIX /local/lib => /path/to/install
# press c: reconfigure build System
# press g: generate makefile
# press q: quit
ccmake .
# build library
make
# install
make install
  1. 配置环境变量
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#%Module

proc ModulesHelp {} {
puts stderr "Program: CGNS $::version"
puts stderr "Description: CFD General Notation System"
puts stderr "Home Page: https://cgns.github.io/index.html"
puts stderr "Github: https://github.com/CGNS"
puts stderr {}
}

set version 4.4.0
set prefix /home/user/Program/CGNS

module-whatis "CGNS -- CFD General Notation System"

setenv CGNS_HOME $prefix/CGNS-$version
setenv CGNS_INCLUDE $prefix/CGNS-$version/include
setenv CGNS_LIB $prefix/CGNS-$version/lib

Utilities

以下是安装的 CGNS 工具

Tool Description
cgnscheck a CGNS file validator
cgnscompress compress (remove extra space) from a CGNS file
cgnsdiff compare 2 CGNS files
cgnslist list the contents of a CGNS file
cgnsnames display all the standard data-name identifiers
cgnsupdate script to update a CGNS file to the current version
cgnsconvert convert a CGNS file to/from ADF/HDF5 format
adf2hdf script to convert a CGNS file from ADF to HDF5
hdf2adf script to convert a CGNS file from HDF5 to ADF
0%