ugrid Package

aflr2 Module

Inheritance diagram of pyNastran.converters.aflr.aflr2.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=False)[source]

Bases: object

defines methods for reading interfacing with AFLR2

Initializes the AFLR2 object

Parameters:
debug : bool/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

log : logging module object / None

if log is set, debug is ignored and uses the settings the logging object has

merge_bedge(self, bedge, bedge_filename)[source]

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

read_bedge(self, bedge_filename, beta_reverse=179.7)[source]

reads a *.bedge file

write_fixed_points(self, fixed_points_filename)[source]

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

write_nastran(self, 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_filename : str

the *.bedge file

nodes : ???

???

grid_bcs : ???

??? source is model.grid_bc, not model.grid_bcs

curves : ???

???

subcurves : ???

???

axis : int; default=1

the axis to remove (nodes in Nx3)

log : Logger(); 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

Inheritance diagram of pyNastran.converters.aflr.surf.surf_reader
class pyNastran.converters.aflr.surf.surf_reader.SurfReader(log=None, debug=False)[source]

Bases: object

Initializes the SurfReader object

Parameters:
debug : bool/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

log : logging module object / None

if log is set, debug is ignored and uses the settings the logging object has

get_normals(self)[source]
read_surf(self, 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(self, surf_filename)[source]
class pyNastran.converters.aflr.surf.surf_reader.TagReader(log=None, debug=False)[source]

Bases: object

read_tag_filename(self, 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_filenames : List[str]

list of surf filenames

surf_out_filename : str; default=None -> no writing

string of stl output filename

Returns:
surf : SurfReader

the surf object

ugrid2d_reader Module

Inheritance diagram of pyNastran.converters.aflr.ugrid.ugrid2d_reader
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(self, 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_filename : str

the input UGRID filename

bdf_filename : str

the output BDF filename

include_shells : bool; default=True

should the shells be written

include_solids : bool; default=True

should the solids be written

convert_pyram_to_penta : bool; default=False

False : NX Nastran True : MSC Nastran

size : int; {8, 16}; default=16

the bdf write precision

is_double : bool; default=False

the field precision to write

log : logger; default=None

a logger object

Returns:
ugrid_model : UGRID()

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, log=None, debug=False)[source]

helper method for loading UGRID models

Parameters:
ugrid_filename : varies

str : the input UGRID filename UGRID : the UGRID object

Returns:
ugrid_model : UGRID()

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, tecplot_filename, log=None, debug=False)[source]

Converts a UGRID to a Tecplot ASCII file.

Parameters:
ugrid_filename : varies

str : the input UGRID filename UGRID : the UGRID object

tecplot_filename : str

the output Tecplot filename

log : logger; default=None

a logger object

debug : bool; default=False

developer debug

Returns:
tecplot_model : Tecplot()

the Tecplot object

pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.ugrid_to_tecplot(ugrid_filename, tecplot_filename=None, log=None, debug=False)[source]

Converts a UGRID to a Tecplot ASCII file.

Parameters:
ugrid_filename : varies

str : the input UGRID filename UGRID : the UGRID object

tecplot_filename : str

the output Tecplot filename

log : logger; default=None

a logger object

debug : bool; default=False

developer debug

Returns:
tecplot_model : Tecplot()

the Tecplot object

pyNastran.converters.aflr.ugrid.ugrid3d_to_tecplot.write_tecplot(ugrid_model, tecplot_filename)[source]

ugrid2d_reader Module

Inheritance diagram of pyNastran.converters.aflr.ugrid.ugrid2d_reader
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(self, 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

Inheritance diagram of pyNastran.converters.aflr.ugrid.ugrid_reader
Defines the following classes:
  • UGRID
class pyNastran.converters.aflr.ugrid.ugrid_reader.UGRID(log=None, debug=False, read_shells=True, read_solids=True)[source]

Bases: object

Interface to the AFLR UGrid format.

_check_node_ids(self)[source]
_write_bdf_solids(self, bdf_file, eid, pid, convert_pyram_to_penta=True)[source]

writes the Nastran BDF solid elements

check_hanging_nodes(self, stop_on_diff=True)[source]

verifies that all nodes are used

read_ugrid(self, ugrid_filename, check=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(self)[source]

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

write_bdf(self, bdf_filename, include_shells=True, include_solids=True, convert_pyram_to_penta=True, write_grids=True, encoding=None, size=16, is_double=False, check=True)[source]

writes a Nastran BDF

Parameters:
size : int; {8, 16}; default=16

the bdf write precision

is_double : bool; default=False

the field precision to write

write_ugrid(self, ugrid_filename_out, check_shells=True, check_solids=True, check=True)[source]

writes a UGrid model

pyNastran.converters.aflr.ugrid.ugrid_reader.determine_dytpe_nfloat_endian_from_ugrid_filename(ugrid_filename=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=None, encoding=None, log=None, debug=True, read_shells=True, read_solids=True, check=True)[source]

Creates the UGRID object

Parameters:
ugrid_filename : str (default=None -> popup)

the ugrid filename

debug : bool/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

log : logging module object / None

if log is set, debug is ignored and uses the settings the logging object has

encoding : str; default=None

is this used?

Returns:
model : UGRID()

an UGRID object