dmig Module

Inheritance diagram of pyNastran.bdf.cards.dmig
class pyNastran.bdf.cards.dmig.DMI(name: str, matrix_form: int, tin: int, tout: int, nrows: int, ncols: int, GCj, GCi, Real, Complex=None, comment='', finalize=True)[source]

Bases: pyNastran.bdf.cards.dmig.NastranMatrix

1

2

3

4

5

6

7

8

9

DMI

NAME

0

FORM

TIN

TOUT

M

N

DMI

NAME

J

I1

A(I1,J)

A(I1,J)

A(I1+1,J)

A(I1+2,J)

etc.

I2

etc.

Creates a NastranMatrix

Parameters
namestr

the name of the matrix

matrix_formint

matrix shape 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]

the jnode, jDOFs

GCiList[(node, dof)]

the inode, iDOFs

RealList[float]

The real values

ComplexList[float]; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_get_complex_fields(func)[source]
_get_real_fields(func)[source]
classmethod _init_from_empty()[source]
_properties = ['shape', 'ifo', 'is_real', 'is_complex', 'is_polar', 'matrix_type', 'tin_dtype', 'tout_dtype']
_read_complex(card)[source]

reads a complex DMI column

_read_real(card)[source]

reads a real DMI column

_write_card(func)[source]

writes the card in single/double precision

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

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

Parameters
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

classmethod export_to_hdf5(h5_file, model, encoding)[source]
finalize()[source]

converts the lists into numpy arrays

get_matrix(is_sparse: bool = False, apply_symmetry: bool = True) → Tuple[numpy.array, None, None][source]

Builds the Matrix

Parameters
is_sparsebool; default=False

should the matrix be returned as a sparse matrix. Slower for dense matrices.

apply_symmetrybool; default=True

If the matrix is symmetric (ifo=6), returns a symmetric matrix. Supported as there are symmetric matrix routines.

Returns
Mnumpy.ndarray or scipy.coomatrix

the matrix

rowsdict[int] = [int, int]

dictionary of keys=rowID, values=(Grid,Component) for the matrix

cols: dict[int] = [int, int]

dictionary of keys=columnID, values=(Grid,Component) for the matrix

Warning

is_sparse=True WILL fail ..

property ifo

#: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)

#: Form of the matrix: 1=Square (not symmetric); 2=Rectangular; #: 3=Diagonal (m=nRows,n=1); 4=Lower Triangular; 5=Upper Triangular; #: 6=Symmetric; 8=Identity (m=nRows, n=m) self.matrix_form = integer(card, 3, ‘matrix_form’)

property is_complex

real vs. complex attribute

property is_polar
Used by:
  • DMIG

  • DMIJ

  • DMIJI

  • DMIK

Not used by:
  • DMI

  • DMIAX

  • DMIG, UACCEL

  • DMIGOUT

  • DMIGROT

property is_real

real vs. complex attribute

property matrix_type

gets the matrix type

1 Square matrix (not symmetric) 2 General rectangular matrix 3 Diagonal matrix (M=number of rows, N = 1) #4 Lower triangular factor #5 Upper triangular factor 6 Symmetric matrix 8 Identity matrix (M=number of rows, N = M)

raw_fields()[source]

Warning

All the writers are bad because Nastran insists on making columns a single DMI card. This makes writing a card much harder, so there are a lot of NotImplementedErrors floating about.

This is an invalid method, but is not disabled because it’s currently needed for checking results

property shape

gets the matrix shape

type = 'DMI'
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()[source]

writes the card in single precision

write_card_8()[source]

writes the card in single precision

write_card_double()[source]

writes the card in double precision

class pyNastran.bdf.cards.dmig.DMIAX(name, matrix_form, tin, tout, ncols, GCNj, GCNi, Real, Complex=None, comment='')[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Direct Matrix Input for Axisymmetric Analysis

Defines axisymmetric (fluid or structure) related direct input matrix terms. The matrix is defined by a single header entry and one or more column entries. Only one header entry is required. A column entry is required for each column with nonzero elements.

1

2

3

4

5

6

7

8

9

DMIAX

NAME

0

IFO

TIN

TOUT

1

2

3

4

5

6

7

8

9

DMIAX

NAME

GJ

CJ

NJ

G1

C1

N1

A1

B1

G2

C2

etc.

1

2

3

4

5

6

7

8

9

DMIAX

B2PP

0

1

3

DMIAX

B2PP

32

1027

3

4.25+6

2.27+3

Creates a DMIAX card

Parameters
namestr

the name of the matrix

matrix_formint

matrix shape 1=Square 2=General Rectangular 6=Symmetric

tinint

matrix input precision 1=Real, Single Precision 3=Complex, Single Precision

toutint

matrix output precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

GCNjList[(node, dof, harmonic_number)]???

the jnode, jDOFs

GCNiList[(node, dof, harmonic_number)]???

the inode, iDOFs

RealList[float]???

The real values

ComplexList[float]???; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_write_card(func)[source]

writes the card

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

Adds a NastranMatrix (DMIAX) card from BDF.add_card(...)

Parameters
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

classmethod export_to_hdf5(h5_file, model, encoding)[source]
finalize()[source]

converts the lists into numpy arrays

property is_complex

is the matrix complex

property is_polar

is the matrix polar (vs real/imag)?

property is_real

is the matrix real?

matrix_form = None

ifo/4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)

property matrix_type

gets the matrix type

raw_fields()[source]
property tin_dtype

gets the input dtype

tout = None

0-Set by cell precision

property tout_dtype

gets the output dtype

type = 'DMIAX'
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()[source]

writes the card in small large format

write_card_8()[source]

writes the card in small field format

class pyNastran.bdf.cards.dmig.DMIG(name, ifo, tin, tout, polar, ncols, GCj, GCi, Real, Complex=None, comment='', finalize=True)[source]

Bases: pyNastran.bdf.cards.dmig.NastranMatrix

Defines direct input matrices related to grid, extra, and/or scalar points. The matrix is defined by a single header entry and one or more column entries. A column entry is required for each column with nonzero elements.

1

2

3

4

5

6

7

8

9

DMIG

NAME

0

IFO

TIN

TOUT

POLAR

NCOL

DMIG

NAME

GJ

CJ

G1

C1

A1

B1

G2

C2

A2

B2

Creates a DMIG card

Parameters
namestr

the name of the matrix

ifoint

matrix shape 2/9=Rectangular 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]

the [jnode, jDOFs] columns

GCiList[(node, dof)]

the [inode, iDOFs] rows

RealList[float]

The real values

ComplexList[float]; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_properties = ['is_real', 'is_complex', 'is_polar', 'matrix_type', 'shape', 'tin_dtype', 'tout_dtype']
classmethod export_to_hdf5(h5_file, model, encoding)[source]
type = 'DMIG'
class pyNastran.bdf.cards.dmig.DMIG_UACCEL(tin, ncol, load_sequences, comment='')[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Direct Matrix Input of Enforced Static Acceleration Defines rigid body accelerations in the basic coordinate system.

1

2

3

4

5

6

7

8

DMIG

UACCEL

“0”

“9”

TIN

NCOL

DMIG

UACCEL

L

G1

C1

X1

G2

C2

X2

G3

C3

X3

DMIG

UACCEL

0

9

1

4

DMIG

UACCEL

2

2

3

386.4

DMIG

UACCEL

3

2

4

3.0

DMIG

UACCEL

4

2

6

1.0

_write_card(func) → str[source]

writes the card

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

Adds a DMIG,UACCEL card from BDF.add_card(...)

Parameters
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

classmethod export_to_hdf5(h5_file, model, encoding)[source]
static finalize()[source]

a passer method

name = 'UACCEL'
raw_fields()[source]
type = 'DMIG'
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() → str[source]

writes the card in small large format

write_card_8() → str[source]

writes the card in small field format

class pyNastran.bdf.cards.dmig.DMIJ(name, matrix_form, tin, tout, polar, ncols, GCj, GCi, Real, Complex=None, comment='', finalize=True)[source]

Bases: pyNastran.bdf.cards.dmig.NastranMatrix

Direct Matrix Input at js-Set of the Aerodynamic Mesh Defines direct input matrices related to collation degrees-of-freedom (js-set) of aerodynamic mesh points for CAERO1, CAERO3, CAERO4 and CAERO5 and for the slender body elements of CAERO2. These include W2GJ, FA2J and input pressures and downwashes associated with AEPRESS and AEDW entries. The matrix is described by a single header entry and one or more column entries. A column entry is required for each column with nonzero elements. For entering data for the interference elements of a CAERO2, use DMIJI or DMI.

Creates a DMIJ card

Parameters
namestr

the name of the matrix

matrix_formint

matrix shape 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]???

the jnode, jDOFs

GCiList[(node, dof)]???

the inode, iDOFs

RealList[float]???

The real values

ComplexList[float]???; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

classmethod _init_from_empty()[source]
_properties = ['shape', 'ifo', 'is_real', 'is_complex', 'is_polar', 'matrix_type', 'tin_dtype', 'tout_dtype']
classmethod export_to_hdf5(h5_file, model, encoding)[source]
type = 'DMIJ'
class pyNastran.bdf.cards.dmig.DMIJI(name: str, ifo: int, tin: int, tout: int, polar: int, ncols: int, GCj, GCi, Real, Complex=None, comment: str = '', finalize: bool = True)[source]

Bases: pyNastran.bdf.cards.dmig.NastranMatrix

Direct Matrix Input at js-Set of the Interference Body Defines direct input matrices related to collation degrees-of-freedom (js-set) of aerodynamic mesh points for the interference elements of CAERO2. These include W2GJ, FA2J and input pressures and downwashes associated with AEPRESS and AEDW entries. The matrix is described by a single header entry and one or more column entries. A column entry is required for each column with nonzero elements. For entering data for the slender elements of a CAERO2, or a CAERO1, 3, 4 or 5 use DMIJ or DMI.

Creates a DMIJI card

Parameters
namestr

the name of the matrix

ifoint

matrix shape 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]???

the jnode, jDOFs

GCiList[(node, dof)]???

the inode, iDOFs

RealList[float]???

The real values

ComplexList[float]???; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_properties = ['shape', 'ifo', 'is_real', 'is_complex', 'is_polar', 'matrix_type', 'tin_dtype', 'tout_dtype']
classmethod export_to_hdf5(h5_file, model, encoding)[source]
type = 'DMIJI'
class pyNastran.bdf.cards.dmig.DMIK(name, ifo, tin, tout, polar, ncols, GCj, GCi, Real, Complex=None, comment='', finalize=True)[source]

Bases: pyNastran.bdf.cards.dmig.NastranMatrix

Direct Matrix Input at ks-Set of the Aerodynamic Mesh Defines direct input matrices related to physical (displacement) degrees-of-freedom (ks-set) of aerodynamic grid points. These include WKK, WTFACT and input forces associated with AEFORCE entries. The matrix is described by a single header entry and one or more column entries. A column entry is required for each column with nonzero elements.

1

2

3

4

5

6

7

8

9

DMIK

NAME

0

IFO

TIN

TOUT

POLAR

NCOL

DMIK

NAME

GJ

CJ

G1

C1

A1

B1

G2

C2

A2

B2

DMIK

ALPH1

0

9

2

0

1

DMIK

ALPH1

1

1

1

1

1.0

2

1

1.0

Creates a DMIK card

Parameters
namestr

the name of the matrix

ifoint

matrix shape 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]

the jnode, jDOFs

GCiList[(node, dof)]

the inode, iDOFs

RealList[float]

The real values

ComplexList[float]; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_properties = ['shape', 'ifo', 'is_real', 'is_complex', 'is_polar', 'matrix_type', 'tin_dtype', 'tout_dtype']
classmethod export_to_hdf5(h5_file, model, encoding)[source]
type = 'DMIK'
class pyNastran.bdf.cards.dmig.DTI(name, fields, comment='')[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

1

2

3

4

5

6

7

8

DTI

UNITS

“1”

MASS

FORCE

LENGTH

TIME

STRESS

MSC

1

2

3

4

5

6

7

8

DTI

UNITS

“1”

MASS

FORCE

LENGTH

TIME

TEMPERATURE

NX

Creates a DTI card

Parameters
namestr

UNITS

fieldsList[varies]

the fields

commentstr; default=’’

a comment for the card

_finalize_hdf5(encoding)[source]

hdf5 helper function

classmethod _init_from_empty()[source]
classmethod add_card(card, comment)[source]

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

Parameters
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

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

exports the elements in a vectorized way

raw_fields()[source]
type = 'DTI'
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.dmig.NastranMatrix(name, matrix_form, tin, tout, polar, ncols, GCj, GCi, Real, Complex=None, comment='', finalize=True)[source]

Bases: pyNastran.bdf.cards.base_card.BaseCard

Base class for the DMIG, DMIJ, DMIJI, DMIK matrices

Creates a NastranMatrix

Parameters
namestr

the name of the matrix

matrix_formint

matrix shape 4=Lower Triangular 5=Upper Triangular 6=Symmetric 8=Identity (m=nRows, n=m)

tinint

matrix input precision 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

toutint

matrix output precision 0=same as tin 1=Real, Single Precision 2=Real, Double Precision 3=Complex, Single Precision 4=Complex, Double Precision

polarint; default=0

Input format of Ai, Bi Integer=blank or 0 indicates real, imaginary format Integer > 0 indicates amplitude, phase format

ncolsint

???

GCjList[(node, dof)]

the jnode, jDOFs

GCiList[(node, dof)]

the inode, iDOFs

RealList[float]

The real values

ComplexList[float]; default=None

The complex values (if the matrix is complex)

commentstr; default=’’

a comment for the card

_finalize_hdf5(encoding)[source]

hdf5 helper function

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

Adds a NastranMatrix (DMIG, DMIJ, DMIK, DMIJI) card from BDF.add_card(...)

Parameters
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

fill_in_default_components(model: BDF) → None[source]
finalize()[source]

converts the lists into numpy arrays

get_matrix(is_sparse: bool = False, apply_symmetry: bool = True)[source]

Builds the Matrix

Parameters
is_sparsebool; default=False

should the matrix be returned as a sparse matrix. Slower for dense matrices.

apply_symmetrybool; default=True

If the matrix is symmetric (ifo=6), returns a symmetric matrix. Supported as there are symmetric matrix routines.

Returns
Mnumpy.ndarray or scipy.coomatrix

the matrix

rowsdict[int] = [int, int]

dictionary of keys=rowID, values=(Grid,Component) for the matrix

cols: dict[int] = [int, int]

dictionary of keys=columnID, values=(Grid,Component) for the matrix

Warning

is_sparse=True WILL fail ..

property is_complex

real vs. complex attribute

property is_polar
Used by:
  • DMIG

  • DMIJ

  • DMIJI

  • DMIK

Not used by:
  • DMI

  • DMIAX

  • DMIG, UACCEL

  • DMIGOUT

  • DMIGROT

property is_real

real vs. complex attribute

matrix_form = None

4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)

property matrix_type

gets the matrix type

polar = None

Input format of Ai, Bi. (Integer=blank or 0 indicates real, imaginary format; Integer > 0 indicates amplitude, phase format.)

property shape

gets the matrix shape

property tin_dtype

gets the input dtype

tout = None

0-Set by cell precision

property tout_dtype

gets the output dtype

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

pyNastran.bdf.cards.dmig._determine_size_double_from_tin(tin: int, size: int, is_double: bool) → Tuple[int, bool][source]

we ignore the requested is_double flag because otherwise Nastran can’t read in the matrix

pyNastran.bdf.cards.dmig._export_dmiax_to_hdf5(h5_file, model, dict_obj, encoding: str) → None[source]

export dmiax

pyNastran.bdf.cards.dmig._export_dmig_to_hdf5(h5_file, model: BDF, dict_obj, encoding: str) → None[source]

export dmigs, dmij, dmiji, dmik, dmi

pyNastran.bdf.cards.dmig._fill_dense_column_matrix(self, nrows, ncols, ndim, rows, cols, apply_symmetry)[source]

helper method for get_matrix

pyNastran.bdf.cards.dmig._fill_dense_rectangular_matrix(self, nrows, ncols, ndim, rows, cols, apply_symmetry)[source]

helper method for get_matrix

pyNastran.bdf.cards.dmig._fill_sparse_matrix(matrix: pyNastran.bdf.cards.dmig.DMIG, nrows: int, ncols: int)[source]

helper method for get_matrix

pyNastran.bdf.cards.dmig._get_real_dtype(type_flag: int) → str[source]

A complex64 array is made up of two float32 arrays.

pyNastran.bdf.cards.dmig._get_row_col_map_1d(matrix, GCi, GCj, ifo: int)[source]

helper for get_row_col_map

pyNastran.bdf.cards.dmig._get_row_col_map_2d(matrix, GCi, GCj, ifo)[source]

helper for get_row_col_map

pyNastran.bdf.cards.dmig._set_polar(polar) → int[source]
pyNastran.bdf.cards.dmig.get_dmi_matrix(matrix: pyNastran.bdf.cards.dmig.DMI, is_sparse: bool = False, apply_symmetry: bool = True) → Tuple[numpy.array, None, None][source]

Builds the Matrix

Parameters
is_sparsebool

should the matrix be returned as a sparse matrix (default=True). Slower for dense matrices.

apply_symmetry: bool

If the matrix is symmetric (matrix_form=6), returns a symmetric matrix. Supported as there are symmetric matrix routines. TODO: unused…

Returns
Mndarray

the matrix

rowsNone

unused

colsNone

unused

Warning

is_sparse=True WILL fail ..

pyNastran.bdf.cards.dmig.get_matrix(self: pyNastran.bdf.cards.dmig.DMIG, is_sparse: bool = False, apply_symmetry: bool = False) → Tuple[Any, Dict[int, Any], Dict[int, Any]][source]

Builds the Matrix

Parameters
is_sparsebool; default=False

should the matrix be returned as a sparse matrix. Slower for dense matrices.

apply_symmetry: bool; default=False

If the matrix is symmetric (matrix_form=6), returns a symmetric matrix. Supported as there are symmetric matrix routines. TODO: unused…

Returns
Mndarray

the matrix

rowsDict[(nid, nid)] = float

dictionary of keys=rowID, values=(Grid,Component) for the matrix

colsDict[(int, int)] = float

dictionary of keys=columnID, values=(Grid,Component) for the matrix

Warning

is_sparse=True WILL fail ..

pyNastran.bdf.cards.dmig.get_row_col_map(matrix: pyNastran.bdf.cards.dmig.DMIG, GCi: numpy.ndarray, GCj: numpy.ndarray, ifo: int) → Tuple[int, int, int, numpy.ndarray, numpy.ndarray, Dict[int, Any], Dict[int, Any]][source]