skip to content


CGNS Implementation


CONTENTS



WHAT IS CGNS?

CGNS, which stands for "CFD General Notation System," was originally developed in the mid-1990's as a joint effort between Boeing, MDC, and NASA. It is an effort to standardize CFD input and output, including grid, flow solution, connectivity, BC's, and auxiliary information (in much the same way that the PLOT3D-format has become the de-facto standard for grids and flow solutions). CGNS also allows for file-stamping and user-inserted-commenting. It employs either ADF (Advanced Data Format) from Boeing or HDF-5 from NCSA, two systems which create unformatted files that are portable across computer platforms.

Return To Top


WHY CGNS?

CGNS will eventually eliminate most of the "translator" programs now necessary when working between machines and between CFD codes. Also, it eventually may allow for the results from one code to be easily restarted using another code. It will hopefully therefore save a lot of time (and money). In particular, it is hoped that future grid-generation packages will generate grids WITH ALL CONNECTIVITY AND BC INFORMATION INCLUDED as part of a CGNS file, saving a lot of time and avoiding potential costly errors in setting up this information after-the-fact.

Return To Top


HOW CGNS HAS BEEN IMPLEMENTED INTO CFL3D:

Basically, what the current implementation of CGNS in CFL3D means is that the old GRID and RESTART files are now replaced with one CGNS file. The input file is unchanged (except for the filename on line 2, which now refers to the CGNS file rather than a "standard" grid file). All old cases that could be run before with CFL3D should still run with CGNS and give identical results.

Changes to the original CFL3D code are relatively minimal. However, extra "high-level" routines that access the CGNS calls have been added in the file cgnstools.F. Starting with Version 6.4, CGNS-related output is no longer mixed in with the standard output file (cfl3d.out), but is now written to a separate file (cgnsinfo.out).

All of the extra routines required to read and write the CGNS file utilize the "mid-level library" (see http://www.cgns.org). The user is responsible for downloading the CGNS library directly from the CGNS website and installing it appropriately. In the CFL3D code, the parameter "icgns" controls whether CGNS files are used or not.

With CGNS, CFL3D no longer needs to read from or write to a separate restart file. However, the input file has purposefully been kept unchanged (i.e., line 14 of the input file, which specifies the file name of the restart file when CGNS is not used, is read in but ignored when CGNS is employed). For now, CFL3D still gets the BC's and 1-to-1 information from the standard input file. (This information is also put in the CGNS file, although it is not used by CFL3D.) It is assumed that in the future, one may desire to read these items from the CGNS file, and shorten the standard input file. But we have deferred this for now.

Some advantages to the fact that the restart file is a CGNS file are:

In other words, with CGNS, some day all that user will need is the CGNS file to get anything and everything he/she wants, from restarting to postprocessing. In fact, many commercial postprocessors already support CGNS files. However, CFL3D still prints out the "usual" PLOT3D-type files, in case they are needed, as well as other auxiliary files (like cfl3d.res, cfl3d.out, etc.) that are normally printed out. But, really, EVERYTHING is contained in the CGNS file! This is particularly useful because (a) all flow solution variables and turbulence information is in one file, and (b) if you want to keep track of your solution's progress as it is running, you can use the iwrest parameter to write out the CGNS file (=restart file) periodically and look at it via a postprocessor.

The user is encouraged to obtain the CGNS file viewer "adfviewer" (available from the CGNS website). It is very easy to use and should be self-explanatory.

Note that when CFL3D is run with mesh sequencing, AND IS STOPPED AT A LEVEL LOWER THAN THE FINEST GRID, there is no easy way to handle this with CGNS, since the CGNS file contains the FINE grid only. With "standard" CFL3D, the restart file would contain the coarser grid and solution only. With CGNS, it was decided to write out the coarse-grid FlowSolution ON THE FINE GRID, with data repeated in neighboring cells. Hence, if you plot the solution, it will be identical to the coarse grid solution, only all the fine-grid gridpoints will be used. A node called "Information" under "FlowSolution" says something like: Every-2nd-cell solution (1 level down)

Note that PATCHING and OVERSET information have not yet been included in the CGNS-part of CFL3D. I.e., the CGNS files are purposefully missing this information. The user can still run patched and overset cases with CGNS, but the patched/overset connectivity information (which is created by ronnie/maggie and placed in separate binary files) is never put into the CGNS file itself. This is similar to the "normal" mode of running CFL3D. In the "normal" mode, the user must have available a grid file, restart file, patched-info file, and overset-info file when running with patched/overset. With CGNS, the user must have available a CGNS file, patched-info file, and overset-info file.

Also, the "IMOVIE" option currently writes out multiple-time flowfield information to the plot3d file only, and not to the CGNS file. Similarly, when using iteravg to compute a running long-time-average of the solution, this is currently only written to the plot3d files cfl3d_avgg.p3d and cfl3d_avgq.p3d, and not to the CGNS file.

Also note that when using a CGNS grid file, NGRID (whose sign usually determines whether a grid of type CFL3D or PLOT3D is being read) in the CFL3D input file can be either + or -; i.e., its sign is irrelevant.

Finally, CFL3D currently writes out solution information to the CGNS file both at CELL CENTERS as well as within one rind cell at all boundaries. This is necessary in the long-term so that plotting packages will be able to extract correct BOUNDARY data (e.g., velocity=0 on solid surfaces) from the CGNS file. However, note that at the current time the BCs are not updated immediately prior to writing out the CGNS file, so the rind cells are "behind" by one iteration; this can mean "imperfect" matching at interfaces or slightly non-zero velocities on solid surfaces when plotting from the CGNS file, particularly if the solution is far from convergence.

Return To Top


EXAMPLE CGNS FILE:

Example screen shots from adfviewer showing the layout of a typical CGNS file from CFL3D are given here (this is a single zone case):

You can download the actual CGNS file used to obtain the above screen shots here: ExampleN4412cgns.tar.gz... gzipped tar file (1.6 MB). This file was created using CGNS Version 2.4 software, with ADF method of data storage (HDF-5 method is also an available option).

Return To Top


HOW TO TRY CGNS:

Return To Top


AUXILIARY PROGRAMS:

Three auxiliary programs are currently available in CFL3D's "Tools" directory. These programs are all you need to get started using CGNS!

plot3dg_to_cgns.F............program to convert a "standard" grid
                             file to a CGNS grid file (also needs
                             to read CFL3D input file in order to
                             capture BC and 1-to-1 connectivity info)

cgns_to_cfl3dinput.F.........program to read an existing CGNS file
                             and create a first-guess skeleton CFL3D
                             input file with most of the needed 
                             relevant information in it

cgns_readhist.F..............program to read an existing CGNS file
                             and write out its convergence history
                             information to a separate formatted file

Return To Top


WHAT DIFFERENCE DOES CGNS MAKE?

Notice, in running CFL3D under CGNS, there is now only ONE file (the CGNS file) rather than TWO (grid+restart). This CGNS file contains the grid and the solution. It is used for restarting, and, if you have a CGNS-compatable postprocessor, for visualizing as well. (Note: if you are using a LINK or LINKS within your CGNS file, then more than one CGNS files are needed).

The CGNS file is A MACHINE-INDEPENDENT file. You can port this file to any machine anywhere, and any code that is CGNS-compliant will be able to read it.

So now you can easily run CFL3D on different machines and transfer the grids and solutions back and forth without need for special translators. You can also run a case and send the resulting CGNS file to a fellow engineer across the country (who has a CGNS-compatable postprocessor), and they will be able to easily view it, without worry about what machine it ran on. In the future, as more and more CFD codes become CGNS-compliant, it will be easier to restart solutions from one code to another.


KNOWN PROBLEMS

Return To Top


DISCLAIMER

Please let us know if you have any problems or find any bugs with CFL3D's implementation of CGNS. We also welcome comments as to the usefulness of the CGNS system.

Return To Top


 


Privacy Act Statement

Responsible NASA Official: Christopher Rumsey
Page Curator: Christopher Rumsey
Last Updated: 03/29/2013