def __read_element_sets(self, elem_dic): i_file = open(self.__filename, "r") elem_sets = [] read_element_set = False set_type_is_elset = True for line in i_file: line = line[0:-1] # Coments and line does not exist if len(line) == 0: continue elif len(line) >= 2: if line[0:1] == "**": continue # Stop reading if line[0] == "*": read_element_set = False if read_element_set: words = line.split(",") if set_type_is_elset: for word in words: if word.isdigit(): elem_set.add_element(elem_dic[int(word)]) else: elem_set.add_element(elem_dic[int(words[0])]) # Check if node key is found and not *NODE PRINT ... if "*ELSET" in line.upper(): set_type_is_elset = True read_element_set = True words = line.split(",") new_word = words[1].split("=") elset_name = self.__remove_char_on_black_list(new_word[1]) elem_set = FEM.ElementSet(elset_name) elem_sets.append(elem_set) if "*ELEMENT" in line.upper(): if "ELSET" in line.upper(): set_type_is_elset = False read_element_set = True words = line.split(",") for word in words: if "ELSET" in word.upper(): new_word = word.split("=") elset_name = self.__remove_char_on_black_list( new_word[1]) elem_set = FEM.ElementSet(elset_name) elem_sets.append(elem_set) return elem_sets
def get_solid_section(self): self.__get_element_sets_according_to_compaction() solid_sections = [] for mat_numb in range(self.__steps): if not len(self.__sets[mat_numb]) == 0: new_material = copy.deepcopy(self.__material) # Change material propertys according to the given material function (law) # Structural material settings for young_modul in new_material.get_young_module(): young_modul.set_young_module(young_modul.get_young_module() * (1.0 - (float(self.__steps - mat_numb - 1)) / float(self.__steps)) ** self.__exponent) for poisson_ratio in new_material.get_poisson_ratio(): poisson_ratio.set_poisson_ratio(poisson_ratio.get_poisson_ratio()) # Heat exchange material settings for conductivity in new_material.get_conductivity(): conductivity.set_conductivity(conductivity.get_conductivity() * (1.0 - (float(self.__steps - mat_numb - 1)) / float(self.__steps)) ** self.__exponent) new_material.set_name(new_material.get_name() + "_" + str(mat_numb)) solid_sections.append(FEM.SolidSection(new_material, FEM.ElementSet("topo_mat_" + str(mat_numb), self.__sets[mat_numb]))) return solid_sections