API Reference¶
CFDPre’s public interface is the single function yhgrcalc, importable directly from the
package:
from cfdpre import yhgrcalc
yhgrcalc¶
yhgrcalc(
fluid,
temperature_c,
pressure_bar,
massflow_kgpersec,
hydraulicdia_mm,
target_yplus,
num_layers,
flow_type="internal",
flow_velocity_mpersec=None,
bl_thickness_mm=None,
bl_thickness_fraction=None,
roughness_mm=0.0,
)
Calculate boundary-layer mesh sizing — first layer height, growth ratio, and final layer thickness — for a given fluid, flow condition, and target \(y^+\). See Theory & Methodology for the underlying physics.
Parameters¶
Name |
Type |
Default |
Description |
|---|---|---|---|
|
|
— |
CoolProp fluid name, e.g. |
|
|
— |
Static temperature in degrees Celsius. |
|
|
— |
Static pressure in bar (absolute). |
|
|
— |
Mass flow rate in kg/s (used for internal flow). |
|
|
— |
Hydraulic diameter (internal) or characteristic length (external), in mm. |
|
|
— |
Target \(y^+\) at the first cell centroid. |
|
|
— |
Number of inflation / prism layers, \(N\). |
|
|
|
|
|
|
|
Free-stream velocity in m/s. Required for |
|
|
|
Explicit total prism-stack thickness in mm. Overrides the default \(\delta_{99}\). |
|
|
|
Internal only. Prism-stack thickness as a fraction of pipe radius, in \((0, 1]\). Ignored if |
|
|
|
Absolute wall roughness in mm for the Haaland turbulent internal correlation. |
Returns¶
A dict with the following keys. Inputs are echoed back; computed quantities are grouped at
the end.
Key |
Description |
|---|---|
|
Echoed input. |
|
Echoed input. |
|
Echoed input. |
|
Echoed input. |
|
Echoed input. |
|
Echoed input. |
|
Echoed input. |
|
|
|
Echoed input. |
|
Dynamic viscosity \(\mu\). |
|
\(k\). |
|
\(c_p\). |
|
\(\rho\). |
|
\(\nu = \mu/\rho\). |
|
Bulk (internal) or free-stream (external) velocity \(V\). |
|
\(Re\). |
|
\(Pr = c_p\mu/k\). |
|
Fanning skin-friction coefficient \(c_f\). |
|
\(\tau_w\) in Pa. |
|
Total thickness \(\delta_{99}\) spanned by the stack. |
|
First-cell centroid height \(y_p\). |
|
First layer height \(y_H = 2y_p\). |
|
Geometric growth ratio \(r\) ( |
|
Outermost layer thickness \(y_H r^{N-1}\) ( |
Raises¶
ValueError— ifflow_typeis not"internal"/"external", ifflow_type="external"is used withoutflow_velocity_mpersec, or ifbl_thickness_fractionis outside \((0, 1]\).
Warns¶
UserWarning— if the resulting growth ratio exceeds ~1.3, or if the boundary-layer thickness is not larger than the first layer height (inputs inconsistent; growth ratio and final layer thickness are returned asnan).
Examples¶
Internal pipe flow (default):
from cfdpre import yhgrcalc
yhgrcalc("Air", 50, 10, 2.5, 125, 1, 8)
Internal flow, prism stack limited to 30 % of the radius:
yhgrcalc("Air", 50, 10, 2.5, 125, 1, 8, bl_thickness_fraction=0.3)
External flat-plate flow (velocity required):
yhgrcalc("Air", 25, 1.01325, 2.5, 1000, 1, 15,
flow_type="external", flow_velocity_mpersec=30)
Auto-generated API docs
This reference is currently hand-maintained. Once the updated library is published, it can
be switched to pull directly from the source docstrings via Sphinx autodoc —
the configuration (napoleon, autodoc) is already wired up in conf.py. The equivalent
directive would be:
::: {eval-rst}
.. autofunction:: cfdpre.yhgrcalc
:::