optimization Module

digraph inheritance4a177321d4 { 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.optimization.DCONADD" [URL="#pyNastran.bdf.cards.optimization.DCONADD",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="+---------+------+------+-----+-----+-----+-----+-----+-----+"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DCONADD" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DCONSTR" [URL="#pyNastran.bdf.cards.optimization.DCONSTR",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.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DCONSTR" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DDVAL" [URL="#pyNastran.bdf.cards.optimization.DDVAL",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="+-------+-----+-------+-------+-------+-------+-------+-------+-------+"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DDVAL" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DESVAR" [URL="#pyNastran.bdf.cards.optimization.DESVAR",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.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DESVAR" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DLINK" [URL="#pyNastran.bdf.cards.optimization.DLINK",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="Multiple Design Variable Linking"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DLINK" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DOPTPRM" [URL="#pyNastran.bdf.cards.optimization.DOPTPRM",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="causes a Nastran core dump if FSDMAX is nonzero and there is no stress case"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DOPTPRM" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DRESP1" [URL="#pyNastran.bdf.cards.optimization.DRESP1",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="+--------+-------+---------+---------+--------+--------+-------+------+-------+"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DRESP1" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DRESP2" [URL="#pyNastran.bdf.cards.optimization.DRESP2",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="Design Sensitivity Equation Response Quantities"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DRESP2" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DRESP3" [URL="#pyNastran.bdf.cards.optimization.DRESP3",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="+--------+---------+--------+--------+--------+--------+--------+--------+--------+"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DRESP3" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DSCREEN" [URL="#pyNastran.bdf.cards.optimization.DSCREEN",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="+---------+-------+-------+------+"]; "pyNastran.bdf.cards.optimization.OptConstraint" -> "pyNastran.bdf.cards.optimization.DSCREEN" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVCREL1" [URL="#pyNastran.bdf.cards.optimization.DVCREL1",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.optimization.DVXREL1" -> "pyNastran.bdf.cards.optimization.DVCREL1" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVCREL2" [URL="#pyNastran.bdf.cards.optimization.DVCREL2",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="+----------+--------+--------+-------+------------+-------+-------+-------+-------+"]; "pyNastran.bdf.cards.optimization.DVXREL2" -> "pyNastran.bdf.cards.optimization.DVCREL2" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVGRID" [URL="#pyNastran.bdf.cards.optimization.DVGRID",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="+--------+------+-----+-----+-------+----+----+----+"]; "pyNastran.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.optimization.DVGRID" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVMREL1" [URL="#pyNastran.bdf.cards.optimization.DVMREL1",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="Design Variable to Material Relation"]; "pyNastran.bdf.cards.optimization.DVXREL1" -> "pyNastran.bdf.cards.optimization.DVMREL1" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVMREL2" [URL="#pyNastran.bdf.cards.optimization.DVMREL2",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="+---------+--------+--------+-------+---------+-------+-------+-------+-------+"]; "pyNastran.bdf.cards.optimization.DVXREL2" -> "pyNastran.bdf.cards.optimization.DVMREL2" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVPREL1" [URL="#pyNastran.bdf.cards.optimization.DVPREL1",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="+---------+--------+--------+--------+-----------+-------+--------+-----+"]; "pyNastran.bdf.cards.optimization.DVXREL1" -> "pyNastran.bdf.cards.optimization.DVPREL1" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVPREL2" [URL="#pyNastran.bdf.cards.optimization.DVPREL2",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="+----------+--------+--------+-------+-----------+-------+-------+-------+-------+"]; "pyNastran.bdf.cards.optimization.DVXREL2" -> "pyNastran.bdf.cards.optimization.DVPREL2" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVXREL1" [URL="#pyNastran.bdf.cards.optimization.DVXREL1",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.optimization.DVXREL1" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.DVXREL2" [URL="#pyNastran.bdf.cards.optimization.DVXREL2",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.optimization.DVXREL2" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.OptConstraint" [URL="#pyNastran.bdf.cards.optimization.OptConstraint",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.optimization.OptConstraint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pyNastran.bdf.cards.optimization.TOPVAR" [URL="#pyNastran.bdf.cards.optimization.TOPVAR",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.optimization.TOPVAR" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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

  • dconstrs - DCONSTR

  • dconadds - DCONADD

  • ddvals - DDVAL

  • dlinks - DLINK

  • dresps - DRESP1, DRESP2, DRESP3

  • dscreen - DSCREEN

  • dvgrids - DVGRID

  • desvars - DESVAR

  • dvcrels - DVCREL1, DVCREL2

  • dvmrels - DVMREL1, DVMREL2

  • dvprels - DVPREL1, DVPREL2

  • doptprm - DOPTPRM

some missing optimization flags http://mscnastrannovice.blogspot.com/2014/06/msc-nastran-design-optimization-quick.html

class pyNastran.bdf.cards.optimization.DCONADD(oid, dconstrs, comment='')[source]

Bases: OptConstraint

1

2

3

4

5

6

7

8

9

DCONADD

DCID

DC1

DC2

DC3

DC4

DC5

DC6

DC7

DC8

etc.

DCONADD

10

4

12

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

property dconstr_ids
classmethod export_to_hdf5(hdf5_file, dconadds, encoding)[source]
raw_fields()[source]
type = 'DCONADD'
uncross_reference() None[source]

Removes cross-reference links

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.optimization.DCONSTR(oid, dresp_id, lid=-1e+20, uid=1e+20, lowfq=0.0, highfq=1e+20, comment='')[source]

Bases: OptConstraint

Creates a DCONSTR card

Parameters:
oidint

unique optimization id

dresp_idint

DRESP1/2 id

lid / uidint/float; default=-1.e20 / 1.e20

int: f(ω) defined by TABLED1-4 float: lower/upper bound

lowfq / highfqfloat; default=0. / 1.e20

lower/upper end of the frequency range

commentstr; default=’’

a comment for the card

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

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(hdf5_file, dconstrs, encoding)[source]
raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'DCONSTR'

1

2

3

4

5

6

7

DCONSTR

DCID

RID

LALLOW/LID

UALLOW/UID

LOWFQ

HIGHFQ

DCONSTR

10

4

1.25

uncross_reference() None[source]

Removes cross-reference links

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.optimization.DDVAL(oid, ddvals, comment='')[source]

Bases: OptConstraint

1

2

3

4

5

6

7

8

9

DDVAL

ID

DVAL1

DVAL2

DVAL3

DVAL4

DVAL5

DVAL6

DVAL7

DDVAL

ID

DVAL1

THRU

DVAL2

BY

INC

DDVAL

110

0.1

0.2

0.3

0.5

0.6

0.4

.7

THRU

1.0

BY

0.05

1.5

2.0

classmethod _init_from_empty()[source]
classmethod add_card(card: BDFCard, comment: str = '')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

raw_fields()[source]
type = 'DDVAL'
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.optimization.DESVAR(desvar_id, label, xinit, xlb=-1e+20, xub=1e+20, delx=None, ddval=None, comment='')[source]

Bases: OptConstraint

Creates a DESVAR card

Parameters:
desvar_idint

design variable id

labelstr

name of the design variable

xinitfloat

the starting point value for the variable

xlbfloat; default=-1.e20

the lower bound

xubfloat; default=1.e20

the lower bound

delxfloat; default=1.e20

fractional change allowed for design variables during approximate optimization NX if blank : take from DOPTPRM; otherwise 1.0 MSC if blank : take from DOPTPRM; otherwise 0.5

ddvalint; default=None
intDDVAL id

allows you to set discrete values

None : continuous

commentstr; default=’’

a comment for the card

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

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, desvar_ids)[source]

exports the elements in a vectorized way

label

user-defined name for printing purposes

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

1

2

3

4

5

6

7

8

DESVAR

OID

LABEL

XINIT

XLB

XUB

DELXV

DDVAL

uncross_reference() None[source]

Removes cross-reference links

property value

gets the actual value for the DESVAR

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

Bases: OptConstraint

Multiple Design Variable Linking Relates one design variable to one or more other design variables.

1

2

3

4

5

6

7

8

9

DLINK

ID

DDVID

C0

CMULT

IDV1

C1

IDV2

C2

IDV3

C3

etc.

Creates a DLINK card, which creates a variable that is a lienar ccombination of other design variables

Parameters:
oidint

optimization id

dependent_desvarint

the DESVAR to link

independent_desvarslist[int]

the DESVARs to combine

coeffslist[int]

the linear combination coefficients

c0float; default=0.0

an offset

cmultfloat; default=1.0

an scale factor

commentstr; default=’’

a comment for the card

property Ci
property IDv
classmethod _init_from_empty()[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

property ddvid
raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'DLINK'
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.optimization.DOPTPRM(params: dict[str, Any], comment: str = '')[source]

Bases: OptConstraint

causes a Nastran core dump if FSDMAX is nonzero and there is no stress case

Design Optimization Parameters Overrides default values of parameters used in design optimization

1

2

3

4

5

6

7

8

9

DOPTPRM

PARAM1

VAL1

PARAM2

VAL2

PARAM3

VAL3

PARAM4

VAL4

PARAM5

VAL5

etc.

_finalize_hdf5(encoding)[source]

hdf5 helper function

classmethod _init_from_empty()[source]
classmethod add_card(card: BDFCard, comment: str = '')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

defaults = {'APRCOD': 2, 'AUTOSE': 0, 'CONV1': 0.0001, 'CONV2': 1e-20, 'CONVDV': 0.001, 'CONVPR': 0.001, 'CT': -0.03, 'CTMIN': 0.003, 'DELB': 0.0001, 'DELOBJ': 0.001, 'DELP': 0.2, 'DELX': 0.5, 'DESMAX': 5, 'DISBEG': 0, 'DISCOD': 1, 'DLXESL': 0.5, 'DOBJ1': 0.1, 'DOBJ2': None, 'DPMAX': 0.5, 'DPMIN': 0.01, 'DRATIO': 0.1, 'DSMXESL': 20, 'DX1': 0.01, 'DX2': None, 'DXMAX': 1.0, 'DXMIN': 0.05, 'EDVOUT': 0.001, 'ETA1': 0.01, 'ETA2': 0.25, 'ETA3': 0.7, 'FSDALP': 0.9, 'FSDMAX': 0, 'GMAX': 0.005, 'GSCAL': 0.001, 'IGMAX': 0, 'IPRINT': 0, 'IPRNT1': 0, 'IPRNT2': 0, 'ISCAL': 0, 'ITMAX': 40, 'ITRMOP': 2, 'ITRMST': 2, 'IWRITE': 6, 'JPRINT': 0, 'JTMAX': 20, 'JWRITE': 0, 'METHOD': 1, 'MXCRTRSP': 5, 'NASPRO': 0, 'OBJMOD': 0, 'P1': 0, 'P2': 1, 'P2CALL': None, 'P2CBL': None, 'P2CC': None, 'P2CDDV': None, 'P2CM': None, 'P2CP': None, 'P2CR': None, 'P2RSET': 0, 'PENAL': 0.0, 'PLVIOL': 0, 'PTOL': 1e+35, 'STPSCL': 1.0, 'TCHECK': -1, 'TDMIN': None, 'TREGION': 0, 'UPDFAC1': 2.0, 'UPDFAC2': 0.5}
raw_fields() list[int | float | str][source]
type = 'DOPTPRM'
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.optimization.DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti, comment='', validate=False)[source]

Bases: OptConstraint

1

2

3

4

5

6

7

8

9

DRESP1

OID

LABEL

RTYPE

PTYPE

REGION

ATTA

ATTB

ATTI

DRESP1

103

STRESS2

STRESS

PSHELL

9

3

DRESP1

1S1

CSTRAN3

CSTRAIN

PCOMP

1

1

10000

Creates a DRESP1 card.

A DRESP1 is used to define a “simple” output result that may be optimized on. A simple result is a result like stress, strain, force, displacement, eigenvalue, etc. for a node/element that may be found in a non-optimization case.

Parameters:
dresp_idint

response id

labelstr

Name of the response

response_typestr

Response type

property_typestr

Element flag (PTYPE = ‘ELEM’), or property entry name, or panel flag for ERP responses (PTYPE = ‘PANEL’ - See Remark 34), or RANDPS ID. Blank for grid point responses. ‘ELEM’ or property name used only with element type responses (stress, strain, force, etc.) to identify the relevant element IDs, or the property type and relevant property IDs.

Must be {ELEM, PBAR, PSHELL, PCOMP, PANEL, etc.) PTYPE = RANDPS ID when RTYPE=PSDDISP, PSDVELO, or PSDACCL.

regionint

Region identifier for constraint screening

attaint / float / str / blank

Response attribute

attbint / float / str / blank

Response attribute

attilist[int / float / str]

the response values to pull from list[int]:

list of grid ids list of property ids

list[str]

‘ALL’

commentstr; default=’’

a comment for the card

validatebool; default=False

should the card be validated when it’s created

Examples

stress/PSHELL

>>> dresp_id = 103
>>> label = 'resp1'
>>> response_type = 'STRESS'
>>> property_type = 'PSHELL'
>>> pid = 3
>>> atta = 9 # von mises upper surface stress
>>> region = None
>>> attb = None
>>> atti = [pid]
>>> DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti)

stress/PCOMP

>>> dresp_id = 104
>>> label = 'resp2'
>>> response_type = 'STRESS'
>>> property_type = 'PCOMP'
>>> pid = 3
>>> layer = 4
>>> atta = 9 # von mises upper surface stress
>>> region = None
>>> attb = layer
>>> atti = [pid]
>>> DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti)

stress/PCOMP

>>> dresp_id = 104
>>> label = 'resp2'
>>> response_type = 'CSTRESS'
>>> property_type = 'ELEM'
>>> pid = 3
>>> layer = 4
>>> atta = 3 # ???
>>> region = None
>>> attb = layer
>>> atti = [eid]
>>> DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti)

displacement - not done

>>> dresp_id = 105
>>> label = 'resp3'
>>> response_type = 'DISP'
>>> #atta = ???
>>> #region = ???
>>> #attb = ???
>>> atti = [nid]
>>> DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti)

not done >>> dresp_id = 105 >>> label = ‘resp3’ >>> response_type = ‘ELEM’ >>> #atta = ??? >>> #region = ??? >>> #attb = ??? >>> atti = [eid???] >>> DRESP1(dresp_id, label, response_type, property_type, region, atta, attb, atti)

Atta()[source]

returns the values of ATTa

DRespID()[source]
OptID()[source]
_elements()[source]

helper method

_nodes()[source]

helper method

_properties()[source]

helper method

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

atti_values()[source]

returns the values of ATTi

calculate(op2_model, subcase_id)[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, encoding)[source]

exports the dresps in a vectorized way

object_attributes(mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

property ptype
raw_fields()[source]
repr_fields()[source]

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

property rtype
safe_cross_reference(model: BDF, xref_errors)[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

type = 'DRESP1'
uncross_reference() None[source]

Removes cross-reference links

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.optimization.DRESP2(dresp_id, label, dequation, region, params, method='MIN', c1=1.0, c2=0.005, c3=10.0, comment='', validate=False)[source]

Bases: OptConstraint

Design Sensitivity Equation Response Quantities Defines equation responses that are used in the design, either as constraints or as an objective.

1

2

3

4

5

6

7

8

9

DRESP2

ID

LABEL

EQID/FUNC

REGION

METHOD

C1

C2

C3

DESVAR

DVID1

DVID2

DVID3

DVID4

DVID5

DVID6

DVID7

DVID8

etc.

DTABLE

LABL1

LABL2

LABL3

LABL4

LABL5

LABL6

LABL7

LABL8

etc.

DRESP1

NR1

NR2

NR3

NR4

NR5

NR6

NR7

NR8

etc.

DNODE

G1

C1

G2

C2

G3

C3

G4

C4

etc.

DVPREL1

DPIP1

DPIP2

DPIP3

DPIP4

DPIP5

DPIP6

DPIP7

DPIP8

DPIP9

etc.

DVCREL1

DCIC1

DCIC2

DCIC3

DCIC4

DCIC5

DCIC6

DCIC7

DCIC8

DCIC9

etc.

DVMREL1

DMIM1

DMIM2

DMIM3

DMIM4

DMIM5

DMIM6

DMIM7

DMIM8

DMIM9

etc.

DVPREL2

DPI2P1

DPI2P2

DPI2P3

DPI2P4

DPI2P5

DPI2P6

DPI2P7

DPI2P8

DPI2P9

etc.

DVCREL2

DCI2C1

DCI2C2

DCI2C3

DCI2C4

DCI2C5

DCI2C6

DCI2C7

DCI2C8

DCI2C9

etc.

DVMREL2

DMI2M1

DMI2M2

DMI2M3

DMI2M4

DMI2M5

DMI2M6

DMI2M7

DMI2M8

DMI2M9

etc.

DRESP2

NRR1

NRR2

NRR3

NRR4

NRR5

NRR6

NRR7

NRR8

etc.

DVLREL1

DLIL1

DLIL2

DLIL3

DLIL4

DLIL5

DLIL6

DLIL7

DLIL8

etc.

C1, C2, C3 are MSC specific

Creates a DRESP2 card.

A DRESP2 is used to define a “complex” output result that may be optimized on. A complex result is a result that uses:

  • simple (DRESP1) results

  • complex (DRESP2) results

  • default values (DTABLE)

  • DVCRELx values

  • DVMRELx values

  • DVPRELx values

  • DESVAR values

  • DNODE values

Then, an equation (DEQATN) is used to formulate an output response.

Parameters:
dresp_idint

response id

labelstr

Name of the response

dequationint / str

int : DEQATN id str : an equation

regionint

Region identifier for constraint screening

paramsdict[(index, card_type)] = values

the storage table for the response function index : int

a counter

card_typestr

the type of card to pull from DESVAR, DVPREL1, DRESP2, etc.

valueslist[int]

the values for this response

methodstr; default=MIN

flag used for FUNC=BETA/MATCH FUNC = BETA

valid options are {MIN, MAX}

FUNC = MATCH

valid options are {LS, BETA}

c1 / c2 / c3float; default=1. / 0.005 / 10.0

constants for FUNC=BETA or FUNC=MATCH

commentstr; default=’’

a comment for the card

validatebool; default=False

should the card be validated when it’s created

params = {

(0, ‘DRESP1’) = [10, 20], (1, ‘DESVAR’) = [30], (2, ‘DRESP1’) = [40],

}
DEquation()[source]
DRespID()[source]
OptID()[source]
_pack(params: list[Any])[source]

packs the params/params_ref into a form for output

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

calculate(op2_model, subcase_id)[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, encoding)[source]

exports the dresps in a vectorized way

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 = 'DRESP2'
uncross_reference() None[source]

Removes cross-reference links

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.optimization.DRESP3(dresp_id, label, group, Type, region, params, validate=False, comment='')[source]

Bases: OptConstraint

1

2

3

4

5

6

7

8

9

DRESP3

ID

LABEL

GROUP

TYPE

REGION

DESVAR

DVID1

DVID2

DVID3

DVID4

DVID5

DVID6

DVID7

DVID8

etc.

DTABLE

LABL1

LABL2

LABL3

LABL4

LABL5

LABL6

LABL7

LABL8

etc.

DRESP1

NR1

NR2

NR3

NR4

NR5

NR6

NR7

NR8

etc.

DNODE

G1

C1

G2

C2

G3

C3

G4

C4

etc.

DVPREL1

DPIP1

DPIP2

DPIP3

DPIP4

DPIP5

DPIP6

DPIP7

DPIP8

DPIP9

etc.

DVCREL1

DCIC1

DCIC2

DCIC3

DCIC4

DCIC5

DCIC6

DCIC7

DCIC8

DCIC9

etc.

DVMREL1

DMIM1

DMIM2

DMIM3

DMIM4

DMIM5

DMIM6

DMIM7

DMIM8

DMIM9

etc.

DVPREL2

DPI2P1

DPI2P2

DPI2P3

DPI2P4

DPI2P5

DPI2P6

DPI2P7

DPI2P8

DPI2P9

etc.

DVCREL2

DCI2C1

DCI2C2

DCI2C3

DCI2C4

DCI2C5

DCI2C6

DCI2C7

DCI2C8

DCI2C9

etc.

DVMREL2

DMI2M1

DMI2M2

DMI2M3

DMI2M4

DMI2M5

DMI2M6

DMI2M7

DMI2M8

DMI2M9

etc.

DRESP2

NRR1

NRR2

NRR3

NRR4

NRR5

NRR6

NRR7

NRR8

etc.

DVLREL1

DLIL1

DLIL2

DLIL3

DLIL4

DLIL5

DLIL6

DLIL7

DLIL8

etc.

USRDATA

String

etc.

Creates a DRESP3 card.

A DRESP3 is used to define a “complex” output result that may be optimized on. A complex result is a result that uses:

  • simple (DRESP1) results

  • complex (DRESP2) results

  • default values (DTABLE)

  • DVCRELx values

  • DVMRELx values

  • DVPRELx values

  • DESVAR values

  • DNODE values

  • DVLREL1 values

  • USRDATA

Then, an secondary code (USRDATA) is used to formulate an output response.

Parameters:
dresp_idint

response id

labelstr

Name of the response

groupstr

Selects a specific external response routine

Typestr

Refers to a specific user-created response calculation type in the external function evaluator

regionstr

Region identifier for constraint screening

paramsdict[(index, card_type)] = values

the storage table for the response function index : int

a counter

card_typestr

the type of card to pull from DESVAR, DVPREL1, DRESP2, etc.

valueslist[int]

the values for this response

commentstr; default=’’

a comment for the card

validatebool; default=False

should the card be validated when it’s created

params = {

(0, ‘DRESP1’) = [10, 20], (1, ‘DESVAR’) = [30], (2, ‘DRESP1’) = [40],

}
_pack(params)[source]

packs the params/params_ref into a form for output

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

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, encoding)[source]

exports the dresps in a vectorized way

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 = 'DRESP3'
uncross_reference() None[source]

Removes cross-reference links

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.optimization.DSCREEN(rtype: str, trs: float = -0.5, nstr: int = 20, comment: str = '')[source]

Bases: OptConstraint

1

2

3

4

DSCREEN

RTYPE

TRS

NSTR

DSCREEN

DISP

-0.3

NSTR

Creates a DSCREEN object

Parameters:
rtypestr

Response type for which the screening criteria apply

trsfloat; default=-0.5

Truncation threshold

nstrint; default=20

Maximum number of constraints to be retained per region per load case

commentstr; default=’’

a comment for the card

classmethod _init_from_empty()[source]
classmethod add_card(card: BDFCard, comment: str = '')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

nstr

Maximum number of constraints to be retained per region per load case. (Integer > 0; Default = 20)

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

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

rtype

Response type for which the screening criteria apply. (Character)

trs

Truncation threshold. (Real; Default = -0.5)

type = 'DSCREEN'
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.optimization.DVCREL1(oid, element_type, eid, cp_name, dvids, coeffs, cp_min=None, cp_max=1e+20, c0=0.0, validate=False, comment='')[source]

Bases: DVXREL1

1

2

3

4

5

6

7

8

9

DVCREL1

ID

TYPE

EID

CPNAME

CPMIN

CPMAX

C0

DVID1

COEF1

DVID2

COEF2

DVID3

etc.

DVCREL1

200000

CQUAD4

1

ZOFFS

1.0

200000

1.0

Eid()[source]
OptID()[source]
property Type
_get_element(model, msg='')[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids']
_update_by_dvcrel(element, value)[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

calculate(op2_model, subcase_id)[source]
cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

object_attributes(mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

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

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'DVCREL1'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVCREL2(oid, element_type, eid, cp_name, deqation, dvids, labels, cp_min=None, cp_max=1e+20, validate=False, comment='')[source]

Bases: DVXREL2

1

2

3

4

5

6

7

8

9

DVCREL2

ID

TYPE

EID

CPNAME/FID

CPMIN

CPMAX

EQID

DESVAR

DVID1

DVID2

DVID3

DVID4

DVID5

DVID6

DVID7

DVID8

etc.

DTABLE

LABL1

LABL2

LABL3

LABL4

LABL5

LABL6

LABL7

LABL8

etc.

DEquation()[source]
Eid()[source]
OptID()[source]
property Type
_get_element(model, eid, msg='')[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids']
_update_by_dvcrel(elem, value)[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

allowed_elements = ['CQUAD4', 'CTRIA3', 'CBAR', 'CBEAM', 'CELAS1', 'CBUSH', 'CDAMP2']
calculate(op2_model, subcase_id)[source]

this should really make a call the the DEQATN; see the PBEAM for an example of get/set_opt_value

cp_max

Maximum value allowed for this property. (Real; Default = 1.0E20)

cp_min

Minimum value allowed for this property. If CPNAME references a connectivity property that can only be positive, then the default value of CPMIN is 1.0E-15. Otherwise, it is -1.0E35. (Real) .. todo:: bad default (see DVCREL2)

cp_name

Name of connectivity property, such as X1, X2, X3, ZOFFS, etc. (Character)

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

.. todo:: add support for DEQATN cards to finish DVPREL2 xref
eid

Element Identification number. (Integer > 0)

element_type

Name of an element connectivity entry, such as CBAR, CQUAD4, etc. (Character)

object_attributes(mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

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

Todo

finish repr_fields for DVCREL2

type = 'DVCREL2'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVGRID(dvid, nid, dxyz, cid=0, coeff=1.0, comment='')[source]

Bases: BaseCard

1

2

3

4

5

6

7

8

DVGRID

DVID

GID

CID

COEFF

N1

N2

N3

Creates a DVGRID card

Parameters:
dvidint

DESVAR id

nidint

GRID/POINT id

dxyz(3, ) float ndarray

the amount to move the grid point

cidint; default=0

Coordinate system for dxyz

coefffloat; default=1.0

the dxyz scale factor

commentstr; default=’’

a comment for the card

classmethod _init_from_empty()[source]
_properties = ['desvar_id', 'node_id', 'coord_id']
static add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

property coord_id
cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

property desvar_id
property node_id
raw_fields()[source]
type = 'DVGRID'
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

class pyNastran.bdf.cards.optimization.DVMREL1(oid: int, mat_type: str, mid: int, mp_name: str, dvids: list[int], coeffs: list[float], mp_min: float | None = None, mp_max: float = 1e+20, c0: float = 0.0, validate: bool = False, comment: str = '')[source]

Bases: DVXREL1

Design Variable to Material Relation Defines the relation between a material property and design variables.

1

2

3

4

5

6

7

8

DVMREL1

ID

TYPE

MID

MPNAME

MPMIN

MPMAX

C0

DVID1

COEF1

DVID2

COEF2

DVID3

COEF3

etc.

Creates a DVMREL1 card

Parameters:
oidint

optimization id

mat_typestr

material card name (e.g., MAT1)

midint

material id

mp_namestr

optimization parameter as a pname (material name; E)

dvidslist[int]

DESVAR ids

coeffslist[float]

scale factors for DESVAR ids

mp_minfloat; default=None

minimum material property value

mp_maxfloat; default=1e20

maximum material property value

c0float; default=0.

offset factor for the variable

validatebool; default=False

should the variable be validated

commentstr; default=’’

a comment for the card

Mid()[source]
OptID()[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids']
_update_by_dvmrel(mat, value)[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

object_attributes(mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

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

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'DVMREL1'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVMREL2(oid, mat_type, mid, mp_name, deqation, dvids, labels, mp_min=None, mp_max=1e+20, validate=False, comment='')[source]

Bases: DVXREL2

1

2

3

4

5

6

7

8

9

DVMREL2

ID

TYPE

MID

MPNAME

MPMIN

MPMAX

EQID

DESVAR

DVID1

DVID2

DVID3

DVID4

DVID5

DVID6

DVID7

DVID8

etc.

DTABLE

LABL1

LABL2

LABL3

LABL4

LABL5

LABL6

LABL7

LABL8

etc.

Creates a DVMREL2 card

Parameters:
oidint

optimization id

mat_typestr

material card name (e.g., MAT1)

midint

material id

mp_namestr

optimization parameter as a pname (material name; E)

deqationint

DEQATN id

dvidslist[int]; default=None

DESVAR ids

labelslist[str]; default=None

DTABLE names

mp_minfloat; default=None

minimum material property value

mp_maxfloat; default=1e20

maximum material property value

validatebool; default=False

should the variable be validated

commentstr; default=’’

a comment for the card

.. note:: either dvids or labels is required
DEquation()[source]
Mid()[source]
OptID()[source]
_get_material(model, mid, msg='')[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids']
_update_by_dvmrel(mat, value)[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

allowed_materials = ['MAT1', 'MAT2', 'MAT8']
calculate(op2_model, subcase_id)[source]

this should really make a call the the DEQATN; see the PBEAM for an example of get/set_opt_value

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

.. todo:: add support for DEQATN cards to finish DVMREL2 xref
mat_type

Name of a material entry, such as MAT1, MAT2, etc

mid

Property entry identification number

mp_max

Maximum value allowed for this property. (Real; Default = 1.0E20)

mp_min

Minimum value allowed for this property. If MPNAME references a material property that can only be positive, then the default value for MPMIN is 1.0E-15. Otherwise, it is -1.0E35. (Real)

mp_name

Property name, such as ‘E’, ‘RHO’ (Character)

object_attributes(mode='public', keys_to_skip=None, filter_properties=False)[source]

See also

pyNastran.utils.object_attributes(…)

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

Todo

finish repr_fields for DVMREL2

type = 'DVMREL2'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVPREL1(oid, prop_type, pid, pname_fid, dvids, coeffs, p_min=None, p_max=1e+20, c0=0.0, validate=False, comment='')[source]

Bases: DVXREL1

1

2

3

4

5

6

7

8

DVPREL1

ID

TYPE

PID

PNAME/FID

PMIN

PMAX

C0

DVID1

COEF1

DVID2

COEF2

DVID3

etc.

DVPREL1

200000

PCOMP

2000

T2

200000

1.0

Creates a DVPREL1 card

Parameters:
oidint

optimization id

prop_typestr

property card name (e.g., PSHELL)

pidint

property id

pname_fidstr/int

optimization parameter as a pname (property name; T) or field number (fid)

dvidslist[int]

DESVAR ids

coeffslist[float]

scale factors for DESVAR ids

p_minfloat; default=None

minimum property value

p_maxfloat; default=1e20

maximum property value

c0float; default=0.

offset factor for the variable

validatebool; default=False

should the variable be validated

commentstr; default=’’

a comment for the card

OptID()[source]
Pid()[source]
_get_property(model, pid, msg='')[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids', 'allowed_properties', 'allowed_elements', 'allowed_masses', 'allowed_properties_mass']
_update_by_dvprel(prop, value)[source]
classmethod add_card(card: BDFCard, comment: str = '')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

allowed_elements = ['CELAS2', 'CBAR', 'CBEAM', 'CQUAD4', 'CBUSH', 'CDAMP2']
allowed_masses = ['CONM2', 'CMASS2', 'CMASS4']
allowed_properties = ['PELAS', 'PROD', 'PTUBE', 'PBAR', 'PBARL', 'PBEAM', 'PBEAML', 'PSHEAR', 'PSHELL', 'PCOMP', 'PCOMPG', 'PBUSH', 'PBUSH1D', 'PGAP', 'PVISC', 'PDAMP', 'PWELD', 'PBMSECT']
allowed_properties_mass = ['PMASS']
calculate(op2_model, subcase_id)[source]
cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

get_xinit_lower_upper_bound(model)[source]

gets the active x value and the lower/upper bounds

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

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'DVPREL1'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVPREL2(oid, prop_type, pid, pname_fid, deqation, dvids=None, labels=None, p_min=None, p_max=1e+20, validate=False, comment='')[source]

Bases: DVXREL2

1

2

3

4

5

6

7

8

9

DVPREL2

ID

TYPE

PID

PNAME/FID

PMIN

PMAX

EQID

DESVAR

DVID1

DVID2

DVID3

DVID4

DVID5

DVID6

DVID7

DVID8

etc.

DTABLE

LABL1

LABL2

LABL3

LABL4

LABL5

LABL6

LABL7

LABL8

etc.

Creates a DVPREL2 card

Parameters:
oidint

optimization id

prop_typestr

property card name (e.g., PSHELL)

pidint

property id

pname_fidstr/int

optimization parameter as a pname (property name; T) or field number (fid)

deqationint

DEQATN id

dvidslist[int]; default=None

DESVAR ids

labelslist[str]; default=None

DTABLE names

#paramsdict[(index, card_type)] = values

#the storage table for the response function #index : int

#a counter

#card_typestr

#the type of card to pull from #DESVAR, DVPREL1, DRESP2, etc.

#valueslist[int]

#the values for this response

p_minfloat; default=None

minimum property value

p_maxfloat; default=1e20

maximum property value

validatebool; default=False

should the variable be validated

commentstr; default=’’

a comment for the card

.. note:: either dvids or labels is required
DEquation()[source]
OptID()[source]
Pid()[source]
_get_property(model, pid, msg='')[source]
classmethod _init_from_empty()[source]
_properties = ['desvar_ids']
_update_by_dvprel(prop, value)[source]
classmethod add_card(card, comment='')[source]

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

allowed_elements = ['CELAS2', 'CBAR', 'CBEAM', 'CQUAD4', 'CBUSH', 'CDAMP2']
allowed_masses = ['CONM2', 'CMASS2', 'CMASS4']
allowed_properties = ['PELAS', 'PROD', 'PTUBE', 'PBAR', 'PBARL', 'PBEAM', 'PBEAML', 'PSHELL', 'PCOMP', 'PCOMPG', 'PBUSH', 'PBUSH1D', 'PGAP', 'PVISC', 'PDAMP', 'PWELD']
allowed_properties_mass = ['PMASS']
calculate(op2_model, subcase_id)[source]

this should really make a call the the DEQATN; see the PBEAM for an example of get/set_optimization_value

cross_reference(model: BDF) None[source]

Cross links the card so referenced cards can be extracted directly

Parameters:
modelBDF()

the BDF object

.. todo:: add support for DEQATN cards to finish DVPREL2 xref
get_xinit_lower_upper_bound(model)[source]

gets the active x value and the lower/upper bounds

p_max

Maximum value allowed for this property. (Real; Default = 1.0E20)

p_min

Minimum value allowed for this property. If FID references a stress recovery location field, then the default value for PMIN is -1.0+35. PMIN must be explicitly set to a negative number for properties that may be less than zero (for example, field ZO on the PCOMP entry). (Real; Default = 1.E-15) .. todo:: bad default (see DVMREL1)

pid

Property entry identification number

pname_fid

Property name, such as ‘T’, ‘A’, or field position of the property entry, or word position in the element property table of the analysis model. Property names that begin with an integer such as 12I/T**3 may only be referred to by field position. (Character or Integer 0)

prop_type

Name of a property entry, such as PBAR, PBEAM, etc

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

Todo

finish repr_fields for DVPREL2

type = 'DVPREL2'
uncross_reference() None[source]

Removes cross-reference links

update_model(model, desvar_values)[source]

doesn’t require cross-referencing

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.optimization.DVXREL1(oid, dvids, coeffs, c0, comment)[source]

Bases: BaseCard

property desvar_ids
validate()[source]

card checking method that should be overwritten

class pyNastran.bdf.cards.optimization.DVXREL2(oid, dvids, labels, deqation, comment)[source]

Bases: BaseCard

_check_args()[source]

checks the number of DEQATN args

dequation

DEQATN entry identification number. (Integer > 0)

property desvar_ids
oid

Unique identification number

validate()[source]

card checking method that should be overwritten

class pyNastran.bdf.cards.optimization.OptConstraint[source]

Bases: BaseCard

class pyNastran.bdf.cards.optimization.TOPVAR(opt_id, label, prop_type, xinit, pid, xlb=0.001, delxv=0.2, power=3.0, options=None, comment='')[source]

Bases: BaseCard

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

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

Parameters:
cardBDFCard()

a BDFCard object

commentstr; default=’’

a comment for the card

repr_fields()[source]

Gets the fields in their simplified form

Returns:
fieldslist[varies]

the fields that define the card

type = 'TOPVAR'
uncross_reference()[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

pyNastran.bdf.cards.optimization._blank_or_mode(attb, msg)[source]

if it’s blank, it’s a static result, otherwise it’s a mode id

pyNastran.bdf.cards.optimization._check_dvcrel_options(cp_name, element_type, options)[source]
pyNastran.bdf.cards.optimization._check_dvmrel_options(mp_name, material_type, options)[source]
pyNastran.bdf.cards.optimization._check_dvprel_options(pname_fid, prop_type, options)[source]
pyNastran.bdf.cards.optimization._check_pbeam_pbeaml_allowable_attas(atta: int, msg: str) None[source]

6 /16/26…106: point E stress 8 /18/28…108: max principal 9 /19/29…109: min principal 10/20/30…110: margin tension 11/21/31…111: margin compression

pyNastran.bdf.cards.optimization._dresp_verify_eids(dresp: DRESP1, model: BDF, property_type: str)[source]
pyNastran.bdf.cards.optimization._dresp_verify_prop(dresp: DRESP1, model: BDF, property_type: str) None[source]
pyNastran.bdf.cards.optimization._export_dresps_to_hdf5(h5_file, model, encoding)[source]

exports dresps

pyNastran.bdf.cards.optimization._get_desvar(desvar_values, desvar_id, dvxrel)[source]
pyNastran.bdf.cards.optimization._get_dresp23_table_values(name, values_list, inline=False)[source]
Parameters:
namestr

the name of the response (e.g., DRESP1, DVPREL1)

values_listvaries

typical : list[int] DNODE : list[list[int], list[int]]

inlinebool; default=False

used for DNODE

pyNastran.bdf.cards.optimization._get_dtable_value(dtable, labels, dvxrel)[source]
pyNastran.bdf.cards.optimization._validate_dresp1_force(property_type, response_type, atta, attb, atti)[source]

helper for validate_dresp

pyNastran.bdf.cards.optimization._validate_dresp1_stress_strain(property_type: str, response_type: str, atta, attb, atti)[source]

helper for validate_dresp

pyNastran.bdf.cards.optimization._validate_dresp_property_none(label: str, property_type: str, response_type: str, atta, attb, atti) None[source]

helper for validate_dresp

pyNastran.bdf.cards.optimization.get_deqatn_args(dvxrel2, model, desvar_values)[source]

gets the arguments for the DEQATN for the DVxREL2

pyNastran.bdf.cards.optimization.get_deqatn_value(dvxrel2, model, desvar_values)[source]
pyNastran.bdf.cards.optimization.get_dvprel_key(dvprel, prop=None)[source]

helper method for the gui

pyNastran.bdf.cards.optimization.get_dvxrel1_coeffs(dvxrel, model, desvar_values, debug=False)[source]

Used by DVPREL1/2, DVMREL1/2, DVCREL1/2, and DVGRID to determine the value for the new property/material/etc. value

pyNastran.bdf.cards.optimization.none_max(lower_bound, xlb)[source]

helper method for DVPREL1

pyNastran.bdf.cards.optimization.none_min(upper_bound, xub)[source]

helper method for DVPREL1

pyNastran.bdf.cards.optimization.parse_table_fields(card_type: str, card: BDFCard, fields)[source]
params = {

(0, ‘DRESP1’) = [10, 20], (1, ‘DESVAR’) = [30], (2, ‘DRESP1’) = [40],

}

pyNastran.bdf.cards.optimization.validate_dresp1(label: str, property_type: str, response_type: str, atta: int, attb: int | None, atti: list[int]) None[source]
pyNastran.bdf.cards.optimization.validate_dvcrel(validate, element_type, cp_name)[source]

Valdiates the DVCREL1/2

Note

words that start with integers (e.g., 12I/T**3) doesn’t support strings

pyNastran.bdf.cards.optimization.validate_dvmrel(validate, mat_type, mp_name)[source]

Valdiates the DVMREL1/2

Note

words that start with integers (e.g., 12I/T**3) doesn’t support strings

pyNastran.bdf.cards.optimization.validate_dvprel(prop_type, pname_fid, validate)[source]

Valdiates the DVPREL1/2

Note

words that start with integers (e.g., 12I/T**3) doesn’t support strings

Note

FID > 0 –> references the Property Card

Note

FID < 0 –> references the EPT card