private static IVectorView SolveModel(Model model, ComsolMeshReader2 modelReader)
        {
            //var initialTemp = Vector.CreateZero(model.Nodes.Count);
            double[] temp0       = new double[model.Nodes.Count];
            int[]    boundaryIDs = new int[] { 0, 1, 2, 3, 4, 7 };
            foreach (int boundaryID in boundaryIDs)
            {
                foreach (IList <Node> nodes in modelReader.triBoundaries[boundaryID])
                {
                    foreach (Node node in nodes)
                    {
                        temp0[node.ID] = 1;
                    }
                }
            }
            boundaryIDs = new int[] { 6, 8, 9 };
            foreach (int boundaryID in boundaryIDs)
            {
                foreach (IList <Node> nodes in modelReader.triBoundaries[boundaryID])
                {
                    foreach (Node node in nodes)
                    {
                        temp0[node.ID] = 0;
                    }
                }
            }
            Vector initialTemp = Vector.CreateFromArray(temp0);
            var    builder     = new DenseMatrixSolver.Builder();

            builder.IsMatrixPositiveDefinite = false;
            var solver   = builder.BuildSolver(model);
            var provider = new ProblemConvectionDiffusion2(model, solver);

            var childAnalyzer  = new LinearAnalyzer(model, solver, provider);
            var BDForder       = 1;
            var parentAnalyzer = new BDF(model, solver, provider, childAnalyzer, .01, 2, BDForder, initialTemp);

            parentAnalyzer.Initialize();
            parentAnalyzer.Solve();

            return(parentAnalyzer.temperature[BDForder][subdomainID]);
            //           return solver.LinearSystems[subdomainID].Solution;
        }
Beispiel #2
0
        private static IVectorView SolveModel(Model model)
        {
            double[] temp0       = new double[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            Vector   initialTemp = Vector.CreateFromArray(temp0);
            var      builder     = new DenseMatrixSolver.Builder();

            builder.IsMatrixPositiveDefinite = false;
            var solver = builder.BuildSolver(model);
            //var solver = new DenseMatrixSolver.Builder().BuildSolver(model);
            //Gmres solver = (new DenseMatrixSolver.Builder()).BuildSolver(model);
            var provider = new ProblemConvectionDiffusion3(model, solver);

            var childAnalyzer  = new LinearAnalyzer(model, solver, provider);
            var parentAnalyzer = new BDF(model, solver, provider, childAnalyzer, 1, 5, 6, initialTemp);

            parentAnalyzer.Initialize();
            parentAnalyzer.Solve();

            //return solver.LinearSystems[subdomainID].Solution;
            return(parentAnalyzer.temperature[5][subdomainID]);
        }