Exemplo n.º 1
0
 private static void Step6_1_WriteBC(string Part_Name, ref StreamWriter sw, ref FEM_Props FEM)
 {
     sw.WriteLine("** BOUNDARY CONDITIONS");
     sw.WriteLine("**");
     sw.WriteLine("** Name: BC_PotentH Type: Electric potential");
     sw.WriteLine("*Boundary");
     sw.WriteLine(Part_Name + "-1.Node_PotentH" + ", 9, 9," + Convert.ToString(FEM.PotentH));
     sw.WriteLine("** Name: BC_PotentL Type: Electric potential");
     sw.WriteLine("*Boundary");
     sw.WriteLine(Part_Name + "-1.Node_PotentL" + ", 9, 9," + Convert.ToString(FEM.PotentL));
     sw.WriteLine("**");
 }
Exemplo n.º 2
0
 private static void Step6_WriteStep(string Part_Name, ref StreamWriter sw, ref FEM_Props FEM)
 {
     sw.WriteLine("** ----------------------------------------------------------------");
     sw.WriteLine("**");
     sw.WriteLine("** STEP: Step-1");
     sw.WriteLine("**");
     sw.WriteLine("*Step, name=Step-1, nlgeom=NO");
     sw.WriteLine("*Coupled Thermal-electrical, steady state, deltmx=0.");
     sw.WriteLine("1., 1., 1e-05, 1.,");
     sw.WriteLine("**");
     Step6_1_WriteBC(Part_Name, ref sw, ref FEM);
     Step6_2_WriteInteractions(ref sw, ref FEM);
     Step6_3_WriteOutReq(ref sw);
     sw.WriteLine("*End Step");
 }
Exemplo n.º 3
0
        private static void Step6_2_WriteInteractions(ref StreamWriter sw, ref FEM_Props FEM)
        {
            sw.WriteLine("** INTERACTIONS");
            sw.WriteLine("** Interaction: Int-Film1");
            sw.WriteLine("*Sfilm");
            sw.WriteLine("S1, F, " + Convert.ToString(FEM.Temper_Envi) + "," + Convert.ToString(FEM.Coef_Film));
            sw.WriteLine("** Interaction: Int-Film2");
            sw.WriteLine("*Sfilm");
            sw.WriteLine("S2, F, " + Convert.ToString(FEM.Temper_Envi) + "," + Convert.ToString(FEM.Coef_Film));

            sw.WriteLine("** Interaction: Int-Radiation1");
            sw.WriteLine("*Sradiate");
            sw.WriteLine("S1, R, " + Convert.ToString(FEM.Temper_Envi) + "," + Convert.ToString(FEM.Coef_Emiss));
            sw.WriteLine("** Interaction: Int-Radiation2");
            sw.WriteLine("*Sradiate");
            sw.WriteLine("S2, R, " + Convert.ToString(FEM.Temper_Envi) + "," + Convert.ToString(FEM.Coef_Emiss));
            sw.WriteLine("**");
        }
Exemplo n.º 4
0
        public static void Write_Serial(string Path, string Work_Name, ref FEM_Props FEM)
        {
            StreamWriter sw = new StreamWriter(Path + Work_Name + ".inp");

            Step1_WriteHead(Work_Name, ref sw);
            int[] ENs = Step2_WritePart(Path, Work_Name, ref sw, ref FEM);
            Step3_WriteAss(Work_Name, ref sw, ref ENs);
            Step4_WriteMat(ref sw, ref FEM);
            Step5_WriteIniPara(Work_Name, ref sw, ref FEM);
            Step6_WriteStep(Work_Name, ref sw, ref FEM);
            sw.Close();

            File.Delete(Path + Work_Name + ".e2");
            File.Delete(Path + Work_Name + ".e3");
            File.Delete(Path + Work_Name + ".e4");
            File.Delete(Path + Work_Name + ".em3");
            File.Delete(Path + Work_Name + ".em4");
        }
Exemplo n.º 5
0
 /// 输出Sections
 private static void Step2_6_WriteSections(ref StreamWriter sw, ref FEM_Props FEM)
 {
     /////输出Section
     sw.WriteLine("** Section: Glass1");
     sw.WriteLine("*Solid Section, elset=Glass1, material=" + FEM.Glass.Name);
     sw.WriteLine(",");
     sw.WriteLine("** Section: PVB");
     sw.WriteLine("*Solid Section, elset=PVB, material=" + FEM.PVB.Name);
     sw.WriteLine(",");
     sw.WriteLine("** Section: Glass2");
     sw.WriteLine("*Solid Section, elset=Glass2, material=" + FEM.Glass.Name);
     sw.WriteLine(",");
     sw.WriteLine("** Section: Wires");
     sw.WriteLine("*Solid Section, elset=Wires, material=" + FEM.Wire.Name);
     sw.WriteLine(Convert.ToString(3.1415926 * (FEM.Diameter_Wire / 2) * (FEM.Diameter_Wire / 2)) + ",");
     sw.WriteLine("** Section: Pole");
     sw.WriteLine("*Solid Section, elset=Pole, material=" + FEM.Pole.Name);
     sw.WriteLine(Convert.ToString(FEM.Thinck_Pole) + ",");
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            string Path;
            string Work_Name;

            if (args.Length == 0)
            {
                Console.WriteLine("请输入路径:");
                Path = Console.ReadLine() + "\\";
                Console.WriteLine("请输入工程名:");
                Work_Name = Console.ReadLine();
            }
            else
            {
                string[] t_1 = args[0].Split(',');
                Path      = t_1[0];
                Work_Name = t_1[1];
            }

            FEM_Props FEM = new FEM_Props(0);

            Comput_FEM(Path, Work_Name, ref FEM);
        }
Exemplo n.º 7
0
        static void Comput_FEM(string Path, string Work_Name, ref FEM_Props FEM)
        {
            System.Diagnostics.Process Proc = new System.Diagnostics.Process();
            //////将几个网格文件组合在一起
            Mesh_Merge_Mod2.MeshFile_Combine(Path, "Free", "Pole", "S1", 0.005);
            Console.WriteLine("已经进行完第一阶段网格合并,正进行第二阶段网格合并");
            Mesh_Merge_Mod2.MeshFile_Combine(Path, "S1", "Wires_Shell", Work_Name, 0.005);
            File.Delete(Path + "S1.mesh");

            //////书写INP文件
            Console.WriteLine("已经完成网格合并,正调用Abaqus计算");
            Abaqus_Inp.Write_Serial(Path, Work_Name, ref FEM);

            //////调用Abaqus Standard计算
            Write_AbaqusBat(Path, Work_Name);
            Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            Proc.StartInfo.FileName    = Path + Work_Name + ".bat";
            Proc.Start();
            ///等待计算完成
            while (true)
            {
                if (File.Exists(Path + Work_Name + ".lck") == true)
                {
                    break;
                }
            }
            while (true)
            {
                if (File.Exists(Path + Work_Name + ".lck") == false)
                {
                    break;
                }
            }

            ///调用Abaqus Python提取结果
            Console.WriteLine("计算已经完成,正读取ODB文件");
            Write_Py(Path, Work_Name);
            Write_AbaqusODBBat(Path, Work_Name);

            Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            Proc.StartInfo.FileName    = Path + Work_Name + "_ODB.bat";
            Proc.Start();
            ///等待结果提取完成
            while (true)
            {
                try
                {
                    using (File.Open(Path + Work_Name + "_ODB.wxd", FileMode.Open, FileAccess.Read, FileShare.None))
                        break;
                }
                catch (System.Exception Ex) { }
            }
            ///绘制PNG图片
            Console.WriteLine("读取ODB文件完成,准备输出");
            double[] Res_Data = Draw_PNGs.Draw(Path, Work_Name, ref FEM);
            ///结果输出
            StreamWriter sw = new StreamWriter(Path + Work_Name + ".res");

            for (int i = 0; i < 4; i++)
            {
                sw.WriteLine(Res_Data[i]);
            }
            sw.Close();

            /////文件删除,精简
            Delete_Files(Path, Work_Name);

            ///图片显示
            //double[] Res_Data = new double[6];
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form_Res(Path, Work_Name, ref Res_Data));
        }
Exemplo n.º 8
0
        private static void Step5_WriteIniPara(string Part_Name, ref StreamWriter sw, ref FEM_Props FEM)
        {
            sw.WriteLine("** PHYSICAL CONSTANTS");
            sw.WriteLine("**");
            sw.WriteLine("*Physical Constants, absolute zero=" + Convert.ToString(FEM.Const_AbsZero)
                         + ", stefan boltzmann=" + Convert.ToString(FEM.Consr_Boltzmann));
            sw.WriteLine("**");

            sw.WriteLine("** PREDEFINED FIELDS");
            sw.WriteLine("** Name: Field_Temp   Type: Temperature");
            sw.WriteLine("*Initial Conditions, type=TEMPERATURE");
            sw.WriteLine(Part_Name + "-1.Node_Whole" + "," + Convert.ToString(FEM.Temper_Envi));
            sw.WriteLine("**");
        }
Exemplo n.º 9
0
 private static void Step4_WriteMat(ref StreamWriter sw, ref FEM_Props FEM)
 {
     FEM.FEM_WriteMat(ref sw);
 }
Exemplo n.º 10
0
        /// 写Part部分
        /// <summary>
        /// 输出结果为单元及节点数量:
        /// 0_第1层玻璃最后编号
        /// 1_PVB层最后编号
        /// 2_第2层最后编号
        /// 3_夹丝线最后编号
        /// 4_电极最后编号
        /// 5_单层节点数量
        /// </summary>
        private static int[] Step2_WritePart(string Path, string Mesh_Name, ref StreamWriter sw, ref FEM_Props FEM)
        {
            string t;

            /////输出Head
            sw.WriteLine("**");
            sw.WriteLine("** PARTS");
            sw.WriteLine("**");
            sw.WriteLine("*Part, name=" + Mesh_Name);
            /////输出节点
            int No = Step2_1_WriteNodes(Path, Mesh_Name, ref sw, ref FEM);

            /////输出单元
            int[] ENs = new int[6];                                                                    /////各层单元的数量
            int[] Qs  = Step2_2_ShellElementsFilter(Path, Mesh_Name);                                  /////存储有原型Shell的:0_总单元个数,1_3节点单元数,2_4节点单元数,3_2节点单元数,4_-3单元数,5_-4单元数
            ENs[0] = Step2_3_WriteSolidElements(No, Qs, 0, 0, Path, Mesh_Name, ref sw);                /////生成第0层Solid单元
            ENs[1] = Step2_3_WriteSolidElements(No, Qs, ENs[0], 1, Path, Mesh_Name, ref sw);           /////生成第1层Solid单元
            ENs[2] = Step2_3_WriteSolidElements(No, Qs, ENs[1], 2, Path, Mesh_Name, ref sw);           /////生成第1层Solid单元
            ENs[3] = Step2_4_WriteWireElements(No, Qs, ENs[2], FEM.Layer_PW, Path, Mesh_Name, ref sw); /////生成夹丝线单元
            ENs[4] = Step2_5_WritePoleElements(No, Qs, ENs[3], FEM.Layer_PW, Path, Mesh_Name, ref sw); /////生成电极单元
            ENs[5] = No;                                                                               /////将单层节点数量放在输出数组的最后
            /////输出节点Set
            sw.WriteLine("*Nset, nset=Node_Layer0, generate");
            sw.WriteLine("1," + Convert.ToString(No) + ",1");
            sw.WriteLine("*Nset, nset=Node_Layer1, generate");
            sw.WriteLine(Convert.ToString(No + 1) + "," + Convert.ToString(2 * No) + ",1");
            sw.WriteLine("*Nset, nset=Node_Layer2, generate");
            sw.WriteLine(Convert.ToString(2 * No + 1) + "," + Convert.ToString(3 * No) + ",1");
            sw.WriteLine("*Nset, nset=Node_Layer3, generate");
            sw.WriteLine(Convert.ToString(3 * No + 1) + "," + Convert.ToString(4 * No) + ",1");
            ///所有节点
            sw.WriteLine("*Nset, nset=Node_Whole, generate");
            sw.WriteLine("1," + Convert.ToString(4 * No) + ",1");
            ///高电势节点
            sw.WriteLine("*Nset, nset=Node_PotentH");
            t = Convert.ToString(FEM.Nodes_PotentH[0] + FEM.Layer_PW * No);
            for (int i = 1; i < FEM.Nodes_PotentH.Count; i++)
            {
                t += "," + Convert.ToString(FEM.Nodes_PotentH[i] + FEM.Layer_PW * No);
            }
            sw.WriteLine(t);
            ///低电势节点
            sw.WriteLine("*Nset, nset=Node_PotentL");
            t = Convert.ToString(FEM.Nodes_PotentL[0] + FEM.Layer_PW * No);
            for (int i = 1; i < FEM.Nodes_PotentL.Count; i++)
            {
                t += "," + Convert.ToString(FEM.Nodes_PotentL[i] + FEM.Layer_PW * No);
            }
            sw.WriteLine(t);
            /////输出单元Set
            sw.WriteLine("*Elset, elset=Glass1, generate");
            sw.WriteLine("1," + Convert.ToString(ENs[0]) + ",1");
            sw.WriteLine("*Elset, elset=PVB, generate");
            sw.WriteLine(Convert.ToString(ENs[0] + 1) + "," + Convert.ToString(ENs[1]) + ",1");
            sw.WriteLine("*Elset, elset=Glass2, generate");
            sw.WriteLine(Convert.ToString(ENs[1] + 1) + "," + Convert.ToString(ENs[2]) + ",1");
            sw.WriteLine("*Elset, elset=Wires, generate");
            sw.WriteLine(Convert.ToString(ENs[2] + 1) + "," + Convert.ToString(ENs[3]) + ",1");
            sw.WriteLine("*Elset, elset=Pole, generate");
            sw.WriteLine(Convert.ToString(ENs[3] + 1) + "," + Convert.ToString(ENs[4]) + ",1");
            /////输出Section
            Step2_6_WriteSections(ref sw, ref FEM);
            /////输出Tail
            sw.WriteLine("*End Part");
            sw.WriteLine("**");
            return(ENs);
        }
Exemplo n.º 11
0
        ///输出节点
        /// <summary>
        /// 输出节点,同时输出4层节点
        /// </summary>
        /// <param name="Path">路径</param>
        /// <param name="Mesh_Name">文件名</param>
        /// <param name="sw">写文件</param>
        /// <param name="Tm">PVB层厚度</param>
        /// <param name="T1">上层玻璃厚度</param>
        /// <param name="T2">下层玻璃厚度</param>
        /// <returns></returns>
        private static int Step2_1_WriteNodes(string Path, string Mesh_Name, ref StreamWriter sw, ref FEM_Props FEM)
        {
            sw.WriteLine("*Node");
            ///第1层节点
            StreamReader sr = new StreamReader(Path + Mesh_Name + ".mesh");

            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            string t = sr.ReadLine();

            string[] t_1;
            int      No = 0;

            while (t != "")
            {
                No++;
                t_1 = t.Split('	');
                t_1 = t_1[1].Split(',');
                if (t_1[2] == "2000")
                {
                    FEM.Nodes_PotentH.Add(No);
                }
                else if (t_1[2] == "-2000")
                {
                    FEM.Nodes_PotentL.Add(No);
                }

                t = Convert.ToString(No) + "," + t_1[0] + "," + t_1[1] + ",0.";
                sw.WriteLine(t);
                t = sr.ReadLine();
            }
            sr.Close();
            ///第2层节点
            sr = new StreamReader(Path + Mesh_Name + ".mesh");
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            string z = "," + Convert.ToString(Math.Round(FEM.Thinck_Glass1, 2));

            for (int i = 1; i <= No; i++)
            {
                t_1 = sr.ReadLine().Split('	');
                t_1 = t_1[1].Split(',');
                t   = Convert.ToString(No + i) + "," + t_1[0] + "," + t_1[1] + z;
                sw.WriteLine(t);
            }
            sr.Close();
            ///第3层节点
            sr = new StreamReader(Path + Mesh_Name + ".mesh");
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            z = "," + Convert.ToString(Math.Round(FEM.Thinck_Glass1 + FEM.Thinck_PVB, 2));
            for (int i = 1; i <= No; i++)
            {
                t_1 = sr.ReadLine().Split('	');
                t_1 = t_1[1].Split(',');
                t   = Convert.ToString(2 * No + i) + "," + t_1[0] + "," + t_1[1] + z;
                sw.WriteLine(t);
            }
            sr.Close();
            ///第4层节点
            sr = new StreamReader(Path + Mesh_Name + ".mesh");
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            z = "," + Convert.ToString(Math.Round(FEM.Thinck_Glass1 + FEM.Thinck_PVB + FEM.Thinck_Glass2, 2));
            for (int i = 1; i <= No; i++)
            {
                t_1 = sr.ReadLine().Split('	');
                t_1 = t_1[1].Split(',');
                t   = Convert.ToString(3 * No + i) + "," + t_1[0] + "," + t_1[1] + z;;
                sw.WriteLine(t);
            }
            sr.Close();
            sr.Dispose();
            return(No);
        }