hexed 0.4.0
 
Loading...
Searching...
No Matches
hexedpy.utils Namespace Reference

A Python module with random tools that are useful for Hexed simulations. More...

Classes

class  History_plot
 creates a real-time, interactive plot of the convergence history More...
 

Functions

 naca (desig, n_points=1000, closure="warp")
 Constructs a NACA 4-digit airfoil geometry.
 
 joukowsky (thickness, camber=0., n_points=1000, scale=True)
 constructs a Joukowsky airfoil
 
 sort_curve (data, coords, start_at=0, closed=True)
 Returns data sorted into a continuous curve.
 
 read_history (output_directory)
 Reads the convergence history from output.txt and returns it as a pandas.DataFrame.
 

Variables

 zhukovsky = joukowsky
 alternative transliteration
 

Detailed Description

A Python module with random tools that are useful for Hexed simulations.

Function Documentation

◆ joukowsky()

hexedpy.utils.joukowsky ( thickness,
camber = 0.,
n_points = 1000,
scale = True )

constructs a Joukowsky airfoil

This is a family of airfoils with a cusped trailing edge which have analytic solutions for the incompressible flow around them.

Parameters
thicknessapproximate thickness-to-chord ratio
camber(radian) angle between the trailing edge and the chord line
n_pointsNumber of points on the airfoil surface
scaleIf True, scale the airfoil so that the leading edge is at (0, 0) and the trailing edge is at (0, 1). Otherwise, the airfoil is left at the size and position dictated by the Joukowsky transform.

◆ naca()

hexedpy.utils.naca ( desig,
n_points = 1000,
closure = "warp" )

Constructs a NACA 4-digit airfoil geometry.

Returns an n by 2 numpy array representing the coordinates of the airfoil at discrete points. This array can then be passed to Solver.generate_mesh as a geometry. Points are clustered near the leading edge but not the trailing (see implementation for details). This function is the recommended way to generate NACA airfoil geometry for Hexed simulations, as importing airfoils from coordinate files requires some special care.

Parameters
desigString representing the airfoil designation (e.g., "0012" for the NACA0012). In general, we cannot accept this parameter as an int because of possible leading zeros.
n_pointsNumber of points on the airfoil surface. Don't be stingy, since DG is finnicky with discrete geometry representations—1000 is actually on the lower end of what I normally use.
closureIf and how to close the trailing edge. There are 3 options:
  • "warp": Close the trailing edge by adding a 4th-degree polyomial of \( x_0 \) to \( x_1 \).
  • "segment": Close the trailing edge by adding a line segment connecting the last point to the first point, causing the array to be (n_points + 1)*2 instead of n_points*2.
  • "extend": Extends the \( x_0 \) domain until the point where the upper and lower surface meet and then rescales the whole airfoil to keep the chord equal to 1. This stays faithful to the original polynomial profile, but slightly decreases the thickness. This is the method used in the classic NASA validation case. Extension and rescaling are applied after the camber addition.
  • "none", None, or False: Don't close the trailing edge.

◆ read_history()

hexedpy.utils.read_history ( output_directory)

Reads the convergence history from output.txt and returns it as a pandas.DataFrame.

Parameters
output_directoryThe working_dir of the simulation you want to read the history of (e.g. hexed_out if you used the default working_dir). Can be an absolute or relative path.

◆ sort_curve()

hexedpy.utils.sort_curve ( data,
coords,
start_at = 0,
closed = True )

Returns data sorted into a continuous curve.

Parameters
dataA pandas.DataFrame containing the data (coordinates and flow variables) to be sorted
coordsLabels of columns to treat as coordinates
start_atIndex of point to start at
closedIf true, will append an additional copy of the start point to the end to ensure that the final curve is closed.