Exemple #1
0
        public void Solve()
        {
            Rectangle rectangle = solidMechanicsModel.Model.Shape as Rectangle;

            if (rectangle != null)
            {
                SolidMechanicsModel2D smm = solidMechanicsModel as SolidMechanicsModel2D;
                if (smm != null)
                {
                    RectangularMesh mesh = new RectangularMesh(rectangle, smm.VerticalElements, smm.HorizontalElements);
                    pointsForGrid = mesh.GetPointsForResult();
                    IEnumerable <INumericalResult> results = null;
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    Task taskSolver = Task.Factory.StartNew(() =>
                    {
                        //Solver solver = new FreeVibrationsLinearSolver(solidMechanicsModel.Model, mesh, error, solidMechanicsModel.MaxAmplitude);

                        Solver solver = new FreeVibrationsLinearSolver(smm.Model, mesh, error, smm.MaxAmplitude);

                        /*Solver initSolver = new FreeVibrationsLinearSolver(_solidMechanicsModel.Model, mesh, _error);
                         * IEnumerable<INumericalResult> initResults = initSolver.Solve(1);
                         * EigenValuesNumericalResult res = initResults.First() as EigenValuesNumericalResult;*/

                        //Solver solver = new FreeVibrationsNonLinearSolver2(_solidMechanicsModel.Model, mesh, _error, res.U, 2, 50);

                        //Solver solver = new NewmarkVibrationNonLinearSolver(_solidMechanicsModel.Model, mesh, _error, res.U, 5, 50);

                        //Solver solver = new StationaryNonlinear2DSolver(_solidMechanicsModel.Model, mesh, _error, 20);

                        //IResult analiticalResult = new AnaliticalResultRectangleWithOneSideFixed(_solidMechanicsModel.Model);

                        results = solver.Solve(maxResults);
                    });
                    sw.Stop();
                    TimeElapsed = sw.Elapsed;
                    Task.WaitAll(taskSolver);
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        Results.Clear();
                        foreach (INumericalResult result in results)
                        {
                            Results.Add(result);
                        }
                    }));
                }
            }
        }
Exemple #2
0
        public void SolveTest()
        {
            double    error     = 0.001;
            Rectangle rectangle = new Rectangle(0.1, 1);
            Model     model     = new Model(Material.Aluminium(), rectangle); // TODO: Initialize to an appropriate value

            model.PointConditions[rectangle.Points[2]].Type = BoundaryConditionsType.Static;
            model.PointConditions[rectangle.Points[3]].Type = BoundaryConditionsType.Static;
            Mesh mesh = new RectangularMesh(rectangle, 10, 4);                                      // TODO: Initialize to an appropriate value
            FreeVibrationsLinearSolver solver = new FreeVibrationsLinearSolver(model, mesh, error); // TODO: Initialize to an appropriate value
            IResult expected = null;                                                                // TODO: Initialize to an appropriate value
            IResult actual   = null;

            actual = solver.Solve(1).FirstOrDefault();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemple #3
0
        public void SolveSimpleTest()
        {
            double    error     = 0.001;
            Rectangle rectangle = new Rectangle(1, 1);
            Model     model     = new Model(Material.Aluminium(), rectangle);

            model.PointConditions[rectangle.Points[2]].Type = BoundaryConditionsType.Static;
            model.PointConditions[rectangle.Points[3]].Type = BoundaryConditionsType.Static;
            //model.BoundaryConditions[rectangle.Edges[0]].Type = BoundaryConditionsType.Static;
            //model.BoundaryConditions[rectangle.Edges[2]].Type = BoundaryConditionsType.Static;
            Mesh mesh = new RectangularMesh(rectangle, 2, 2);
            FreeVibrationsLinearSolver solver = new FreeVibrationsLinearSolver(model, mesh, error);
            IResult expected = null; // TODO: Initialize to an appropriate value
            IResult actual   = solver.Solve(1).FirstOrDefault();

            IEnumerable <Point> points = mesh.GetPointsForResult();

            ResultHelper.IsResultsEqual(points, expected, actual, 0, error);

            Assert.AreEqual(true, false);
        }