subcase Module

Inheritance diagram of pyNastran.bdf.subcase

Subcase creation/extraction class

class pyNastran.bdf.subcase.Subcase(id=0)[source]

Bases: object

Subcase creation/extraction class

add(key: str, value: Any, options: List[Any], param_type: str)[source]
add_set_from_values(set_id: int, values: List[int])[source]

Simple way to add SET cards

allowed_param_types = ['SET-type', 'CSV-type', 'SUBCASE-type', 'KEY-type', 'STRESS-type', 'STRING-type', 'OBJ-type']
export_to_hdf5(hdf5_file, encoding: str) → None[source]
finish_subcase()[source]

Removes the subcase parameter from the subcase to avoid printing it in a funny spot

get_op2_data(sol, solmap_to_value)[source]
get_parameter(param_name: str, msg: str = '', obj: bool = False) → Tuple[Union[int, str], List[Any]][source]

Gets the [value, options] for a subcase.

Parameters
param_namestr

the case control parameters to get

objbool; default=False

should the object be returned

Returns
valuevaries

the value of the parameter ‘ALL’ in STRESS(PLOT,PRINT) = ALL

optionsList[varies]

the values in parentheses [‘PLOT’, ‘PRINT’] in STRESS(PLOT,PRINT) = ALL

has_parameter(*param_names) → List[bool][source]

Checks to see if one or more parameter names are in the subcase.

Parameters
param_namesstr; List[str]

the case control parameters to check for

Returns
existsList[bool]

do the parameters exist

load_hdf5_file(hdf5_file, encoding: str)[source]
print_param(key: str, param: Tuple[Any, Any, str]) → str[source]

Prints a single entry of the a subcase from the global or local subcase list.

solCodeMap = {1: 101, 21: 101, 24: 101, 26: 101, 61: 101, 64: 106, 66: 106, 68: 106, 76: 101, 99: 129, 144: 101, 187: 101}
subcase_sorted(lst)[source]

Does a “smart” sort on the keys such that SET cards increment in numerical order. Also puts the sets first.

Parameters
lstList[str]

the list of subcase list objects (list_a)

Returns
list_bList[str]

the sorted version of list_a

suppress_output(suppress_to: str = 'PLOT') → None[source]

Replaces F06 printing with OP2 printing

Converts:

STRESS(PRINT,SORT1,REAL) FORCE(PRINT,PLOT,SORT1,REAL)

to:

STRESS(PLOT,SORT1,REAL) FORCE(PLOT,SORT1,REAL)

Warning

needs more validation

update(key, value, options, param_type)[source]
write_subcase(subcase0)[source]

Internal method to print a subcase

Parameters
subcase0Subcase()

the global Subcase object

Returns
msgstr

the string of the current Subcase

pyNastran.bdf.subcase.get_analysis_code(sol)[source]

Maps the solution number to the OP2 analysis code.

  • 8 - post-buckling (maybe 7 depending on NLPARM???)

# not important
  • 3/4 - differential stiffness (obsolete)

  • 11 - old geometric nonlinear statics

  • 12 - contran (???)

Todo

verify

pyNastran.bdf.subcase.get_device_code(options: Any, unused_value: Any) → int[source]

Gets the device code of a given set of options and value

Parameters
optionslist[int/float/str]

the options for a parameter

unused_valueint/float/str

the value of the parameter

Returns
device_codeint

The OP2 device code

0 - No output 1 - PRINT 2 - PLOT 3 - PRINT, PLOT 4 - PUNCH 5 - PRINT, PUNCH 6 - PRINT, PLOT, PUNCH

pyNastran.bdf.subcase.get_format_code(options: Any, unused_value: Any) → int[source]

Gets the format code that will be used by the op2 based on the options.

Parameters
optionslist[int/float/str]

the options for a parameter

unused_valueint/float/str

the value of the parameter

.. todo:: not done…only supports REAL, IMAG, PHASE, not RANDOM
pyNastran.bdf.subcase.get_sort_code(options, unused_value)[source]

Gets the sort code of a given set of options and value

Parameters
optionsList[int/str]

the options for a parameter

unused_valueint; str

the value of the parameter

pyNastran.bdf.subcase.get_stress_code(key: str, options: Dict[str, Any], unused_value: Any) → int[source]

Method get_stress_code:

Note

the individual element must take the stress_code and reduce

it to what the element can return. For example, for an isotropic CQUAD4 the fiber field doesnt mean anything.

BAR - no von mises/fiber ISOTROPIC - no fiber

Todo

how does the MATERIAL bit get turned on? I’m assuming it’s element dependent…

pyNastran.bdf.subcase.get_table_code(sol, table_name, unused_options)[source]

Gets the table code of a given parameter. For example, the DISPLACMENT(PLOT,POST)=ALL makes an OUGV1 table and stores the displacement. This has an OP2 table code of 1, unless you’re running a modal solution, in which case it makes an OUGV1 table of eigenvectors and has a table code of 7.

Parameters
optionslist[int/float/str]

the options for a parameter

valueint/float/str

the value of the parameter

Returns
table_codeint

the OP2 table_code

pyNastran.bdf.subcase.update_param_name(param_name)[source]

Takes an abbreviated name and expands it so the user can type DISP or DISPLACEMENT and get the same answer

Parameters
param_namestr

the parameter name to be standardized (e.g. DISP vs. DIPLACEMENT)

.. todo:: not a complete list