Package solvcon :: Module block :: Class Block
[hide private]
[frames] | no frames]

Class Block

source code

object --+
         |
        Block

Provide metric and connectivity information for unstructured-mesh block. In terms of APIs in the Block class, to build a block requires the following actions:

  1. build_interior: build up inner connectivity and call calc_metric to calculate metrics for interior meshes.
  2. build_boundary: build up information of boundary faces according to boundary conditions objects (BCs). Also "patch" the block with "unspecified" BC for boundary faces without related BC objects.
  3. build_ghost: build up information for ghost cells. Ghost cells is for treatment of boundary conditions in a solving code/logic. The build-up includes create ghost entities (nodes, faces, and cells itself) and their connectivity and metrics. The storage of interior meshed will be changed to make the storgae for both interior and ghost information contiguous.

Note: Prefixes: nd = node, fc = face, cl = cell; gst = ghost; sh = shared.

Instance Methods [hide private]
 
__init__(self, *args, **kw)
Initialization.
source code
 
__str__(self)
str(x)
source code
 
bind(self) source code
 
unbind(self) source code
BlockShape
create_shape(self)
Returns: the shape of this block.
source code
 
create_msd(self) source code
 
calc_metric(self)
Calculate metrics including normal vector and area of faces, and centroid coordinates and volume of cells.
source code
 
build_interior(self)
Build all remaining connectivity information out of cell node definition, and calculate metric.
source code
 
build_boundary(self, unspec_type=None, unspec_name='unspecified')
Build boundary faces according to face connectivity.
source code
 
build_ghost(self)
Build data for ghost cells and related information.
source code
tuple
_count_ghost(self)
Count number of ghost entities.
source code
 
_init_shared(self, ngstnode, ngstface, ngstcell)
Allocate arrays to stored data both for ghost and real/interior cells.
source code
 
_assign_ghost(self, ngstnode, ngstface, ngstcell)
Assign ghost arrays to lower portion of shared arrays.
source code
 
_reassign_interior(self, ngstnode, ngstface, ngstcell)
Reassign interior data stored in standalone ndarray object to upper portion of shared ndarray object.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  FCMND = 4
  CLMND = 8
  CLMFC = 6
Instance Variables [hide private]
  _fpdtype
dtype for the floating point data in the block instance.
  bclist
list of associated BC objects.
  blkn
serial number of the block.
  bndfcs
list of BC faces, contains BC face index and BC class serial number, respectively.
  clcnd
Central coordinates of cell.
  clfcs
List of faces in cell; arr[:,0] for the number.
  clgrp
Group index of cell.
  clnds
List of nodes in cell; arr[:,0] for the number.
  cltpn
Type of cell.
  clvol
Volume of cell.
  fcara
Area of face.
  fccls
Related cells for each face, contains belong, neibor (ghost as negative), neiblk, and neibcl (cell index in neighboring block), respectively.
  fccnd
Central coordinates of face.
  fcnds
List of nodes in face; arr[:,0] for the number.
  fcnml
Unit-normal vector of face.
  fctpn
Type of face.
  grpnames
list of names of cell groups.
  ndcrd
Node croodinate data.
Properties [hide private]
  fpdtype
  fpdtypestr
  fpptr
  _clib_solvcon
  ndim
  nnode
  nface
  ncell
  nbound
  ngstnode
  ngstface
  ngstcell

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kw)
(Constructor)

source code 

Initialization.

Parameters:
  • fpdtype - dtype for the floating point data.
  • ndim - spatial dimension.
  • nnode - number of nodes.
  • nface - number of faces.
  • ncell - number of cells.
  • nbound - number of BC faces.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

create_shape(self)

source code 
Returns: BlockShape
the shape of this block.

calc_metric(self)

source code 

Calculate metrics including normal vector and area of faces, and centroid coordinates and volume of cells.

Returns:
nothing.

build_interior(self)

source code 

Build all remaining connectivity information out of cell node definition, and calculate metric.

This method alters content in self object.

Returns:
nothing.

build_boundary(self, unspec_type=None, unspec_name='unspecified')

source code 

Build boundary faces according to face connectivity. If a face belongs to only one cell (i.e., has no neighboring cell), it is regarded as a boundary face.

This method alters content in self object.

Parameters:
  • unspec_type (solvcon.boundcond.BC) - BC type for the unspecified boundary faces. The default is solvcon.boundcond.unspecified.
  • unspec_name (str) - name for the unspecified BC.
Returns:
nothing.

build_ghost(self)

source code 

Build data for ghost cells and related information.

This method alters content in self object.

Returns:
nothing.

_count_ghost(self)

source code 

Count number of ghost entities. Number of nodes, faces, and cells for ghost can be determined according to boundary connectivities.

Nubmer of ghost cells is exactly the number of boundary faces.

Number of exterior faces for ghost cells is the total number of faces of ghost cells minus the number of boundary faces (which is shared between ghost cells and adjacent interior cells).

Number of exterior nodes for ghost cells is the total number of nodes of ghost cells minus the total number of nodes of boundary faces.

Returns: tuple
node, face, and cell number for ghost.

_init_shared(self, ngstnode, ngstface, ngstcell)

source code 

Allocate arrays to stored data both for ghost and real/interior cells.

This method alters content in self object.

Parameters:
  • ngstnode (int) - number of nodes for ghost cells.
  • ngstcell (int) - number of faces for ghost cells.
  • ngstcell (int) - number of ghost cells.
  • ngstface (int)
Returns:
nothing.

_assign_ghost(self, ngstnode, ngstface, ngstcell)

source code 

Assign ghost arrays to lower portion of shared arrays.

This method alters content in self object.

Parameters:
  • ngstnode (int) - number of nodes for ghost cells.
  • ngstcell (int) - number of faces for ghost cells.
  • ngstcell (int) - number of ghost cells.
  • ngstface (int)
Returns:
nothing.

_reassign_interior(self, ngstnode, ngstface, ngstcell)

source code 

Reassign interior data stored in standalone ndarray object to upper portion of shared ndarray object.

This method alters content in self object.

Parameters:
  • ngstnode (int) - number of nodes for ghost cells.
  • ngstcell (int) - number of faces for ghost cells.
  • ngstcell (int) - number of ghost cells.
  • ngstface (int)
Returns:
nothing.

Instance Variable Details [hide private]

bndfcs

list of BC faces, contains BC face index and BC class serial number, respectively. The type number definition follows Nasa 2D CESE code.

Property Details [hide private]

fpdtype

Get Method:
unreachable.fpdtype(self)

fpdtypestr

Get Method:
unreachable.fpdtypestr(self)

fpptr

Get Method:
unreachable.fpptr(self)

_clib_solvcon

Get Method:
unreachable._clib_solvcon(self)

ndim

Get Method:
unreachable.ndim(self)

nnode

Get Method:
unreachable.nnode(self)

nface

Get Method:
unreachable.nface(self)

ncell

Get Method:
unreachable.ncell(self)

nbound

Get Method:
unreachable.nbound(self)

ngstnode

Get Method:
unreachable.ngstnode(self)

ngstface

Get Method:
unreachable.ngstface(self)

ngstcell

Get Method:
unreachable.ngstcell(self)