// [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); }
public void FindSupportNode() { var k3d = new Toolkit(); var nFaces = 1; var length = 10.0; var xIncMesh = length / nFaces; var limit_dist = xIncMesh / 100.0; // create the mesh var mesh = new Mesh(); mesh.Vertices.Add(new Point3d(0, -0.5, 0)); mesh.Vertices.Add(new Point3d(0, 0.5, 0)); for (var faceInd = 0; faceInd < nFaces; ++faceInd) { mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, -0.5, 0)); mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, 0.5, 0)); var nV = mesh.Vertices.Count; mesh.Faces.AddFace(new MeshFace(nV - 4, nV - 3, nV - 1, nV - 2)); } // create a shell var outLogger = new MessageLogger(); var outBuilderShells = k3d.Part.MeshToShell(new List <Mesh3>() { mesh.Convert() }, new List <string>(), new List <CroSec>(), outLogger, out var outPoints); // create two supports var support1 = k3d.Support.Support(new Point3(0, -0.5, 0), k3d.Support.SupportFixedConditions); var support2 = k3d.Support.Support(new Point3(0, 0.5, 0), k3d.Support.SupportFixedConditions); // create a gravity load var gravityLoad = new GravityLoad(new Vector3(0, 0, -1)); // assemble the model var model = k3d.Model.AssembleModel(outBuilderShells, new List <Support>() { support1, support2 }, new List <Load>() { gravityLoad }, out var info, out var mass, out var cog, out var warning, out var runtimeWarning); var targetMass = length * 0.01 * 7850; Assert.AreEqual(mass, targetMass, 1E-5); ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out warning, out model); // Assert.AreEqual(outMaxDisp[0], 34.137028934059728, 1E-5); Assert.AreEqual(outMaxDisp[0], 53.621934860941359, 1E-5); }
public void AxialSpringOnBothSides() { var k3d = new Toolkit(); var crosec = k3d.CroSec.CircularHollow(); crosec.Az = 1E20; // make the cross section very stiff in shear var elems = new List <BuilderBeam>() { k3d.Part.IndexToBeam(0, 1, "", crosec), k3d.Part.IndexToBeam(1, 2, "", crosec), }; double cx = 100; var joint0 = new Joint(new double?[] { cx, null, null, null, null, null, null, null, null, null, null, null }); var joint1 = new Joint(new double?[] { null, null, null, null, null, null, cx, null, null, null, null, null }); elems[0].joint = joint0; elems[1].joint = joint1; var L = 10.0; // in meter var points = new List <Point3> { new Point3(), new Point3(L * 0.5, 0, 0), new Point3(L, 0, 0) }; var supports = new List <Support> { k3d.Support.Support(0, new List <bool> { true, true, true, true, false, false }), k3d.Support.Support(2, new List <bool> { false, true, true, false, false, false }) }; var fx = 1.0; // in kN var loads = new List <Load> { k3d.Load.PointLoad(2, new Vector3(fx, 0, 0)) }; var model = k3d.Model.AssembleModel(elems, supports, loads, out var info, out var mass, out var cog, out var msg, out var runtimeWarning, new List <Joint>(), points); ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); var A = (model.elems[0].crosec as CroSec_Beam).A; var E = model.elems[0].crosec.material.E(); var c_inv_tot = L / (E * A) + 2 / cx; var dispTarget = Math.Abs(fx) * c_inv_tot; Assert.AreEqual(outMaxDisp[0], dispTarget, 1E-10); }
public void ModifyModel() { var k3d = new Toolkit(); var crosec = k3d.CroSec.CircularHollow(); crosec.Az = 1E20; // make the cross section very stiff in shear var elems = new List <BuilderBeam>() { k3d.Part.IndexToBeam(0, 1, "", crosec), k3d.Part.IndexToBeam(1, 2, "", crosec), }; var L = 10.0; // in meter var points = new List <Point3> { new Point3(), new Point3(L * 0.5, 0, 0), new Point3(L, 0, 0) }; var supports = new List <Support> { k3d.Support.Support(0, k3d.Support.SupportHingedConditions), k3d.Support.Support(2, k3d.Support.SupportHingedConditions) }; var fz = -0.1; // in kN var loads = new List <Load> { k3d.Load.PointLoad(1, new Vector3(0, 0, fz)) }; var model = k3d.Model.AssembleModel(elems, supports, loads, out var info, out var mass, out var cog, out var msg, out var runtimeWarning, new List <Joint>(), points); ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); var I = (model.elems[0].crosec as CroSec_Beam).Iyy; var E = model.elems[0].crosec.material.E(); var dispTarget = Math.Abs(fz) * L * L * L / (48 * E * I); Assert.AreEqual(outMaxDisp[0], dispTarget, 1E-10); }
public void MeshLoadProfiling() { var k3d = new Toolkit(); 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; } LineToBeam.solve(new List <Point3>(), lines, true, true, limit_dist, new List <Vector3>(), new List <string>(), new List <Color>(), new List <CroSec>(), true, out List <Point3> outPoints, out List <BuilderBeam> builderElements, out string info); // create a MeshLoad var meshUnitLoadsBuffer = new Dictionary <MeshUnitLoad, MeshUnitLoad>(); var mesh = new Mesh(); mesh.Vertices.Add(new Point3d(0, -0.5, 0)); mesh.Vertices.Add(new Point3d(0, 0.5, 0)); for (var faceInd = 0; faceInd < nFaces; ++faceInd) { mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, -0.5, 0)); mesh.Vertices.Add(new Point3d((faceInd + 1) * xIncMesh, 0.5, 0)); var nV = mesh.Vertices.Count; mesh.Faces.AddFace(new MeshFace(nV - 4, nV - 3, nV - 1, nV - 2)); } UnitsConversionFactory ucf = UnitsConversionFactories.Conv(); UnitConversion m = ucf.m(); var baseMesh = m.toBaseMesh(new RhinoMesh(mesh)); var load = new MeshLoad(new List <Vector3>() { new Vector3(0, 0, -1) }); load.InitUnitLoads(meshUnitLoadsBuffer, baseMesh, LoadOrientation.global, new List <bool>() { true, true }, new List <Point3>(), new List <string>()); // 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 info, out var mass, out var cog, out var msg, out var runtimeWarning); ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); Assert.AreEqual(outMaxDisp[0], 2.8232103119331837, 1E-5); // Assert.AreEqual(1, 1, 1E-8); }
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); }
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); }
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); }
public void TwoPointLoads() { var k3d = new Toolkit(); var logger = new MessageLogger(); double length = 4.0; var p0 = new Point3(0, 0, 0); var p1 = new Point3(length, 0, 0); var axis = new Line3(p0, p1); var resourcePath = @""; // get a material from the material table in the folder 'Resources' var materialPath = Path.Combine(resourcePath, "Materials/MaterialProperties.csv"); var inMaterials = k3d.Material.ReadMaterialTable(materialPath); var material = inMaterials.Find(x => x.name == "Steel"); // get a cross section from the cross section table in the folder 'Resources' var crosecPath = Path.Combine(resourcePath, "CrossSections/CrossSectionValues.bin"); CroSecTable inCroSecs = k3d.CroSec.ReadCrossSectionTable(crosecPath, out var info); var crosec_family = inCroSecs.crosecs.FindAll(x => x.family == "FRQ"); var crosec_initial = crosec_family.Find(x => x.name == "FRQ45/5"); // attach the material to the cross section crosec_initial.setMaterial(material); // create the column var beams = k3d.Part.LineToBeam(new List <Line3> { axis }, new List <string>() { "B1" }, new List <CroSec>() { crosec_initial }, logger, out var out_points); // create supports var supports = new List <Support> { k3d.Support.Support(p0, new List <bool>() { true, true, true, true, true, true }), }; // create a Point-load var loads = new List <Load> { k3d.Load.PointLoad(p1, new Vector3(0, 100, 0), new Vector3(), "LC0"), k3d.Load.PointLoad(p1, new Vector3(0, 0, 50), new Vector3(), "LC1") }; // create the model var model = k3d.Model.AssembleModel(beams, supports, loads, out info, out var mass, out var cog, out var message, out var is_warning); // calculate the displacements ThIAnalyze.solve(model, out var outMaxDisp, out var outG, out var outComp, out var warning, out model); Assert.AreEqual(54.338219302231252, outMaxDisp[0], 1e-5); Assert.AreEqual(27.169109651115626, outMaxDisp[1], 1e-5); }