case_control_deck Module

Inheritance diagram of pyNastran.bdf.case_control_deck

CaseControlDeck parsing and extraction class

CaseControlDeck:

get_subcase_parameter(self, isubcase, param_name) has_subcase(self, isubcase) create_new_subcase(self, isubcase) delete_subcase(self, isubcase) copy_subcase(self, i_from_subcase, i_to_subcase, overwrite_subcase=True) get_subcase_list(self) get_local_subcase_list(self) update_solution(self, isubcase, sol) add_parameter_to_global_subcase(self, param) add_parameter_to_local_subcase(self, isubcase, param) finish_subcases(self) convert_to_sol_200(self, model)

class pyNastran.bdf.case_control_deck.CaseControlDeck(lines: List[str], log: Optional[Any] = None)[source]

Bases: object

CaseControlDeck parsing and extraction class

Creates the CaseControlDeck from a set of lines

Parameters
linesList[str]

list of lines that represent the case control deck ending with BEGIN BULK

loglog()

a :mod: logging object

add_parameter_to_global_subcase(param)[source]

Takes in a single-lined string and adds it to the global subcase.

Parameters
paramstr

the variable to add

Notes

dont worry about overbounding the line

Examples

>>> bdf = BDF()
>>> bdf.read_bdf(bdf_filename)
>>> bdf.case_control.add_parameter_to_global_subcase('DISP=ALL')
>>> bdf.case_control
TITLE = DUMMY LINE
DISP = ALL
add_parameter_to_local_subcase(isubcase: int, param: List[str]) → None[source]

Takes in a single-lined string and adds it to a single Subcase.

Parameters
isubcaseint

the subcase ID to add

param_nameList[str]

the parameter name to add

Notes

dont worry about overbounding the line

Examples

>>> bdf = BDF()
>>> bdf.read_bdf(bdf_filename)
>>> bdf.case_control.add_parameter_to_local_subcase(1, 'DISP=ALL')
>>> print(bdf.case_control)
TITLE = DUMMY LINE
SUBCASE 1
    DISP = ALL
>>>
convert_to_sol_200(model: BDF) → None[source]

Takes a case control deck and changes it from a SOL xxx to a SOL 200

Parameters
modelBDF()

the BDF object

.. todo:: not done…
copy_subcase(i_from_subcase: int, i_to_subcase: int, overwrite_subcase: bool = True) → pyNastran.bdf.subcase.Subcase[source]

Overwrites the parameters from one subcase to another.

Parameters
i_from_subcaseint

the Subcase to pull the data from

i_to_subcaseint

the Subcase to map the data to

overwrite_subcasebool; default=True

NULLs i_to_subcase before copying i_from_subcase

Returns
subcaseSubcase()

the new subcase

create_new_subcase(isubcase: int) → pyNastran.bdf.subcase.Subcase[source]

Method create_new_subcase:

Parameters
isubcaseint

the subcase ID

Returns
subcaseSubcase()

the new subcase

Warning

be careful you dont add data to the global subcase after running this…is this True???

cross_reference(model: BDF) → None[source]

Cross links the card so referenced cards can be extracted directly

Parameters
modelBDF()

the BDF object

delete_subcase(isubcase: int) → None[source]

Deletes a subcase.

Parameters
isubcaseint

the Subcase to delete

export_to_hdf5(hdf5_file, model: BDF, encoding: str) → None[source]

exports the case control deck section to an hdf5 file

finish_subcases()[source]

Removes any unwanted data in the subcase…specifically the SUBCASE data member. Otherwise it will print out after a key like stress.

get_local_subcase_list() → List[int][source]

Gets the list of subcases that aren’t the global subcase ID

get_op2_data() → Dict[int, Any][source]

Gets the relevant op2 parameters required for a given subcase

Todo

not done…

get_subcase_list() → List[int][source]

Gets the list of subcases including the global subcase ID (0)

get_subcase_parameter(isubcase: int, param_name: str, obj: bool = False) → Any[source]

Get the [value, options] of a subcase’s parameter. For example, for STRESS(PLOT,POST)=ALL:

param_name=STRESS value=ALL options=[‘PLOT’, ‘POST’]

Parameters
isubcaseint

the subcase ID to check

param_namestr

the parameter name to look for

objbool; default=False

should the object be returned

has_parameter(isubcase: int, *param_names: List[str]) → bool[source]

Checks to see if a parameter (e.g. STRESS) is defined in a certain subcase ID.

Parameters
isubcaseint

the subcase ID to check

param_namesList[str]

the parameter name to look for

Returns
has_parameterbool

does any subcase have a parameter

has_subcase(isubcase: int) → bool[source]

Checks to see if a subcase exists.

Parameters
isubcaseint

the subcase ID

Returns
valbool

does_subcase_exist (type = bool)

load_hdf5_file(hdf5_file, encoding: str) → None[source]

loads the case control deck section from a hdf5 file

reject_lines = None

stores a single copy of ‘BEGIN BULK’ or ‘BEGIN SUPER’

suppress_output() → 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

most case control types are not supported

type = 'CaseControlDeck'
update_solution(isubcase: int, sol: str) → None[source]

sol = STATICS, FLUTTER, MODAL, etc.

Parameters
isubcaseint

the subcase ID to update

solstr

the solution type to change the solution to

>>> bdf.case_control
SUBCASE 1

DISP = ALL

>>> bdf.case_control.update_solution(1, ‘FLUTTER’)
>>> bdf.case_control
SUBCASE 1

ANALYSIS FLUTTER DISP = ALL

>>>
write(write_begin_bulk: Optional[bool] = None) → str[source]

Writes the case control deck. Has an option to not write the begin bulk line

Parameters
write_begin_bulkbool; default=None

None: use the value in the original deck

Returns
msgstr

the deck as a string

pyNastran.bdf.case_control_deck.integer(str_value: str, line: str) → int[source]

casts the value as an integer

pyNastran.bdf.case_control_deck.split_equal_space(line: str, word: str, example: str) → str[source]

Splits a case insensative line by an

reads:
  • ‘SUBCASE = 5’

  • ‘SUBCASE 5’

pyNastran.bdf.case_control_deck.verify_card(key: int, value: Any, options: Any, line: str) → None[source]

Make sure there are no obvious errors

pyNastran.bdf.case_control_deck.verify_card2(key, value, options, line)[source]

Make sure there are no obvious errors