g3d.mesh.geo package
Subpackages
- g3d.mesh.geo.region package
- Submodules
- g3d.mesh.geo.region.block_region module
- g3d.mesh.geo.region.box_region module
- g3d.mesh.geo.region.cylinder_region module
- g3d.mesh.geo.region.ijk_region module
- g3d.mesh.geo.region.prism_region module
- g3d.mesh.geo.region.region module
- g3d.mesh.geo.region.sphere_region module
- g3d.mesh.geo.region.xyz_region module
- Module contents
Submodules
g3d.mesh.geo.block module
mesh building block - Block class definition
- class g3d.mesh.geo.block.Block(*args: Any, **kwargs: Any)[source]
Bases:
Coordinatesclass Block (mesh block), extends class Coordinates
- Attributes:
X- return:
Y- return:
Z- return:
chighglobal cell index of last cell in block
clowglobal cell index of first cell in block
coordinatesblock node coordinates
edgeslist of block edges
filenamemesh file filename
immesh-block number
n_cellsnumber of cells in block
n_nodesnumber of nodes in block
nhighglobal node index of last node in block
ninumber of nodes in the i-direction
njnumber of nodes in the j-direction
nknumber of nodes in the k-direction
nlowglobal node index of first node in block
nmcaccumulated cell count in blocks with lower block number
nmpaccumulated node count in blocks with lower block number
posfile position (file record pointer)
size- return:
tagtag (string) used for identification
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
add_Coord(c)add coordinate to block coordinate list input: Coordinate (c)
add_Edge(e[, edge_def])add edge to block edge list input: Edge (e), edge definition in block reference (optional input)
allocate(*args, **kwargs)allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=
allocate_XYZ([N])allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)
allocate coordinate vectors used for mesh smooth operator
apply_face_coordinates(face)copies face coordinate vector data to Block coordinate placeholders input: Face f
backup_is_allocated()cell_get_ijk(kc)get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)
check_face_block_bounds(kc, ld)check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)
checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()
copy(b)copies block definition from specified block input: block example: copy(Block b)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_rotate_Edge(face_def, alpha, **kwargs)copy_rotate_Face(face_def, npk, alpha, **kwargs)export_XY(f)writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)
export_XYZ(f)writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)
extrude_Face(face_def, edge)face_offset(original_face, offset_dist, ...)generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)
fill([vol_def])fill_2D([w])fill_Face(face_def)get_Coord(lp, **kwargs)get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)
get_Coord_by_tag(tag)get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)
get_Coord_from_IJK(i, j, k, **kwargs)get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)
get_Edge(i0, j0, k0, idir, npi)get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)
get_Edge_by_tag(tag)get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)
get_Face(N[, normal])gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)
get_X([lp])get_XYZ([lp])get_XYZ_from_IJK(i, j, k)get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)
get_X_from_IJK(i, j, k)get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)
get_Y([lp])get_Y_from_IJK(i, j, k)get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)
get_Z([lp])get_Z_from_IJK(i, j, k)get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)
return block node counts input: no input example: ni, nj, nk = get_block_sizes()
get_cell(i, j, k)returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)
returns block range of cell pointers input: no input example: lc = get_cell_pointers()
get_def()returns block definition input: no input example: im, ni, nj, nk = get_def()
returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()
get_extreme_values()get_face_pointers(face_def)returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction
get_from_backup([reset_bak])get_glue_pointers(face_def[, face_type])get_index(i, j, k)returns local node index input: i, j, k (1-based indices) example:
get_node(i, j, k)returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)
returns block range of node pointers input: no input example: lp = get_node_pointers()
get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()import_XY(f)reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)
import_XYZ(f)reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)
initialize face lists based on block definition
node_get_ijk(kp)get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)
populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input
print()prints block definition, block cell and node count
print_XYZ(face_def)prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)
read_from_file(f)remove_Coord_by_tag(tag)remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)
remove_Edge_by_tag(tag)remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)
reset coordinate vectors used for mesh smooth operator
rotate(**kwargs)scale(sf)scale block coordinates input: scale factor (sf) example: scale(sf)
scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])scatter_face_XYZ(plt, face_def[, m])generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = 'o')
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for Block class: 'filename', 'pos', 'ni', 'nj', 'nk' example: set_from_key_value(key, value)
shift(**kwargs)shift_Face(face_def, **kwargs)smooth_Face(face_def)smooth_apply(face_def)updates node and cell counts
write_to_file(f)backup
nullify
print_extreme_values
reset_XYZ
- add_Edge(e: Edge, edge_def: list | None = None) None[source]
add edge to block edge list input: Edge (e), edge definition in block reference (optional input)
- allocate(*args: Any, **kwargs: Any) None[source]
allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=
- allocate_XYZ(N: int | None = None) None[source]
allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)
- apply_face_coordinates(face: Face) None[source]
copies face coordinate vector data to Block coordinate placeholders input: Face f
- cell_get_ijk(kc: int) Tuple[int, int, int][source]
get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)
- check_face_block_bounds(kc: int, ld: int) Tuple[int, int][source]
check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)
- check_volumes() Tuple[int, float, float][source]
checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()
- property chigh: int
global cell index of last cell in block
- property clow: int
global cell index of first cell in block
- property coordinates: list
block node coordinates
- copy(b: Block) None[source]
copies block definition from specified block input: block example: copy(Block b)
- copy_rotate_Edge(face_def: list | BlockFace | Face, alpha: float, **kwargs: Any) None[source]
- Parameters:
face_def
alpha
kwargs
- copy_rotate_Face(face_def: list | BlockFace | Face, npk: int, alpha: float, **kwargs: Any) None[source]
- Parameters:
face_def
npk
alpha
kwargs
- property edges: list
list of block edges
- export_XY(f: BinaryIO) None[source]
writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)
- export_XYZ(f: BinaryIO) None[source]
writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)
- face_offset(original_face: Face, offset_dist: float, offset_dir: int, offset_n: int) None[source]
generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)
- property filename: str
mesh file filename
- fill_Face(face_def: list | BlockFace | Face) Tuple[ndarray, ...][source]
- Parameters:
face_def
- Returns:
- get_Coord(lp: int, **kwargs: Any) Coord[source]
get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)
- get_Coord_by_tag(tag: str) Coord | None[source]
get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)
- get_Coord_from_IJK(i: int, j: int, k: int, **kwargs: Any) Coord[source]
get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)
- get_Edge(i0: int, j0: int, k0: int, idir: int, npi: int) Edge[source]
get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)
- get_Edge_by_tag(tag: str) Edge | None[source]
get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)
- get_Face(N: Any, normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) Face | None[source]
gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)
- get_XYZ_from_IJK(i: int, j: int, k: int) Tuple[float, float, float][source]
get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)
- get_X_from_IJK(i: int, j: int, k: int) float[source]
get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)
- get_Y_from_IJK(i: int, j: int, k: int) float[source]
get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)
- get_Z_from_IJK(i: int, j: int, k: int) float[source]
get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)
- get_block_sizes() Tuple[int, int, int][source]
return block node counts input: no input example: ni, nj, nk = get_block_sizes()
- get_cell(i: int, j: int, k: int) int[source]
returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)
- get_cell_pointers() ndarray[source]
returns block range of cell pointers input: no input example: lc = get_cell_pointers()
- get_def() Tuple[int, int, int, int][source]
returns block definition input: no input example: im, ni, nj, nk = get_def()
- get_delta_arrays() Tuple[ndarray, ...][source]
returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()
- get_face_pointers(face_def: list | BlockFace | Face) Tuple[int, ...][source]
returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction
- get_glue_pointers(face_def: list | BlockFace | Face, face_type: Any = FaceType.A_SIDE) Tuple[ndarray, ...][source]
- Parameters:
face_def
face_type
- Returns:
- get_index(i: int, j: int, k: int) int[source]
returns local node index input: i, j, k (1-based indices) example:
- get_node(i: int, j: int, k: int) int[source]
returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)
- get_node_pointers() ndarray[source]
returns block range of node pointers input: no input example: lp = get_node_pointers()
- property im: int
mesh-block number
- import_XY(f: BinaryIO) None[source]
reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)
- import_XYZ(f: BinaryIO) None[source]
reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)
- property n_cells: int
number of cells in block
- property n_nodes: int
number of nodes in block
- property nhigh: int
global node index of last node in block
- property ni: int
number of nodes in the i-direction
- property nj: int
number of nodes in the j-direction
- property nk: int
number of nodes in the k-direction
- property nlow: int
global node index of first node in block
- property nmc: int
accumulated cell count in blocks with lower block number
- property nmp: int
accumulated node count in blocks with lower block number
- node_get_ijk(kp: int) Tuple[int, int, int][source]
get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)
- populate_face_coordinate_placeholders(face: Face) None[source]
populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input
- property pos: int
file position (file record pointer)
- print_XYZ(face_def: list | BlockFace | Face) None[source]
prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)
- remove_Coord_by_tag(tag: str) None[source]
remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)
- remove_Edge_by_tag(tag: str) None[source]
remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)
- scatter_face_XYZ(plt: Any, face_def: list | BlockFace | Face, m: str = 'o') None[source]
generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = ‘o’)
- set_from_key_value(key: str, value: Any) bool[source]
sets code parameters from specified key => value data input: key, value valid keys for Block class: ‘filename’, ‘pos’, ‘ni’, ‘nj’, ‘nk’ example: set_from_key_value(key, value)
g3d.mesh.geo.coord module
mesh building block - Coord class definition
- class g3d.mesh.geo.coord.Coord(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntity- Attributes:
Methods
add(c)copy(c, **kwargs)copies data from specified entity input: entity example: copy(e)
divide(c)get_angle(c, **kwargs)get_delta(c)get_dist(c)get_xyz()length()multiply(c)print(**kwargs)prints entity data
rotate(**kwargs)scale(f)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_coordinates(xs, ys, zs)set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
shift(**kwargs)subtract(c)- property alpha: float
return:
- property angle_dim: Any
return:
- property beta: float
return:
- copy(c: Coord, **kwargs: Any) None[source]
copies data from specified entity input: entity example: copy(e)
- property ialt: Any
return:
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property shape_factor: float
return:
- property spacing: float
return:
- property x: float
return:
- property y: float
return:
- property z: float
return:
g3d.mesh.geo.coordinates module
mesh coordinate placeholders (X, Y, Z arrays)
- class g3d.mesh.geo.coordinates.Coordinates(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntity- Attributes:
Methods
allocate_XYZ([N])copy(e)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_from_backup([reset_bak])print()prints entity data
scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
backup
nullify
print_extreme_values
reset_XYZ
- property X: ndarray
return:
- property Y: ndarray
return:
- property Z: ndarray
return:
- copy(e: Coordinates) None[source]
copies data from specified entity input: entity example: copy(e)
- get_X(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- get_XYZ(lp: int | list[int] | ndarray | None = None) Tuple[ndarray, ...] | Tuple[float64, ...][source]
- Parameters:
lp
- Returns:
- get_Y(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- get_Z(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- set_X(x: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
x
lp
- set_XYZ(x: float | ndarray, y: float | ndarray, z: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
x
y
z
lp
- set_Y(y: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
y
lp
- set_Z(z: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
z
lp
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property size: int
return:
- property x_max: float64
return:
- property x_min: float64
return:
- property y_max: float64
return:
- property y_min: float64
return:
- property z_max: float64
return:
- property z_min: float64
return:
g3d.mesh.geo.edge module
mesh building block - Edge class definition
- class g3d.mesh.geo.edge.Edge(*args: Any, **kwargs: Any)[source]
Bases:
Coordinates- Attributes:
X- return:
Y- return:
Z- return:
alpha- return:
angle_dim- return:
applied- return:
axis- return:
beta- return:
data- return:
direction- return:
distribute- return:
end- return:
h0- return:
h1- return:
i0- return:
ialt- return:
idir- return:
j0- return:
k0- return:
npi- return:
size- return:
start- return:
stretch_rate- return:
tagtag (string) used for identification
tolerance- return:
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
allocate_XYZ([N])append(e, **kwargs)backup_is_allocated()copy(e)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_def(e)define_Edge(e)find_index(x, **kwargs)generate_offset_Edge(offset[, in_plane_vector])get_Coord(lp)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_angle(**kwargs)get_def()get_extreme_values()get_from_backup([reset_bak])get_spacing(**kwargs)get_sub(**kwargs)get_tangent(lp, **kwargs)get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()prepend(e, **kwargs)print()prints entity data
re_distribute_nodes(**kwargs)read_from_file(f)rotate(**kwargs)scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_coordinates(**kwargs)set_end_Coord(end)set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
set_start_Coord(start)set_start_end_Coord(start, end)shift(**kwargs)write_to_file(f)backup
distribute_nodes
nullify
print_extreme_values
reset_XYZ
update_end_Coord
update_start_Coord
- property alpha: float
return:
- property angle_dim: Any
return:
- property applied: bool
return:
- property axis: Any
return:
- property beta: float
return:
- property data: Any
return:
- property direction: Any
return:
- property distribute: Any
return:
- generate_offset_Edge(offset: float, in_plane_vector: ndarray = array([0, 0, 1])) Edge[source]
- Parameters:
offset
in_plane_vector
- Returns:
- property h0: float
return:
- property h1: float
return:
- property i0: int
return:
- property ialt: Any
return:
- property idir: int
return:
- property j0: int
return:
- property k0: int
return:
- property npi: int
return:
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property stretch_rate: float | str
return:
- property tolerance: float
return:
g3d.mesh.geo.face module
mesh building block - Face class definition
- class g3d.mesh.geo.face.Face(*args: Any, **kwargs: Any)[source]
Bases:
Coordinates- Attributes:
FMP- return:
FMP_size- return:
X- return:
Y- return:
Z- return:
alpha- return:
check- return:
delta- return:
face_type- return:
i0- return:
idir- return:
im- return:
it- return:
j0- return:
jdir- return:
k0- return:
npi- return:
npj- return:
size- return:
tagtag (string) used for identification
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
allocate_FMP([mf])allocate_XYZ([N])backup_is_allocated()check_FMP_cell_metrics(ic, check_sum)copy(f)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_def(f)generate_offset_Face(offset)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_def([normal])get_extreme_values()get_from_backup([reset_bak])get_index(i, j)get_node(i, j)get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()print()prints entity data
read_from_file(f)rotate(**kwargs)scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_def([f])set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
shift(**kwargs)write_to_file(f)backup
deallocate_FMP
nullify
print_extreme_values
reset_XYZ
swap_normal
- property FMP_size: int
return:
- property alpha: float
return:
- property check: str
return:
- property face_type: str
return:
- get_def(normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) Tuple[int, ...][source]
- Parameters:
normal
- Returns:
- property i0: int
return:
- property idir: int
return:
- property im: int
return:
- property it: int | None
return:
- property j0: int
return:
- property jdir: int
return:
- property k0: int
return:
- property npi: int
return:
- property npj: int
return:
- class g3d.mesh.geo.face.Glue(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None)[source]
Bases:
object- Attributes:
type- return:
Methods
set_face_defs([face_def_A, face_def_B])- set_face_defs(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None) None[source]
- Parameters:
face_def_A
face_def_B
- property type: Any
return:
g3d.mesh.geo.grid module
mesh placeholder - Grid class definition
- class g3d.mesh.geo.grid.Grid(*args: Any, **kwargs: Any)[source]
Bases:
G3DCode- Attributes:
Methods
add_BC(bc, **kwargs)add_Block(ni[, nj, nk])add_IO(io, **kwargs)add_Intf(faceA_def, faceB_def, **kwargs)add_smooth_face(face_def)add_smooth_face_glue(faceA_def, faceB_def)cell_get_block(kc)cell_get_ijk(kc)copy(e)copies data from specified entity input: entity example: copy(e)
copy_Face(faceA_def, faceB_def)copy_X(im_to, l_to, im_from, l_from)copy_XYZ(im_to, l_to, im_from, l_from)copy_Y(im_to, l_to, im_from, l_from)copy_Z(im_to, l_to, im_from, l_from)export(*args, **kwargs)exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)
export_connections([bcf])get_X(im[, lp])get_XYZ(im[, lp])get_Y(im[, lp])get_Z(im[, lp])header(*args, **kwargs)prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')
hline(*args, **kwargs)prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)
import_mesh(*args, **kwargs)imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename
jobname_append(name)extends jobname with the specified string input: name example: jobname_append(name)
node_get_block(kp)node_get_ijk(kp)print()prints entity data
scale(sf)set(*args, **kwargs)sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(im, X[, lp])set_XYZ(im, X, Y, Z[, lp])set_Y(im, Y[, lp])set_Z(im, Z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)
smooth([N])allocate_arrays
fill
glue_blocks
nullify_boundary_lists
nullify_smooth_faces
plot_edges_XY
plot_edges_XZ
plot_edges_YZ
print_extreme_values
redefine_ghosts
- add_Intf(faceA_def: Face | list[int], faceB_def: Face | list[int], **kwargs: Any) None[source]
- Parameters:
faceA_def
faceB_def
kwargs
- add_smooth_face_glue(faceA_def: Face | list, faceB_def: Face | list) None[source]
- Parameters:
faceA_def
faceB_def
- property blocks: list
return:
- copy_Face(faceA_def: Face | list[int], faceB_def: Face | list[int]) None[source]
- Parameters:
faceA_def
faceB_def
- copy_X(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_XYZ(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_Y(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_Z(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- export(*args: Any, **kwargs: Any) None[source]
exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE)
- get_XYZ(im: int, lp: int | None = None) Tuple[ndarray, ...] | Tuple[float64, ...][source]
- Parameters:
im
lp
- Returns:
- import_mesh(*args, **kwargs: Any) None[source]
imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE), ‘msh_file’ -> filename, ‘topo_file’ -> filename
- property n_blocks: int
return:
- property n_cells: int
return:
- property n_nodes: int
return:
- property nodes: Coordinates
return:
- set_XYZ(im: int, X: float | ndarray, Y: float | ndarray, Z: float | ndarray, lp=None) None[source]
- Parameters:
im
X
Y
Z
lp
g3d.mesh.geo.interp module
grid interpolation routines
Module contents
g3d/mesh/geo sub library
- class g3d.mesh.geo.Block(*args: Any, **kwargs: Any)[source]
Bases:
Coordinatesclass Block (mesh block), extends class Coordinates
- Attributes:
X- return:
Y- return:
Z- return:
chighglobal cell index of last cell in block
clowglobal cell index of first cell in block
coordinatesblock node coordinates
edgeslist of block edges
filenamemesh file filename
immesh-block number
n_cellsnumber of cells in block
n_nodesnumber of nodes in block
nhighglobal node index of last node in block
ninumber of nodes in the i-direction
njnumber of nodes in the j-direction
nknumber of nodes in the k-direction
nlowglobal node index of first node in block
nmcaccumulated cell count in blocks with lower block number
nmpaccumulated node count in blocks with lower block number
posfile position (file record pointer)
size- return:
tagtag (string) used for identification
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
add_Coord(c)add coordinate to block coordinate list input: Coordinate (c)
add_Edge(e[, edge_def])add edge to block edge list input: Edge (e), edge definition in block reference (optional input)
allocate(*args, **kwargs)allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=
allocate_XYZ([N])allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)
allocate coordinate vectors used for mesh smooth operator
apply_face_coordinates(face)copies face coordinate vector data to Block coordinate placeholders input: Face f
backup_is_allocated()cell_get_ijk(kc)get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)
check_face_block_bounds(kc, ld)check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)
checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()
copy(b)copies block definition from specified block input: block example: copy(Block b)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_rotate_Edge(face_def, alpha, **kwargs)copy_rotate_Face(face_def, npk, alpha, **kwargs)export_XY(f)writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)
export_XYZ(f)writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)
extrude_Face(face_def, edge)face_offset(original_face, offset_dist, ...)generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)
fill([vol_def])fill_2D([w])fill_Face(face_def)get_Coord(lp, **kwargs)get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)
get_Coord_by_tag(tag)get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)
get_Coord_from_IJK(i, j, k, **kwargs)get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)
get_Edge(i0, j0, k0, idir, npi)get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)
get_Edge_by_tag(tag)get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)
get_Face(N[, normal])gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)
get_X([lp])get_XYZ([lp])get_XYZ_from_IJK(i, j, k)get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)
get_X_from_IJK(i, j, k)get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)
get_Y([lp])get_Y_from_IJK(i, j, k)get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)
get_Z([lp])get_Z_from_IJK(i, j, k)get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)
return block node counts input: no input example: ni, nj, nk = get_block_sizes()
get_cell(i, j, k)returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)
returns block range of cell pointers input: no input example: lc = get_cell_pointers()
get_def()returns block definition input: no input example: im, ni, nj, nk = get_def()
returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()
get_extreme_values()get_face_pointers(face_def)returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction
get_from_backup([reset_bak])get_glue_pointers(face_def[, face_type])get_index(i, j, k)returns local node index input: i, j, k (1-based indices) example:
get_node(i, j, k)returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)
returns block range of node pointers input: no input example: lp = get_node_pointers()
get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()import_XY(f)reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)
import_XYZ(f)reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)
initialize face lists based on block definition
node_get_ijk(kp)get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)
populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input
print()prints block definition, block cell and node count
print_XYZ(face_def)prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)
read_from_file(f)remove_Coord_by_tag(tag)remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)
remove_Edge_by_tag(tag)remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)
reset coordinate vectors used for mesh smooth operator
rotate(**kwargs)scale(sf)scale block coordinates input: scale factor (sf) example: scale(sf)
scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])scatter_face_XYZ(plt, face_def[, m])generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = 'o')
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for Block class: 'filename', 'pos', 'ni', 'nj', 'nk' example: set_from_key_value(key, value)
shift(**kwargs)shift_Face(face_def, **kwargs)smooth_Face(face_def)smooth_apply(face_def)updates node and cell counts
write_to_file(f)backup
nullify
print_extreme_values
reset_XYZ
- add_Edge(e: Edge, edge_def: list | None = None) None[source]
add edge to block edge list input: Edge (e), edge definition in block reference (optional input)
- allocate(*args: Any, **kwargs: Any) None[source]
allocates coordinate vectors input: args, kwargs args: ni, nj, nk kwargs: ni=, nj=, nk=
- allocate_XYZ(N: int | None = None) None[source]
allocate XYZ vectors input: vector length (optional input, default value = np) example: allocate_XYZ(N)
- apply_face_coordinates(face: Face) None[source]
copies face coordinate vector data to Block coordinate placeholders input: Face f
- cell_get_ijk(kc: int) Tuple[int, int, int][source]
get 0-based indices from global cell index input: cell index example i, j, k = cell_get_ijk(kc)
- check_face_block_bounds(kc: int, ld: int) Tuple[int, int][source]
check if face increment is within block boundaries input: cell index (kc), cell increment (ld) example: check_face_block_bounds(kc, ld)
- check_volumes() Tuple[int, float, float][source]
checks volumes for all cells in block returns number of negative volumes, min volume, and max volume warning message printed in case negative volumes are found input: no input example: n_neg, v_min, v_max = check_volumes()
- property chigh: int
global cell index of last cell in block
- property clow: int
global cell index of first cell in block
- property coordinates: list
block node coordinates
- copy(b: Block) None[source]
copies block definition from specified block input: block example: copy(Block b)
- copy_rotate_Edge(face_def: list | BlockFace | Face, alpha: float, **kwargs: Any) None[source]
- Parameters:
face_def
alpha
kwargs
- copy_rotate_Face(face_def: list | BlockFace | Face, npk: int, alpha: float, **kwargs: Any) None[source]
- Parameters:
face_def
npk
alpha
kwargs
- property edges: list
list of block edges
- export_XY(f: BinaryIO) None[source]
writes (x, y) coordinates to file input: file handle (f) example: export_XY(f)
- export_XYZ(f: BinaryIO) None[source]
writes (x, y, z) coordinates to file input: file handle (f) example: export_XYZ(f)
- face_offset(original_face: Face, offset_dist: float, offset_dir: int, offset_n: int) None[source]
generates a Face from specified original Face and offset information applies offset Face to Block coordinate vectors input: Face (original face), offset distance (distance in face-normal direction), offset direction, number of nodes in offset direction definition of offset direction: 1 (+i) 2 (-i) 3 (+j) 4 (-j) 5 (+k) 6 (-k) example: face_offset(Face, dist, dir, n_nodes)
- property filename: str
mesh file filename
- fill_Face(face_def: list | BlockFace | Face) Tuple[ndarray, ...][source]
- Parameters:
face_def
- Returns:
- get_Coord(lp: int, **kwargs: Any) Coord[source]
get Coord from coordinate vector index input: vector index (lp) optional input: kwargs (forwarded to Coord constructor) example: Coord c = get_Coord(lp, kwargs)
- get_Coord_by_tag(tag: str) Coord | None[source]
get Coord with specified tag from coordinate list input: tag example: Coord c = get_Coord_by_tag(tag)
- get_Coord_from_IJK(i: int, j: int, k: int, **kwargs: Any) Coord[source]
get Coord from (i, j, k) input: indices (i, j ,k) example: Coord c = get_Coord_from_IJK(i, j, k)
- get_Edge(i0: int, j0: int, k0: int, idir: int, npi: int) Edge[source]
get Bock Edge from specified Edge definition input: Edge definition (i0, j0, k0, idir, npi) (i0, j0, k0) = start index idir = direction npi = number of nodes example: EDge e = get_Edge_by_tag(tag)
- get_Edge_by_tag(tag: str) Edge | None[source]
get Edge with specified tag from Edge list input: tag example: EDge e = get_Edge_by_tag(tag)
- get_Face(N: Any, normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) Face | None[source]
gets Block Face: input: BlockFace (Enum), normal (Enum, default value = FaceOrientation.OUTWARD_FACING_NORMAL) valid options: Blockface: ILOW, IHIGH, JLOW, JHIGH, KLOW, KHIGH normal: OUTWARD_FACING_NORMAL, INWARD_FACING_NORMAL example: Face f = get_Face(BlockFace, normal)
- get_XYZ_from_IJK(i: int, j: int, k: int) Tuple[float, float, float][source]
get (x, y, z) from (i, j, k) input: indices (i, j ,k) example: x, y, z = get_XYZ_from_IJK(i, j, k)
- get_X_from_IJK(i: int, j: int, k: int) float[source]
get x from (i, j, k) input: indices (i, j ,k) example: x = get_X_from_IJK(i, j, k)
- get_Y_from_IJK(i: int, j: int, k: int) float[source]
get y from (i, j, k) input: indices (i, j ,k) example: y = get_Y_from_IJK(i, j, k)
- get_Z_from_IJK(i: int, j: int, k: int) float[source]
get z from (i, j, k) input: indices (i, j ,k) example: z = get_Z_from_IJK(i, j, k)
- get_block_sizes() Tuple[int, int, int][source]
return block node counts input: no input example: ni, nj, nk = get_block_sizes()
- get_cell(i: int, j: int, k: int) int[source]
returns global cell index input: i, j, k (0-based indices) example: l = get_cell(i, j, k)
- get_cell_pointers() ndarray[source]
returns block range of cell pointers input: no input example: lc = get_cell_pointers()
- get_def() Tuple[int, int, int, int][source]
returns block definition input: no input example: im, ni, nj, nk = get_def()
- get_delta_arrays() Tuple[ndarray, ...][source]
returns delta coordinates (grid smooth placeholders) input: no input example: dx, dy, dz = get_delta_arrays()
- get_face_pointers(face_def: list | BlockFace | Face) Tuple[int, ...][source]
returns Face data from specified input input: Face or BlockFace, or Face definition example: i0, j0, k0, idir, jdir, npi, npj = get_face_pointers(f) (i0, j0, k0) = start index (idir, jdir) = local i-direction, local j-direction (npi, npj) = number of nodes in local i-direction and local j-direction
- get_glue_pointers(face_def: list | BlockFace | Face, face_type: Any = FaceType.A_SIDE) Tuple[ndarray, ...][source]
- Parameters:
face_def
face_type
- Returns:
- get_index(i: int, j: int, k: int) int[source]
returns local node index input: i, j, k (1-based indices) example:
- get_node(i: int, j: int, k: int) int[source]
returns global node index input: i, j, k (0-based indices) example: l = get_node(i, j, k)
- get_node_pointers() ndarray[source]
returns block range of node pointers input: no input example: lp = get_node_pointers()
- property im: int
mesh-block number
- import_XY(f: BinaryIO) None[source]
reads (x, y) coordinates from file input: file handle (f) example: import_XY(f)
- import_XYZ(f: BinaryIO) None[source]
reads (x, y, z) coordinates from file input: file handle (f) example: import_XYZ(f)
- property n_cells: int
number of cells in block
- property n_nodes: int
number of nodes in block
- property nhigh: int
global node index of last node in block
- property ni: int
number of nodes in the i-direction
- property nj: int
number of nodes in the j-direction
- property nk: int
number of nodes in the k-direction
- property nlow: int
global node index of first node in block
- property nmc: int
accumulated cell count in blocks with lower block number
- property nmp: int
accumulated node count in blocks with lower block number
- node_get_ijk(kp: int) Tuple[int, int, int][source]
get 0-based indices from global node index input: node index example i, j, k = node_get_ijk(kp)
- populate_face_coordinate_placeholders(face: Face) None[source]
populates face node placeholders copies (x, y, z) coordinate data from Block coordinate arrays to face coordinate vectors input: no input
- property pos: int
file position (file record pointer)
- print_XYZ(face_def: list | BlockFace | Face) None[source]
prints (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition)
- remove_Coord_by_tag(tag: str) None[source]
remove Coord with specified tag from coordinate list input: tag example: remove_Coord_by_tag(tag)
- remove_Edge_by_tag(tag: str) None[source]
remove Edge with specified tag from Edge list input: tag example: remove_Edge_by_tag(tag)
- scatter_face_XYZ(plt: Any, face_def: list | BlockFace | Face, m: str = 'o') None[source]
generate scatter plot for (x, y, z) coordinates for nodes on specified face input: Face (given as Face, BlockFace, or face definition) optional input: scatter symbol (default value = ‘o’)
- set_from_key_value(key: str, value: Any) bool[source]
sets code parameters from specified key => value data input: key, value valid keys for Block class: ‘filename’, ‘pos’, ‘ni’, ‘nj’, ‘nk’ example: set_from_key_value(key, value)
- class g3d.mesh.geo.BlockRegion(*args: Any, **kwargs: Any)[source]
Bases:
PrismRegion- Attributes:
alpha- return:
beta- return:
ialt- return:
length- return:
tagtag (string) used for identification
width- return:
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- copy(r: BlockRegion) None[source]
copies data from specified entity input: entity example: copy(e)
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property width: float
return:
- class g3d.mesh.geo.BoxRegion(*args: Any, **kwargs: Any)[source]
Bases:
RegionMethods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- property dx: float
return:
- property dy: float
return:
- property dz: float
return:
- class g3d.mesh.geo.Coord(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntity- Attributes:
Methods
add(c)copy(c, **kwargs)copies data from specified entity input: entity example: copy(e)
divide(c)get_angle(c, **kwargs)get_delta(c)get_dist(c)get_xyz()length()multiply(c)print(**kwargs)prints entity data
rotate(**kwargs)scale(f)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_coordinates(xs, ys, zs)set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
shift(**kwargs)subtract(c)- property alpha: float
return:
- property angle_dim: Any
return:
- property beta: float
return:
- copy(c: Coord, **kwargs: Any) None[source]
copies data from specified entity input: entity example: copy(e)
- property ialt: Any
return:
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property shape_factor: float
return:
- property spacing: float
return:
- property x: float
return:
- property y: float
return:
- property z: float
return:
- class g3d.mesh.geo.Coordinates(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntity- Attributes:
Methods
allocate_XYZ([N])copy(e)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_from_backup([reset_bak])print()prints entity data
scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
backup
nullify
print_extreme_values
reset_XYZ
- property X: ndarray
return:
- property Y: ndarray
return:
- property Z: ndarray
return:
- copy(e: Coordinates) None[source]
copies data from specified entity input: entity example: copy(e)
- get_X(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- get_XYZ(lp: int | list[int] | ndarray | None = None) Tuple[ndarray, ...] | Tuple[float64, ...][source]
- Parameters:
lp
- Returns:
- get_Y(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- get_Z(lp: int | list[int] | ndarray | None = None) ndarray | float64[source]
- Parameters:
lp
- Returns:
- set_X(x: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
x
lp
- set_XYZ(x: float | ndarray, y: float | ndarray, z: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
x
y
z
lp
- set_Y(y: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
y
lp
- set_Z(z: float | ndarray, lp: int | list[int] | ndarray | None = None) None[source]
- Parameters:
z
lp
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property size: int
return:
- property x_max: float64
return:
- property x_min: float64
return:
- property y_max: float64
return:
- property y_min: float64
return:
- property z_max: float64
return:
- property z_min: float64
return:
- class g3d.mesh.geo.CylinderRegion(*args: Any, **kwargs: Any)[source]
Bases:
PrismRegion- Attributes:
alpha- return:
beta- return:
ialt- return:
length- return:
radius- return:
tagtag (string) used for identification
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- copy(r: CylinderRegion) None[source]
copies data from specified entity input: entity example: copy(e)
- property radius: float
return:
- class g3d.mesh.geo.Edge(*args: Any, **kwargs: Any)[source]
Bases:
Coordinates- Attributes:
X- return:
Y- return:
Z- return:
alpha- return:
angle_dim- return:
applied- return:
axis- return:
beta- return:
data- return:
direction- return:
distribute- return:
end- return:
h0- return:
h1- return:
i0- return:
ialt- return:
idir- return:
j0- return:
k0- return:
npi- return:
size- return:
start- return:
stretch_rate- return:
tagtag (string) used for identification
tolerance- return:
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
allocate_XYZ([N])append(e, **kwargs)backup_is_allocated()copy(e)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_def(e)define_Edge(e)find_index(x, **kwargs)generate_offset_Edge(offset[, in_plane_vector])get_Coord(lp)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_angle(**kwargs)get_def()get_extreme_values()get_from_backup([reset_bak])get_spacing(**kwargs)get_sub(**kwargs)get_tangent(lp, **kwargs)get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()prepend(e, **kwargs)print()prints entity data
re_distribute_nodes(**kwargs)read_from_file(f)rotate(**kwargs)scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_coordinates(**kwargs)set_end_Coord(end)set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
set_start_Coord(start)set_start_end_Coord(start, end)shift(**kwargs)write_to_file(f)backup
distribute_nodes
nullify
print_extreme_values
reset_XYZ
update_end_Coord
update_start_Coord
- property alpha: float
return:
- property angle_dim: Any
return:
- property applied: bool
return:
- property axis: Any
return:
- property beta: float
return:
- property data: Any
return:
- property direction: Any
return:
- property distribute: Any
return:
- generate_offset_Edge(offset: float, in_plane_vector: ndarray = array([0, 0, 1])) Edge[source]
- Parameters:
offset
in_plane_vector
- Returns:
- property h0: float
return:
- property h1: float
return:
- property i0: int
return:
- property ialt: Any
return:
- property idir: int
return:
- property j0: int
return:
- property k0: int
return:
- property npi: int
return:
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property stretch_rate: float | str
return:
- property tolerance: float
return:
- class g3d.mesh.geo.Face(*args: Any, **kwargs: Any)[source]
Bases:
Coordinates- Attributes:
FMP- return:
FMP_size- return:
X- return:
Y- return:
Z- return:
alpha- return:
check- return:
delta- return:
face_type- return:
i0- return:
idir- return:
im- return:
it- return:
j0- return:
jdir- return:
k0- return:
npi- return:
npj- return:
size- return:
tagtag (string) used for identification
x_max- return:
x_min- return:
y_max- return:
y_min- return:
z_max- return:
z_min- return:
Methods
allocate_FMP([mf])allocate_XYZ([N])backup_is_allocated()check_FMP_cell_metrics(ic, check_sum)copy(f)copies data from specified entity input: entity example: copy(e)
copy_X(*args)copy_XYZ(*args)copy_Y(*args)copy_Z(*args)copy_def(f)generate_offset_Face(offset)get_X([lp])get_XYZ([lp])get_Y([lp])get_Z([lp])get_def([normal])get_extreme_values()get_from_backup([reset_bak])get_index(i, j)get_node(i, j)get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()print()prints entity data
read_from_file(f)rotate(**kwargs)scale(sf)scatter_XY(plt[, m])scatter_XZ(plt[, m])scatter_YZ(plt[, m])set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(x[, lp])set_XYZ(x, y, z[, lp])set_Y(y[, lp])set_Z(z[, lp])set_def([f])set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
shift(**kwargs)write_to_file(f)backup
deallocate_FMP
nullify
print_extreme_values
reset_XYZ
swap_normal
- property FMP_size: int
return:
- property alpha: float
return:
- property check: str
return:
- property face_type: str
return:
- get_def(normal: Any = FaceOrientation.OUTWARD_FACING_NORMAL) Tuple[int, ...][source]
- Parameters:
normal
- Returns:
- property i0: int
return:
- property idir: int
return:
- property im: int
return:
- property it: int | None
return:
- property j0: int
return:
- property jdir: int
return:
- property k0: int
return:
- property npi: int
return:
- property npj: int
return:
- class g3d.mesh.geo.Glue(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None)[source]
Bases:
object- Attributes:
type- return:
Methods
set_face_defs([face_def_A, face_def_B])- set_face_defs(face_def_A: Face | list | None = None, face_def_B: Face | list | None = None) None[source]
- Parameters:
face_def_A
face_def_B
- property type: Any
return:
- class g3d.mesh.geo.Grid(*args: Any, **kwargs: Any)[source]
Bases:
G3DCode- Attributes:
Methods
add_BC(bc, **kwargs)add_Block(ni[, nj, nk])add_IO(io, **kwargs)add_Intf(faceA_def, faceB_def, **kwargs)add_smooth_face(face_def)add_smooth_face_glue(faceA_def, faceB_def)cell_get_block(kc)cell_get_ijk(kc)copy(e)copies data from specified entity input: entity example: copy(e)
copy_Face(faceA_def, faceB_def)copy_X(im_to, l_to, im_from, l_from)copy_XYZ(im_to, l_to, im_from, l_from)copy_Y(im_to, l_to, im_from, l_from)copy_Z(im_to, l_to, im_from, l_from)export(*args, **kwargs)exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)
export_connections([bcf])get_X(im[, lp])get_XYZ(im[, lp])get_Y(im[, lp])get_Z(im[, lp])header(*args, **kwargs)prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')
hline(*args, **kwargs)prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)
import_mesh(*args, **kwargs)imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename
jobname_append(name)extends jobname with the specified string input: name example: jobname_append(name)
node_get_block(kp)node_get_ijk(kp)print()prints entity data
scale(sf)set(*args, **kwargs)sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(im, X[, lp])set_XYZ(im, X, Y, Z[, lp])set_Y(im, Y[, lp])set_Z(im, Z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)
smooth([N])allocate_arrays
fill
glue_blocks
nullify_boundary_lists
nullify_smooth_faces
plot_edges_XY
plot_edges_XZ
plot_edges_YZ
print_extreme_values
redefine_ghosts
- add_Intf(faceA_def: Face | list[int], faceB_def: Face | list[int], **kwargs: Any) None[source]
- Parameters:
faceA_def
faceB_def
kwargs
- add_smooth_face_glue(faceA_def: Face | list, faceB_def: Face | list) None[source]
- Parameters:
faceA_def
faceB_def
- property blocks: list
return:
- copy_Face(faceA_def: Face | list[int], faceB_def: Face | list[int]) None[source]
- Parameters:
faceA_def
faceB_def
- copy_X(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_XYZ(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_Y(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- copy_Z(im_to: int, l_to: int | list[int] | ndarray, im_from: int, l_from: int | list[int] | ndarray) None[source]
- Parameters:
im_to
l_to
im_from
l_from
- export(*args: Any, **kwargs: Any) None[source]
exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE)
- get_XYZ(im: int, lp: int | None = None) Tuple[ndarray, ...] | Tuple[float64, ...][source]
- Parameters:
im
lp
- Returns:
- import_mesh(*args, **kwargs: Any) None[source]
imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: ‘format’ binary_format (defaults to BinaryFormat.NATIVE), ‘msh_file’ -> filename, ‘topo_file’ -> filename
- property n_blocks: int
return:
- property n_cells: int
return:
- property n_nodes: int
return:
- property nodes: Coordinates
return:
- set_XYZ(im: int, X: float | ndarray, Y: float | ndarray, Z: float | ndarray, lp=None) None[source]
- Parameters:
im
X
Y
Z
lp
- class g3d.mesh.geo.IJKRegion(*args: Any, **kwargs: Any)[source]
Bases:
Region- Attributes:
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
get_def()print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_def(im, i1, i2, j1, j2, k1, k2[, it])set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- property i1: int
return:
- property i2: int
return:
- property im: int
return:
- property it: int
return:
- property j1: int
return:
- property j2: int
return:
- property k1: int
return:
- property k2: int
return:
- property nc: int
return:
- property ni: int
return:
- property nj: int
return:
- property nk: int
return:
- property np: int
return:
- class g3d.mesh.geo.PrismRegion(*args: Any, **kwargs: Any)[source]
Bases:
Region- Attributes:
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- property alpha
return:
- property beta
return:
- copy(r: PrismRegion) None[source]
copies data from specified entity input: entity example: copy(e)
- property ialt
return:
- property length
return:
- class g3d.mesh.geo.Region(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntity- Attributes:
tagtag (string) used for identification
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- class g3d.mesh.geo.SphereRegion(*args: Any, **kwargs: Any)[source]
Bases:
Region- Attributes:
radius- return:
tagtag (string) used for identification
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- copy(r: SphereRegion) None[source]
copies data from specified entity input: entity example: copy(e)
- property radius: float
return:
- class g3d.mesh.geo.XYZRegion(*args: Any, **kwargs: Any)[source]
Bases:
Region- Attributes:
Methods
copy(r)copies data from specified entity input: entity example: copy(e)
print()prints entity data
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
- set_from_key_value(key: str, value: Any) bool[source]
sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: ‘tag’ example: set_from_key_value(key, value)
- property x1: float
return:
- property x2: float
return:
- property y1: float
return:
- property y2: float
return:
- property z1: float
return:
- property z2: float
return: