subcase Module

digraph inheritance94b61c6e18 { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.bdf.subcase.Subcase" [URL="#pyNastran.bdf.subcase.Subcase",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="Subcase creation/extraction class"]; }

Subcase creation/extraction class

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

Bases: object

Subcase creation/extraction class

add(key: str, value: Any, options: list[Any], param_type: str) None[source]
add_integer_type(key: str, value: int) None[source]
Simple way to add something of the form:

SPC = 1

subcase.add_integer_type(‘SPC’, 1) vs. subcase.add(‘SPC’, 1, [], ‘STRESS-type’)

add_result_type(key: str, value: int | str, options: list[str]) None[source]
Simple way to add something of the form:

DISP(PLOT) = ALL STRESS(PLOT) = ALL FORCE(PLOT) = 1

subcase.add_integer_type(‘SPC’, 1, [‘PLOT’]) vs. subcase.add(‘SPC’, ‘ALL’, [‘PLOT’], ‘STRESS-type’)

add_set_from_values(set_id: int, values: list[int]) None[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() None[source]

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

get_int_parameter(param_name: str, msg: str = '', obj: bool = False) tuple[int, 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:
valueint

the value of the parameter 1 in LOAD = 1

optionslist[varies]

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

get_op2_data(sol, solmap_to_value) None[source]
get_parameter(param_name: str, msg: str = '', obj: bool = False) tuple[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

get_str_parameter(param_name: str, msg: str = '', obj: bool = False) tuple[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:
valuestr

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[str]) 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 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: list[str]) list[str][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: str, value, options, param_type: str) None[source]
write_subcase(subcase0: Subcase) str[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: int) int[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: list[str], 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: list[str], unused_value) int[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: int, table_name: str, unused_options) int[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: str) str[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