# bars Module¶

defines:
• CBAR

• CBARAO

• BAROR

• CBEAM3

• CBEND

class pyNastran.bdf.cards.elements.bars.BAROR(pid, is_g0, g0, x, offt='GGG', comment='')[source]

1

2

3

4

5

6

7

8

9

BAROR

PID

G0/X1

X2

X3

OFFT

BAROR

39

0.6

2.9

-5.87

GOG

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

Gets the fields of the card in their full form

type = 'BAROR'
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

class pyNastran.bdf.cards.elements.bars.CBAR(eid, pid, nids, x, g0, offt='GGG', pa=0, pb=0, wa=None, wb=None, comment='')[source]

1

2

3

4

5

6

7

8

9

CBAR

EID

PID

GA

GB

X1

X2

X3

OFFT

PA

PB

W1A

W2A

W3A

W1B

W2B

W3B

or

1

2

3

4

5

6

7

8

9

CBAR

EID

PID

GA

GB

G0

OFFT

PA

PB

W1A

W2A

W3A

W1B

W2B

W3B

1

2

3

4

5

6

7

8

9

CBAR

2

39

7

6

105

GGG

513

0.0

0.0

-9.

0.0

0.0

-9.

Parameters
pidint

property id

midint

material id

nidsList[int, int]

node ids; connected grid points at ends A and B

xList[float, float, float]

Components of orientation vector, from GA, in the displacement coordinate system at GA (default), or in the basic coordinate system

g0int

Alternate method to supply the orientation vector using grid point G0. Direction of is from GA to G0. is then transferred to End A

offtstr; default=’GGG’

Offset vector interpretation flag

pa / pbint; default=0

Pin Flag at End A/B. Releases the specified DOFs

wa / wbList[float, float, float]

Components of offset vectors from the grid points to the end points of the axis of the shear center

a comment for the card

Area()[source]

returns the area of the element face

Centroid()[source]
G0()[source]

gets G0

Ga()[source]

gets Ga/G1

Gb()[source]

gets Gb/G2

I1()[source]
I2()[source]
J()[source]

returns the Polar Moment of Inertia, $$J$$

Length()[source]

Gets the length, $$L$$, of the element.

$L = \sqrt{ (n_{x2}-n_{x1})^2+(n_{y2}-n_{y1})^2+(n_{z2}-n_{z1})^2 }$
Mid()[source]
Nsm()[source]

Placeholder method for the non-structural mass, $$nsm$$

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

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

Parameters
cardBDFCard()

a BDFCard object

beamorBAROR() or None

defines the defaults

a comment for the card

center_of_mass()[source]
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, eids)[source]

exports the elements in a vectorized way

get_axes(model)[source]

Gets the axes of a CBAR/CBEAM, while respecting the OFFT flag.

Notes

pyNastran.bdf.cards.elements.bars.rotate_v_wa_wb() for a description of the OFFT flag.

is_passed: bool out: (wa, wb, ihat, jhat, khat)

get_axes_by_nodes(model, pid_ref, node1, node2, xyz1, xyz2, log)[source]

Gets the axes of a CBAR/CBEAM, while respecting the OFFT flag.

Notes

pyNastran.bdf.cards.elements.bars.rotate_v_wa_wb() for a description of the OFFT flag.

get_edge_ids()[source]

Return the edge IDs

get_orientation_vector(xyz)[source]

Element offsets are defined in a Cartesian system located at the connecting grid point. The components of the offsets are always defined in units of translation, even if the displacement coordinate system is cylindrical or spherical.

For example, in Figure 11-11, the grid point displacement coordinate system is cylindrical, and the offset vector is defined using Cartesian coordinates u1, u2, and u3 in units of translation.

get_x_g0_defaults()[source]

X and G0 compete for the same fields, so the method exists to make it easier to write the card

Returns
x_g0varies

g0 : List[int, None, None] x : List[float, float, float]

Notes

Used by CBAR and CBEAM

property node_ids
property nodes
property nodes_ref
raw_fields()[source]

Gets the fields of the card in their full form

repr_fields()[source]

Gets the fields of the card in their reduced form

safe_cross_reference(model: BDF, xref_errors)[source]
type = 'CBAR'
uncross_reference() → None[source]

update_by_cp_name(cp_name, value)[source]
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=False)[source]
class pyNastran.bdf.cards.elements.bars.CBARAO(eid, scale, x, comment='')[source]

Per MSC 2016.1 +——–+——+——-+——+—–+——–+—–+—-+—-+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | +========+======+=======+======+=====+========+=====+====+====+ | CBARAO | EID | SCALE | X1 | X2 | X3 | X4 | X5 | X6 | +——–+——+——-+——+—–+——–+—–+—-+—-+ | CBARAO | 1065 | FR | 0.2 | 0.4 | 0.6 | 0.8 | | | +——–+——+——-+——+—–+——–+—–+—-+—-+

Alternate form (not supported): +——–+——+——-+——+—–+——–+—–+—-+—-+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | +========+======+=======+======+=====+========+=====+====+====+ | CBARAO | EID | SCALE | NPTS | X1 | DELTAX | | | | +——–+——+——-+——+—–+——–+—–+—-+—-+ | CBARAO | 1065 | FR | 4 | 0.2 | 0.2 | | | | +——–+——+——-+——+—–+——–+—–+—-+—-+

Creates a CBARAO card, which defines additional output locations for the CBAR card.

It also changes the OP2 element type from a CBAR-34 to a CBAR-100. However, it is ignored if there are no PLOAD1s in the model. Furthermore, the type is changed for the whole deck, regardless of whether there are PLOAD1s in the other load cases.

Parameters
eidint

element id

scalestr

defines what x means LE : x is in absolute coordinates along the bar FR : x is in fractional

xList[float]

the additional output locations (doesn’t include the end points) len(x) <= 6

a comment for the card

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

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

Parameters
cardBDFCard()

a BDFCard object

a comment for the card

raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns
fieldsList[varies]

the fields that define the card

type = 'CBARAO'
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

class pyNastran.bdf.cards.elements.bars.CBEAM3(eid, pid, nids, x, g0, wa=None, wb=None, wc=None, tw=None, s=None, comment='')[source]

dummy init

Area()[source]

returns the area of the element face

Centroid()[source]
G0()[source]

gets the orientation vector node

Ga()[source]

gets node 1

Gb()[source]

gets node 2

Gc()[source]

gets the node between node 1 and 2

Length()[source]

We’ll fit a 2nd order polynomial to the x, y, and z coefficients. We know GA (t=0), GB(t=1), and GC (t=0.5 assumed). This gives us A, for:

• y1 = a1*t^2 = b1*t + c1

where:
• yi is for the x, y, and z terms

[xa, xb, xc] = [A][a1, b1, c1].T [ya, yb, yc] = [A][a2, b2, c2].T [za, zb, zc] = [A][a3, b3, c3].T

[a1, b1, c1] = [A^-1][[xa, xb, xc].T A = [0. , 0. , 1. ]

[1. , 1. , 1. ] [0.25, 0.5 , 1. ]

Ainv = [ 2., 2., -4.]

[-3., -1., 4.] [ 1., 0., 0.]

MassPerLength()[source]

Get the mass per unit length, :math: rac{m}{L}

Nsm()[source]

Placeholder method for the non-structural mass, $$nsm$$

Volume()[source]
classmethod _init_from_empty()[source]
_integrate(xabc, yabc, zabc)[source]
We integrate:

y = sqrt(x’(t)^2 + y’(t)^2 + z’(t)^2)*dt from 0 to 1 y = sqrt(r)

/where:
• x(t) = a*t^2 + b*t + c

• x’(t) = 2*a*t + b

• x’(t)^2 = 4*(a*t)^2 + 2*a*b*t + b^2

expanding terms:
• x’(t)^2 = 4*(a1*t)^2 + 2*a1*b1*t + b1^2

• y’(t)^2 = 4*(a2*t)^2 + 2*a2*b2*t + b2^2

• z’(t)^2 = 4*(a3*t)^2 + 2*a3*b3*t + b3^2

grouping terms:
• a = 4 * (a1 ** 2 + a2 ** 2 + a3 ** 2) * t^2

• b = 2 * (a1 * b1 + a2 * b2 + a3 * b3) * t

• c = b1 ** 2 + b2 ** 2 + b3 ** 2

• y = integrate(sqrt(a*t^2 + b*t + t), t, 0., 1.)

Looking up integral formulas, we get a really complicated integral.

for a = 0 (and rewriting):
• y = integrate(sqrt(a*t + b), t, 0., 1.)

• y = (2*b/3a + 2*t/3) * sqrt(at + b)

or:
• y = (2*c/3b + 2*t/3) * sqrt(b*t + c)

_properties = ['node_ids', 'nodes']

Defines a three-node beam element

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

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

Parameters
cardBDFCard()

a BDFCard object

a comment for the card

center_of_mass()[source]
cross_reference(model: BDF) → None[source]

Cross links the card so referenced cards can be extracted directly

Parameters
modelBDF()

the BDF object

get_edge_ids()[source]

Return the edge IDs

get_x_g0_defaults()[source]

X and G0 compete for the same fields, so the method exists to make it easier to write the card

Returns
x_g0varies

g0 : List[int, None, None] x : List[float, float, float]

Notes

Used by CBAR, CBEAM, and CBEAM3

property node_ids
property nodes
raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns
fieldsList[varies]

the fields that define the card

safe_cross_reference(model: BDF, xref_errors)[source]
type = 'CBEAM3'
uncross_reference() → None[source]

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

class pyNastran.bdf.cards.elements.bars.CBEND(eid, pid, nids, g0, x, geom, comment='')[source]

Creates a CBEND card

Parameters
eidint

element id

pidint

property id (PBEND)

nidsList[int, int]

node ids; connected grid points at ends A and B

g0int

???

xList[float, float, float]

???

geomint

1 : The center of curvature lies on the line AO (or its extension) or vector v. 2 : The tangent of centroid arc at end A is parallel to line AO or vector v.

Point O (or vector v) and the arc must be on the same side of the chord AB.

3The bend radius (RB) is specified on the PBEND entry:

Points A, B, and O (or vector v) define a plane parallel or coincident with the plane of the element arc. Point O (or vector v) lies on the opposite side of line AB from the center of the curvature.

4THETAB is specified on the PBEND entry. Points A, B, and O (or vector v)

define a plane parallel or coincident with the plane of the element arc. Point O (or vector v) lies on the opposite side of line AB from the center of curvature.

a comment for the card

Area()[source]

returns the area of the element face

Centroid()[source]
Ga()[source]
Gb()[source]
Length()[source]

Gets the length, $$L$$, of the element.

$L = \sqrt{ (n_{x2}-n_{x1})^2+(n_{y2}-n_{y1})^2+(n_{z2}-n_{z1})^2 }$
classmethod _init_from_empty()[source]
_properties = ['node_ids']
classmethod add_card(card, comment='')[source]

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

Parameters
cardBDFCard()

a BDFCard object

a comment for the card

center_of_mass()[source]
cross_reference(model: BDF) → None[source]

Cross links the card so referenced cards can be extracted directly

Parameters
modelBDF()

the BDF object

get_x_g0_defaults()[source]
property node_ids
property nodes
property nodes_ref
raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns
fieldsList[varies]

the fields that define the card

safe_cross_reference(model: BDF, xref_errors)[source]
type = 'CBEND'
uncross_reference() → None[source]

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

class pyNastran.bdf.cards.elements.bars.LineElement[source]

dummy init

Area()[source]

returns the area of the element face

C()[source]

torsional constant

E()[source]

returns the Young’s Modulus, $$E$$

G()[source]

returns the Shear Modulus, $$G$$

I11()[source]

returns the Moment of Inertia, $$I_{11}$$

I12()[source]

returns the Moment of Inertia, $$I_{12}$$

I22()[source]

returns the Moment of Inertia, $$I_{22}$$

J()[source]

returns the Polar Moment of Inertia, $$J$$

Length()[source]

Gets the length, $$L$$, of the element.

$L = \sqrt{ (n_{x2}-n_{x1})^2+(n_{y2}-n_{y1})^2+(n_{z2}-n_{z1})^2 }$
Mass()[source]

Get the mass of the element.

$m = \left( \rho A + nsm \right) L$
MassPerLength()[source]

Get the mass per unit length, :math: rac{m}{L}

Nsm()[source]

Placeholder method for the non-structural mass, $$nsm$$

Nu()[source]

Get Poisson’s Ratio, :math: u

Rho()[source]

Get the material density, :math: ho

get_edge_ids()[source]

Return the edge IDs

uncross_reference() → None[source]

pyNastran.bdf.cards.elements.bars.check_offt(element)[source]

B,G,O Note: The character ‘O’ in the table replaces the obsolete character ‘E’ allowed = ‘GGG,BGG,GGO,BGO,GOG,BOG,GOO,BOO,GGE,BGE,GEG,BEG,GEE,BEE,GGB,BGB,GBG,BBG,GBB,BBB,B’

pyNastran.bdf.cards.elements.bars.get_bar_vector(model, elem, node1, node2, xyz1)[source]

helper method for rotate_v_wa_wb

pyNastran.bdf.cards.elements.bars.get_bar_yz_transform(v, ihat, eid, xyz1, xyz2, nid1, nid2, i, Li)[source]

helper method for _get_bar_yz_arrays

Parameters
vList[float, float, float]

the projection vector that defines the y-axis (jhat)

ihat(3, ) float ndarray

the normalized x-axis (not including the CBEAM offset)

eidint

the element id

xyz1 / xyz2(3, ) float ndarray

the xyz locations for node 1 / 2

nid1 / nid2int

the node ids for xyz1 / xyz2

i(3, ) float ndarray

the unnormalized x-axis (not including the CBEAM offset)

Lifloat

the length of the CBAR/CBEAM (not including the CBEAM offset)

Returns
yhat (3, ) float ndarray

the CBAR/CBEAM’s y-axis

zhat (3, ) float ndarray

the CBAR/CBEAM’s z-axis

pyNastran.bdf.cards.elements.bars.init_x_g0(card, eid, x1_default, x2_default, x3_default)[source]

common method to read the x/g0 field for the CBAR, CBEAM, CBEAM3

pyNastran.bdf.cards.elements.bars.init_x_g0_cbeam3(card, eid, x1_default, x2_default, x3_default)[source]

reads the x/g0 field for the CBEAM3

pyNastran.bdf.cards.elements.bars.rotate_v_wa_wb(model: BDF, elem, xyz1, xyz2, node1, node2, ihat_offset, i_offset, eid, Li_offset, log: SimpleLogger) → Tuple[NDArray3float, NDArray3float, NDArray3float, NDArray33float][source]

Rotates v, wa, wb

Parameters
modelBDF()

BDF : assume the model isn’t xref’d None : use the xref’d values

elemCBAR() / CBEAM()

the CBAR/CBEAM

xyz1 / xyz2(3, ) float ndarray

the xyz locations for node 1 / 2

node1 / node2GRID()

the xyz object for node 1 / 2

ihat_offset(3, ) float ndarray

the normalized x-axis (not including the CBEAM offset)

i_offset(3, ) float ndarray

the unnormalized x-axis (not including the CBEAM offset)

eidint

the element id

Li_offsetfloat

the length of the CBAR/CBEAM (not including the CBEAM offset)

logLog()

a logging object or None

Returns
vList[float, float, float]

the projection vector that defines the y-axis (jhat)

waList[float, float, float]

the offset vector at A

wbList[float, float, float]

the offset vector at B

xform(3, 3) float ndarray

a vstack of the [ihat, jhat, khat] axes

Notes

This section details the OFFT flag.

ABC or A-B-C (an example is G-G-G or B-G-G) while the slots are:

• A -> orientation; values=[G, B]

• B -> End A; values=[G, O]

• C -> End B; values=[G, O]

and the values for A,B,C mean:
• B -> basic

• G -> global

• O -> orientation

so for example G-G-G, that’s global for all terms. BOG means basic orientation, orientation end A, global end B

so now we’re left with what does basic/global/orientation mean? - basic -> the global coordinate system defined by cid=0 - global -> the local coordinate system defined by the

CD field on the GRID card, but referenced by the CBAR/CBEAM

• orientation -> wa/wb are defined in the xform_offset (yz) frame;

this is likely the easiest frame for a user