butterfly.blockMeshDict module¶
BlockMeshDict class.
-
class
butterfly.blockMeshDict.
BlockMeshDict
(values=None)[source]¶ Bases:
butterfly.foamfile.FoamFile
BlockMeshDict.
-
back_face_indices
¶ Get indecies for back face.
-
back_face_vertices
¶ Get vertices for back face.
-
bottom_face_indices
¶ Get indecies for bottom face.
-
bottom_face_vertices
¶ Get vertices for bottom face.
-
boundary
¶ Get boundaries and a dictionary.
-
center
¶ Get center of the block.
-
convertToMeters
¶ Get convertToMeters.
-
expand_by_cells_count
(x_count, y_count, z_count, renumber_division=True)[source]¶ Expand blockMeshDict boundingbox for n cells from all sides.
This method will increase the number of divisions by 2 to keep the size of the cells unchanged unless renumber_division is set to False. Use a negative count to shrink the bounding box.
-
expand_uniform_by_cells_count
(count, renumber_division=True)[source]¶ Expand blockMeshDict boundingbox for n cells from all sides.
This method will increase the number of divisions by 2 to keep the size of the cells unchanged unless renumber_division is set to False. Use a negative count to shrink the bounding box.
-
classmethod
from_bf_block_geometries
(bf_block_geometries, convertToMeters=1, n_div_xyz=None, grading=None, x_axis=None)[source]¶ Create BlockMeshDict from bf_block_geometries.
Parameters: - bf_block_geometries – A collection of boundary surfaces for bounding box.
- convertToMeters – Scaling factor for the vertex coordinates.
- n_div_xyz – Number of divisions in (x, y, z) as a tuple (default: 5, 5, 5).
- grading – A simpleGrading (default: simpleGrading(1, 1, 1)).
- x_axis – An optional tuple that indicates the x_axis direction (default: (1, 0)).
-
classmethod
from_file
(filepah, convertToMeters=1)[source]¶ Create a blockMeshDict from file.
Parameters: - filepah – Full path to blockMeshDict.
- converToMeters – converToMeters for the new document. This values will be used to update the vertices to the new units. Default is 1 which means blockMeshDict will be converted to meters.
-
classmethod
from_min_max
(min_pt, max_pt, convertToMeters=1, n_div_xyz=None, grading=None, x_axis=None)[source]¶ Create BlockMeshDict from minimum and maximum point.
Parameters: - min_pt – Minimum point of bounding box as (x, y, z).
- max_pt – Maximum point of bounding box as (x, y, z).
- convertToMeters – Scaling factor for the vertex coordinates.
- n_div_xyz – Number of divisions in (x, y, z) as a tuple (default: 5, 5, 5).
- grading – A simpleGrading (default: simpleGrading(1, 1, 1)).
- x_axis – An optional tuple that indicates the x_axis direction (default: (1, 0)).
-
classmethod
from_origin_and_size
(origin, width, length, height, convertToMeters=1, n_div_xyz=None, grading=None, x_axis=None)[source]¶ Create BlockMeshDict from bf_block_geometries.
Parameters: - origin – Minimum point of bounding box as (x, y, z).
- width – Width in x direction.
- length – Length in y direction.
- height – Height in y direction.
- convertToMeters – Scaling factor for the vertex coordinates.
- n_div_xyz – Number of divisions in (x, y, z) as a tuple (default: 5, 5, 5).
- grading – A simpleGrading (default: simpleGrading(1, 1, 1)).
- x_axis – An optional tuple that indicates the x_axis direction (default: (1, 0)).
-
classmethod
from_vertices
(vertices, convertToMeters=1, n_div_xyz=None, grading=None, x_axis=None)[source]¶ Create BlockMeshDict from vertices.
Parameters: - vertices – 8 vertices to define the bounding box.
- convertToMeters – Scaling factor for the vertex coordinates.
- n_div_xyz – Number of divisions in (x, y, z) as a tuple (default: 5, 5, 5).
- grading – A simpleGrading (default: simpleGrading(1, 1, 1)).
- x_axis – An optional tuple that indicates the x_axis direction (default: (1, 0)).
-
front_face_indices
¶ Get indecies for front face.
-
front_face_vertices
¶ Get vertices for front face.
-
geometry
¶ A tuple of bf_geometries for BoundingBox faces.
-
get_face_indices
(face_index)[source]¶ Update boundary to empty for one of the faces.
Parameters: face_index – 0 - front, 1 - back, 2 - bottom, 3 - top, 4 - right, 5 - left.
-
get_face_vertices
(face_index)[source]¶ Update boundary to empty for one of the faces.
Parameters: face_index – 0 - front, 1 - back, 2 - bottom, 3 - top, 4 - right, 5 - left.
-
grading
¶ simpleGrading(1, 1, 1)).
Type: A simpleGrading (default
-
height
¶ Length of block in Z direction.
-
is2d_in_x_direction
¶ Return True if the case is 2d in X direction.
-
is2d_in_y_direction
¶ Return True if the case is 2d in Y direction.
-
is2d_in_z_direction
¶ Return True if the case is 2d in Z direction.
-
left_face_indices
¶ Get indecies for left face.
-
left_face_vertices
¶ Get vertices for left face.
-
length
¶ Length of block in Y direction.
-
make2d
(plane_origin, plane_normal, width=0.1)[source]¶ Make the blockMeshDict two dimensional.
Parameters: - plane_origin – Plane origin as (x, y, z).
- plane_normal – Plane normal as (x, y, z).
- width – width of 2d blockMeshDict (default: 01).
-
max_pt
¶ Return maximum pt x, y, z in this block.
-
min_pt
¶ Return minimum pt x, y, z in this block.
-
min_z
¶ Return minimum Z value of vertices in this block.
-
n_div_xyz
¶ 5, 5, 5).
Type: Number of divisions in (x, y, z) as a tuple (default
-
right_face_indices
¶ Get indecies for right face.
-
right_face_vertices
¶ Get vertices for right face.
-
top_face_indices
¶ Get indecies for top face.
-
top_face_vertices
¶ Get vertices for top face.
-
vertices
¶ Get the sorted list of vertices.
-
vertices_order
¶ Get order of vertices in blocks.
-
width
¶ Length of block in X direction.
-
x_axis
¶ X axis as a tuple.
-
y_axis
¶ Y axis.
-
z_axis
¶ Z axis.
-