Esempio n. 1
0
        /// <summary>
        /// Sets up the necessary MSolve objects, checks user input and finally runs the simulation.
        /// </summary>
        public void Submit()
        {
            // Linear system solver
            ISolver solver;

            if (Solver == SolverOptions.DirectSkyline)
            {
                var solverBuilder = new SkylineSolver.Builder();
                solver = solverBuilder.BuildSolver(model.CoreModel);
            }
            else if (Solver == SolverOptions.IterativePcg)
            {
                var solverBuilder = new PcgSolver.Builder();
                solver = solverBuilder.BuildSolver(model.CoreModel);
            }
            else
            {
                throw new NotImplementedException();
            }

            // Provider of the problem
            var provider = new ProblemStructural(model.CoreModel, solver); //TODO: extend this

            // (Non) linear analyzer
            IChildAnalyzer childAnalyzer;

            if (Integrator == IntegratorOptions.Linear)
            {
                var linearAnalyzer = new LinearAnalyzer(model.CoreModel, solver, provider);

                // Field output requests
                //TODO: this should work for all analyzers
                if (FieldOutputRequests != null)
                {
                    linearAnalyzer.LogFactories[0] = FieldOutputRequests.CreateLogFactory(model);
                }

                childAnalyzer = linearAnalyzer;
            }
            else if (Integrator == IntegratorOptions.LoadControl)
            {
                throw new NotImplementedException("The next code doesn't compile since the classes NonLinearSubdomainUpdater"
                                                  + " and SubdomainGlobalMapping do not exist");
                //INonLinearSubdomainUpdater[] subdomainUpdaters = new[] { new NonLinearSubdomainUpdater(model.Subdomains[0]) };
                //ISubdomainGlobalMapping[] subdomainMappers = new[] { new SubdomainGlobalMapping(model.Subdomains[0]) };
                //int increments = 1;
                //int maxIterations = 100;
                //int iterationsForMatrixRebuild = 1;
                //var nonLinearAnalyzer = new NewtonRaphsonNonLinearAnalyzer(solver, linearSystems.Values.ToArray(),
                //    subdomainUpdaters, subdomainMappers, provider, increments, model.TotalDOFs, maxIterations,
                //    iterationsForMatrixRebuild);

                //childAnalyzer = nonLinearAnalyzer;
            }
            else
            {
                throw new NotImplementedException();
            }

            // Parent analyzer
            IAnalyzer parentAnalyzer;

            if (Procedure == ProcedureOptions.Static)
            {
                parentAnalyzer = new StaticAnalyzer(model.CoreModel, solver, provider, childAnalyzer);
            }
            else if (Procedure == ProcedureOptions.DynamicImplicit)
            {
                var analyzerBuilder = new NewmarkDynamicAnalyzer.Builder(model.CoreModel, solver, provider, childAnalyzer,
                                                                         model.TimeStep, model.TotalDuration);
                analyzerBuilder.SetNewmarkParameters(0.6, 1); //TODO: Use the defaults.
                parentAnalyzer = analyzerBuilder.Build();
            }
            else
            {
                throw new NotImplementedException();
            }

            // Run the analysis
            parentAnalyzer.Initialize(true);
            parentAnalyzer.Solve();
        }