ugrid Package
aflr2 Module
digraph inheritancea82b7e08e4 {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.converters.aflr.aflr2.aflr2.AFLR2" [URL="#pyNastran.converters.aflr.aflr2.aflr2.AFLR2",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="defines methods for reading interfacing with AFLR2"];
}
- defines:
read_bedge(bedge_filename, beta_reverse=179.7, log=None, debug=False)
AFLR2(log=None, debug=False) - read_bedge(self, bedge_filename, beta_reverse=179.7) - write_nastran(self, bdf_filename) - write_fixed_points(self, fixed_points_filename) - merge_bedge(self, bedge, bedge_filename)
export_to_bedge(bedge_filename, nodes, grid_bcs, curves, subcurves, axis=1, log=None)
- m3.bedge
4 4 2 4 4
60 16 60 16 134 6 76 22 252 2 66 2
- 144 2
0 0 0 0 1 1 1 1 1 1 1 1 1 1
-6.633581169548380 -4.083969916911601 …
ncurves = 4 nsubcurves_per_curve = [4, 2, 4, 4]; n=4 nsubcurves = 14 nnodes_pack = [60, 16, 60, 16, 134, 6, 76, 22, 252, 2, 66, 2, 144, 2]; n=14 grid_bc = [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; n=14
- class pyNastran.converters.aflr.aflr2.aflr2.AFLR2(log=None, debug: str | bool | None = False)[source]
Bases:
objectdefines methods for reading interfacing with AFLR2
Initializes the AFLR2 object
- Parameters:
- debugbool/None; default=True
- used to set the logger if no logger is passed in
True: logs debug/info/error messages False: logs info/error messages None: logs error messages
- loglogging module object / None
if log is set, debug is ignored and uses the settings the logging object has
- merge_bedge(bedge, bedge_filename: str | PurePath) None[source]
merges two bedge models into a single new *.bedge file
- read_bedge(bedge_filename: str | PurePath, beta_reverse: float = 179.7) None[source]
reads a *.bedge file
- write_esp(esp_filename: str | PurePath, curves_to_skip: list[int] | None = None) None[source]
LINSEG straight line segment CIRARC circular arc ARC alternative way of specifying a circular arc BEZIER Bezier curve SPLINE cubic spline
- skbeg Wing_RX_TE 0 0
linseg Wing_TX_TE Wing_Semib 0 linseg Wing_TX Wing_Semib 0 linseg Wing_RX 0 0 linseg Wing_RX_TE 0 0
skend
SKBEG 1.0 2.0 Z LINSEG 1.0+L 2.0 Z CIRARC 1.0+L-(1-s2)*H 2.0+s2*H Z 1.0+L-H 2.0+H Z LINSEG 1.0 2.0+H Z LINSEG 1.0 2.0 Z SKEND
- write_fixed_points(fixed_points_filename: str | PurePath) None[source]
writes a *.csv file that can be read by pyNastranGUI to show the points
- write_tri(tri_filename: str | PurePath, holes: list[tuple[float, float]] | None = None, circles: list[tuple[float, float, float, int]] | None = None, regions: list[tuple[float, float]] | None = None, curves_to_skip: list[int] | None = None, bc_tags: list[int] | None = None, temp_tags_map: list[int] | None = None, min_angle: float | str = 20.0, max_area: float | str = 0.05, tri_order: int = 1, plot_clear_regions: bool = True, show: bool = False) None[source]
- pyNastran.converters.aflr.aflr2.aflr2._flip_value(lst: list[int]) list[int][source]
flips a 0 to 1 and vice-versa
- pyNastran.converters.aflr.aflr2.aflr2._func_circle(R: float, x: float, y: float, N: int) tuple[ndarray, ndarray][source]
- pyNastran.converters.aflr.aflr2.aflr2.export_to_bedge(bedge_filename: str | PurePath, nodes, grid_bcs, curves, subcurves, axis: int = 1, log: SimpleLogger | None = None)[source]
Creates a bedge file
- Parameters:
- bedge_filenamestr | Path
the *.bedge file
- nodes???
???
- grid_bcs???
??? source is model.grid_bc, not model.grid_bcs
- curves???
???
- subcurves???
???
- axisint; default=1
the axis to remove (nodes in Nx3)
- logLogger(); default=None
a required logging object
- pyNastran.converters.aflr.aflr2.aflr2.get_nnodes_pack(curves: ndarray, subcurves: ndarray, log: SimpleLogger) list[source]
- pyNastran.converters.aflr.aflr2.aflr2.get_triangle_input(model: AFLR2, holes: list[tuple[float, float]] | None = None, circles: list[tuple[float, float, float, int]] | None = None, regions: list[tuple[float, float, int, int]] | None = None, curves_to_skip: list[int] | None = None, min_angle: float | str = 20.0, max_area: float | str = 0.05, tri_order: int = 1) tuple[dict[str, ndarray], str][source]
‘qpa0.05’
- Triangle needs to be a closed curve and 2d (unlike bedge)
triangle has an MIT license
https://github.com/inducer/meshpy https://rufat.be/triangle/examples.html
- Parameters:
- extrastr
https://www.cs.cmu.edu/~quake/triangle.switch.html -A Assigns a regional attribute to each triangle that
identifies what segment-bounded region it belongs to.
- -j Jettisons vertices that are not part of the final
triangulation from the output .node file (including duplicate input vertices and vertices ``eaten’’ by holes).
-o2 Generates second-order subparametric elements with six nodes each.
- optionsstr; default=’qpa0.05’
*p - Triangulates a Planar Straight Line Graph. r - Refines a previously generated mesh. *q - Quality mesh generation with no angles smaller
than 20 degrees. An alternate minimum angle may be specified after the q.
- *a - Imposes a maximum triangle area constraint.
A fixed area constraint (that applies to every triangle) may be specified after the a, or varying areas may be read from the input dictionary.
c - Encloses the convex hull with segments. D - Conforming Delaunay: use this switch if you want all
triangles in the mesh to be Delaunay, and not just constrained Delaunay; or if you want to ensure that all Voronoi vertices lie within the triangulation.
X - Suppresses exact arithmetic. S - Specifies the maximum number of added Steiner points. i - Uses the incremental algorithm for Delaunay
triangulation, rather than the divide-and-conquer algorithm.
- F - Uses Steven Fortune’s sweepline algorithm for
Delaunay triangulation, rather than the divide-and-conquer algorithm.
- l - Uses only vertical cuts in the divide-and-conquer
algorithm. By default, Triangle uses alternating vertical and horizontal cuts, which usually improve the speed except with vertex sets that are small or short and wide. This switch is primarily of theoretical interest.
- s - Specifies that segments should be forced into the
triangulation by recursively splitting them at their midpoints, rather than by generating a constrained Delaunay triangulation. Segment splitting is true to Ruppert’s original algorithm, but can create needlessly small triangles. This switch is primarily of theoretical interest.
- C - Check the consistency of the final mesh. Uses exact
arithmetic for checking, even if the -X switch is used. Useful if you suspect Triangle is buggy.
n - Return neighbor list in dict key ‘neighbors’ e - Return edge list in dict key ‘edges’
surf_reader Module
digraph inheritance0c05775e3d {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.converters.aflr.surf.surf_reader.SurfReader" [URL="#pyNastran.converters.aflr.surf.surf_reader.SurfReader",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"];
"pyNastran.converters.aflr.surf.surf_reader.TagReader" [URL="#pyNastran.converters.aflr.surf.surf_reader.TagReader",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"];
}
- class pyNastran.converters.aflr.surf.surf_reader.SurfReader(log=None, debug=False)[source]
Bases:
objectInitializes the SurfReader object
- Parameters:
- debugbool/None; default=True
- used to set the logger if no logger is passed in
True: logs debug/info/error messages False: logs info/error messages None: logs error messages
- loglogging module object / None
if log is set, debug is ignored and uses the settings the logging object has
- read_surf(surf_filename)[source]
# AFLR3,14.18.115,28.206.154,WIN/doc/ug_io/3d_input_output_grids.html
Grid BC
Description
-6
internal embedded/transparent surface that will be converted to internal/interior/volume faces with BL volume grid
-5
embedded/transparent surface with BL volume grid
-1
standard surface with BL volume grid; wall
0
standard surface
1
standard surface; farfield
2
standard surface that intersects the BL region; boundary layer
3
embedded/transparent surface or source surface that will be converted to source nodes; source
4
embedded/transparent surface that intersects the BL region
5
embedded/transparent surface
6
internal embedded/transparent surface that will be converted to internal/interior/volume faces
7
fixed surface that intersects and directly connects to the BL region; transparent
- class pyNastran.converters.aflr.surf.surf_reader.TagReader(log=None, debug=False)[source]
Bases:
object
- pyNastran.converters.aflr.surf.surf_reader.combine_surfs(surf_filenames, surf_out_filename=None)[source]
Combines multiple SURFs into a single file
- Parameters:
- surf_filenameslist[str]
list of surf filenames
- surf_out_filenamestr; default=None -> no writing
string of stl output filename
- Returns:
- surfSurfReader
the surf object
ugrid2d_reader Module
digraph inheritance9ea67ac6b1 {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.converters.aflr.ugrid.ugrid2d_reader.UGRID2D_Reader" [URL="#id0",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Interface to the AFLR UGrid2D format."];
}
- Defines the following classes:
UGRID2D_Reader
- class pyNastran.converters.aflr.ugrid.ugrid2d_reader.UGRID2D_Reader(log=None, debug=None)[source]
Bases:
objectInterface to the AFLR UGrid2D format.
- read_ugrid(ugrid_filename: str | PurePath)[source]
Reads a ugrid2d file of the form:
#(nnodes, ntrias, nquads), ntets, npyram5, npenta6, nhexas8s '5 1 1 0 0 0 0
- ‘
# nodes ‘0. 0. 0.
- ‘
‘1. 0. 0.
- ‘
‘1. 1. 0.
- ‘
‘0. 1. 0.
- ‘
‘0. 2. 0.
- ‘
# tris ‘3 4 5
- ‘
# quads ‘1 2 3 4
‘
Note
comment lines should not be included and exist for reference
ugrid2d_to_nastran Module
ugrid3d_to_nastran Module
- pyNastran.converters.aflr.ugrid.ugrid3d_to_nastran.ugrid3d_to_nastran(ugrid_filename, bdf_filename, include_shells=True, include_solids=True, convert_pyram_to_penta=False, encoding=None, size=16, is_double=False, log=None)[source]
Converts a UGRID to a BDF.
- Parameters:
- ugrid_filenamestr
the input UGRID filename
- bdf_filenamestr
the output BDF filename
- include_shellsbool; default=True
should the shells be written
- include_solidsbool; default=True
should the solids be written
- convert_pyram_to_pentabool; default=False
False : NX Nastran True : MSC Nastran
- sizeint; {8, 16}; default=16
the bdf write precision
- is_doublebool; default=False
the field precision to write
- loglogger; default=None
a logger object
- Returns:
- ugrid_modelUGRID()
the ugrid model
ugrid3d_to_openfoam Module
- pyNastran.converters.aflr.ugrid.ugrid3d_to_openfoam._write_boundary(ugrid, boundary_filename, tag_filename)[source]
writes an OpenFOAM boundary file
- pyNastran.converters.aflr.ugrid.ugrid3d_to_openfoam._write_faces(ugrid, faces_filename)[source]
writes an OpenFOAM faces file
ugrid3d_to_tecplot Module
- pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.get_ugrid_model(ugrid_filename: str, log=None, debug: bool = False) UGRID[source]
helper method for loading UGRID models
- Parameters:
- ugrid_filenamevaries
str : the input UGRID filename UGRID : the UGRID object
- Returns:
- ugrid_modelUGRID()
the UGRID object
- pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.ugrid3d_to_tecplot_filename(ugrid_filename: str, tecplot_filename: str, log=None, debug: bool = False) Tecplot[source]
Converts a UGRID to a Tecplot ASCII file.
- Parameters:
- ugrid_filenamevaries
str : the input UGRID filename UGRID : the UGRID object
- tecplot_filenamestr
the output Tecplot filename
- loglogger; default=None
a logger object
- debugbool; default=False
developer debug
- Returns:
- tecplot_modelTecplot()
the Tecplot object
- pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.ugrid_to_tecplot(ugrid_filename: str, tecplot_filename: str | None = None, log=None, debug: bool = False) tuple[Tecplot, Zone][source]
Converts a UGRID to a Tecplot ASCII file.
- Parameters:
- ugrid_filenamevaries
str : the input UGRID filename UGRID : the UGRID object
- tecplot_filenamestr
the output Tecplot filename
- loglogger; default=None
a logger object
- debugbool; default=False
developer debug
- Returns:
- tecplot_modelTecplot()
the Tecplot object
ugrid2d_reader Module
digraph inheritance9ea67ac6b1 {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.converters.aflr.ugrid.ugrid2d_reader.UGRID2D_Reader" [URL="#id0",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Interface to the AFLR UGrid2D format."];
}
- Defines the following classes:
UGRID2D_Reader
- class pyNastran.converters.aflr.ugrid.ugrid2d_reader.UGRID2D_Reader(log=None, debug=None)[source]
Bases:
objectInterface to the AFLR UGrid2D format.
- read_ugrid(ugrid_filename: str | PurePath)[source]
Reads a ugrid2d file of the form:
#(nnodes, ntrias, nquads), ntets, npyram5, npenta6, nhexas8s '5 1 1 0 0 0 0
- ‘
# nodes ‘0. 0. 0.
- ‘
‘1. 0. 0.
- ‘
‘1. 1. 0.
- ‘
‘0. 1. 0.
- ‘
‘0. 2. 0.
- ‘
# tris ‘3 4 5
- ‘
# quads ‘1 2 3 4
‘
Note
comment lines should not be included and exist for reference
ugrid_reader Module
digraph inheritanceb23aabd6c5 {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.converters.aflr.ugrid.ugrid_reader.UGRID" [URL="#pyNastran.converters.aflr.ugrid.ugrid_reader.UGRID",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Interface to the AFLR UGrid format."];
}
- Defines the following classes:
UGRID
- class pyNastran.converters.aflr.ugrid.ugrid_reader.UGRID(log=None, debug: bool = False, read_shells: bool = True, read_solids: bool = True)[source]
Bases:
objectInterface to the AFLR UGrid format.
- read_ugrid(ugrid_filename: str | PurePath | None, check: bool = True)[source]
$ $ NASTRAN INPUT DECK GENERATED BY UG_IO $ BEGIN BULK $UG_IO_ Data $Number_of_BL_Vol_Tets 2426 $UG_IO_ Data $Number_of_Bnd_Nodes 34350 $UG_IO_ Data $Number_of_Nodes 399036 $UG_IO_ Data $Number_of_Surf_Quads 20665 $UG_IO_ Data $Number_of_Surf_Trias 27870 $UG_IO_ Data $Number_of_Vol_Hexs 163670 $UG_IO_ Data $Number_of_Vol_Pents_5 27875 $UG_IO_ Data $Number_of_Vol_Pents_6 67892 $UG_IO_ Data $Number_of_Vol_Tets 1036480
- write_bdf(bdf_filename: str | PurePath, include_shells: bool = True, include_solids: bool = True, convert_pyram_to_penta: bool = True, write_grids: bool = True, encoding=None, size: int = 16, is_double: bool = False, check: bool = True) None[source]
writes a Nastran BDF
- Parameters:
- sizeint; {8, 16}; default=16
the bdf write precision
- is_doublebool; default=False
the field precision to write
- pyNastran.converters.aflr.ugrid.ugrid_reader._write_bdf_solids(bdf_file, log, eid: int, pid: int, tets, penta5s, penta6s, hexas, convert_pyram_to_penta: bool = True)[source]
writes the Nastran BDF solid elements
- pyNastran.converters.aflr.ugrid.ugrid_reader.determine_dytpe_nfloat_endian_from_ugrid_filename(ugrid_filename: str | PurePath | None = None)[source]
figures out what the format of the binary data is based on the filename
- pyNastran.converters.aflr.ugrid.ugrid_reader.read_ugrid(ugrid_filename: str | PurePath | None = None, encoding=None, log=None, debug: bool = True, read_shells: bool = True, read_solids: bool = True, check: bool = True)[source]
Creates the UGRID object
- Parameters:
- ugrid_filenamestr (default=None -> popup)
the ugrid filename
- debugbool/None
- used to set the logger if no logger is passed in
True: logs debug/info/error messages False: logs info/error messages None: logs error messages
- loglogging module object / None
if log is set, debug is ignored and uses the settings the logging object has
- encodingstr; default=None
is this used?
- Returns:
- modelUGRID()
an UGRID object