Boundary Conditions
CGNS MidLevel Library  Boundary Conditions
Boundary Conditions
 Boundary Condition Type and Location

cg_boco_write
 Write boundary condition type and data

cg_boco_normal_write
 Write boundary condition normals

cg_nbocos
 Get number of boundary condition in zone

cg_boco_info
 Get boundary condition info

cg_boco_read
 Read boundary condition data and normals

cg_boco_gridlocation_write
 Write boundary condition location

cg_boco_gridlocation_read
 Read boundary condition location
 Boundary Condition Datasets

cg_dataset_write
 Write boundary condition dataset info

cg_dataset_read
 Read boundary condition dataset info

cg_bcdataset_write
 Write family boundary condition dataset info

cg_bcdataset_info
 Get number of family boundary condition datasets

cg_bcdataset_read
 Read family boundary condition dataset info
 Boundary Condition Data

cg_bcdata_write
 Write boundary condition data
 Special Boundary Condition Properties

cg_bc_wallfunction_write
 Write wall function data

cg_bc_area_write
 Write arearelated data

cg_bc_wallfunction_read
 Read wall function data

cg_bc_area_read
 Read arearelated data
Boundary Condition Type and Location
Node: BC_t
(SIDS,
File Mapping)
Functions
 Modes

ier = cg_boco_write(int fn, int B, int Z, char *boconame,
BCType_t bocotype, PointSetType_t ptset_type, cgsize_t npnts,
cgsize_t *pnts, int *BC);

 w m

ier = cg_boco_normal_write(int fn, int B, int Z, int BC,
int *NormalIndex, int NormalListFlag,
DataType_t NormalDataType, void *NormalList);

 w m

ier = cg_boco_gridlocation_write(int fn, int B, int Z, int BC, GridLocation_t location);

 w m

ier = cg_nbocos(int fn, int B, int Z, int *nbocos);

r  m

ier = cg_boco_info(int fn, int B, int Z, int BC, char *boconame,
BCType_t *bocotype, PointSetType_t *ptset_type, cgsize_t *npnts,
int *NormalIndex, cgsize_t *NormalListSize,
DataType_t *NormalDataType, int *ndataset);

r  m

ier = cg_boco_read(int fn, int B, int Z, int BC, cgsize_t *pnts,
void *NormalList);

r  m

ier = cg_boco_gridlocation_read(int fn, int B, int Z, int BC, GridLocation_t *location);

r  m

call cg_boco_write_f(fn, B, Z, boconame, bocotype, ptset_type,
npnts, pnts, BC, ier)

 w m

call cg_boco_normal_write_f(fn, B, Z, BC, NormalIndex,
NormalListFlag, NormalDataType, NormalList, ier)

 w m

call cg_boco_gridlocation_write_f(fn, B, Z, BC, location, ier)

 w m

call cg_nbocos_f(fn, B, Z, nbocos, ier)

r  m

call cg_boco_info_f(fn, B, Z, BC, boconame, bocotype, ptset_type,
npnts, NormalIndex, NormalListSize, NormalDataType, ndataset,
ier)

r  m

call cg_boco_read_f(fn, B, Z, BC, pnts, NormalList, ier)

r  m

call cg_boco_gridlocation_read_f(fn, B, Z, BC, location, ier)

r  m

Input/Output
 fn 
 CGNS file index number.

 B 
 Base index number, where 1 ≤ B ≤ nbases .

 Z 
 Zone index number, where 1 ≤ Z ≤ nzones .

 BC 
 Boundary condition index number, where
1 ≤ BC ≤ nbocos .

 nbocos 
 Number of boundary conditions in zone Z .

 boconame 
 Name of the boundary condition.

 bocotype 
 Type of boundary condition defined.
See the eligible types for BCType_t in the
Typedefs section.
Note that if bocotype is FamilySpecified
the boundary condition type is being specified for the family
to which the boundary belongs.
The boundary condition type for the family may be read and written
using cg_fambc_read and
cg_fambc_write .

 ptset_type 
 The extent of the boundary condition may be defined using a range
of points or elements using PointRange , or using a
discrete list of all points or elements at which the boundary
condition is applied using PointList .
When the boundary condition is to be applied anywhere other than points,
then GridLocation_t under the BC_t node must
be used to indicate this.
The value of GridLocation_t may be read or written by
cg_boco_gridlocation_read and cg_boco_gridlocation_write .
As in previous versions of the library, this may also be done by
first using cg_goto
to access the BC_t node, then using
cg_gridlocation_read
or cg_gridlocation_write .

 npnts 
 Number of points or elements defining the boundary
condition region.
For a ptset_type of PointRange ,
npnts is always two.
For a ptset_type of PointList ,
npnts is the number of points or elements in the list.

 pnts 
 Array of point or element indices defining the boundary condition region.
There should be npnts values, each of dimension
IndexDimension
(i.e., 1 for unstructured grids, and 2 or 3 for structured grids
with 2D or 3D elements, respectively).

 NormalIndex 
 Index vector indicating the computational coordinate direction
of the boundary condition patch normal.

 NormalListFlag 
 Flag indicating if the normals are defined in NormalList
and are to be written out; 1 if they are defined, 0 if they're not.

 NormalListSize 
 If the normals are defined in NormalList ,
NormalListSize is the number of points
in the patch times phys_dim , the number of coordinates
required to define a vector in the field.
If the normals are not defined in NormalList ,
NormalListSize is 0.

 NormalDataType 
 Data type used in the definition of the normals.
Admissible data types for the normals are RealSingle and
RealDouble .

 NormalList 
 List of vectors normal to the boundary condition patch pointing
into the interior of the zone.

 ndataset 
 Number of boundary condition datasets for the current boundary
condition.

 location 
 Grid location used in the definition of the point set.
The currently admissible locations are Vertex (the default
if not given), and CellCenter . Interpretation of
CellCenter , and additional allowable values of grid location
depends on the base cell dimension. For CellDim =1,
CellCenter refers to line elements. For CellDim =2,
CellCenter refers to area elements, and the additional
value EdgeCenter is allowed. For CellDim =3,
CellCenter refers to volume elements, and in addition to
EdgeCenter , the values of FaceCenter ,
IFaceCenter , JFaceCenter , and KFaceCenter
may be used.

 ier 
 Error status.

Notes: (see CPEX 0031)
 The use of
ElementList
and ElementRange
for
ptset_type
is deprecated and should not be used
in new code for writing boundary conditions. These are still currently
accepted, but will be internally replaced with the appropriate values
of PointList/PointRange
and GridLocation_t
,
based on the base cell dimension.
 Code which reads older CGNS files, should handle
ElementList
and ElementRange
, however, since many older files contain
these specifications for ptset_type
.
Boundary Condition Datasets
Node: BCDataSet_t
(SIDS,
File Mapping)
Functions
 Modes

ier = cg_dataset_write(int fn, int B, int Z, int BC,
char *DatasetName, BCType_t BCType, int *Dset);

 w m

ier = cg_dataset_read(int fn, int B, int Z, int BC, int Dset,
char *DatasetName, BCType_t *BCType, int *DirichletFlag,
int *NeumannFlag);

r  m

call cg_dataset_write_f(fn, B, Z, BC, DatasetName, BCType, Dset,
ier)

 w m

call cg_dataset_read_f(fn, B, Z, BC, Dset, DatasetName, BCType,
DirichletFlag, NeumannFlag, ier)

r  m

Input/Output
 fn 
 CGNS file index number.

 B 
 Base index number, where 1 ≤ B ≤ nbases .

 Z 
 Zone index number, where 1 ≤ Z ≤ nzones .

 BC 
 Boundary condition index number, where
1 ≤ BC ≤ nbocos .

 Dset 
 Dataset index number, where
1 ≤ Dset ≤ ndataset .

 DatasetName 
 Name of dataset.

 BCType 
 Simple boundary condition type for the dataset.
The supported types are listed in the table of
Simple Boundary
Condition Types in the SIDS manual, but note that
FamilySpecified does not apply here.

 DirichletFlag 
 Flag indicating if the dataset contains Dirichlet data.

 NeumannFlag 
 Flag indicating if the dataset contains Neumann data.

 ier 
 Error status.

The above functions are applicable to BCDataSet_t
nodes
that are children of BC_t
nodes.
For BCDataSet_t
nodes that are children of a BC_t
node,
after accessing a particular BCDataSet_t
node using
cg_goto
, the
Point Set functions may be used to
read or write the locations at which the boundary conditions are to be
applied.
This is only applicable when the boundary conditions are to be applied
at locations different from those used with
cg_boco_write
to define the boundary
condition region (e.g., when the region is being defined by
specification of vertices, but the boundary conditions are to be applied
at face centers).
When writing point set data to a BCDataSet_t
node, in addition
to the specification of the indices using cg_ptset_write
, the
function cg_gridlocation_write
must also be used to specify the location of the data with respect to
the grid (e.g., Vertex
or FaceCenter
).
Functions
 Modes

ier = cg_bcdataset_write(char *DatasetName, BCType_t BCType,
BCDataType_t BCDataType);

 w m

ier = cg_bcdataset_info(int *ndataset);

r  m

ier = cg_bcdataset_read(int Dset, char *DatasetName, BCType_t *BCType,
int *DirichletFlag, int *NeumannFlag);

r  m

call cg_bcdataset_write_f(DatasetName, BCType, BCDataType, ier)

 w m

call cg_bcdataset_info_f(ndataset, ier)

r  m

call cg_bcdataset_read_f(Dset, DatasetName, BCType, DirichletFlag,
NeumannFlag, ier)

r  m

Input/Output
 Dset 
 Dataset index number, where
1 ≤ Dset ≤ ndataset .

 DatasetName 
 Name of dataset.

 BCType 
 Simple boundary condition type for the dataset.
The supported types are listed in the table of
Simple Boundary
Condition Types in the SIDS manual, but note that
FamilySpecified does not apply here.

 BCDataType 
 Type of boundary condition in the dataset (i.e., for a
BCData_t child node).
Admissible types are Dirichlet and Neumann .

 ndataset 
 Number of BCDataSet nodes under the current
FamilyBC_t node.

 DirichletFlag 
 Flag indicating if the dataset contains Dirichlet data.

 NeumannFlag 
 Flag indicating if the dataset contains Neumann data.

 ier 
 Error status.

The above functions are applicable to BCDataSet_t
nodes
that are used to define boundary conditions for a CFD family, and thus
are children of a FamilyBC_t
node.
The FamilyBC_t
node must first be accessed using
cg_goto
.
The first time cg_bcdataset_write
is called with a particular
DatasetName
, BCType
, and BCDataType
, a new
BCDataSet_t
node is created, with a child BCData_t
node.
Subsequent calls with the same DatasetName
and BCType
may be made to add additional BCData_t
nodes, of type
BCDataType
, to the existing BCDataSet_t
node.
Boundary Condition Data
Node: BCData_t
(SIDS,
File Mapping)
Functions
 Modes

ier = cg_bcdata_write(int fn, int B, int Z, int BC, int Dset,
BCDataType_t BCDataType);

 w m

call cg_bcdata_write_f(fn, B, Z, BC, Dset, BCDataType, ier)

 w m

Input/Output
 fn 
 CGNS file index number.

 B 
 Base index number, where 1 ≤ B ≤ nbases .

 Z 
 Zone index number, where 1 ≤ Z ≤ nzones .

 BC 
 Boundary condition index number, where
1 ≤ BC ≤ nbocos .

 Dset 
 Dataset index number, where
1 ≤ Dset ≤ ndataset .

 BCDataType 
 Type of boundary condition in the dataset.
Admissible boundary condition types are Dirichlet and
Neumann .

 ier 
 Error status.

To write the boundary condition data itself, after creating the
BCData_t
node using the function cg_bcdata_write
, use
cg_goto
to access the node,
then cg_array_write
to
write the data.
Note that when using cg_goto
to access a BCData_t
node, the node index should be specified as either Dirichlet
or
Neumann
, depending on the type of boundary condition.
See the description of cg_goto
for details.
Special Boundary Condition Properties
Node: BCProperty_t
(SIDS,
File Mapping)
Functions
 Modes

ier = cg_bc_wallfunction_write(int fn, int B, int Z, int BC,
WallFunctionType_t WallFunctionType);

 w m

ier = cg_bc_area_write(int fn, int B, int Z, int BC,
AreaType_t AreaType, float SurfaceArea, char *RegionName);

 w m

ier = cg_bc_wallfunction_read(int fn, int B, int Z, int BC,
WallFunctionType_t *WallFunctionType);

r  m

ier = cg_bc_area_read(int fn, int B, int Z, int BC,
AreaType_t *AreaType, float *SurfaceArea, char *RegionName);

r  m

call cg_bc_wallfunction_write_f(fn, B, Z, BC, WallFunctionType, ier)

 w m

call cg_bc_area_write_f(fn, B, Z, BC, AreaType, SurfaceArea,
RegionName, ier)

 w m

call cg_bc_wallfunction_read_f(fn, B, Z, BC, WallFunctionType, ier)

r  m

call cg_bc_area_read_f(fn, B, Z, BC, AreaType, SurfaceArea,
RegionName, ier)

r  m

Input/Output
 fn 
 CGNS file index number.

 B 
 Base index number, where
1 ≤ B ≤ nbases .

 Z 
 Zone index number, where
1 ≤ Z ≤ nzones .

 BC 
 Boundary condition index number, where
1 ≤ BC ≤ nbocos .

 WallFunctionType 
 The wall function type.
Valid types are CG_Null , CG_UserDefined , and
Generic .

 AreaType 
 The type of area.
Valid types are CG_Null , CG_UserDefined ,
BleedArea , and CaptureArea .

 SurfaceArea 
 The size of the area. (In Fortran, this is a Real*4 value.)

 RegionName 
 The name of the region, 32 characters max.

 ier 
 Error status.

The "write
" functions will create the BCProperty_t
node if it doesn't already exist, then add the appropriate boundary
condition property.
Multiple boundary condition properties may be recorded under the same
BCProperty_t
node.
The "read
" functions will return with ier
= 2 =
CG_NODE_NOT_FOUND
if the requested boundary condition property,
or the BCProperty_t
node itself, doesn't exist.