/// <summary> /// Checks the passed in node to see if it is inside the layer bounds /// </summary> /// <param name="node">Current node object to inspect</param> /// <param name="Current_Layer">Current layer in which the node object resides</param> private void Check_Node(Node node, Layer Current_Layer) { if (node.x_pos > Current_Layer.Layer_xf) Mesh_Errors.Post_Error("MESH ERROR: Node assignment outside of layer bounds {xf-" + Current_Layer.Layer_xf.ToString() + ", x_node-" + node.x_pos.ToString() + "}"); if (node.y_pos > Current_Layer.Layer_y0) Mesh_Errors.Post_Error("MESH ERROR: Node assignment outside of layer bounds {y0-" + Current_Layer.Layer_y0.ToString() + ", y_node-" + node.y_pos.ToString() + "}"); if (node.y_pos < Current_Layer.Layer_yf) Mesh_Errors.Post_Error("MESH ERROR: Node assignment outside of layer bounds {yf-" + Current_Layer.Layer_yf.ToString() + ", y_node-" + node.y_pos.ToString() + "}"); if (node.x_pos < Current_Layer.Layer_x0) Mesh_Errors.Post_Error("MESH ERROR: Node assignment outside of layer bounds {x0-" + Current_Layer.Layer_x0.ToString() + ", x_node-" + node.x_pos.ToString() + "}"); }
// GenerateGeometry // // Main function which generates the geometry of the TEM, and organizes it into a list of layers /// <summary> /// Generates geometry of the TEM, which is essentially a list of rectangular coordinates /// </summary> /// <returns>List (array) of Layer objects</returns> public List<Layer> GenerateGeometry() { // Update MainUI (ie, the user) with the progress of the geometry generation Geometry_Errors.UpdateProgress(0); Geometry_Errors.UpdateProgress_Text("Generating Geometry and Material Layers"); // Generates Layers for both top and bottom ceramic pieces of TEM geometry Layer TEM_Bottom = new Layer(Geometry_Errors, Coord_Ceramic_Base_Bottom[0], Coord_Ceramic_Base_Bottom[1], Coord_Ceramic_Base_Bottom[2], Coord_Ceramic_Base_Bottom[3], "Ceramic", n_Nodes_Ceramic); Layer TEM_Top = new Layer(Geometry_Errors, Coord_Ceramic_Base_Top[0], Coord_Ceramic_Base_Top[1], Coord_Ceramic_Base_Top[2], Coord_Ceramic_Base_Top[3], "Ceramic", n_Nodes_Ceramic); Layer_List.Add(TEM_Bottom); Layer_List.Add(TEM_Top); // End of ceramic geometry creation // Generates Layers for air gaps to the far left and far right of the computational domain Layer Left_Air_Gap = new Layer(Geometry_Errors, Coord_Left_Air_Gap[0], Coord_Left_Air_Gap[1], Coord_Left_Air_Gap[2], Coord_Left_Air_Gap[3], "Air", n_Nodes_Air); Layer Right_Air_Gap = new Layer(Geometry_Errors, Coord_Right_Air_Gap[0], Coord_Right_Air_Gap[1], Coord_Right_Air_Gap[2], Coord_Right_Air_Gap[3], "Air", n_Nodes_Air); Layer_List.Add(Left_Air_Gap); Layer_List.Add(Right_Air_Gap); // End creation of Air Gaps // Generates Layer for first and last Cu pieces on the bottom (stubbed off ones) Layer First_Bot_Cu = new Layer(Geometry_Errors, Coord_First_Bot_CU[0], Coord_First_Bot_CU[1], Coord_First_Bot_CU[2], Coord_First_Bot_CU[3], "Copper", n_Nodes_CE); Layer Last_Bot_Cu = new Layer(Geometry_Errors, Coord_Last_Bot_CU[0], Coord_Last_Bot_CU[1], Coord_Last_Bot_CU[2], Coord_Last_Bot_CU[3], "Copper", n_Nodes_CE); Layer_List.Add(First_Bot_Cu); Layer_List.Add(Last_Bot_Cu); // End creation of the first and last bottom Cu pieces // Generates Layers for each the rest of the bottom Cu pieces for (int i = 0; i < 8; i++) { float x0 = Coord_Cu_Bottom[0] + ((float)i * (BiTE_AirGap + CE_Width)); float y0 = Coord_Cu_Bottom[1]; float xf = x0 + CE_Width; float yf = Coord_Cu_Bottom[3]; Layer_List.Add(new Layer(Geometry_Errors, x0, y0, xf, yf, "Copper", n_Nodes_CE)); } // End creation of bottom Cu pieces // Generates Layers for each of the top of the Cu pieces for (int i = 0; i < 9; i++) { float x0 = Coord_Cu_Top[0] + ((float)i * (BiTE_AirGap + CE_Width)); float y0 = Coord_Cu_Top[1]; float xf = x0 + CE_Width; float yf = Coord_Cu_Top[3]; Layer_List.Add(new Layer(Geometry_Errors, x0, y0, xf, yf, "Copper", n_Nodes_CE)); } // End creation of the top Cu pieces // Generates layers for each of the Bismuth Telluride Pieces for (int i = 0; i < 18; i++) { float x0 = Coord_BiTE[0] + ((float)i * (BiTE_Thickness + BiTE_AirGap)); float y0 = Coord_BiTE[1]; float xf = x0 + BiTE_Thickness; float yf = Coord_BiTE[3]; Layer_List.Add(new Layer(Geometry_Errors, x0, y0, xf, yf, "BiTe", n_Nodes_BiTe)); } // End creation of the Bismuth Telluride Pieces // Generates layers for air gaps that 'float' near top for (int i = 0; i < 8; i++) { float x0 = Coord_Top_AirGaps[0] + ((float)i * (2 * (BiTE_Thickness + BiTE_AirGap))); float y0 = Coord_Top_AirGaps[1]; float xf = x0 + BiTE_AirGap; float yf = Coord_Top_AirGaps[3]; Layer_List.Add(new Layer(Geometry_Errors, x0, y0, xf, yf, "Air", n_Nodes_Air)); } // End creation of layers for top air gaps // Generates layers for air gaps that 'float' near bottom for (int i = 0; i < 9; i++) { float x0 = Coord_Bottom_AirGaps[0] + ((float)i * (2 * (BiTE_Thickness + BiTE_AirGap))); float y0 = Coord_Bottom_AirGaps[1]; float xf = x0 + BiTE_AirGap; float yf = Coord_Bottom_AirGaps[3]; Layer_List.Add(new Layer(Geometry_Errors, x0, y0, xf, yf, "Air", n_Nodes_Air)); } // End creation of layers for the bottom air gaps Geometry_Errors.Post_Error("NOTE: Geometry for the TEM has been generated succesfully"); return Layer_List; }