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)

class pyNastran.converters.aflr.aflr2.aflr2.AFLR2(log=None, debug: str | bool | None = False)[source]

Bases: object

defines 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)[source]

merges two bedge models into a single new *.bedge file

read_bedge(bedge_filename, beta_reverse=179.7)[source]

reads a *.bedge file

write_fixed_points(fixed_points_filename)[source]

writes a *.csv file that can be read by pyNastranGUI to show the points

write_nastran(bdf_filename)[source]

converts the *.bedge to a nastran *.bdf

pyNastran.converters.aflr.aflr2.aflr2._flip_value(lst)[source]

flips a 0 to 1 and vice-versa

pyNastran.converters.aflr.aflr2.aflr2.export_to_bedge(bedge_filename, nodes, grid_bcs, curves, subcurves, axis=1, log=None)[source]

Creates a bedge file

Parameters:
bedge_filenamestr

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.read_bedge(bedge_filename, beta_reverse=179.7, log=None, debug=False)[source]

reads a *.bedge file

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: object

Initializes 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

get_normals()[source]
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

read_surf_failnode(surf_filename)[source]
class pyNastran.converters.aflr.surf.surf_reader.TagReader(log=None, debug=False)[source]

Bases: object

read_tag_filename(tag_filename)[source]
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: object

Interface to the AFLR UGrid2D format.

read_ugrid(ugrid_filename)[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

pyNastran.converters.aflr.ugrid.ugrid2d_to_nastran.convert_ugrid2d_to_nastran(bdf_filename, nodes, tris, quads, cp=2000, pid=2000, mid=2000, axis_order=None, nid_start=1, eid_start=1, punch=True)[source]
pyNastran.converters.aflr.ugrid.ugrid2d_to_nastran.ugrid2d_to_nastran_filename(ugrid2d_filename, bdf_filename, axis_order=None, nid_start=1, eid_start=1, cp=2000, pid=2000, mid=2000, punch=False)[source]

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

pyNastran.converters.aflr.ugrid.ugrid3d_to_openfoam._write_points(ugrid, points_filename)[source]

writes an OpenFOAM points file

pyNastran.converters.aflr.ugrid.ugrid3d_to_openfoam.main()[source]

Tests UGrid

pyNastran.converters.aflr.ugrid.ugrid3d_to_openfoam.write_foam(ugrid, foam_filename, tag_filename)[source]

writes an OpenFOAM 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.main()[source]
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

pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.write_tecplot(ugrid_model: UGRID, tecplot_filename: str) Tecplot[source]

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: object

Interface to the AFLR UGrid2D format.

read_ugrid(ugrid_filename)[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: object

Interface to the AFLR UGrid format.

_check_node_ids() None[source]
check_hanging_nodes(stop_on_diff: bool = True)[source]

verifies that all nodes are used

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

skin_solids()[source]

Finds the CTRIA3s and CQUAD4 elements on the surface of the solid

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

write_cart3d(cart3d_filename: str | PurePath, float_fmt: str = '%f', encoding=None, pids_to_remove=None, check: bool = True) None[source]
write_ugrid(ugrid_filename_out: str | PurePath, check_shells=True, check_solids=True, check=True)[source]

writes a UGrid model

pyNastran.converters.aflr.ugrid.ugrid_reader._to_unit(value: int) str[source]
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