cart3d Package

cart3dIO Module

cart3d_reader Module

Inheritance diagram of pyNastran.converters.cart3d.cart3d_reader

class pyNastran.converters.cart3d.cart3d_reader.Cart3DReader(log=None, debug=False)[source]

Bases: object

Methods

get_max(points, i)[source]
get_min(points, i)[source]
get_normals(nodes, elements, shift_nodes=True)[source]

Gets the centroidal normals

Parameters:
  • self – The reader object
  • nodes – the ndarray of nodes
  • elements – the ndarray of triangles
  • shift_nodes – boolean to shift element IDs such that the node IDs start at 0 instead of 1 True : nodes start at 1 False : nodes start at 0
Retval cnormals:
 

the ndarray of normalized centroidal normal vectors

get_normals_at_nodes(nodes, elements, cnormals, shift_nodes=True)[source]

Gets the nodal normals

Parameters:
  • self – The reader object
  • nodes – the ndarray of nodes
  • elements – the ndarray of triangles
  • cnormals – the ndarray of normalized centroidal normal vectors
  • shift_nodes – boolean to shift element IDs such that the node IDs start at 0 instead of 1 True : nodes start at 1 False : nodes start at 0
Retval nnormals:
 

the ndarray of normalized nodal normal vectors

isOutwardNormals = True
isStructured = False
make_half_model(nodes, elements, regions, loads=None, axis='y', remap_nodes=True)[source]

Makes a half model from a full model

... note:: Cp is really loads[‘Cp’] and was meant for loads analysis only

make_mirror_model(nodes, elements, regions, loads, axis='y', tol=1e-06)[source]

Makes a full cart3d model about the given axis.

Parameters:
  • nodes – the nodes; (nnodes, 3) ndarray
  • elements – the elmements; (nelements, 3) ndarray
  • regions – the regions; (nelements) ndarray
  • loads – not supported; dictionary of (nnodes) ndarray
  • axis – a string of “x”, “y”, “z”, “-x”, “-y”, “-z”
  • tol – the tolerance for the centerline points (default=0.000001)
modelType = 'cart3d'
read_cart3d(infilename, result_names=None)[source]

extracts the points, elements, and Cp

read_elements_ascii(bypass=False)[source]

An element is defined by n1,n2,n3 and the ID is the location in elements.

read_elements_binary(nelements)[source]
read_header_ascii()[source]
read_header_binary()[source]
read_points_ascii()[source]

A point is defined by x,y,z and the ID is the location in points.

read_points_binary(npoints)[source]
read_regions_ascii(bypass=True)[source]
read_regions_binary(nelements)[source]
read_results_ascii(i, infile, result_names=None)[source]

Reads the Cp results. Results are read on a nodal basis from the following table:

Cp rho,rhoU,rhoV,rhoW,rhoE
With the following definitions:
Cp = (p - 1/gamma) / (0.5*M_inf*M_inf) rhoVel^2 = rhoU^2+rhoV^2+rhoW^2 M^2 = rhoVel^2/rho^2
Thus:
p = (gamma-1)*(e- (rhoU**2+rhoV**2+rhoW**2)/(2.*rho)) p_dimensional = qInf * Cp + pInf

# ??? rho,rhoU,rhoV,rhoW,rhoE

Parameters:result_names

the results to read; default=None -> All result_names = [‘Cp’, ‘rho’, ‘rhoU’, ‘rhoV’, ‘rhoW’, ‘rhoE’,

‘Mach’, ‘U’, ‘V’, ‘W’, ‘E’]
read_results_binary(i, infile, result_names=None)[source]
write_cart3d(outfilename, points, elements, regions, loads=None, is_binary=False, float_fmt='%6.7f')[source]
write_elements(f, elements, is_binary, int_fmt='%6i')[source]
write_header(f, points, elements, is_loads, is_binary=False)[source]
write_loads(f, loads, is_binary, float_fmt='%6.6f')[source]
write_points(f, points, is_binary, float_fmt='%6.6f')[source]
write_regions(f, regions, is_binary)[source]
pyNastran.converters.cart3d.cart3d_reader.comp2tri(self, in_filenames, out_filename, is_binary=False, float_fmt='%6.7f')[source]

Combines multiple Cart3d files (binary or ascii) into a single file.

Parameters:
  • in_filenames – list of filenames
  • out_filename – output filename
  • is_binary – is the output filename binary (default=False)
  • float_fmt – the format string to use for ascii writing (default=’%6.7f’)

Note

assumes loads is None

pyNastran.converters.cart3d.cart3d_reader.convert_to_float(svalues)[source]
pyNastran.converters.cart3d.cart3d_reader.main()[source]

cart3d_to_stl Module

pyNastran.converters.cart3d.cart3d_to_stl.cart3d_to_stl(cart3d, log=None, debug=False)[source]

Converts a Cart3DReader object to STL format.

Parameters:
  • cart3d – a Cart3DReader object
  • log – a logger object (or None)
  • debug – True/False (used if log is not defined)
Returns stl:

an STLReader object

pyNastran.converters.cart3d.cart3d_to_stl.cart3d_to_stl_filename(cart3d_filename, stl_filename, log=None, debug=False)[source]

Converts a Cart3D file to STL format.

Parameters:
  • cart3d_filename – path to the input Cart3D file
  • stl_filename – path to the output STL file
  • log – a logger object (or None)
  • debug – True/False (used if log is not defined)

cart3d_to_nastran Module

pyNastran.converters.cart3d.cart3d_to_nastran.cart3d_to_nastran_filename(cart3d_filename, bdf_filename, log=None, debug=False)[source]

Converts a Cart3D file to STL format.

Parameters:
  • cart3d_filename – path to the input Cart3D file
  • bdf_filename – path to the output BDF file
  • log – a logger object (or None)
  • debug – True/False (used if log is not defined)
pyNastran.converters.cart3d.cart3d_to_nastran.main()[source]

test_cart3d Module

Inheritance diagram of pyNastran.converters.cart3d.test_cart3d

class pyNastran.converters.cart3d.test_cart3d.TestCart3d(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

Methods

test_1()[source]
test_2()[source]
test_3()[source]
pyNastran.converters.cart3d.test_cart3d.check_array(points, points2)[source]