예제 #1
0
        //you don't need to assign modelSetting.num_longit as it will calculated by axis
        public static void BuildCurveModel(ModelSetting modelSetting, Model model, string path)
        {
            //get the coordinary of each ring
            double length = Math.Abs(modelSetting.axis.AxisPoints.First().Mileage -
                modelSetting.axis.AxisPoints.Last().Mileage);
            modelSetting.num_ring = (int)(length / modelSetting.width);
            List<RingInfo> ringInfos = GetRingInfo(modelSetting);

            //get single ring result
            SingleRingResult ringResult = new SingleRingResult();
            GenerateNodes.GenerateSingleRingNode(modelSetting, ringResult);
            GenerateElements.GenerateSingleRingElement(modelSetting, ringResult);

            //initial 3D result
            List<ShieldTunnel3DResult> results = new List<ShieldTunnel3DResult>();

            for (int i = 0; i < ringInfos.Count - 1; i++)
            //for (int i = 0; i < 10; i++)
            {
                ShieldTunnel3DResult result = new ShieldTunnel3DResult();
                ChangeLocal(ringInfos[i], result);
                GetNodes(i, modelSetting, ringResult, result);
                GetShellElements(i, modelSetting, ringResult, result);
                RotateNode(i, modelSetting, result);
                results.Add(result);
            }

            Output(model, results, path);
        }
예제 #2
0
 public static void Build(ModelSetting modelSetting, Model model, string path)
 {
     if (modelSetting.isCurve == false)
         BuildStraightModel(modelSetting, model);
     else
         BuildCurveModel(modelSetting, model, path);
 }
예제 #3
0
 public static void Output(Model model, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     foreach (Node node in model.nodes.Values)
     {
         sw.Write(node.AnsysOutput());
     }
     sw.Close();
 }
예제 #4
0
 public static void ConstrainedOutput(Model model, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     foreach (Constrained constrained in model.constradineds)
     {
         sw.Write(constrained.AnsysOutput());
     }
     sw.Close();
 }
예제 #5
0
 public static void BoundaryOutput(Model model, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     foreach (Boundary boundary in model.boundaries)
     {
         sw.Write(boundary.AnsysOutput());
     }
     sw.Close();
 }
예제 #6
0
 public static void Output(Model model, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     sw.WriteLine("!!");
     foreach (Part part in model.parts.Values)
     {
         if (model.elementTypes.ContainsKey(part.eid))
             sw.Write(model.elementTypes[part.eid].AnsysOutput());
         if (model.mats.ContainsKey(part.mid))
             sw.Write(model.mats[part.mid].AnsysOutput());
         if (model.sections.ContainsKey(part.secid))
             sw.Write(model.sections[part.secid].AnsysOutput());
         sw.WriteLine("!!");
     }
     sw.Close();
 }
예제 #7
0
 public static void Output(Model model, List<Element> elements, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     int partID = elements[0].pid;
     if (!model.parts.ContainsKey(partID))
         return;
     Part part = model.parts[partID];
     if (model.elementTypes.ContainsKey(part.eid))
         sw.WriteLine("type," + part.eid);
     if (model.mats.ContainsKey(part.mid))
         sw.WriteLine("mat," + part.mid);
     if (model.sections.ContainsKey(part.secid))
         sw.WriteLine("real," + part.secid);
     foreach (Element element in elements)
     {
         sw.Write(element.AnsysOutput());
     }
     sw.Close();
 }
예제 #8
0
 public static void Output(Model model, string path)
 {
     FileStream stream = new FileStream(path, FileMode.Append);
     StreamWriter sw = new StreamWriter(stream);
     sw.WriteLine("/prep7");
     foreach (int partID in model.partIDtoElements.Keys)
     {
         Part part = model.parts[partID];
         if (model.elementTypes.ContainsKey(part.eid))
             sw.WriteLine("type," + part.eid);
         if (model.mats.ContainsKey(part.mid))
             sw.WriteLine("mat," + part.mid);
         if (model.sections.ContainsKey(part.secid))
             sw.WriteLine("real," + part.secid);
         foreach (Element element in model.partIDtoElements[partID].Values)
         {
             sw.Write(element.AnsysOutput());
         }
     }
     sw.Close();
 }
예제 #9
0
        public static void GenerateAllParts(MatSetting matSetting, Model model)
        {
            //lining element, shell143
            Part partShell = new Part(1, 1, 1, 1);
            ElementType typeShell = new ElementType(1, EType.shell143);
            Mat matShell = new Mat(1, matSetting.shell_coe, matSetting.shell_pr, matSetting.shell_dens);
            Shell143 sectionShell = new Shell143(1);
            sectionShell.thickness = matSetting.shell_thickness;
            model.AddPart(partShell);
            model.AddElementType(typeShell);
            model.AddMat(matShell);
            model.AddSection(sectionShell);

            //radial ground spring, link180
            Part partRadialGround = new Part(2, 2, 2, 2);
            ElementType typeRadialGround = new ElementType(2, EType.link180);
            Mat matRadialGround = new Mat(2, matSetting.radial_spring_coe, matSetting.radial_spring_pr, 0);
            Link180 linkRadialGround = new Link180(2);
            linkRadialGround.area = matSetting.radial_spring_area;
            linkRadialGround.keyOption1 = 3;
            linkRadialGround.keyOption2 = 2;
            model.AddPart(partRadialGround);
            model.AddElementType(typeRadialGround);
            model.AddMat(matRadialGround);
            model.AddSection(linkRadialGround);

            //tangential ground spring, link180
            Part partTangentialGround = new Part(3, 3, 3, 3);
            ElementType typeTangentialGround = new ElementType(3, EType.link180);
            Mat matTangentialGround = new Mat(3, matSetting.tangential_spring_coe, matSetting.tangential_spring_pr, 0);
            Link180 linkTangentialGround = new Link180(3);
            linkTangentialGround.area = matSetting.tangential_spring_area;
            model.AddPart(partTangentialGround);
            model.AddElementType(typeTangentialGround);
            model.AddMat(matTangentialGround);
            model.AddSection(linkTangentialGround);

            //circumferential joint
            Part partCircumferentialJoint = new Part(4, 4, 0, 4);
            ElementType typeCircumferentialJoint = new ElementType(4, EType.combin39);
            //Mat matCircumferentialJoint = new Mat(4, 0, 0, 0);
            Combin39 combinCircumferentialJoint = new Combin39(4);
            combinCircumferentialJoint.keyOption1 = 3;
            combinCircumferentialJoint.keyOption2 = 1;
            combinCircumferentialJoint.stiffness = GeneratePairs(
                -0.001 * matSetting.circumferential_joint_compression, -0.001,
                0, 0,
                0.001 * matSetting.circumferential_joint_tensile, 0.001);
            model.AddPart(partCircumferentialJoint);
            model.AddElementType(typeCircumferentialJoint);
            //model.AddMat(matCircumferentialJoint);
            model.AddSection(combinCircumferentialJoint);

            //longitudinal joint rotation X
            Part partLongitJointZ = new Part(5, 5, 0, 5);
            ElementType typeLongitJointZ = new ElementType(5, EType.combin39);
            //Mat matLongitJointZ = new Mat(5, 0, 0, 0);
            Combin39 combinLongitJointZ = new Combin39(5);
            combinLongitJointZ.keyOption1 = 3;
            combinLongitJointZ.keyOption2 = 4;
            combinLongitJointZ.stiffness = GeneratePairs(GenerateCoordinate(
                matSetting.longitudinal_joint_rotation_k_1, matSetting.longitudinal_joint_rotation_strain_1,
                matSetting.longitudinal_joint_rotation_k_2, matSetting.longitudinal_joint_rotation_strain_2));
            model.AddPart(partLongitJointZ);
            model.AddElementType(typeLongitJointZ);
            //model.AddMat(matLongitJointZ);
            model.AddSection(combinLongitJointZ);

            //circumferential joint Y
            Part partLongitJointX = new Part(6, 6, 0, 6);
            ElementType typeLongitJointX = new ElementType(6, EType.combin39);
            //Mat matLongitJointX = new Mat(6);
            Combin39 combinLongitJointX = new Combin39(6);
            combinLongitJointX.keyOption1 = 3;
            combinLongitJointX.keyOption2 = 2;
            combinLongitJointX.stiffness = GeneratePairs(GenerateCoordinate(
                matSetting.longitudinal_joint_rotation_k_1 / 2, matSetting.longitudinal_joint_rotation_strain_1,
                matSetting.longitudinal_joint_rotation_k_2 / 2, matSetting.longitudinal_joint_rotation_strain_2));
            model.AddPart(partLongitJointX);
            model.AddElementType(typeLongitJointX);
            //model.AddMat(matLongitJointX);
            model.AddSection(combinLongitJointX);

            //circumferential joint Z
            Part partLongitJointY = new Part(7, 7, 0, 7);
            ElementType typeLongitJointY = new ElementType(7, EType.combin39);
            //Mat matLongitJointY = new Mat(7);
            Combin39 combinLongitJointY = new Combin39(7);
            combinLongitJointY.keyOption1 = 3;
            combinLongitJointY.keyOption2 = 3;
            combinLongitJointY.stiffness = GeneratePairs(GenerateCoordinate(
                matSetting.longitudinal_joint_rotation_k_1 / 2, matSetting.longitudinal_joint_rotation_strain_1,
                matSetting.longitudinal_joint_rotation_k_2 / 2, matSetting.longitudinal_joint_rotation_strain_2));
            model.AddPart(partLongitJointY);
            model.AddElementType(typeLongitJointY);
            //model.AddMat(matLongitJointY);
            model.AddSection(combinLongitJointY);

            //pre-load element, in axial direction, link180
            Part partAxial = new Part(8, 8, 8, 8);
            ElementType typeAxial = new ElementType(8, EType.link180);
            Mat matAxial = new Mat(8, matSetting.radial_spring_coe, matSetting.radial_spring_pr, 0);
            Link180 linkAxial = new Link180(8);
            linkRadialGround.area = matSetting.radial_spring_area;
            linkRadialGround.keyOption1 = 3;
            linkRadialGround.keyOption2 = 2;
            model.AddPart(partRadialGround);
            model.AddElementType(typeRadialGround);
            model.AddMat(matRadialGround);
            model.AddSection(linkRadialGround);
        }
예제 #10
0
        //you don't need to assign modelSetting.axis as it won't be used
        public static void BuildStraightModel(ModelSetting modelSetting, Model model)
        {
            SingleRingResult ringResult = new SingleRingResult();
            GenerateNodes.GenerateSingleRingNode(modelSetting, ringResult);
            GenerateElements.GenerateSingleRingElement(modelSetting, ringResult);

            //generate all nodes
            for(int i = 0; i < modelSetting.num_ring; i++)
            {
                for(int j = 0; j < modelSetting.num_node_all; j++)
                {
                    Node node = ringResult.nodes[j];
                    Node newNode = new Node(node.nid + i * modelSetting.num_node_all,
                        node.x, node.y, node.z + modelSetting.width * i);
                    model.AddNode(newNode);
                }
            }

            int elemenCount = 0;

            //generate all shells
            for (int i = 0; i < modelSetting.num_ring; i++)
            {
                foreach (Element element in ringResult.elements[1])
                {
                    elemenCount++;
                    ElementShell shell = element as ElementShell;
                    ElementShell newShell = new ElementShell(elemenCount,
                        shell.pid, shell.n1 + modelSetting.num_node_all * i, shell.n2 + modelSetting.num_node_all * i,
                        shell.n3 + modelSetting.num_node_all * i, shell.n4 + modelSetting.num_node_all * i);
                    model.AddElement(newShell);
                }
            }

            //generate radial ground spring
            for (int i = 0; i < modelSetting.num_ring; i++)
            {
                foreach (Element element in ringResult.elements[2])
                {
                    elemenCount++;
                    ElementLink link = element as ElementLink;
                    ElementLink newLink = new ElementLink(elemenCount,
                        link.pid, link.n1 + modelSetting.num_node_all * i, link.n2 + modelSetting.num_node_all * i);
                    model.AddElement(newLink);
                }
            }

            //generate tangential ground spring
            for (int i = 0; i < modelSetting.num_ring; i++)
            {
                foreach (Element element in ringResult.elements[3])
                {
                    elemenCount++;
                    ElementLink link = element as ElementLink;
                    ElementLink newLink = new ElementLink(elemenCount,
                        link.pid, link.n1 + modelSetting.num_node_all * i, link.n2 + modelSetting.num_node_all * i);
                    model.AddElement(newLink);
                }
            }

            //generate the longitudinal joint spring
            for (int i = 0; i < modelSetting.num_ring; i++)
            {
                for (int j = 0; j <= modelSetting.num_longit; j++)
                {
                    for (int k = 0; k < modelSetting.pos_joint.Count; k++)
                    {
                        elemenCount++;
                        ElementCombin combinZ = new ElementCombin(elemenCount, 5,
                            modelSetting.pos_joint[k] + 1 + j * modelSetting.num_node_face + i * modelSetting.num_node_all,
                            k + 1 + modelSetting.num_circum + j * modelSetting.num_node_face + i * modelSetting.num_node_all);
                        model.AddElement(combinZ);
                    }
                }
            }

            //generate circumferential joint spring
            for (int i = 1; i < modelSetting.num_ring; i++)
            {
                for (int j = 0; j < modelSetting.num_node_face; j++ )
                {
                    elemenCount++;
                    ElementCombin combinCircumZ = new ElementCombin(elemenCount, 4,
                         j + 1 + (i - 1) * modelSetting.num_node_all + modelSetting.num_node_face * modelSetting.num_longit,
                         j + 1 + i * modelSetting.num_node_all);
                    elemenCount++;
                    ElementCombin combinCircumX = new ElementCombin(elemenCount, 6,
                         j + 1 + (i - 1) * modelSetting.num_node_all + modelSetting.num_node_face * modelSetting.num_longit,
                         j + 1 + i * modelSetting.num_node_all);
                    elemenCount++;
                    ElementCombin combinCircumY = new ElementCombin(elemenCount, 7,
                        j + 1 + (i - 1) * modelSetting.num_node_all + modelSetting.num_node_face * modelSetting.num_longit,
                         j + 1 + i * modelSetting.num_node_all);
                    model.AddElement(combinCircumZ);
                    model.AddElement(combinCircumX);
                    model.AddElement(combinCircumY);
                }

            }

            //add longitudinal joint nodes couple-constrain
            for (int i = 0; i < modelSetting.num_ring; i++)
            {
                for (int j = 0; j <= modelSetting.num_longit; j++)
                {
                    for (int k = 0; k < modelSetting.pos_joint.Count; k++)
                    {
                        ConstrainedNodes constrain = new ConstrainedNodes();
                        constrain.nodes.Add(model.nodes[modelSetting.pos_joint[k] + 1 + j * modelSetting.num_node_face + i * modelSetting.num_node_all]);
                        constrain.nodes.Add(model.nodes[k + 1 + modelSetting.num_circum + j * modelSetting.num_node_face + i * modelSetting.num_node_all]);
                        constrain.ux = 1;
                        constrain.uy = 1;
                        model.AddConstrained(constrain);
                    }
                }
            }

            //add boundary
            for (int i = 0; i < modelSetting.num_node_face; i++)
            {
                BoundaryNode boundary = new BoundaryNode();
                boundary.node = model.nodes[i + 1];
                boundary.ux = 1;
                boundary.uy = 1;
                boundary.uz = 1;
                boundary.rx = 1;
                boundary.ry = 1;
                boundary.rz = 1;
                model.AddBoundary(boundary);
            }
            for (int i = 0; i < modelSetting.num_node_face; i++)
            {
                BoundaryNode boundary = new BoundaryNode();
                boundary.node = model.nodes[i + 1 + modelSetting.num_node_all * (modelSetting.num_ring - 1)
                    + modelSetting.num_longit * modelSetting.num_node_face];
                boundary.ux = 1;
                boundary.uy = 1;
                boundary.uz = 1;
                boundary.rx = 1;
                boundary.ry = 1;
                boundary.rz = 1;
                model.AddBoundary(boundary);
            }

            //apply load
        }
예제 #11
0
        private static void Output(Model model, List<ShieldTunnel3DResult> results, string path)
        {
            FileStream stream = new FileStream(path, FileMode.Append);
            StreamWriter sw = new StreamWriter(stream);

            //output parts
            sw.WriteLine("/prep7");
            sw.WriteLine("!!");
            foreach (Part part in model.parts.Values)
            {
                if (model.elementTypes.ContainsKey(part.eid))
                    sw.Write(model.elementTypes[part.eid].AnsysOutput());
                if (model.mats.ContainsKey(part.mid))
                    sw.Write(model.mats[part.mid].AnsysOutput());
                if (model.sections.ContainsKey(part.secid))
                    sw.Write(model.sections[part.secid].AnsysOutput());
                sw.WriteLine("!!");
            }

            foreach(ShieldTunnel3DResult result in results)
            {
                //change local system
                sw.WriteLine(result.changeLocal);

                //nodes
                foreach (Node node in result.nodes)
                {
                    sw.Write(node.AnsysOutput());
                }

                //pre elements
                foreach (int partID in result.PreElements.Keys)
                {
                    Part part = model.parts[partID];
                    if (model.elementTypes.ContainsKey(part.eid))
                        sw.WriteLine("type," + part.eid);
                    if (model.mats.ContainsKey(part.mid))
                        sw.WriteLine("mat," + part.mid);
                    if (model.sections.ContainsKey(part.secid))
                        sw.WriteLine("real," + part.secid);
                    foreach (Element element in result.PreElements[partID])
                    {
                        sw.Write(element.AnsysOutput());
                    }
                }

                //rotate node
                foreach (int id in result.rotateNodeID)
                    sw.WriteLine("nrotat," + id);

            }
            sw.Close();
        }
예제 #12
0
 private static void ApplyLoad(ModelSetting modelSetting, Model model, SoilInitalStress.IResult load, int ringNo)
 {
 }
예제 #13
0
        public TestWindow()
        {
            model = new Model();

            InitializeComponent();
        }