Skip navigation links
(CGNS Documentation Home Page) (Steering Committee Charter) (Overview and Entry-Level Document) (A User's Guide to CGNS) (Mid-Level Library) (Standard Interface Data Structures) (SIDS File Mapping Manual) (CGIO User's Guide) (Parallel CGNS User's Guide) (ADF Implementation) (HDF5 Implementation) (Python Implementation) (CGNS Tools and Utilities)

(General Remarks) (File Operations) (Navigating a CGNS File) (Error Handling) (Structural Nodes) (Descriptors) (Physical Data) (Location and Position) (Auxiliary Data) (Grid Specification) (Solution Data) (Grid Connectivity) (Boundary Conditions) (Equation Specification) (Families) (Time-Dependent Data) (Links)

Solution Data

Flow Solution

Node: FlowSolution_t (SIDS, File Mapping)

Functions Modes
ier = cg_sol_write(int fn, int B, int Z, char *solname,
      GridLocation_t location, int *S);
- w m
ier = cg_nsols(int fn, int B, int Z, int *nsols); r - m
ier = cg_sol_info(int fn, int B, int Z, int S, char *solname,
      GridLocation_t *location);
r - m
ier = cg_sol_ptset_write(int fn, int B, int Z, const char *solname,
      GridLocation_t location, PointSetType_t ptset_type,
      cgsize_t npnts, const cgsize_t *pnts, int *S);
- w m
ier = cg_sol_ptset_info(int fn, int B, int Z, int S,
      PointSetType_t *ptset_type, cgsize_t *npnts);
r - m
ier = cg_sol_ptset_read(int fn, int B, int Z, int S, cgsize_t *pnts); r - m
ier = cg_sol_size(int fn, int B, int Z, int S, int *data_dim,
      cgsize_t *dim_vals);
r - m
call cg_sol_write_f(fn, B, Z, solname, location, S, ier) - w m
call cg_nsols_f(fn, B, Z, nsols, ier) r - m
call cg_sol_info_f(fn, B, Z, S, solname, location, ier) r - m
call cg_sol_ptset_write_f(fn, B, Z, solname, location, ptset_type,
      npnts, pnts, S, ier);
- w m
call cg_sol_ptset_info_f(fn, B, Z, S, ptset_type, npnts, ier); r - m
call cg_sol_ptset_read_f(fn, B, Z, S, pnts, ier); r - m
call cg_sol_size_f(fn, B, Z, S, data_dim, dim_vals, ier); r - m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
S Flow solution index number, where 1 ≤ Snsols.
nsols Number of flow solutions for zone Z.
solname Name of the flow solution.
location Grid location where the solution is recorded. The current admissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
ptset_type Type of point set defining the interface in the current solution; either PointRange or PointList.
npnts Number of points defining the interface in the current solution. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
pnts Array of points defining the interface in the current solution.
data_dim Number of dimensions defining the solution data. If a point set has been defined, this will be 1, otherwise this will be the current zone index dimension.
dim_vals The array of data_dim dimensions for the solution data.
ier Error status.

The above functions are used to create, and get information about, FlowSolution_t nodes.

Solution data may be specified over the entire zone, as in previous versions of the library, using cg_sol_write or over a patch region of the zone using cg_sol_ptset_write. The two are mutually exclusive. In the first case, the size of the solution data is determined by the size of the zone, the grid location, and rind data (if any) as in previous versions. In the second case the solution data size is entirely determined by the PointList/PointRange patch. In order to determine which of the two forms in which the solution data was written, use cg_sol_ptset_info. If the solution is over the entire zone, ptset_type will be returned as CG_Null and npnts as 0. Otherwise, ptset_type will be either PointList or PointRange, and the number of points will be returned in npnts.

To assist in determining the size of the solution data, the function cg_sol_size has been added. For a solution defined over the full zone, data_dim returns the index dimension for the zone, and dim_vals specifies the dimensions of the data, corrected for the grid location type and rind data. If a point set patch has been specified, data_dim will be 1 and dim_vals will contain the total size of the patch.

Acceptable values of GridLocation_t are Vertex and CellCenter. If the base cell dimension is 2 or greater (surface or volume), then EdgeCenter is also allowed. For 3 dimensional bases, FaceCenter, and for structured zones, IFaceCenter, JFaceCenter and KFaceCenter, are also acceptable.

Flow Solution Data

Functions Modes
ier = cg_field_write(int fn, int B, int Z, int S,
      DataType_t datatype, char *fieldname, void *solution_array,
      int *F);
- w m
ier = cg_field_partial_write(int fn, int B, int Z, int S,
      DataType_t datatype, char *fieldname, cgsize_t *range_min,
      cgsize_t *range_max, void *solution_array, int *F);
- w m
ier = cg_field_general_write(int fn, int B, int Z, int S, char *fieldname,
      DataType_t datatype, cgsize_t *range_min, cgsize_t *range_max,
      DataType_t mem_datatype, int mem_rank, cgsize_t *mem_dimensions,
      cgsize_t *mem_range_min, cgsize_t *mem_range_max,
      void *solution_array, int *F);
- w m
ier = cg_nfields(int fn, int B, int Z, int S, int *nfields); r - m
ier = cg_field_info(int fn, int B, int Z, int S, int F,
      DataType_t *datatype, char *fieldname);
r - m
ier = cg_field_read(int fn, int B, int Z, int S, char *fieldname,
      DataType_t mem_datatype, cgsize_t *range_min, cgsize_t *range_max,
      void *solution_array);
r - m
ier = cg_field_general_read(int fn, int B, int Z, int S, char *fieldname,
      cgsize_t *range_min, cgsize_t *range_max,
      DataType_t mem_datatype, int mem_rank, cgsize_t *mem_dimensions,
      cgsize_t *mem_range_min, cgsize_t *mem_range_max,
      void *solution_array);
r - m
call cg_field_write_f(fn, B, Z, S, datatype, fieldname,
     solution_array, F, ier)
- w m
call cg_field_partial_write_f(fn, B, Z, S, datatype, fieldname,
     range_min, range_max, solution_array, F, ier)
- w m
call cg_field_general_write_f(fn, B, Z, S, fieldname, datatype,
     range_min, range_max, mem_datatype, mem_rank, mem_dimensions,
     mem_range_min, mem_range_max, solution_array, F, ier);
- w m
call cg_nfields_f(fn, B, Z, S, nfields, ier) r - m
call cg_field_info_f(fn, B, Z, S, F, datatype, fieldname, ier) r - m
call cg_field_read_f(fn, B, Z, S, fieldname, mem_datatype, range_min,
     range_max, solution_array, ier)
r - m
call cg_field_general_read_f(fn, B, Z, S, fieldname,
     range_min, range_max, mem_datatype, mem_rank, mem_dimensions,
     mem_range_min, mem_range_max, solution_array, ier);
r - m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
S Flow solution index number, where 1 ≤ Snsols.
F Solution array index number, where 1 ≤ Fnfields.
nfields Number of data arrays in flow solution S.
datatype Data type of the solution array written to the file. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
fieldname Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to insure file compatibility.
range_min Lower range index in file (eg., imin, jmin, kmin).
range_max Upper range index in file (eg., imax, jmax, kmax).
mem_datatype Data type of an array in memory. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
mem_rank Number of dimensions of array in memory.
mem_dimensions Dimensions of array in memory.
mem_range_min Lower range index in memory (eg., imin, jmin, kmin).
mem_range_max Upper range index in memory (eg., imax, jmax, kmax).
solution_array Array of solution values.
ier Error status.

The above functions are used to read and write solution arrays stored below a FlowSolution_t node.

When writing, the function cg_field_write will automatically write the full range of the solution (i.e., the entire solution_array). The functions cg_field_partial_write and cg_field_general_write may be used to write only a subset of solution_array. When using the partial write, any existing data from range_min to range_max will be overwritten by the new values. All other values will not be affected.

The function cg_field_read returns the solution array fieldname, for the range prescribed by range_min and range_max. The array is returned to the application in the data type requested in mem_datatype. This data type does not need to be the same as the one in which the data is stored in the file. A solution array stored as double precision in the CGNS file can be returned to the application as single precision, or vice versa. The functions cg_field_general_read and cg_field_general_write allow for type conversion when both reading from and writing to the file.

In Fortran, when using cg_field_read_f to read a 2D or 3D solution, the extent of each dimension of solution_array must be consistent with the requested range. When reading a 1D solution, the declared size can be larger than the requested range. For example, for a 2D zone with 100 × 50 vertices, if range_min and range_max are set to (11,11) and (20,20) to read a subset of the solution, then solution_array must be dimensioned (10,10). If solution_array is declared larger (e.g., (100,50)) the indices for the returned array values will be wrong. These restrictions can be avoided by using cg_field_general_read_f instead.

When using cg_field_general_write and cg_field_general_read, the lower core locations in the file have index 1 for defining range_min and range_max; whereas for the array in memory, defined by mem_rank and mem_dimensions, the lower array locations in memory have index 1 for defining mem_range_min and mem_range_max. The actual lower and upper bounds of the array in memory can be anything. For example, to fully read a two-dimensional 6 × 6 solution array with 1 rind plane on each side in the file to an 8 × 8 array in memory (mem_rank = 2 and mem_dimensions = (8,8)), set range_min and range_max to (0,0) and (7,7), and set mem_range_min and mem_range_max to (1,1) and (8,8).

Discrete Data

Node: DiscreteData_t (SIDS, File Mapping)

Functions Modes
ier = cg_discrete_write(int fn, int B, int Z, char *DiscreteName,
      int *D);
- w m
ier = cg_ndiscrete(int fn, int B, int Z, int *ndiscrete); r - m
ier = cg_discrete_read(int fn, int B, int Z, int D,
      char *DiscreteName);
r - m
ier = cg_discrete_ptset_write(int fn, int B, int Z, const char *DiscreteName,
      GridLocation_t location, PointSetType_t ptset_type,
      cgsize_t npnts, const cgsize_t *pnts, int *D);
- w m
ier = cg_discrete_ptset_info(int fn, int B, int Z, int D,
      PointSetType_t *ptset_type, cgsize_t *npnts);
r - m
ier = cg_discrete_ptset_read(int fn, int B, int Z, int D, cgsize_t *pnts); r - m
ier = cg_discrete_size(int fn, int B, int Z, int D, int *data_dim,
      cgsize_t *dim_vals);
r - m
call cg_discrete_write_f(fn, B, Z, DiscreteName, D, ier) - w m
call cg_ndiscrete_f(fn, B, Z, ndiscrete, ier) r - m
call cg_discrete_read_f(fn, B, Z, D, DiscreteName, ier) r - m
call cg_discrete_ptset_write_f(fn, B, Z, DiscreteName, location, ptset_type,
      npnts, pnts, D, ier);
- w m
call cg_discrete_ptset_info_f(fn, B, Z, D, ptset_type, npnts, ier); r - m
call cg_discrete_ptset_read_f(fn, B, Z, D, pnts, ier); r - m
call cg_discrete_size_f(fn, B, Z, D, data_dim, dim_vals, ier); r - m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
D Discrete data index number, where 1 ≤ Dndiscrete.
ndiscrete Number of DiscreteData_t data structures under zone Z.
DiscreteName Name of DiscreteData_t data structure.
location Grid location where the discrete data is recorded. The current admissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
ptset_type Type of point set defining the interface for the discrete data; either PointRange or PointList.
npnts Number of points defining the interface for the discrete data. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the list.
pnts Array of points defining the interface for the discrete data.
data_dim Number of dimensions defining the discrete data. If a point set has been defined, this will be 1, otherwise this will be the current zone index dimension.
dim_vals The array of data_dim dimensions for the discrete data.
ier Error status.

DiscreteData_t nodes are intended for the storage of fields of data not usually identified as part of the flow solution, such as fluxes or equation residuals.

The description for these functions is similar to the FlowSolution_t node as described above. To read and write the discrete data, use cg_goto to access the DiscreteData_t node, then cg_array_read and cg_array_write. The dimensions provided to the array-write family of functions must match the dimensions specified by the Zone_t and DiscreteData_t nodes. Use cg_gridlocation_write and cg_rind_write under the DiscreteData_t node, as required.

Zone Subregions

Node: ZoneSubRegion_t (SIDS, File Mapping)

Functions Modes
ier = cg_nsubregs(int fn, int B, int Z, int *nsubregs); r - m
ier = cg_subreg_info(int fn, int B, int Z, int S, char *regname,
      int *dimension, GridLocation_t *location,
      PointSetType_t *ptset_type, cgsize_t *npnts,
      int *bcname_len, int *gcname_len);
r - m
ier = cg_subreg_ptset_read(int fn, int B, int Z, int S, cgsize_t *pnts); r - m
ier = cg_subreg_bcname_read(int fn, int B, int Z, int S, char *bcname); r - m
ier = cg_subreg_gcname_read(int fn, int B, int Z, int S, char *gcname); r - m
ier = cg_subreg_ptset_write(int fn, int B, int Z, const char *regname,
      int dimension, GridLocation_t location,
      PointSetType_t ptset_type, cgsize_t npnts,
      const cgsize_t *pnts, int *S);
- w m
ier = cg_subreg_bcname_write(int fn, int B, int Z, const char *regname,
      int dimension, const char *bcname, int *S);
- w m
ier = cg_subreg_gcname_write(int fn, int B, int Z, const char *regname,
      int dimension, const char *gcname, int *S);
- w m
call cg_nsubregs_f(fn, B, Z, nsubregs, ier) r - m
call cg_subreg_info_f(fn, B, Z, S, regname, dimension, location,
      ptset_type, npnts, bcname_len, gcname_len, ier)
r - m
call cg_subreg_ptset_read_f(fn, B, Z, S, pnts, ier) r - m
call cg_subreg_bcname_read_f(fn, B, Z, S, bcname, ier) r - m
call cg_subreg_gcname_read_f(fn, B, Z, S, gcname, ier) r - m
call cg_subreg_ptset_write_f(fn, B, Z, regname, dimension, location,
      ptset_type, npnts, pnts, S, ier)
- w m
call cg_subreg_bcname_write_f(fn, B, Z, regname, dimension, bcname, S, ier) - w m
call cg_subreg_gcname_write_f(fn, B, Z, regname, dimension, gcname, S, ier) - w m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
S ZoneSubRegion index number, where 1 ≤ Snsubregs.
nsubregs Number of ZoneSubRegion_t nodes under Zone Z.
regname Name of the ZoneSubRegion_t node,
dimension Dimensionality of the subregion, 1 for lines, 2 for faces, 3 for volumes,
location Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
ptset_type Type of point set defining the interface for the subregion data; either PointRange or PointList.
npnts Number of points defining the interface for the subregion data. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
pnts Array of points defining the interface for the subregion data.
bcname The name of a BC_t node which defines the subregion.
gcname The name of a GridConnectivity_t or GridConnectivity1to1_t node which defines the subregion.
bcname_len String length of bcname.
gcname_len String length of gcname.
ier Error status.

These functions allow for the specification of Zone subregions. The subregion may be specified as either the name of an existing BC_t node (cg_subreg_bcname_write), an existing GridConnectivity_t or GridConnectivity1to1_t node (cg_subreg_gcname_write), or as a PointSet/PointRange (cg_subreg_ptset_write). These specifications are mutually exclusive. To determine the type of the subregion, use cg_subreg_info. If the subregion is a point set, then ptset_type will indicate the point set type (either PointList or PointRange) and npts will be set to the number of points to define the region. Otherwise, ptset_type will be set to CG_Null and npnts will be 0. In this case, one of bcname_len or gcname_len will be non-zero, indicating whether the ZoneSubRegion references a BC_t node (bcname_len non-zero) or GridConnectivity_t node (gcname_len non-zero).