case_control_deck Module

digraph inheritancef116c66ce6 { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.bdf.case_control_deck.CaseControlDeck" [URL="#pyNastran.bdf.case_control_deck.CaseControlDeck",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="CaseControlDeck parsing and extraction class"]; }

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: Any | None = 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) 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) 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

object_methods(mode: str = 'public', keys_to_skip=None, filter_properties: bool = False) list[str][source]
object_stats(mode: str = 'public', keys_to_skip=None, filter_properties: bool = False) str[source]
reject_lines: list[str]

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: bool | None = 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.parse_entry(lines: list[str], log: SimpleLogger, debug: bool = False) tuple[int, bool, str, Any, list[str], str][source]

Internal method for parsing a card of the case control deck

Parses a single case control deck card into 4 sections

  1. param_name - obvious

  2. Value - still kind of obvious

  3. options - rarely used data

  4. param_type - STRESS-type, SUBCASE-type, PARAM-type, SET-type, BEGIN_BULK-type

It’s easier with examples:

param_type = SUBCASE-type

SUBCASE 1 -> paramName=SUBCASE value=1 options=[]

param_type = STRESS-type

STRESS = ALL -> paramName=STRESS value=ALL options=[] STRAIN(PLOT) = 5 -> paramName=STRAIN value=5 options=[PLOT] TITLE = stuff -> paramName=TITLE value=stuff options=[]

param_type = SET-type

SET 1 = 10,20,30 -> paramName=SET value=[10,20,30] options = 1

param_type = BEGIN_BULK-type

BEGIN BULK -> paramName=BEGIN value=BULK options = []

param_type = CSV-type

PARAM,FIXEDB,-1 -> paramName=PARAM value=FIXEDB options = [-1]

The param_type is the “macro” form of the data (similar to integer, float, string). The value is generally whats on the RHS of the equals sign (assuming it’s there). Options are modifiers on the data. Form things like the PARAM card or the SET card they arent as clear, but the param_type lets the program know how to format it when writing it out.

Parameters:
lineslist[str, str, …]

list of lines

Returns:
param_namestr

see brief

valuelist[…]

see brief

optionslist[str/int/float]

see brief

param_typestr/int/float/list

see brief

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

Splits a case insensitive 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