barotropy.fluent_automation.nozzle_meshing module#

class barotropy.fluent_automation.nozzle_meshing.NozzleMesher(config)[source]#

Bases: object

Methods

create_mesh()

Create full nozzle mesh (geometry + structured meshing).

create_physical_groups()

Define physical groups for Fluent boundary conditions based on self.curves.

show_mesh

write_mesh

create_mesh()[source]#

Create full nozzle mesh (geometry + structured meshing).

create_physical_groups()[source]#

Define physical groups for Fluent boundary conditions based on self.curves.

Parameters:
symmetrybool

Whether the geometry includes a centerline symmetry boundary.

show_mesh()[source]#
write_mesh(filename='nozzle.msh')[source]#
barotropy.fluent_automation.nozzle_meshing.check_gmsh()[source]#
barotropy.fluent_automation.nozzle_meshing.create_structured_surface(curves_1: list[int], curves_2: list[int], curves_3: list[int], curves_4: list[int], corner_12: int, corner_23: int, corner_34: int, corner_41: int, N_horizontal: int, N_vertical: int, progression_horizontal=1.0, progression_vertical=1.0) int[source]#

Create and mesh a structured quadrilateral surface with transfinite constraints.

Parameters:
namestr

Optional surface name for user reference or debugging.

curves_1 to curves_4list of int

OCC curve tags forming the four sides of the surface, ordered counter-clockwise: bottom, right, top, left.

corner_12, corner_23, corner_34, corner_41int

OCC point tags at the surface corners in CCW order. These are used for transfinite meshing.

N_horizontalint

Number of mesh divisions along curves_1 and curves_3.

N_verticalint

Number of mesh divisions along curves_2 and curves_4.

Returns:
int

The Gmsh surface tag of the created structured surface.

barotropy.fluent_automation.nozzle_meshing.find_optimal_inflation_layer(h_wall, inflation_ratio, H_total, N_total, check_errors=True)[source]#

Determine the optimal inflation layer configuration given a geometric growth rate and total wall-normal mesh height and resolution.

The function finds the number of inflation layer cells such that the last inflation cell matches the height of the uniform core cells. It also recomputes the exact inflation ratio that achieves this match after rounding the number of inflation cells.

Parameters:
h_wallfloat

Height of the first cell at the wall (e.g., to meet y⁺ constraint).

inflation_ratiofloat

Initial approximation for the geometric growth ratio (r > 1). If r ≈ 1, a uniform grid is used.

H_totalfloat

Total height of the mesh in the wall-normal direction.

N_totalint

Total number of mesh cells in the wall-normal direction.

check_errorsbool, default=True

Whether to check and report mismatch between core and inflation cell heights.

Returns:
dict

Dictionary containing resolved inflation and core region parameters: - “H_total”: total height of the domain - “N_total”: total number of cells - “h_wall”: height of the first inflation cell - “N_inflation”: integer number of inflation cells (after rounding) - “H_inflation”: height of the inflation region - “h_inflation”: height of the last inflation cell - “N_core”: number of core cells - “H_core”: height of the core region - “h_core”: uniform height of core cells - “inflation_ratio”: recomputed exact geometric ratio used

Notes

  • If inflation_ratio ≈ 1, the method falls back to uniform spacing with no dedicated inflation layer (N_inflation = 0).

  • This ensures a smooth transition between inflation and core regions, and that the inflation region integrates cleanly into the mesh.

barotropy.fluent_automation.nozzle_meshing.get_arclength_occ(curveTag)[source]#

Compute the arc length of a Gmsh OCC curve using numerical integration.

Parameters:
curveTagint

Tag of the OCC curve entity (dimension 1) whose arc length is to be computed.

Returns:
lengthfloat

Total arc length of the curve, computed by integrating the norm of the first derivative (dx/dt, dy/dt, dz/dt) over the curve’s parametric domain.

Notes

  • This function uses gmsh.model.getDerivative to obtain the first derivative of the OCC curve with respect to its parameter u, and numerically integrates the magnitude of the derivative using scipy.integrate.quad.

  • Requires that gmsh.model.occ.synchronize() has been called before use.

barotropy.fluent_automation.nozzle_meshing.plot_y_mesh(h_wall, r, H_total, N_total)[source]#
barotropy.fluent_automation.nozzle_meshing.sample_meshed_curves(curve_tags)[source]#

Extracts ordered XYZ points from one or more curve tags, avoiding duplicated nodes at segment joints.

Parameters:
curve_tagsint or list of int

A single curve tag or a list of curve tags.

Returns:
list of tuple

Ordered list of (x, y, z) points along the concatenated curves.

barotropy.fluent_automation.nozzle_meshing.set_transfinite_curves(curve_tags, total_nodes, meshType='Progression', coef=1.0)[source]#

Assign transfinite meshing to a sequence of connected curves, distributing the given number of points (not elements) according to the arc length of each segment.

Parameters:#

curve_tagslist of int

Tags of the OCC curves forming a continuous chain (e.g., lower or upper wall). Each curve is treated as a segment between two mesh nodes.

total_nodesint

Total number of mesh nodes along the full chain (including endpoints). This implies total_nodes - 1 mesh elements will be distributed.

Behavior:#

  • If the chain has only one curve, assigns total_nodes directly to it.

  • If the chain has multiple curves, it:
    • Computes each curve’s arc length.

    • Distributes total_nodes - 1 elements proportionally to segment length.

    • Rounds to integers and ensures the sum matches exactly.

    • Applies setTransfiniteCurve to each segment with (elements + 1) points.