cart3d Package

cart3d Module

digraph inheritance462bd5f69d { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.converters.cart3d.cart3d.Cart3D" [URL="#pyNastran.converters.cart3d.cart3d.Cart3D",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="Cart3d interface class"]; "pyNastran.converters.cart3d.cart3d_reader_writer.Cart3dReaderWriter" -> "pyNastran.converters.cart3d.cart3d.Cart3D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.converters.cart3d.cart3d_reader_writer.Cart3dReaderWriter" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Cart3d IO class"]; }
Defines:
  • Cart3D(log=None, debug=False)
    • read_cart3d(self, infilename, result_names=None)

    • write_cart3d(self, outfilename, is_binary=False, float_fmt=’%6.7f’)

    • flip_model()

    • make_mirror_model(self, nodes, elements, regions, loads, axis=’y’, tol=0.000001)

    • make_half_model(self, axis=’y’, remap_nodes=True)

    • get_free_edges(self, elements)

    • get_area(self)

    • get_normals(self)

    • get_normals_at_nodes(self, cnormals)

  • comp2tri(in_filenames, out_filename,

    is_binary=False, float_fmt=’%6.7f’)

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

Bases: Cart3dReaderWriter

Cart3d interface class

flip_model() None[source]

flip the model about the y-axis

get_area() ndarray[source]

Gets the element area

Returns:
area(nelement,) float ndarray

the element areas

get_area_centroid_normals()[source]

Gets the area, centroid, and centroidal normals

Returns:
area(nelement,) float ndarray

the element areas

centroid(nelement, 3) float ndarray

centroid of the element

cnormals(nelement, 3) float ndarray

normalized centroidal normal vectors

get_free_edges(elements)[source]

Cart3d must be a closed model with each edge shared by 2 elements The free edges indicate the problematic areas.

Returns:
free edges(nedges, 2) int ndarray

the free edge node ids

get_normals() ndarray[source]

Gets the centroidal normals

Returns:
cnormals(n, 3) ndarray

normalized centroidal normal vectors

get_normals_at_nodes(cnormals: ndarray) ndarray[source]

Gets the nodal normals

Parameters:
cnormals(nelement, 3) float ndarray

normalized centroidal normal vectors

Returns:
nnormals(nnode, 3) float ndarray

normalized nodal normal vectors

is_outward_normals = True
is_structured = False
keep_elements(ielements: ndarray, remove_associated_nodes: bool = True) ndarray[source]

keeps a set of elements from the model

make_half_model(axis: str = 'y', remap_nodes: bool = True)[source]

Makes a half model from a full model

Notes

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(nnodes, 3) ndarray

the nodes

elements(nelements, 3) ndarray

the elmements

regions(nelements) ndarray

the regions

loadsdict[str] = (nnodes) ndarray

not supported

axisstr; {“x”, “y”, “z”, “-x”, “-y”, “-z”}

a string of the axis

tolfloat; default=0.000001

the tolerance for the centerline points

model_type = 'cart3d'
read_cart3d(infilename, result_names=None)[source]

extracts the points, elements, and Cp

remove_elements(ielements: ndarray, remove_associated_nodes: bool = True) ndarray[source]

removes a set of elements from the model

write_cart3d(outfilename, is_binary=False, float_fmt='%6.7f')[source]

writes a cart3d file

pyNastran.converters.cart3d.cart3d.comp2tri(in_filenames, out_filename, is_binary=False, float_fmt='%6.7f', log=None, debug=False) Cart3D[source]

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

Parameters:
in_filenameslist[str]

list of filenames

out_filenamestr

output filename

is_binarybool; default=False

is the output file binary

float_fmtstr; default=’%6.7f’

the format string to use for ascii writing

Notes

assumes loads is None

pyNastran.converters.cart3d.cart3d.convert_to_float(svalues: list[str]) list[float][source]

Takes a list of strings and converts them to floats.

pyNastran.converters.cart3d.cart3d.get_area_centroid_normals(nodes: ndarray, elements: ndarray) tuple[ndarray, ndarray, ndarray][source]

Gets the area, centroid, and centroidal normals

Parameters:
nodes(nnode,3) float ndarray

the nodal load

elements(nelement,3) int ndarray

the nodal load

Returns:
area(nelement,) float ndarray

the element areas

centroid(nelement, 3) float ndarray

centroid of the element

cnormals(nelement, 3) float ndarray

normalized centroidal normal vectors

pyNastran.converters.cart3d.cart3d.get_average_load(load: dict[str, ndarray], elements: ndarray) ndarray[source]

Gets the area, centroid, and centroidal normals

Returns:
load(nnode,) float ndarray

the nodal load

pyNastran.converters.cart3d.cart3d.read_cart3d(cart3d_filename, log=None, debug=False, result_names=None) Cart3D[source]

loads a Cart3D file

cart3d_result Module

digraph inheritance447ed5111c { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.converters.cart3d.cart3d_result.Cart3dGeometry" [URL="#pyNastran.converters.cart3d.cart3d_result.Cart3dGeometry",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="Stores the cart3d results."]; "pyNastran.gui.gui_objects.gui_result.GuiResultCommon" -> "pyNastran.converters.cart3d.cart3d_result.Cart3dGeometry" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.gui.gui_objects.gui_result.GuiResultCommon" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }
defines:
  • Cart3dGeometry

class pyNastran.converters.cart3d.cart3d_result.Cart3dGeometry(subcase_id, labels, nodes, elements, regions, area, cnormals, colormap: str = 'jet', uname: str = 'Cart3dGeometry')[source]

Bases: GuiResultCommon

Stores the cart3d results.

get_annotation(i, name)[source]
headerstr

the sidebar word

get_data_format(i, name)[source]
get_default_data_format(i, name)[source]
get_default_legend_title(i, name)[source]
get_default_min_max(i, name) tuple[float, float][source]
get_default_nlabels_labelsize_ncolors_colormap(i, name)[source]
get_fringe_result(i, name) ndarray[source]
get_fringe_vector_result(i, name) tuple[ndarray, None][source]
get_imin_imax(i, name) tuple[None, None][source]
get_legend_title(i, name)[source]
get_location(i, name)[source]
get_methods(i: str, name: str)[source]
get_min_max(i, name) tuple[float, float][source]
get_nlabels_labelsize_ncolors_colormap(i, name)[source]
has_coord_transform(i: int, name: str) tuple[bool, list[str]][source]
has_derivation_transform(i: int, resname: str) tuple[bool, dict[str, Any]][source]

min/max/avg

has_nodal_combine_transform(i: int, resname: str) tuple[bool, list[str]][source]

elemental -> nodal

set_data_format(i, name, data_format)[source]
set_legend_title(i, name, title)[source]
set_min_max(i, name, min_value, max_value)[source]
set_nlabels_labelsize_ncolors_colormap(i, name, nlabels, labelsize, ncolors, colormap)[source]

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 Nastran format.

Parameters:
cart3d_filenamestr

path to the input Cart3D file

bdf_filenamestr

path to the output BDF file

loglog / None

log : a logger object None : a log will be defined

debugbool

True/False (used if log is not defined)

Examples

>>> cart3d_filename = 'threePlugs.tri'
>>> bdf_filename = 'threePlugs.bdf'
>>> cart3d_to_nastran_filename(cart3d_filename, bdf_filename)
pyNastran.converters.cart3d.cart3d_to_nastran.cart3d_to_nastran_model(cart3d_filename: str, loads_map: LOADS_DICT | None = None, log: SimpleLogger | None = None, debug: bool = False) BDF[source]

Converts a Cart3D file to Nastran format and returns a BDF() object.

Parameters:
cart3d_filenamestr

path to the input Cart3D file

loads_dict: dict[load_id, case]

case : dict[eid, pressure] write the loads

loglog / None

log : a logger object None : a log will be defined

debugbool

True/False (used if log is not defined)

Returns:
bdf_modelBDF

BDF() model object

cart3d_to_stl Module

defines:
  • stl = cart3d_to_stl(cart3d, stl_filename=None, is_binary=False, log=None, debug=False)

  • stl = cart3d_to_stl_filename(cart3d_filename, stl_filename=None, is_binary=False, log=None, debug=False)

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

Converts a Cart3D object to STL format.

Parameters:
cart3dCart3D()

a Cart3D object

stl_filenamestr; default=None

path to the output STL file (or None to skip)

loglog

a logger object (or None)

debugbool; default=False

True/False (used if log is not defined)

Returns:
stlSTL()

an STL object

Todo

this seems to be broken… ..

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

Converts a Cart3D file to STL format.

Parameters:
cart3d_filenamestr

path to the input Cart3D file

stl_filenamestr; default=None

path to the output STL file (or None to skip

is_binarybool; default=False

writes the stl in binary

loglog

a logger object (or None)

debugbool; default=False

True/False (used if log is not defined)

Returns:
stlSTL()

an STL object

cart3d_to_tecplot Module

pyNastran.converters.cart3d.cart3d_to_tecplot.cart3d_to_tecplot(cart3d_filename, tecplot_filename, log=None, debug=False)[source]

Converts Cart3d to Tecplot

input_c3d_reader Module

digraph inheritance92950c0ec7 { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.converters.cart3d.input_c3d_reader.InputC3dReader" [URL="#pyNastran.converters.cart3d.input_c3d_reader.InputC3dReader",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.cart3d.input_c3d_reader.InputC3dReader(log=None, debug=False)[source]

Bases: object

read_input_c3d(input_c3d_filename, stack=True)[source]

reads the input.c3d file

pyNastran.converters.cart3d.input_c3d_reader.read_input_c3d(input_c3d_filename, log=None, debug=False, stack=True) InputC3dReader[source]

reads the input.c3d file

>>> input_c3d_filename = 'bJet/input.c3d'
>>> nodes, elements = read_input_c3d(input_c3d_filename)

input_cntl_reader Module

digraph inheritance8aac948077 { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.converters.cart3d.input_cntl_reader.InputCntlReader" [URL="#pyNastran.converters.cart3d.input_cntl_reader.InputCntlReader",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.cart3d.input_cntl_reader.InputCntlReader(log=None, debug=False)[source]

Bases: object

get_boundary_conditions() tuple[int, int, int, int, int, int, dict[int, list[float]]][source]
get_flow_conditions()[source]
get_post_processing()[source]
read_input_cntl(input_cntl_filename)[source]
pyNastran.converters.cart3d.input_cntl_reader.main()[source]
pyNastran.converters.cart3d.input_cntl_reader.read_input_cntl(input_cntl_filename, log=None, debug=False) InputCntlReader[source]