def load_model(self, model_path=None): global nodes, Elements, domains, opt_domains, en_all, plane_strain, plane_stress, axisymmetry, file_name, domain_shells, domain_volumes, elm_states model_path = model_path if (model_path is not None) else file_name [ nodes, Elements, domains, opt_domains, en_all, plane_strain, plane_stress, axisymmetry ] = beso_lib.import_inp(model_path, domains_from_config, domain_optimized, shells_as_composite) domain_shells = {} domain_volumes = {} for dn in domains_from_config: # distinguishing shell elements and volume elements domain_shells[dn] = set(domains[dn]).intersection( list(Elements.tria3.keys()) + list(Elements.tria6.keys()) + list(Elements.quad4.keys()) + list(Elements.quad8.keys())) domain_volumes[dn] = set(domains[dn]).intersection( list(Elements.tetra4.keys()) + list(Elements.tetra10.keys()) + list(Elements.hexa8.keys()) + list(Elements.hexa20.keys()) + list(Elements.penta6.keys()) + list(Elements.penta15.keys())) # initial element state elm_states = {} if continue_from[-4:] == ".frd": elm_states = beso_lib.import_frd_state(continue_from, elm_states, number_of_states, file_name) elif continue_from[-4:] == ".inp": elm_states = beso_lib.import_inp_state(continue_from, elm_states, number_of_states, file_name) else: for dn in domains_from_config: for en in domains[dn]: elm_states[en] = len( domain_density[dn]) - 1 # set to highest state
elm_states = {} if isinstance(continue_from, int): for dn in domains_from_config: if (len(domain_density[dn]) - 1) < continue_from: sn = len(domain_density[dn]) - 1 msg = "\nINFO: elements from the domain " + dn + " were set to the highest state.\n" beso_lib.write_to_log(file_name, msg) print(msg) else: sn = continue_from for en in domains[dn]: elm_states[en] = sn elif continue_from[-4:] == ".frd": elm_states = beso_lib.import_frd_state(continue_from, elm_states, number_of_states, file_name) elif continue_from[-4:] == ".inp": elm_states = beso_lib.import_inp_state(continue_from, elm_states, number_of_states, file_name) elif continue_from[-4:] == ".csv": elm_states = beso_lib.import_csv_state(continue_from, elm_states, file_name) else: for dn in domains_from_config: for en in domains[dn]: elm_states[en] = len(domain_density[dn]) - 1 # set to highest state # computing volume or area, and centre of gravity of each element [cg, cg_min, cg_max, volume_elm, area_elm] = beso_lib.elm_volume_cg(file_name, nodes, Elements) mass = [0.0] mass_full = 0 # sum from initial states TODO make it independent on starting elm_states? for dn in domains_from_config: if domain_optimized[dn] is True: for en in domain_shells[dn]: