pymech.core#
This module contains the classes for the data structures used by pymech.neksuite and pymech.simsonsuite. The Contents of core.py are reported at the bottom of this page.
HexaData#
The main data class is pymech.core.HexaData
which is a structure
for general and element by element information on data stored on hexahedral
element(s). The general information is constituted by:

integer 
number of spatial dimensions of the data 

integer 
number of elements included in 

integer 
number of curved sides (used only by Nek5000) 

string 
variables included in 


number of datapoints per element 

float 
simulation time of the file 

integer 
simulation time step of the file 

integer 
word size, i.e. double or single precision file 

string 
endianness of the file (little/big) 

extrema of all quantities stored 
The element by element data is stored in:


array containing element data 
Elem#
This class contains the data for one hexahedral element organised as follows:

array of floats 
x,y,z coordinates of each grid point 

array of floats 
radius of curvature of the element edges (Nek5000) 

array of strings 
defines the type of curvature 

array of floats 
u,v,w velocity at each grid point 

array of floats 
pressure at each grid point 

array of floats 
temperature at each grid point 

array of floats 
passive scalars at each grid point 

array of floats 
list of boundary condition parameters (Nek5000) 
DataLims#
This class contains the extrema of all quantities stored in the mesh.

array of floats 
max and min of x,y,z coordinates 

array of floats 
max and min of u,v,w velocity 

array of floats 
max and min of pressure 

array of floats 
max and min of temperature 

array of floats 
max and min of passive scalars 
Contents of core.py#
Core data structures for pymech
 class pymech.core.DataLims(elements)[source]#
A class containing the extrema of all quantities stored in the mesh
  pos
 Type:
x,y,z min,max
  vel
 Type:
u,v,w min,max
  pres
 Type:
p min,max
  temp
 Type:
T min,max
  scal
 Type:
s_i min,max
 class pymech.core.Elem(var, lr1, nbc, dtype='float64')[source]#
A class containing one hexahedral element of Nek5000/SIMSON flow field.
 Parameters:
var (iterable) – Iterable of integers of size 5, indicating how many variables are to be initialized
lr1 (iterable) – Iterable of integers of size 3, defining the shape of an element as
(lx, ly, lz)
nbc (int) – Number of boundary conditions
dtype (str) – Floating point data type. Typical values are ‘f4’ or ‘float32’ for single precision, ‘f8’ or ‘float64’ for double precision
 class pymech.core.HexaData(ndim, nel, lr1, var, nbc=0, dtype='float64')[source]#
A class containing data related to a hexahedral mesh
 check_bcs_present()[source]#
Returns True if and only if all faces of all elements have boundary conditions applied.
Note that this function returning False does not mean the mesh is invalid: it is not mandatory to define internal boundary conditions for Nek5000.
 check_connectivity(tol=0.001)[source]#
Check element connectivity, specifically for matching boundary conditions and geometry. Errors are reported as logging messages.
 Parameters:
tol (float) – relative tolerance (compared to the smallest edge of adjacent elements) for detecting whether faces are at the same location
 get_points()[source]#
Returns an array containing the coordinates of all the points in the mesh as a (nel, lx1*ly1*lz1, 3) array
 merge(other, tol=0.01, ignore_empty=True, ignore_all_bcs=False)[source]#
Merges another
pymech.core.HexaData
into the current one and connects it Parameters:
other (
pymech.core.HexaData
) – mesh to merge into selftol (float) – maximum distance, relative to the smallest edge of neighbouring elements, at which faces are considered touching
ignore_empty (bool) – if True, the faces with an empty boundary condition (‘’) will be treated as internal faces and will not be merged. This is useful if internal boundary conditions are not defined and will make the operation much faster, but requires boundary conditions to be defined on the faces to be merged.
ignore_all_bcs (bool) – if True, the boundary conditions will not be changed. This is likely to result in invalid boundary conditions at the interface between the merged meshes. This option is intended for fast merging in a situation in which the boundary conditions are either irrelevant or will be defined or corrected later.