def write_case_control_cards(self): # Case Control cc = CaseControlDeck([]) for key, subcase in self.subcases.items(): cc.create_new_subcase(key) self.write_case_control_from_list(cc, key, subcase) self.model.case_control_deck = cc
def write_case_control_cards(self): # Case Control cc = CaseControlDeck([]) for key, subcase in self.subcases.items(): fmethod, method = self.write_cards_from_subcase(key) cc.create_new_subcase(key) self.write_case_control_from_list(cc, key, subcase) cc.add_parameter_to_local_subcase(1, 'FMETHOD = %d' % fmethod) # the flutter card id cc.add_parameter_to_local_subcase(1, 'METHOD = %d' % method) # the eigenval analysis card id self.model.case_control_deck = cc
def test_loads(self): """tests the ``get_load_arrays`` and ``_reduce_dload_case`` methods""" model = BDF(debug=True, log=None, mode='msc') subcase_id = 10 eid_map = None node_ids = [] normals = None lines = [] cc = CaseControlDeck(lines, log=None) #print(model.case_control_deck) model.case_control_deck = cc subcase = cc.create_new_subcase(subcase_id) out = get_load_arrays(model, subcase_id, eid_map, node_ids, normals, nid_map=None) is_loads, is_temperatures, temperature_data, load_data = out assert is_loads is False, is_loads assert is_temperatures is False, is_temperatures assert temperature_data == (None, None), temperature_data assert load_data == (None, None, None), load_data key = 'LOAD' value = 10 options = [] param_type = '???' with self.assertRaises(TypeError): subcase.add(key, value, options, param_type) param_type = 'STRESS-type' subcase.add(key, value, options, param_type) with self.assertRaises(KeyError): get_load_arrays(model, subcase_id, eid_map, node_ids, normals, nid_map=None, stop_on_failure=True) #is_loads, is_temperatures, temperature_data, load_data = out #assert is_loads is False, is_loads #assert is_temperatures is False, is_temperatures #assert temperature_data == (None, None), temperature_data #assert load_data == (None, None, None), load_data dload_case = [] dloads, scale_factors = model._reduce_dload_case( dload_case, scale=1., unallowed_dload_ids=None, skip_scale_factor0=False, msg='') assert dloads == [], dloads assert scale_factors == [], scale_factors del dloads, scale_factors # ---------------------------------------------------------------------- dload_id = 5 scale = 1. scale_factors = [2] load_ids = [3] dload = model.add_dload(dload_id, scale, scale_factors, load_ids) dload_case = [dload] with self.assertRaises(KeyError): model._reduce_dload_case(dload_case, scale=1., unallowed_dload_ids=None, skip_scale_factor0=False, msg='') excite_id = 100 tid = 2 model.add_tload1(dload_id, excite_id, tid, delay=0, Type='LOAD', us0=0.0, vs0=0.0, comment='') with self.assertRaises(KeyError): model._reduce_dload_case(dload_case, scale=1., unallowed_dload_ids=None, skip_scale_factor0=False, msg='')