heat_transfer_materials.py
def save_custom_user_material(self, material_dict: dict) -> None:
        """
        Including custom user material into its dedicated file
        """

        file_name = self.custom_materials_filename

        # When the custom user file already exists, append it
        # Otherwise create it from scratch
        # Being consistent with the default file, so including the
        #   T_MELT column, and filling it with zero
        if os.path.isfile(file_name):
            with open(file_name, "a") as custom_materials_file:
                csv_writer = csv.writer(custom_materials_file)

                element_row = []
                element_row.append(material_dict["name"])
                element_row.append(0)
                element_row.append(material_dict["properties"]["rho"])
                element_row.append(material_dict["properties"]["cp"])
                element_row.append(material_dict["properties"]["lmbd"])
                csv_writer.writerow(element_row)
        else:
            with open(file_name, "w") as custom_materials_file:
                csv_writer = csv.writer(custom_materials_file)

                headers = ["NAME", "T_MELT [C]", "RHO [kg/m3]",
                           "C_P [J/(kg*K)]", "LAMBDA [W/(m*K)]"]
                csv_writer.writerow(headers)

                element_row = []
                element_row.append(material_dict["name"])
                element_row.append(0)
                element_row.append(material_dict["properties"]["rho"])
                element_row.append(material_dict["properties"]["cp"])
                element_row.append(material_dict["properties"]["lmbd"])
                csv_writer.writerow(element_row)

        Including custom user material into its dedicated file
        
Including custom user material into its dedicated file
Including custom user material into its dedicated file
def save_custom_user_material(self, material_dict: dict) -> None:
        file_name = self.custom_materials_filename
        if os.path.isfile(file_name):
            with open(file_name, "a") as custom_materials_file:
                csv_writer = csv.writer(custom_materials_file)
                element_row = []
                element_row.append(material_dict["name"])
                element_row.append(0)
                element_row.append(material_dict["properties"]["rho"])
                element_row.append(material_dict["properties"]["cp"])
                element_row.append(material_dict["properties"]["lmbd"])
                csv_writer.writerow(element_row)
        else:
            with open(file_name, "w") as custom_materials_file:
                csv_writer = csv.writer(custom_materials_file)
                headers = ["NAME", "T_MELT [C]", "RHO [kg/m3]",
                           "C_P [J/(kg*K)]", "LAMBDA [W/(m*K)]"]
                csv_writer.writerow(headers)
                element_row = []
                element_row.append(material_dict["name"])
                element_row.append(0)
                element_row.append(material_dict["properties"]["rho"])
                element_row.append(material_dict["properties"]["cp"])
                element_row.append(material_dict["properties"]["lmbd"])
                csv_writer.writerow(element_row)
def save_custom_user_material ( self , material_dict : dict ) -> None : file_name = self . custom_materials_filename if os . path . isfile ( file_name ) : with open ( file_name , "a" ) as custom_materials_file : csv_writer = csv . writer ( custom_materials_file ) element_row = [ ] element_row . append ( material_dict [ "name" ] ) element_row . append ( 0 ) element_row . append ( material_dict [ "properties" ] [ "rho" ] ) element_row . append ( material_dict [ "properties" ] [ "cp" ] ) element_row . append ( material_dict [ "properties" ] [ "lmbd" ] ) csv_writer . writerow ( element_row ) else : with open ( file_name , "w" ) as custom_materials_file : csv_writer = csv . writer ( custom_materials_file ) headers = [ "NAME" , "T_MELT [C]" , "RHO [kg/m3]" , "C_P [J/(kg*K)]" , "LAMBDA [W/(m*K)]" ] csv_writer . writerow ( headers ) element_row = [ ] element_row . append ( material_dict [ "name" ] ) element_row . append ( 0 ) element_row . append ( material_dict [ "properties" ] [ "rho" ] ) element_row . append ( material_dict [ "properties" ] [ "cp" ] ) element_row . append ( material_dict [ "properties" ] [ "lmbd" ] ) csv_writer . writerow ( element_row )
Including custom user material into its dedicated file
Including custom user material into its dedicated file
"""
        Including custom user material into its dedicated file
        """ # When the custom user file already exists, append it # Otherwise create it from scratch # Being consistent with the default file, so including the #   T_MELT column, and filling it with zero
self
material_dict
dict