예제 #1
0
        public void ReinforcedPlate()
        {
            var k3d    = new Toolkit();
            var logger = new MessageLogger();

            double length = 1.0;
            var    mesh   = new Mesh3();

            mesh.AddVertex(new Point3(0, length, 0));
            mesh.AddVertex(new Point3(0, 0, 0));
            mesh.AddVertex(new Point3(length, 0, 0));
            mesh.AddVertex(new Point3(length, length, 0));
            mesh.AddFace(new Face3(0, 1, 3));
            mesh.AddFace(new Face3(1, 2, 3));

            var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(25, 0, null, new List <double> {
                4, 4, -4, -4
            }, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);

            // create supports
            var supportConditions = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(0, supportConditions),
                k3d.Support.Support(1, supportConditions),
            };

            // create a Point-load
            var loads = new List <Load>
            {
                k3d.Load.PointLoad(2, new Vector3(), new Vector3(0, 25, 0)),
                k3d.Load.PointLoad(3, new Vector3(), new Vector3(0, 25, 0))
            };

            // create the model
            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var warning);

            model = k3d.Algorithms.OptiReinf(model, out var maxDisplacements, out var compliances, out message, out var reinfMass);

            k3d.Results.ShellForcesLocal(model, null, "0",
                                         out var nxx, out var nyy, out var nxy,
                                         out var mxx, out var myy, out var mxy,
                                         out var vx, out var vy);
            Assert.AreEqual(mxx[0][0][0], 50.082245640312429, 1E-5);
            Assert.AreEqual(mxx[0][0][1], 49.91775435968767, 1E-5);

            var crosec_shell = model.elems[0].crosec as CroSec_Shell;
            var reinf_thick  = crosec_shell.elem_crosecs[0].layers[1].height;

            Assert.AreEqual(reinf_thick, 0.00046824411288599481, 1E-5);
        }
예제 #2
0
        // [Category("QuickTests")]
        public void FindSupportNode()
        {
            var nFaces     = 1;
            var length     = 10.0;
            var xIncMesh   = length / nFaces;
            var limit_dist = xIncMesh / 100.0;

            // create the mesh
            var mesh = new Mesh3((nFaces + 1) * 2, nFaces);

            mesh.AddVertex(new Point3(0, -0.5, 0));
            mesh.AddVertex(new Point3(0, 0.5, 0));
            for (var faceInd = 0; faceInd < nFaces; ++faceInd)
            {
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, -0.5, 0));
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, 0.5, 0));
                var nV = mesh.Vertices.Count;
                mesh.AddFace(nV - 4, nV - 3, nV - 1, nV - 2);
            }

            // create a shell
            MeshToShell.solve(new List <Point3>(), new List <Mesh3>()
            {
                mesh
            }, limit_dist, new List <string>(), new List <Color>(), new List <CroSec>(), true,
                              out List <Point3> outPoints, out List <BuilderShell> outBuilderShells, out MessageLogger outLogger);

            // create two supports
            var support1 = new Support(new Point3(0, -0.5, 0), new List <bool>()
            {
                true, true, true, true, true, true
            }, Plane3.Default);
            var support2 = new Support(new Point3(0, 0.5, 0), new List <bool>()
            {
                true, true, true, true, true, true
            }, Plane3.Default);

            // create a gravity load
            var gravityLoad = new GravityLoad(new Vector3(0, 0, -1));

            // assemble the model
            var modelBuilder = new ModelBuilder(limit_dist);
            var model        = modelBuilder.build(new List <Point3>(), new List <FemMaterial>(), new List <CroSec>(),
                                                  new List <Support>()
            {
                support1, support2
            }, new List <Load>()
            {
                gravityLoad
            }, outBuilderShells, new List <ElemSet>(),
                                                  new List <Joint>(), new MessageLogger()
                                                  );

            ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model);

            // Assert.AreEqual(outMaxDisp[0], 53.621934860880543, 1E-5);
            Assert.AreEqual(outMaxDisp[0], 53.62193486094136, 1E-5);
        }
예제 #3
0
 private Mesh3 MakeMesh()
 {
     Mesh3 mesh = new Mesh3();
     mesh.AddVertex(0, 0, 0);
     mesh.AddVertex(1, 0, 0);
     mesh.AddVertex(0, 1, 0.5);
     mesh.AddFace(0, 1, 2);
     return mesh;
 }
예제 #4
0
        public void Shell()
        {
            var    k3d    = new Toolkit();
            var    logger = new MessageLogger();
            double length = 1.0;
            var    mesh   = new Mesh3();
            var    p0     = new Point3(0, length, 0);
            var    p1     = new Point3(0, 0, 0);

            mesh.AddVertex(p0);
            mesh.AddVertex(p1);
            mesh.AddVertex(new Point3(length, 0, 0));
            mesh.AddVertex(new Point3(length, length, 0));
            mesh.AddFace(new Face3(0, 1, 3));
            mesh.AddFace(new Face3(1, 2, 3));

            var crosec = k3d.CroSec.ShellConst(25, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);


            // create supports
            var supports = new List <Support>
            {
                k3d.Support.Support(p0, new List <bool>()
                {
                    true, true, true, true, true, true
                }),
                k3d.Support.Support(p1, new List <bool>()
                {
                    true, true, true, true, true, true
                }),
            };


            // create the model
            var model = k3d.Model.AssembleModel(shells, supports, new List <Load>(),
                                                out var info, out var mass, out var cog, out var message, out var warning);

            // calculate the natural vibrations
            int    from_shape_ind = 1;
            int    shapes_num     = 1;
            int    max_iter       = 100;
            double eps            = 1e-8;
            var    disp_dummy     = new List <double>();
            var    scaling        = EigenShapesScalingType.matrix;

            model = k3d.Algorithms.NaturalVibes(model, from_shape_ind, shapes_num, max_iter, eps, disp_dummy, scaling,
                                                out List <double> nat_frequencies, out List <double> modal_masses, out List <Vector3> participation_facs,
                                                out List <double> participation_facs_disp, out model);

            Assert.AreEqual(nat_frequencies[0], 624.44918408731951, 1e-8);
        }
        private static Karamba.Models.Model MakeNonConvexModel()
        {
            var k3d  = new Toolkit();
            var mesh = new Mesh3();

            mesh.AddVertex(0, 0, 0.5);
            mesh.AddVertex(1, 0, 0);
            mesh.AddVertex(1, 1, 1);
            mesh.AddVertex(0, 1, 0);
            mesh.AddFace(0, 1, 2);
            mesh.AddFace(0, 2, 3);

            var supportConditions = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(0, supportConditions),
                k3d.Support.Support(1, supportConditions),
                k3d.Support.Support(2, supportConditions),
                k3d.Support.Support(3, supportConditions)
            };

            var loads = new List <Load>
            {
                k3d.Load.PointLoad(0, new Vector3(0, 0, -5)),
                k3d.Load.PointLoad(1, new Vector3(0, 0, -5)),
                k3d.Load.PointLoad(2, new Vector3(0, 0, -5)),
                k3d.Load.PointLoad(3, new Vector3(0, 0, -5))
            };

            var logger = new MessageLogger();
            var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(25, 0, null, new List <double> {
                4, 4, -4, -4
            }, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);
            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var any_warning);

            model = k3d.Algorithms.AnalyzeThI(model, out var maxDisplacements, out var gravityForce, out var elasticEnergy, out var warning);
            return(model);
        }
예제 #6
0
        public void TSection_2Elems()
        {
            var k3d = new Toolkit();

            var logger = new MessageLogger();

            double Lx     = 1.0;
            double Ly     = 2.0;
            double Lz     = 3.0;
            var    points = new List <Point3> {
                new Point3(0, Ly, 0), new Point3(0, 0, 0),
                new Point3(Lx, 0, 0),
                new Point3(0, 0, Lz)
            };

            var mesh = new Mesh3();

            foreach (var point in points)
            {
                mesh.AddVertex(point);
            }
            mesh.AddFace(new Face3(0, 1, 2));
            mesh.AddFace(new Face3(1, 2, 3));

            var material = k3d.Material.IsotropicMaterial("", "", 200000, 100000, 100000, 0, 0, 0, 0, 0);
            var crosec   = k3d.CroSec.ShellConst(0.1, 0, material);
            var shells   = k3d.Part.MeshToShell(
                new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, true, logger, out var nodes,
                0.005, null, points);

            // create supports
            var supportConditions_1 = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(points[0], supportConditions_1),
                k3d.Support.Support(points[1], supportConditions_1),
                k3d.Support.Support(points[2], supportConditions_1)
            };

            // create a Point-load
            double Fx    = 100.0;
            var    loads = new List <Load>
            {
                k3d.Load.PointLoad(points[3], new Vector3(Fx, 0, 0), new Vector3()),
            };

            double c      = 0.1;
            var    joints = new List <Joint>()
            {
                new JointLine(new List <string> {
                    ""
                },
                              new PolyLine3(new List <Point3> {
                    points[1], points[2]
                }),
                              -Vector3.ZAxis, null, Math.PI * 0.25, new double?[] { c })
            };

            // create the model
            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var warning, joints);

            // var model = k3d.Model.AssembleModel(shells, supports, loads,
            //    out var info, out var mass, out var cog, out var message, out var warning, joints, points);
            // var model = k3d.Model.AssembleModel(shells, supports, loads,
            //    out var info, out var mass, out var cog, out var message, out var warning);

            ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning_msg, out model);

            var dispTarget = Fx / Lx / c;
            var dispCalc   = outMaxDisp[0];

            Assert.AreEqual(dispCalc, dispTarget, 1);
        }
예제 #7
0
        public void Membrane_Triangle_InPlaneSpringOnOneSide()
        {
            var k3d = new Toolkit();

            var logger = new MessageLogger();

            double L      = 1.0;
            var    points = new List <Point3> {
                new Point3(0, 0.5 * L, 0), new Point3(0, -0.5 * L, 0), new Point3(L, 0, 0)
            };

            var mesh = new Mesh3();

            foreach (var point in points)
            {
                mesh.AddVertex(point);
            }
            mesh.AddFace(new Face3(0, 1, 2));

            var material = k3d.Material.IsotropicMaterial("", "", 200000, 100000, 100000, 0, 0, 0, 0, 0);
            var crosec   = k3d.CroSec.ShellConst(0.01, 0, material);
            var shells   = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, false, logger, out var out_nodes);

            // create supports
            var supportConditions_1 = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(points[0], supportConditions_1),
                k3d.Support.Support(points[1], supportConditions_1),
            };

            // create a Point-load
            double fx    = 100.0;
            var    loads = new List <Load>
            {
                k3d.Load.PointLoad(points[2], new Vector3(fx, 0, 0), new Vector3()),
            };

            double cx     = 2.0;
            var    joints = new List <Joint>()
            {
                new JointLine(new List <string> {
                    ""
                },
                              new PolyLine3(new List <Point3> {
                    points[1], points[0]
                }),
                              -Vector3.XAxis, Vector3.ZAxis, Math.PI * 0.5, new double?[] { null, cx })
            };

            // create the model
            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var warning, joints);

            // var model = k3d.Model.AssembleModel(shells, supports, loads,
            //     out var info, out var mass, out var cog, out var message, out var warning);

            ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning_msg, out model);

            var h = (model.elems[0].crosec as CroSec_Shell).getHeight();
            var E = model.elems[0].crosec.material.E();
            // var c_inv_tot = 2 * L / (E * h);
            var c_inv_tot  = 2 * L / (E * h) + 1 / cx / L;
            var dispTarget = Math.Abs(fx) / L * c_inv_tot;
            var dispCalc   = outMaxDisp[0];

            Assert.AreEqual(dispCalc, dispTarget, 1);
        }
예제 #8
0
        public void DeformationTestIsotropicShellInPlane()
        {
            var nFaces     = 1;
            var length     = 1.0;
            var xIncMesh   = length / nFaces;
            var limit_dist = xIncMesh / 100.0;

            var y0 = 0.0;
            var y1 = 1.0;

            // create the mesh
            var mesh = new Mesh3((nFaces + 1) * 2, nFaces);

            mesh.AddVertex(new Point3(0, y0, 0));
            mesh.AddVertex(new Point3(0, y1, 0));
            for (var faceInd = 0; faceInd < nFaces; ++faceInd)
            {
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, y0, 0));
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, y1, 0));
                var nV = mesh.Vertices.Count;
                mesh.AddFace(nV - 4, nV - 3, nV - 1, nV - 2);
            }

            // create a shell
            MeshToShell.solve(new List <Point3>(), new List <Mesh3>()
            {
                mesh
            }, limit_dist, new List <string>(), new List <Color>(), new List <CroSec>(), true,
                              out List <Point3> outPoints, out List <BuilderShell> outBuilderShells, out MessageLogger outLogger);

            // create two supports
            var support1 = new Support(new Point3(0, y0, 0), new List <bool>()
            {
                true, true, true, true, true, true
            }, Plane3.Default);
            var support2 = new Support(new Point3(0, y1, 0), new List <bool>()
            {
                true, false, true, true, true, true
            }, Plane3.Default);

            // create two point loads
            var pl1 = new PointLoad(mesh.Vertices.Count - 2, new Vector3(25, 0, 0), new Vector3(), false);
            var pl2 = new PointLoad(mesh.Vertices.Count - 1, new Vector3(25, 0, 0), new Vector3(), false);

            // assemble the model
            var modelBuilder = new ModelBuilder(limit_dist);
            var model        = modelBuilder.build(new List <Point3>(), new List <FemMaterial>(), new List <CroSec>(),
                                                  new List <Support>()
            {
                support1, support2
            }, new List <Load>()
            {
                pl1, pl2
            }, outBuilderShells, new List <ElemSet>(),
                                                  new List <Joint>(), new MessageLogger()
                                                  );

            ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model);

            Assert.AreEqual(outMaxDisp[0], 2.4858889456113236E-05, 1E-5);
        }
예제 #9
0
        public static Mesh3 Chuck(params object[] o)
        {
            Mesh3 mesh = new Mesh3();
            int v0 = mesh.AddVertex(0, 0, 0);
            int v1 = mesh.AddVertex(40, 0, 0);
            int v2 = mesh.AddVertex(40, 15, 0);
            int v3 = mesh.AddVertex(0, 15, 0);
            int v4 = mesh.AddVertex(90, 0, 0);
            int v5 = mesh.AddVertex(90, 30, 0);
            int v6 = mesh.AddVertex(40, 30, 0);
            int v7 = mesh.AddVertex(110, 0, 0);
            int v8 = mesh.AddVertex(110, 45, 0);
            int v9 = mesh.AddVertex(90, 45, 0);

            int v12 = mesh.AddVertex(90, 45, -30);
            int v13 = mesh.AddVertex(90, 30, -30);
            int v14 = mesh.AddVertex(40, 30, -30);
            int v15 = mesh.AddVertex(40, 15, -30);
            int v16 = mesh.AddVertex(0, 15, -30);

            int v17 = mesh.AddVertex(90, 0, -30);
            int v18 = mesh.AddVertex(40, 0, -30);
            int v19 = mesh.AddVertex(0, 0, -30);

            int v10 = mesh.AddVertex(110, 0, -30);
            int v11 = mesh.AddVertex(110, 45, -30);

            int v20 = mesh.AddVertex(120, 45, -20);
            int v21 = mesh.AddVertex(120, 45, -10);
            int v22 = mesh.AddVertex(120, 0, -10);
            int v23 = mesh.AddVertex(120, 0, -20);

            int n0 = mesh.AddNormal(0, 0, 1);
            int[] poly0 = { v0, v1, v2, v3 };
            int[] normal0 = { n0, n0, n0, n0 };
            mesh.AddPoly(poly0, normal0);

            int[] poly1 = { v1, v4, v5, v6 };
            mesh.AddPoly(poly1, normal0);

            int[] poly2 = { v4, v7, v8, v9 };
            mesh.AddPoly(poly2, normal0);

            int n1 = mesh.AddNormal(1, 0, 0);
            int[] poly3 = { v21, v22, v23, v20 };
            int[] normal1 = { n1, n1, n1, n1 };
            mesh.AddPoly(poly3, normal1);

            int n3 = mesh.AddNormal(0, 1, 0);
            int[] poly4 = { v9, v8, v11, v12 };
            int[] normal3 = { n3, n3, n3, n3 };
            mesh.AddPoly(poly4, normal3);

            int[] poly5 = { v6, v5, v13, v14 };
            mesh.AddPoly(poly5, normal3);

            int[] poly6 = { v3, v2, v15, v16 };
            mesh.AddPoly(poly6, normal3);

            int n2 = mesh.AddNormal(0, 0, -1);
            int[] normal2 = { n2, n2, n2, n2 };
            int[] poly7 = { v12, v11, v10, v17 };
            mesh.AddPoly(poly7, normal2);

            int[] poly8 = { v14, v13, v17, v18 };
            mesh.AddPoly(poly8, normal2);

            int[] poly9 = { v16, v15, v18, v19 };
            mesh.AddPoly(poly9, normal2);

            int n4 = mesh.AddNormal(-1, 0, 0);
            int[] normal4 = { n4, n4, n4, n4 };
            int[] poly10 = { v9, v12, v13, v5 };
            mesh.AddPoly(poly10, normal4);

            int[] poly11 = { v6, v14, v15, v2 };
            mesh.AddPoly(poly11, normal4);

            int[] poly12 = { v0, v3, v16, v19 };
            mesh.AddPoly(poly12, normal4);

            int n5 = mesh.AddNormal(0, -1, 0);
            int[] normal5 = { n5, n5, n5, n5 };
            int[] poly13 = { v0, v19, v10, v7 };
            mesh.AddPoly(poly13, normal5);

            int[] poly14 = { v8, v7, v22, v21 };
            int n6 = mesh.AddNormal(new Vector3D(1, 0, 1).Unit());
            int[] normal6 = { n6, n6, n6, n6 };
            mesh.AddPoly(poly14, normal6);

            int[] poly15 = { v11, v20, v23, v10 };
            int n7 = mesh.AddNormal(new Vector3D(1, 0, -1).Unit());
            int[] normal7 = { n7, n7, n7, n7 };
            mesh.AddPoly(poly15, normal2);

            int[] poly16 = { v8, v21, v20, v11 };
            mesh.AddPoly(poly16, normal3);

            int[] poly17 = { v7, v10, v23, v22 };
            mesh.AddPoly(poly17, normal5);
            return mesh;
        }
예제 #10
0
        public void Initialize()
        {
            var k3d = new Toolkit();

            var mesh = new Mesh3();

            mesh.AddVertex(0, 0, 0);
            mesh.AddVertex(0, 1, 0);
            mesh.AddVertex(1, 0, 0);
            mesh.AddVertex(1, 1, 0);
            mesh.AddFace(0, 2, 3);
            mesh.AddFace(0, 3, 1);

            var supportConditions = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(new Point3(0, 0, 0), supportConditions),
                k3d.Support.Support(new Point3(0, 1, 0), supportConditions),
            };

            var loads = new List <Load>
            {
                k3d.Load.PointLoad(new Point3(1, 1, 0), new Vector3(-5, 0, -5)),
                k3d.Load.PointLoad(new Point3(1, 0, 0), new Vector3(-5, 0, -5)),
            };

            var logger = new MessageLogger();
            var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(1);//20, 0, null, new List<double> { 4, 4, -4, -4 }, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);
            var model = k3d.Model.AssembleModel(shells, supports, loads, out var info, out var mass, out var cog, out var message, out var any_warning);


            model             = k3d.Algorithms.AnalyzeThI(model, out var maxDisplacements, out var gravityForce, out var elasticEnergy, out var warning);
            _model            = model;
            _inputPolyline    = new PolyLine3(new Point3(0.5, -0.5, 1), new Point3(0.5, 1.5, 1));
            _projectionVector = new Vector3(0, 0, -1);
            _tol             = 1E-12;
            _delta           = 0.02;
            _outputPolylines = new List <PolyLine3>()
            {
                new PolyLine3
                (
                    new Point3(0.5, 0, 0),
                    new Point3(0.5, 0.5, 0),
                    new Point3(0.5, 1, 0)
                )
            };
            _outputCrossedFaces = new List <List <int> >()
            {
                new List <int>()
                {
                    0, 1
                }
            };
        }
예제 #11
0
        public void MeshLoadProfiling()
        {
            var k3d    = new Toolkit();
            var logger = new MessageLogger();

            int    nBeams      = 20;
            int    nFaces      = 1500;
            double lengthBeams = 10.0;
            double xIncBeam    = lengthBeams / nBeams;
            double xIncMesh    = lengthBeams / nFaces;
            double limit_dist  = xIncBeam / 100.0;

            // create beams
            var lines = new List <Line3>();
            var nodeI = new Point3(0, 0, 0);

            for (int beamInd = 0; beamInd < nBeams; ++beamInd)
            {
                var nodeK = new Point3(nodeI.X + xIncBeam, 0, 0);
                lines.Add(new Line3(nodeI, nodeK));
                nodeI = nodeK;
            }

            var builderElements = k3d.Part.LineToBeam(lines, new List <string>(), new List <CroSec>(), logger, out List <Point3> outPoints);

            // create a MeshLoad
            var mesh = new Mesh3((nFaces + 1) * 2, nFaces);

            mesh.AddVertex(new Point3(0, -0.5, 0));
            mesh.AddVertex(new Point3(0, 0.5, 0));
            for (var faceInd = 0; faceInd < nFaces; ++faceInd)
            {
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, -0.5, 0));
                mesh.AddVertex(new Point3((faceInd + 1) * xIncMesh, 0.5, 0));
                var nV = mesh.Vertices.Count;
                mesh.AddFace(nV - 4, nV - 3, nV - 1, nV - 2);
            }
            UnitsConversionFactory ucf = UnitsConversionFactory.Conv();
            UnitConversion         m   = ucf.m();
            var baseMesh = m.toBaseMesh(mesh);

            // create a mesh load
            var load = k3d.Load.MeshLoad(new List <Vector3>()
            {
                new Vector3(0, 0, -1)
            }, baseMesh);

            // create a support
            var support = k3d.Support.Support(new Point3(0, 0, 0), k3d.Support.SupportFixedConditions);

            // assemble the model
            var model = k3d.Model.AssembleModel(builderElements, new List <Support>()
            {
                support
            }, new List <Load>()
            {
                load
            },
                                                out var info, out var mass, out var cog, out var message, out var runtimeWarning);

            // calculate the model
            model = k3d.Algorithms.AnalyzeThI(model, out var outMaxDisp, out var outG, out var outComp, out var warning);
            Assert.AreEqual(outMaxDisp[0], 2.8232103119228276, 1E-5);
        }
예제 #12
0
        public void Initialize()
        {
            //Create Mesh
            var mesh = new Mesh3();

            mesh.AddVertex(0, 0, 0);
            mesh.AddVertex(0, 1, 0);
            mesh.AddVertex(0, 2, 0);
            mesh.AddVertex(1, 0, 0);
            mesh.AddVertex(1, 1, 0);
            mesh.AddVertex(1, 2, 0);
            mesh.AddVertex(2, 0, 0);
            mesh.AddVertex(2, 1, 0);
            mesh.AddVertex(2, 2, 0);

            mesh.AddFace(0, 3, 4);
            mesh.AddFace(1, 4, 5);
            mesh.AddFace(3, 6, 7);
            mesh.AddFace(4, 7, 8);
            mesh.AddFace(0, 4, 1);
            mesh.AddFace(1, 5, 2);
            mesh.AddFace(3, 7, 4);
            mesh.AddFace(4, 8, 5);

            //Create Model
            var k3d = new Toolkit();
            var supportConditions = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(new Point3(0, 0, 0), supportConditions),
                k3d.Support.Support(new Point3(0, 1, 0), supportConditions),
                k3d.Support.Support(new Point3(0, 2, 0), supportConditions)
            };

            var loads = new List <Load>
            {
                k3d.Load.PointLoad(new Point3(2, 2, 0), new Vector3(0, 0, -5)),
                k3d.Load.PointLoad(new Point3(2, 1, 0), new Vector3(0, 0, -5)),
                k3d.Load.PointLoad(new Point3(2, 0, 0), new Vector3(0, 0, -5)),
            };

            var logger = new MessageLogger();
            var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(25, 0, null, new List <double> {
                4, 4, -4, -4
            }, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);

            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var any_warning);

            model = k3d.Algorithms.AnalyzeThI(model, out var maxDisplacements,
                                              out var gravityForce, out var elasticEnergy, out var warning);

            //Create projection Vector
            Vector3 proj_vect = new Vector3(0, 0, -1);

            //Create other definition
            var tol   = 1E-12;
            var delta = 0.02;


            _model            = model;
            _projectionVector = proj_vect;
            _tol   = tol;
            _delta = delta;
        }
        public void Initialize()
        {
            //Create Mesh
            var mesh = new Mesh3();

            mesh.AddVertex(0, 0, 0);
            mesh.AddVertex(0, 1, 0);
            mesh.AddVertex(1, 0, 0);
            mesh.AddVertex(1, 1, 0);
            mesh.AddVertex(2, 0, 0);
            mesh.AddVertex(2, 1, 0);
            mesh.AddVertex(0, 0, 0);
            mesh.AddVertex(1, 0, 0);
            mesh.AddVertex(2, 0, 0);
            mesh.AddVertex(0, 0, 1);
            mesh.AddVertex(1, 0, 1);
            mesh.AddVertex(2, 0, 1);
            mesh.AddVertex(0, 0, 2);
            mesh.AddVertex(1, 0, 2);
            mesh.AddVertex(2, 0, 2);
            mesh.AddVertex(2, 0, 0);
            mesh.AddVertex(2, 1, 0);
            mesh.AddVertex(2, 0, 1);
            mesh.AddVertex(2, 1, 1);
            mesh.AddVertex(2, 0, 2);
            mesh.AddVertex(2, 1, 2);
            mesh.AddVertex(2, 1, 0);
            mesh.AddVertex(1, 1, 0);
            mesh.AddVertex(0, 1, 0);
            mesh.AddVertex(2, 1, 1);
            mesh.AddVertex(1, 1, 1);
            mesh.AddVertex(0, 1, 1);
            mesh.AddVertex(2, 1, 2);
            mesh.AddVertex(1, 1, 2);
            mesh.AddVertex(0, 1, 2);
            mesh.AddVertex(0, 1, 0);
            mesh.AddVertex(0, 0, 0);
            mesh.AddVertex(0, 1, 1);
            mesh.AddVertex(0, 0, 1);
            mesh.AddVertex(0, 1, 2);
            mesh.AddVertex(0, 0, 2);
            mesh.AddVertex(0, 0, 2);
            mesh.AddVertex(1, 0, 2);
            mesh.AddVertex(2, 0, 2);
            mesh.AddVertex(0, 1, 2);
            mesh.AddVertex(1, 1, 2);
            mesh.AddVertex(2, 1, 2);
            mesh.AddFace(0, 1, 3);
            mesh.AddFace(2, 3, 5);
            mesh.AddFace(6, 7, 10);
            mesh.AddFace(7, 8, 11);
            mesh.AddFace(9, 10, 13);
            mesh.AddFace(10, 11, 14);
            mesh.AddFace(15, 16, 18);
            mesh.AddFace(17, 18, 20);
            mesh.AddFace(21, 22, 25);
            mesh.AddFace(22, 23, 26);
            mesh.AddFace(24, 25, 28);
            mesh.AddFace(25, 26, 29);
            mesh.AddFace(30, 31, 33);
            mesh.AddFace(32, 33, 35);
            mesh.AddFace(36, 37, 40);
            mesh.AddFace(37, 38, 41);
            mesh.AddFace(0, 3, 2);
            mesh.AddFace(2, 5, 4);
            mesh.AddFace(6, 10, 9);
            mesh.AddFace(7, 11, 10);
            mesh.AddFace(9, 13, 12);
            mesh.AddFace(10, 14, 13);
            mesh.AddFace(15, 18, 17);
            mesh.AddFace(17, 20, 19);
            mesh.AddFace(21, 25, 24);
            mesh.AddFace(22, 26, 25);
            mesh.AddFace(24, 28, 27);
            mesh.AddFace(25, 29, 28);
            mesh.AddFace(30, 33, 32);
            mesh.AddFace(32, 35, 34);
            mesh.AddFace(36, 40, 39);
            mesh.AddFace(37, 41, 40);

            //Create Model
            var k3d = new Toolkit();
            var supportConditions = new List <bool>()
            {
                true, true, true, true, true, true
            };
            var supports = new List <Support>
            {
                k3d.Support.Support(new Point3(0, 0, 0), supportConditions),
                k3d.Support.Support(new Point3(0, 1, 0), supportConditions),
                k3d.Support.Support(new Point3(1, 0, 0), supportConditions),
                k3d.Support.Support(new Point3(1, 1, 0), supportConditions),
                k3d.Support.Support(new Point3(2, 0, 0), supportConditions),
                k3d.Support.Support(new Point3(2, 1, 0), supportConditions)
            };
            var loads = new List <Load>
            {
                k3d.Load.PointLoad(new Point3(0, 0, 2), new Vector3(1000, 0, 0)),
                k3d.Load.PointLoad(new Point3(1, 0, 2), new Vector3(1000, 0, 0)),
                k3d.Load.PointLoad(new Point3(2, 0, 2), new Vector3(1000, 0, 0)),
                k3d.Load.PointLoad(new Point3(2, 1, 2), new Vector3(1000, 0, 0)),
                k3d.Load.PointLoad(new Point3(1, 1, 2), new Vector3(1000, 0, 0)),
                k3d.Load.PointLoad(new Point3(0, 1, 2), new Vector3(1000, 0, 0))
            };

            var logger = new MessageLogger();
            var crosec = k3d.CroSec.ReinforcedConcreteStandardShellConst(25, 0, null, new List <double> {
                4, 4, -4, -4
            }, 0);
            var shells = k3d.Part.MeshToShell(new List <Mesh3> {
                mesh
            }, null, new List <CroSec> {
                crosec
            }, logger, out var nodes);

            var model = k3d.Model.AssembleModel(shells, supports, loads,
                                                out var info, out var mass, out var cog, out var message, out var any_warning);

            model = k3d.Algorithms.AnalyzeThI(model, out var maxDisplacements,
                                              out var gravityForce, out var elasticEnergy, out var warning);

            //Create projection Vector
            Vector3 proj_vect = new Vector3(0, 1, 0);

            //Create other definition
            var tol   = 1E-12;
            var delta = 0.02;

            _model            = model;
            _projectionVector = proj_vect;
            _tol   = tol;
            _delta = delta;
        }