coordinate_systems Module

digraph inheritance3e3364fb2e { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.bdf.cards.base_card.BaseCard" [URL="pyNastran.bdf.cards.base_card.html#pyNastran.bdf.cards.base_card.BaseCard",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 a series of base methods for every card class"]; "pyNastran.bdf.cards.coordinate_systems.CORD1C" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD1C",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="Intilizes the CORD1C"]; "pyNastran.bdf.cards.coordinate_systems.Cord1x" -> "pyNastran.bdf.cards.coordinate_systems.CORD1C" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CylindricalCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD1C" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD1R" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD1R",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="Intilizes the CORD1R"]; "pyNastran.bdf.cards.coordinate_systems.Cord1x" -> "pyNastran.bdf.cards.coordinate_systems.CORD1R" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.RectangularCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD1R" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD1S" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD1S",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="Intilizes the CORD1S"]; "pyNastran.bdf.cards.coordinate_systems.Cord1x" -> "pyNastran.bdf.cards.coordinate_systems.CORD1S" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.SphericalCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD1S" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD2C" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD2C",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="Intilizes the CORD2C"]; "pyNastran.bdf.cards.coordinate_systems.Cord2x" -> "pyNastran.bdf.cards.coordinate_systems.CORD2C" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CylindricalCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD2C" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD2R" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD2R",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="Intilizes the CORD2R"]; "pyNastran.bdf.cards.coordinate_systems.Cord2x" -> "pyNastran.bdf.cards.coordinate_systems.CORD2R" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.RectangularCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD2R" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD2S" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD2S",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="Intilizes the CORD2S"]; "pyNastran.bdf.cards.coordinate_systems.Cord2x" -> "pyNastran.bdf.cards.coordinate_systems.CORD2S" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.SphericalCoord" -> "pyNastran.bdf.cards.coordinate_systems.CORD2S" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CORD3G" [URL="#pyNastran.bdf.cards.coordinate_systems.CORD3G",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 a general coordinate system using three rotational angles as"]; "pyNastran.bdf.cards.coordinate_systems.Coord" -> "pyNastran.bdf.cards.coordinate_systems.CORD3G" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.Coord" [URL="#pyNastran.bdf.cards.coordinate_systems.Coord",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.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.coordinate_systems.Coord" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.Cord1x" [URL="#pyNastran.bdf.cards.coordinate_systems.Cord1x",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="Parent class for:"]; "pyNastran.bdf.cards.coordinate_systems.Coord" -> "pyNastran.bdf.cards.coordinate_systems.Cord1x" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.Cord2x" [URL="#pyNastran.bdf.cards.coordinate_systems.Cord2x",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="Parent class for:"]; "pyNastran.bdf.cards.coordinate_systems.Coord" -> "pyNastran.bdf.cards.coordinate_systems.Cord2x" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.coordinate_systems.CylindricalCoord" [URL="#pyNastran.bdf.cards.coordinate_systems.CylindricalCoord",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 common methods for cylindrical coordinate systems"]; "pyNastran.bdf.cards.coordinate_systems.MATCID" [URL="#pyNastran.bdf.cards.coordinate_systems.MATCID",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="Initializes the MATCID card"]; "pyNastran.bdf.cards.coordinate_systems.RectangularCoord" [URL="#pyNastran.bdf.cards.coordinate_systems.RectangularCoord",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 common methods for rectangular coordinate systems"]; "pyNastran.bdf.cards.coordinate_systems.SphericalCoord" [URL="#pyNastran.bdf.cards.coordinate_systems.SphericalCoord",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 common methods for spherical coordinate systems"]; }

All coordinate cards are defined in this file. This includes:

  • CORD1R

  • CORD1C

  • CORD1S

  • CORD2R

  • CORD2C

  • CORD2S

  • MATCID

{ug} = [Tgb]{ub} {ub} = [Tbg]{ug}

class pyNastran.bdf.cards.coordinate_systems.CORD1C(cid, g1, g2, g3, comment='')[source]

Bases: Cord1x, CylindricalCoord

Intilizes the CORD1C

1

2

3

4

5

6

7

8

CORD1C

CIDA

G1A

G2A

CIDB

G1B

G2B

G3B

Creates the CORD1C card, which defines a cylindrical coordinate system using 3 GRID points.

Parameters:
cidint

the coordinate id

g1, g2, g3int

grid point 1, 2, 3

commentstr; default=’’

a comment for the card

Type = 'C'
raw_fields()[source]
type = 'CORD1C'
class pyNastran.bdf.cards.coordinate_systems.CORD1R(cid, g1, g2, g3, comment='')[source]

Bases: Cord1x, RectangularCoord

Intilizes the CORD1R

1

2

3

4

5

6

7

8

CORD1R

CIDA

G1A

G2A

CIDB

G1B

G2B

G3B

Creates the CORD1R card, which defines a rectangular coordinate system using 3 GRID points.

Parameters:
cidint

the coordinate id

g1, g2, g3int

grid point 1, 2, 3

commentstr; default=’’

a comment for the card

Type = 'R'
int_type = 0
raw_fields()[source]
type = 'CORD1R'
class pyNastran.bdf.cards.coordinate_systems.CORD1S(cid, g1, g2, g3, comment='')[source]

Bases: Cord1x, SphericalCoord

Intilizes the CORD1S

1

2

3

4

5

6

7

8

CORD1S

CIDA

G1A

G2A

CIDB

G1B

G2B

G3B

Creates the CORD1S card, which defines a spherical coordinate system using 3 GRID points.

Parameters:
cidint

the coordinate id

g1, g2, g3int

grid point 1, 2, 3

commentstr; default=’’

a comment for the card

Type = 'S'
raw_fields()[source]
type = 'CORD1S'
class pyNastran.bdf.cards.coordinate_systems.CORD2C(cid, origin, zaxis, xzplane, rid=0, setup=True, comment='')[source]

Bases: Cord2x, CylindricalCoord

Intilizes the CORD2C

1

2

3

4

5

6

7

8

CORD2C

CID

RID

A1

A2

A3

B1

B2

B3

C1

C2

C3

Creates the CORD2C card, which defines a cylindrical coordinate system using 3 vectors.

Parameters:
cidint

coordinate system id

originlist[float, float, float]

the origin of the coordinate system

zaxislist[float, float, float]

the z-axis of the coordinate system

xzplanelist[float, float, float]

a point on the xz plane

ridint; default=0

the referenced coordinate system that defines the system the vectors

commentstr; default=’’

a comment for the card

Type = 'C'
raw_fields()[source]
type = 'CORD2C'
class pyNastran.bdf.cards.coordinate_systems.CORD2R(cid: int, origin, zaxis, xzplane, rid: int = 0, setup: bool = True, comment: str = '')[source]

Bases: Cord2x, RectangularCoord

Intilizes the CORD2R

1

2

3

4

5

6

7

8

CORD2R

CID

RID

A1

A2

A3

B1

B2

B3

C1

C2

C3

Note

no type checking

Creates the CORD2R card, which defines a rectangular coordinate system using 3 vectors.

Parameters:
cidint

coordinate system id

originlist[float, float, float]

the origin of the coordinate system

zaxislist[float, float, float]

the z-axis of the coordinate system

xzplanelist[float, float, float]

a point on the xz plane

ridint; default=0

the referenced coordinate system that defines the system the vectors

commentstr; default=’’

a comment for the card

Type = 'R'
raw_fields()[source]
type = 'CORD2R'
class pyNastran.bdf.cards.coordinate_systems.CORD2S(cid, origin, zaxis, xzplane, rid=0, setup=True, comment='')[source]

Bases: Cord2x, SphericalCoord

Intilizes the CORD2S

1

2

3

4

5

6

7

8

CORD2S

CID

RID

A1

A2

A3

B1

B2

B3

C1

C2

C3

Creates the CORD2C card, which defines a spherical coordinate system using 3 vectors.

Parameters:
cidint

coordinate system id

originlist[float, float, float]

the origin of the coordinate system

zaxislist[float, float, float]

the z-axis of the coordinate system

xzplanelist[float, float, float]

a point on the xz plane

ridint; default=0

the referenced coordinate system that defines the system the vectors

commentstr; default=’’

a comment for the card

Type = 'S'
raw_fields()[source]
type = 'CORD2S'
class pyNastran.bdf.cards.coordinate_systems.CORD3G(cid, method_es, method_int, form, thetas, rid, comment='')[source]

Bases: Coord

Defines a general coordinate system using three rotational angles as functions of coordinate values in the reference coordinate system. The CORD3G entry is used with the MAT9 entry to orient material principal axes for 3-D composite analysis.

1

2

3

4

5

6

7

8

CORD3G

CID

METHOD

FORM

THETAID1

THETAID2

THETAID3

CIDREF

CORD3G

100

E313

EQN

110

111

112

0

Defines the CORD3G card

Parameters:
cidint

coordinate system id

method_esstr

flag for coordinate system type E : Eularian? S : Space?

method_intint

0-1000 E1000 = ‘E’ + 1000

formstr

EQN

thetaslist[int]

???

ridint

the referenced coordinate system that defines the system the vectors???

commentstr; default=’’

a comment for the card

Rid()[source]
classmethod add_card(card, comment='')[source]

Adds a CORD3G card from BDF.add_card(...)

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

coord3g_transform_to_global(p)[source]
Parameters:
p(3,) float ndarray

the point to transform

.. warning:: not done, just setting up how you’d do this
.. note:: per http://en.wikipedia.org/wiki/Euler_angles

“This means for example that a convention named (YXZ) is the result of performing first an intrinsic Z rotation, followed by X and Y rotations, in the moving axes (Note: the order of multiplication of matrices is the opposite of the order in which they’re applied to a vector).”

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

raw_fields()[source]
rotation_x(ct, st)[source]
rotation_y(ct, st)[source]
rotation_z(ct, st)[source]
type = 'CORD3G'
uncross_reference() None[source]

Removes cross-reference links

class pyNastran.bdf.cards.coordinate_systems.Coord[source]

Bases: BaseCard

Defines a general CORDxx object

Cid()[source]

Gets the coordinate ID

beta() ndarray[source]

Gets the 3 x 3 transformation

\[[\lambda] = [B_{ij}]\]
beta_n(n: int) ndarray[source]

Gets the 3n x 3n transformation

\[[\lambda] = [B_{ij}]\]
property global_to_local

Gets the 3 x 3 global to local transform

is_resolved

have all the transformation matricies been determined

property local_to_global: ndarray

Gets the 3 x 3 local to global transform

move_origin(xyz: NDArray3float, maintain_rid: bool = False) None[source]

Move the coordinate system to a new origin while maintaining the orientation

Parameters:
xyzthe new origin point to move the coordinate to in

the global coordinate system

maintain_ridbool; default=False

set the rid to cid=0 if False

repr_fields() list[source]

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

resolve()[source]
setup()[source]
\[e_{13} = e_3 - e_1\]
\[e_{12} = e_2 - e_1\]
\[k = \frac{e_{12}}{\lvert e_{12} \rvert}\]
\[j_{dir} = k \times e_{13}\]
\[j = \frac{j_{dir}}{\lvert j_{dir} \rvert}\]
\[i = j \times k\]
setup_global_cord2x()[source]

Sets up a global CORD2R, CORD2S, CORD2C

setup_no_xref(model: BDF)[source]
\[e_{13} = e_3 - e_1\]
\[e_{12} = e_2 - e_1\]
\[k = \frac{e_{12}}{\lvert e_{12} \rvert}\]
\[j_{dir} = k \times e_{13}\]
\[j = \frac{j_{dir}}{\lvert j_{dir} \rvert}\]
\[i = j \times k\]
transform_matrix_to_global(matrix: ndarray) ndarray[source]
transform_matrix_to_global_from_element_coord(matrix: ndarray, n: int, i: ndarray, j: ndarray, k: ndarray) ndarray[source]
type = 'COORD'
class pyNastran.bdf.cards.coordinate_systems.Cord1x(cid, g1, g2, g3, comment='')[source]

Bases: Coord

Parent class for:
  • CORD1R

  • CORD1C

  • CORD1S

Initializes the CORD1R, CORD1C, CORD1S card

Parameters:
cidint

the coordinate id

g1, g2, g3int

grid point 1, 2, 3

commentstr; default=’’

a comment for the card

G1()[source]
G2()[source]
G3()[source]
Rid()[source]

Gets the reference coordinate system self.rid

classmethod add_card(card, icard=0, comment='')[source]
Parameters:
cardBDF()

a BDFCard object

icardint

the coordinate location on the line (there are possibly 2 coordinates on 1 card)

commentstr; default=’’

a comment for the card

cid

the coordinate ID

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

classmethod export_to_hdf5(h5_file, model, cids)[source]

exports the coords in a vectorized way

g1

a Node at the origin

g2

a Node on the z-axis

g3

a Node on the xz-plane

property node_ids

Gets the integers for the node [g1,g2,g3]

rid = 0
setup()[source]

Finds the position of the nodes used define the coordinate system and sets the ijk vectors

to_cord2x(model, rid=0)[source]

Converts a coordinate system from a CORD1x to a CORD2x

Parameters:
modelBDF()

a BDF model

ridint; default=0

The relative coordinate system

uncross_reference() None[source]

Removes cross-reference links

validate()[source]

card checking method that should be overwritten

write_card(size: int = 8, is_double: bool = False) str[source]

Writes the card with the specified width and precision

Parameters:
sizeint (default=8)

size of the field; {8, 16}

is_doublebool (default=False)

is this card double precision

Returns:
msgstr

the string representation of the card

write_card_16(is_double: bool = False) str[source]

Writes a CORD1x card in 16-field format

class pyNastran.bdf.cards.coordinate_systems.Cord2x(cid: int, origin, zaxis, xzplane, rid: int = 0, setup: bool = True, comment: str = '')[source]

Bases: Coord

Parent class for:
  • CORD2R

  • CORD2C

  • CORD2S

This method emulates the CORD2x card.

Parameters:
cidint

coord id

originndarray/None

the origin None -> [0., 0., 0.]

zaxisndarray/None

a point on the z-axis None -> [0., 0., 1.]

xzplanendarray/None

a point on the xz-plane None -> [1., 0., 0.]

ridint; default=0

reference coord id

.. note :: no type checking
Rid()[source]

Gets the reference coordinate system self.rid

classmethod _add(cid, origin, zaxis, xzplane, rid=0, comment='')[source]
_finish_setup()[source]
classmethod add_axes(cid: int, rid: int = 0, origin=None, xaxis=None, yaxis=None, zaxis=None, xyplane=None, yzplane=None, xzplane=None, comment: str = '')[source]

Create a coordinate system based on a defined axis and point on the plane. This is the generalized version of the CORD2x card.

Parameters:
cidint

the new coordinate system id

ridint; default=0

the new reference coordinate system id

origin(3,) ndarray

defines the location of the origin in the global coordinate frame

xaxis(3,) ndarray

defines the x axis (default=None)

yaxis(3,) ndarray

defines the y axis (default=None)

zaxis(3,) ndarray

defines the z axis (default=None)

Notes

One axis (xaxis, yaxis, zaxis) and one plane (xyplane, yzplane, xz plane) must be defined; the others must be None

The axes and planes are defined in the rid coordinate system

classmethod add_card(card, comment='')[source]

Defines the CORD2x class

classmethod add_ijk(cid: int, origin=None, i=None, j=None, k=None, rid: int = 0, comment: str = '')[source]

Create a coordinate system based on 2 or 3 perpendicular unit vectors

Parameters:
cidint

the new coordinate system id

origin(3,) float ndarray

defines the location of the origin in the global coordinate frame

ridint; default=0

the new reference coordinate system id

i(3,) float ndarray

defines the i unit vector

j(3,) float ndarray

defines the j unit vector

k(3,) float ndarray

defines the k unit vector

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

.. warning:: Doesn’t set rid to the coordinate system if it’s in the

global. This isn’t a problem. It’s meant to speed up the code in order to resolve extra coordinate systems.

classmethod export_to_hdf5(h5_file, model, cids)[source]

exports the coords in a vectorized way

classmethod init_from_empty()[source]
translate(dxyz: NDArray3float) None[source]
uncross_reference() None[source]

Removes cross-reference links

update(unused_nid_map, cid_map)[source]
maps = {

‘node’ : nid_map, ‘coord’ : cid_map,

}

update_e123(maintain_rid: bool = False) None[source]

If you move the coordinate frame, e1, e2, e3 does not update. This updates the coordinate system.

Parameters:
maintain_ridbool; default=False

set the rid to cid=0 if False

write_card(size: int = 8, is_double: bool = False) str[source]

Writes the card with the specified width and precision

Parameters:
sizeint (default=8)

size of the field; {8, 16}

is_doublebool (default=False)

is this card double precision

Returns:
msgstr

the string representation of the card

write_card_16(is_double: bool = False) str[source]

Writes a CORD2x card in 16-field format

class pyNastran.bdf.cards.coordinate_systems.CylindricalCoord[source]

Bases: object

defines common methods for cylindrical coordinate systems

\[r = \sqrt(x^2+y^2)\]
\[\theta = tan^{-1}\left(\frac{y}{x}\right)\]
\[z = z\]
\[x = r cos(\theta)\]
\[y = r sin(\theta)\]
\[z = z\]
\[p = [x,y,z] + e_1\]

http://en.wikipedia.org/wiki/Cylindrical_coordinate_system

static coord_to_cylindrical(p)[source]
static coord_to_spherical(rtz)[source]

R-theta-z to rho-theta-phi transform

static coord_to_xyz(p)[source]
y       R
|     /
|   /
| / theta
*------------x
\[x = R \cos(\theta)\]
\[y = R \sin(\theta)\]
Returns:
xyz(3,) float ndarray

the point in the local coordinate system

static coord_to_xyz_array(p)[source]
y       R
|     /
|   /
| / theta
*------------x
\[x = R \cos(\theta)\]
\[y = R \sin(\theta)\]
Returns:
xyz(3,) float ndarray

the point in the local coordinate system

global_to_basic(xyz_global)[source]
static xyz_to_coord(xyz: NDArray3float)[source]
Returns:
xyz(3,) float ndarray

the delta xyz point in the local coordinate system

static xyz_to_coord_array(p)[source]
y       R
|     /
|   /
| / theta
*------------x
\[x = R \cos(\theta)\]
\[y = R \sin(\theta)\]
Returns:
rtp(3,) float ndarray

the point in the local coordinate system

class pyNastran.bdf.cards.coordinate_systems.MATCID(cid, form: int, eids=None, start: int | None = None, thru: int | None = None, by: int | None = None, comment='')[source]

Bases: object

Initializes the MATCID card

Format (alternative 1):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

EID2

EID3

EID4

EID5

EID6

EID7

EID8

EID9

-etc-

Format (alternative 2):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

“THRU”

EID2

Format (alternative 3):

1

2

3

4 | 5 | 6 | 7

8

9

MATCID

CID

EID1

“THRU”

EID2

“BY”

N

Format (alternative 4):

1

2

3

4

5

6

7

8

9

MATCID

CID

“ALL”

Note

no type checking

Creates the MATCID card, which defines the Material Coordinate System for Solid Elements

-Overrides the material coordinate system for CHEXA, CPENTA, CTETRA, and CPYRAM solid elements when the elements reference a PSOLID property.

-Overrides the material coordinate system for CHEXA and CPENTA solid elements when the elements reference a PCOMPS property.

-Overrides the material coordinate system for CHEXCZ and CPENTCZ solid elements.

Parameters:
cidint

coordinate system id

form: int

integer indicating the format alternative (for reference, see the 4 different formats below)

eidsarray[int, …]

Array of element identification numbers

start: int

used in format alternative 2 and 3, indicates starting eID

thruint

used in format alternative 2 and 3

byint

used in format alternative 3

commentstr; default=’’

a comment for the card

Format (alternative 1):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

EID2

EID3

EID4

EID5

EID6

EID7

EID8

EID9

-etc-

Format (alternative 2):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

“THRU”

EID2

Format (alternative 3):

1

2

3

4 | 5 | 6 | 7

8

9

MATCID

CID

EID1

“THRU”

EID2

“BY”

N

Format (alternative 4):

1

2

3

4

5

6

7

8

9

MATCID

CID

“ALL”

Cid() int[source]
classmethod add_card(card, comment='')[source]

Material Coordinate System for Solid Elements

-Overrides the material coordinate system for CHEXA, CPENTA, CTETRA, and CPYRAM solid elements when the elements reference a PSOLID property.

-Overrides the material coordinate system for CHEXA and CPENTA solid elements when the elements reference a PCOMPS property.

-Overrides the material coordinate system for CHEXCZ and CPENTCZ solid elements.

Format (alternative 1):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

EID2

EID3

EID4

EID5

EID6

EID7

EID8

EID9

-etc-

Format (alternative 2):

1

2

3

4

5

6

7

8

9

MATCID

CID

EID1

“THRU”

EID2

Format (alternative 3):

1

2

3

4 | 5 | 6 | 7

8

9

MATCID

CID

EID1

“THRU”

EID2

“BY”

N

Format (alternative 4):

1

2

3

4

5

6

7

8

9

MATCID

CID

“ALL”

raw_fields()[source]
repr_fields()[source]
type = 'MATCID'
write_card(size: int = 8, is_double: bool = False) str[source]
write_card_16(is_double: bool = False) str[source]

Writes a MATCID card in 16-field format

class pyNastran.bdf.cards.coordinate_systems.RectangularCoord[source]

Bases: object

defines common methods for rectangular coordinate systems

static coord_to_xyz(p)[source]
Returns:
xyz(3,) ndarray

the point in the local coordinate system

static coord_to_xyz_array(p)[source]
Returns:
xyz(n, 3) ndarray

the point in the local coordinate system

global_to_basic(xyz_global)[source]
static xyz_to_coord(p)[source]
Returns:
xyz(3,) ndarray

the delta xyz point in the local coordinate system

static xyz_to_coord_array(p)[source]
Returns:
xyz(n, 3) ndarray

the delta xyz point in the local coordinate system

class pyNastran.bdf.cards.coordinate_systems.SphericalCoord[source]

Bases: object

defines common methods for spherical coordinate systems

\[r = \rho = \sqrt(x^2+y^2+z^2)\]
\[\theta = \cos^{-1}\left(\frac{z}{r}\right)\]
\[\phi = \tan^{-1}\left(\frac{y}{x}\right)\]
\[x = r \sin(\theta)\cos(\phi)\]
\[y = r \sin(\theta)\sin(\phi)\]
\[z = r \cos(\theta)\]
\[p = [x,y,z]\]
static coord_to_cylindrical(p)[source]

hasn’t been tested

static coord_to_spherical(p)[source]
static coord_to_xyz(p)[source]
Returns:
xyz(3,) float ndarray

the R, theta, phi in the local coordinate system

static coord_to_xyz_array(p)[source]
Returns:
xyz(3,) float ndarray

the R, theta, phi in the local coordinate system

global_to_basic(xyz_global)[source]
static xyz_to_coord(p)[source]
Returns:
xyz(3, ) float ndarray

the local XYZ point in the R, theta, phi coordinate system

static xyz_to_coord_array(p)[source]
Returns:
xyz(3, ) float ndarray

the local XYZ point in the R, theta, phi coordinate system

pyNastran.bdf.cards.coordinate_systems._check_square(matrix: ndarray) None[source]
pyNastran.bdf.cards.coordinate_systems._coord_to_xyz(xyz: ndarray, coord_type: str) ndarray[source]
pyNastran.bdf.cards.coordinate_systems._fix_xyz_shape(xyz: NDArray3float, name: str = 'xyz') NDArray3float[source]

Checks the shape of a grid point location and fixes it if possible

Parameters:
xyz(N, 3) float ndarray

the xyz locations

namestr; default=’xyz’

the name in case of an error

pyNastran.bdf.cards.coordinate_systems._primary_axes(coord)[source]

gets the i,j,k axes from the ???

pyNastran.bdf.cards.coordinate_systems.create_coords_along_line(model, p1, p2, percents, cid=0, axis=1)[source]

Creates a series of coordinate systems

Parameters:
modelBDF()

the model

p1(3,) float ndarray

the start point

p2(3,) float ndarray

the end point

percents(ncoords, ) float ndarray

the location of the coords (0. to 1.; inclusive)

cidint; default=0

the reference coordinate system

axisint; default=1

the axis normal to the plane; defines the “x” axis

Returns:
xyz_cid0(nnodes, 3) float ndarray

the xyz locations the global (basic) coordinate system

nid_cp_cd(nnodes, 3) int ndarray

the node_id, cp coord, cd coord

icd_transform???

a mapping of the cid to nids???

cidslist[int]

the created coordinate system ids

originslist[(ox, oy, oz)]

the origin of each coordinate system

cid_to_inidsdict[cid] -> inids

maps the coord id to the index of the nodes along the axis cid : int

the coord id

inids : (nnodes_in_cid)

Warning

  • requires at least 1 node

pyNastran.bdf.cards.coordinate_systems.define_coord_e123(model: BDF, cord2_type: str, cid: int, origin: NDArray3float, rid: int = 0, xaxis=None, yaxis=None, zaxis=None, xyplane=None, yzplane=None, xzplane=None, add=True)[source]

Create a coordinate system based on a defined axis and point on the plane. This is the generalized version of the CORDx card.

Parameters:
modelBDF()

a BDF object

cord2_typestr

‘CORD2R’, ‘CORD2C’, ‘CORD2S’

cidint

the new coordinate system id

origin(3,) ndarray

defines the location of the origin in the global coordinate frame

ridint; default=0

the new reference coordinate system id

xaxis(3,) ndarray

defines the x axis (default=None)

yaxis(3,) ndarray

defines the y axis (default=None)

zaxis(3,) ndarray

defines the z axis (default=None)

addbool; default=True

adds the coordinate system to the model

Returns:
coordCORD2R, CORD2C, CORD2S

the coordinate system

Notes

One axis (xaxis, yaxis, zaxis) and one plane (xyplane, yzplane, xz plane) must be defined; the others must be None.

The axes and planes are defined in the rid coordinate system

Todo

hasn’t been tested…

pyNastran.bdf.cards.coordinate_systems.define_coord_ijk(model, cord2_type, cid, origin, rid=0, i=None, j=None, k=None, add=True)[source]

Create a coordinate system based on 2 or 3 perpendicular unit vectors

Parameters:
modelBDF()

a BDF object

cord2_typestr

‘CORD2R’, ‘CORD2C’, ‘CORD2S’

cidint

the new coordinate system id

origin(3,) ndarray

defines the location of the origin in the global coordinate frame

ridint; default=0

the new reference coordinate system id

i(3,) ndarray

defines the i unit vector

j(3,) ndarray

defines the j unit vector

k(3,) ndarray

defines the k unit vector

addbool; default=True

adds the coordinate system to the model

Returns:
coordCORD2R, CORD2C, CORD2S

the coordinate system

pyNastran.bdf.cards.coordinate_systems.define_spherical_cutting_plane(model: BDF, origin: NDArray3float, rid: int, cids: list[int], thetas: list[float], phis: list[float])[source]

Creates a series of coordinate systems defined as constant origin, with a series of theta and phi angles, which are defined about the aerodynamic axis <1, 0, 0>. This is intended to be with a supersonic mach plane for calculating wave drag where:

\[\theta = \mu = \frac{1}{\sqrt(Mach^2 - 1)}\]
\[\phi = [-\pi, \pi]\]
Parameters:
modelBDF()

a BDF object

origin(3, ) float ndarray

defines the location of the origin in the global coordinate frame

ridint

the new spherical reference coordinate system id

cidslist[int, …]

list of new coordinate system ids

thetaslist[float, …]

list of thetas (in radians)

phis: list[float, …]

list of phis (in radians)

Notes

creates 1 CORD2S and ncid CORD2R coordinate systems

Todo

hasn’t been tested…

pyNastran.bdf.cards.coordinate_systems.get_nodes_along_axis_in_coords(model, nids, xyz_cp, icp_transform, cids)[source]
Parameters:
modelBDF()

the model

nids(nnodes, ) ndarray

the nodes of the model

xyz_cp(nnodes, 3) float ndarray

the xyz locations in a representative local coordinate system for example, for cid=0, use xyz_cid0

icp_transformdict[cp cid] -> inids

a mapping of the CP coord to the node indices

icd_transformdict[cd cid] -> inids

a mapping of the CD coord to the node indices

cidslist[int]

the created coordinate system ids

Returns:
#originslist[(ox, oy, oz)]

#the origin of each coordinate system

cid_to_inidsdict[cid] -> inids

maps the coord id to the index of the nodes along the axis cid : int

the coord id

inids : (nnodes_in_cid)

pyNastran.bdf.cards.coordinate_systems.global_to_basic_cylindrical(coord, xyz_global, dtype='float64')[source]
pyNastran.bdf.cards.coordinate_systems.global_to_basic_rectangular(coord, unused_xyz_global, dtype='float64')[source]
pyNastran.bdf.cards.coordinate_systems.global_to_basic_spherical(coord, xyz_global, dtype='float64')[source]
pyNastran.bdf.cards.coordinate_systems.normalize(v)[source]

Normalizes v into a unit vector.

Parameters:
v(3, ) float ndarray

the vector to normalize

Returns:
vn(3, ) float ndarray

normalized v

\[v_{norm} = \frac{v}{\lvert v \lvert} ..\]
pyNastran.bdf.cards.coordinate_systems.setup_add_axes(cid: int, coord_type: str, rid: int = 0, origin=None, xaxis=None, yaxis=None, zaxis=None, xyplane=None, yzplane=None, xzplane=None) tuple[ndarray, ndarray, ndarray, ndarray][source]
pyNastran.bdf.cards.coordinate_systems.setup_add_ijk(coord_type: str, origin=None, i=None, j=None, k=None) tuple[ndarray, ndarray, ndarray, ndarray][source]
pyNastran.bdf.cards.coordinate_systems.transform_coords_vectorized(cps_to_check0, icp_transform, nids, xyz_cp, xyz_cid0, xyz_cid0_correct, coords, do_checks)[source]

Transforms coordinates in a vectorized way

Parameters:
cps_to_check0list[int]

the Cps to check

icp_transformdict{int cp(n,) int ndarray}

Dictionary from coordinate id to index of the nodes in self.point_ids that their input (CP) in that coordinate system.

nids(n, ) int ndarray

the GRID/SPOINT/EPOINT ids corresponding to xyz_cp

xyz_cp(n, 3) float ndarray

points in the CP coordinate system

xyz_cid(n, 3) float ndarray

points in the CID coordinate system

xyz_cid_correct(n, 3) float ndarray

points in the CID coordinate system

unused_in_placebool, default=False

If true the original xyz_cp is modified, otherwise a new one is created.

do_checksbool; default=False

internal value for testing True : makes use of xyz_cid_correct False : xyz_cid_correct is unused

Returns:
nids_checked(nnodes_checked,) int ndarray

the node ids that were checked

cps_checkedlist[int]

the Cps that were checked

cps_to_checklist[int]

the Cps that are unreferenceable given the current information

pyNastran.bdf.cards.coordinate_systems.transform_cylindrical_to_rectangular(rtz: ndarray) ndarray[source]

vectorized?

pyNastran.bdf.cards.coordinate_systems.transform_spherical_to_rectangular(rtp: ndarray) ndarray[source]

vectorized?