reader Class Reference

Reads CCM files as written by PROSTAR/STARCCM. More...

Inheritance diagram for reader:
[legend]
Collaboration diagram for reader:
[legend]

Classes

class  options
 

Public Member Functions

 reader (const fileName &file, const reader::options &opts)
 Open a file for reading. More...
 
 ~reader ()
 Destructor (closes file) More...
 
const reader::optionsoption () const
 Reference to the reader options. More...
 
autoPtr< polyMeshmesh (const objectRegistry &registry, const fileName &remappingDictName=fileName::null)
 Construct the polyMesh from the read geometry. More...
 
bool hasGeometry ()
 Return true if file has geometry associated with it. More...
 
bool hasSolution ()
 Return true if file has solutions associated with it. More...
 
bool remapMeshInfo (const objectRegistry &registry, const fileName &remappingDictName=fileName::null)
 Remap cellTable and boundaryRegion according to dictionary. More...
 
void writeMesh (const polyMesh &mesh, IOstreamOption streamOpt=IOstreamOption(IOstreamOption::BINARY)) const
 Write the polyMesh. More...
 
void writeAux (const objectRegistry &registry) const
 Write cellTable, boundaryRegion and interface information. More...
 
bool readGeometry (const scalar scaleFactor=1.0)
 Detect and read geometry if possible. More...
 
void printInfo () const
 Print general information about the mesh. More...
 
void clearGeom ()
 Clear out some information after obtaining a polyMesh. More...
 
const labelListorigCellId () const
 Map to original cell Id. More...
 
const labelListorigFaceId () const
 Map to original face Id. More...
 
const interfaceDefinitionsinterfaceDefinitionsInfo () const
 Return interface definitions map. More...
 
const boundaryRegionboundaryTableInfo () const
 Return boundaryRegion table. More...
 
const cellTablecellTableInfo () const
 Return cell table. More...
 
Map< wordfluids () const
 Return a list of names corresponding to fluids. More...
 
Map< wordsolids () const
 Return a list of names corresponding to solids. More...
 
const solutionTablesolutions ()
 Return table of available solutions. More...
 
const fieldTablefields ()
 Return table of available fields. More...
 
const fieldTablelagrangian ()
 Return table of available lagrangian fields. More...
 
tmp< scalarFieldreadField (const word &solutionName, const word &fieldName, const bool wallData=false)
 Read solution and field combination. More...
 
- Public Member Functions inherited from base
 base ()
 Default construct. Initializes the global-state. More...
 
 ~base ()
 Destructor: close file. More...
 
bool close ()
 Explicitly close the file and terminate ccmio access. More...
 

Static Public Member Functions

static void warnDuplicates (const word &context, const wordList &lst)
 Warn about repeated name. More...
 

Additional Inherited Members

- Protected Types inherited from STARCDCore
enum  fileHeader { HEADER_CEL , HEADER_VRT , HEADER_BND }
 Enumeration defining the file headers. More...
 
enum  fileExt { CEL_FILE , VRT_FILE , BND_FILE , INP_FILE }
 Enumeration defining the file extensions. More...
 
enum  matlType {
  starcdFluidType = 1 , starcdSolidType = 2 , starcdBaffleType = 3 , starcdShellType = 4 ,
  starcdLineType = 5 , starcdPointType = 6
}
 Basic material type for STARCD/PROSTAR files. More...
 
enum  shapeType {
  starcdPoint = 1 , starcdLine = 2 , starcdShell = 3 , starcdHex = 11 ,
  starcdPrism = 12 , starcdTet = 13 , starcdPyr = 14 , starcdPoly = 255
}
 Shape-Type for STARCD/PROSTAR files. More...
 
- Protected Member Functions inherited from base
bool assertNoError (const char *msg) const
 check global state for errors and die as required More...
 
bool assertNoError (const std::string &msg) const
 check global state for errors and die as required More...
 
 base (const base &)=delete
 No copy construct. More...
 
void operator= (const base &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from STARCDCore
 STARCDCore ()=default
 Construct null. More...
 
- Static Protected Member Functions inherited from base
static bool assertNoError (int err, const char *msg)
 Die with msg if there is an error. More...
 
static bool assertNoError (int err, const std::string &msg)
 Die with msg if there is an error. More...
 
- Static Protected Member Functions inherited from STARCDCore
static bool readHeader (IFstream &is, const enum fileHeader header)
 Read header and check signature PROSTAR_(CELL|VERTEX|BOUNDARY) More...
 
static void writeHeader (Ostream &os, const enum fileHeader header)
 Write header for fileType (CELL|VERTEX|BOUNDARY) More...
 
static fileName starFileName (const fileName &baseName, const enum fileExt ext)
 Resolve base file-name for the given file-type. More...
 
static void removeFiles (const fileName &baseName)
 Remove existing PROSTAR files for the given base file-name. More...
 
static label readPoints (IFstream &is, List< point > &points, List< label > &ids)
 Read points from a (.vrt) file, return the max prostar id used. More...
 
static void writePoints (Ostream &os, const UList< point > &points, const scalar scaleFactor=1.0)
 Write header and points to (.vrt) file, optionally with scaling. More...
 
- Protected Attributes inherited from base
std::unique_ptr< ccmGlobalState > globalState_
 Maintain overall global states (error, root-node) More...
 
- Static Protected Attributes inherited from STARCDCore
static const Map< FixedList< int, 6 > > starToFoamFaceAddr
 Face addressing from PROSTAR faces to OpenFOAM faces. More...
 
static const Map< FixedList< int, 6 > > foamToStarFaceAddr
 Face addressing from OpenFOAM faces to PROSTAR faces. More...
 
static const char *const defaultBoundaryName
 The name for default (unassigned) boundaries. More...
 
static const char *const defaultSolidBoundaryName
 The name we have chosen for default (unassigned) solid boundaries. More...
 

Detailed Description

Reads CCM files as written by PROSTAR/STARCCM.

  • arbitrary polyhedral meshs
  • writes interfaces (baffles) to constant/polymesh/interfaces
  • experimental handling of monitoring (internal) boundaries
  • does not handle cyclics. Use createPatch to recreate these
  • does patch names only if they are in the problem description
  • reads cell and face solution data
  • reads Lagrangian data

The Default_Boundary_Region (region 0) is a special region that serves two purposes:

  1. it contains all wall and baffle boundaries that have not otherwise been assigned.
  2. it holds the outer bounds of flow domains (fluid/porous/solid)

The CCM node Meshes/FaceBasedTopology/Cells/Interfaces holds the mapping of the corresponding mesh faces, which can be used to merge these internal boundaries.

If solid cells exist, there are three possible courses of action:

  1. Remove all solid cells for subsequent flow calculations. This is the default.
  2. Treat solid cells like fluid cells, but convert the corresponding Default_Boundary_Region to Default_Boundary_Solid for easier identification. This treatment is useful for visualization purposes.
  3. Move solid cells to a separate mesh region. This would be useful for conjugate heat transfer, but is not implemented.
Files

The constant/remapping file is an IOdictionary that is READ_IF_PRESENT and can be used to remap certain information. eg,

    // rename/combine cellTable entries
    //   newName ( listOldNames );
    cellTable
    {
        fluid ( inletRegion outletRegion );
        cat1  ( CAT1 "cat1_(Back|Front|Gamma)" );
    }

    // rename boundary regions
    //   newName oldName;
    boundaryRegion
    {
        inlet_4  inlet_1;
        inlet_5  inlet_2;
        inlet_6  inlet_3;
    }

The constant/boundaryRegion file is an IOMap<dictionary> that is written. It contains the boundary type and names. eg,

    (
        0
        {
            BoundaryType    wall;
            Label           Default_Boundary_Region;
        }
        1
        {
            BoundaryType    inlet;
            Label           inlet_1;
        }
        ...

        4
        {
            BoundaryType    pressure;
            Label           outlet;
        }
    )

The constant/cellTable file is an IOMap<dictionary> that is written. It contains the cellTable information. eg,

    (
        1
        {
            Label           inletRegion;
            MaterialType    fluid;
            MaterialId      1;
        }
        2
        {
            Label           cat1;
            MaterialType    fluid;
            MaterialId      1;
            PorosityId      1;
        }
        3
        {
            Label           outletRegion;
            MaterialType    fluid;
            MaterialId      1;
        }
    )
Note
this class is still under development
  • any/all of the class names and members may change
Source files

Definition at line 183 of file ccmReader.H.

Constructor & Destructor Documentation

◆ reader()

reader ( const fileName file,
const reader::options opts 
)

Open a file for reading.

Definition at line 650 of file ccmReader.C.

References base::assertNoError(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, base::globalState_, Foam::isFile(), and reader::option().

Here is the call graph for this function:

◆ ~reader()

~reader ( )

Destructor (closes file)

Definition at line 709 of file ccmReader.C.

Member Function Documentation

◆ warnDuplicates()

void warnDuplicates ( const word context,
const wordList lst 
)
static

Warn about repeated name.

Definition at line 69 of file ccmReaderAux.C.

References Foam::endl(), HashTable< T, Key, Hash >::find(), forAllConstIters, Foam::Info, HashTable< T, Key, Hash >::insert(), Foam::nl, and UList< T >::size().

Here is the call graph for this function:

◆ option()

const Foam::ccm::reader::options & option ( ) const

Reference to the reader options.

Definition at line 717 of file ccmReader.C.

Referenced by reader::reader().

Here is the caller graph for this function:

◆ mesh()

Foam::autoPtr< Foam::polyMesh > mesh ( const objectRegistry registry,
const fileName remappingDictName = fileName::null 
)

Construct the polyMesh from the read geometry.

provide optional remapping dictionary

Definition at line 2600 of file ccmReaderMesh.C.

References IOobject::AUTO_WRITE, polyMesh::defaultRegion, mesh, meshPtr, Time::New(), and IOobject::NO_READ.

Here is the call graph for this function:

◆ hasGeometry()

bool hasGeometry ( )

Return true if file has geometry associated with it.

Definition at line 564 of file ccmReader.C.

◆ hasSolution()

bool hasSolution ( )

Return true if file has solutions associated with it.

Definition at line 571 of file ccmReader.C.

◆ remapMeshInfo()

bool remapMeshInfo ( const objectRegistry registry,
const fileName remappingDictName = fileName::null 
)

Remap cellTable and boundaryRegion according to dictionary.

Definition at line 592 of file ccmReader.C.

References dictionary::isDict(), IOobject::NO_WRITE, IOobject::READ_IF_PRESENT, and dictionary::subDict().

Here is the call graph for this function:

◆ writeMesh()

void writeMesh ( const polyMesh mesh,
IOstreamOption  streamOpt = IOstreamOption(IOstreamOption::BINARY) 
) const

Write the polyMesh.

Definition at line 578 of file ccmReader.C.

References Foam::endl(), Foam::Info, and mesh.

Here is the call graph for this function:

◆ writeAux()

void writeAux ( const objectRegistry registry) const

Write cellTable, boundaryRegion and interface information.

Definition at line 181 of file ccmReaderAux.C.

References IOstreamOption::ASCII, and IOstreamOption::BINARY.

◆ readGeometry()

bool readGeometry ( const scalar  scaleFactor = 1.0)

Detect and read geometry if possible.

Definition at line 535 of file ccmReader.C.

◆ printInfo()

void printInfo ( ) const

Print general information about the mesh.

Definition at line 522 of file ccmReader.C.

References Foam::endl(), Foam::Info, and Foam::nl.

Here is the call graph for this function:

◆ clearGeom()

void clearGeom ( )

Clear out some information after obtaining a polyMesh.

Definition at line 2580 of file ccmReaderMesh.C.

◆ origCellId()

const labelList & origCellId ( ) const
inline

Map to original cell Id.

Definition at line 510 of file ccmReader.H.

◆ origFaceId()

const labelList & origFaceId ( ) const
inline

Map to original face Id.

Definition at line 516 of file ccmReader.H.

◆ interfaceDefinitionsInfo()

const interfaceDefinitions & interfaceDefinitionsInfo ( ) const
inline

Return interface definitions map.

Definition at line 522 of file ccmReader.H.

◆ boundaryTableInfo()

const boundaryRegion & boundaryTableInfo ( ) const
inline

Return boundaryRegion table.

Definition at line 528 of file ccmReader.H.

◆ cellTableInfo()

const cellTable & cellTableInfo ( ) const
inline

Return cell table.

Definition at line 534 of file ccmReader.H.

◆ fluids()

Map< word > fluids ( ) const
inline

Return a list of names corresponding to fluids.

Definition at line 540 of file ccmReader.H.

References cellTable::fluids().

Here is the call graph for this function:

◆ solids()

Map< word > solids ( ) const
inline

Return a list of names corresponding to solids.

Definition at line 546 of file ccmReader.H.

References cellTable::solids().

Here is the call graph for this function:

◆ solutions()

const solutionTable & solutions ( )
inline

Return table of available solutions.

Definition at line 552 of file ccmReader.H.

◆ fields()

const fieldTable & fields ( )
inline

Return table of available fields.

Definition at line 559 of file ccmReader.H.

◆ lagrangian()

const fieldTable & lagrangian ( )
inline

Return table of available lagrangian fields.

Definition at line 566 of file ccmReader.H.

◆ readField()

Foam::tmp< Foam::scalarField > readField ( const word solutionName,
const word fieldName,
const bool  wallData = false 
)

Read solution and field combination.

Definition at line 356 of file ccmReaderSolution.C.

References cellId, UList< T >::data(), forAll, n, Time::New(), tmp< T >::ref(), and List< T >::setSize().

Here is the call graph for this function:

The documentation for this class was generated from the following files: