コード例 #1
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = -dt(conductuvity*temperature + rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            double[,] kappa = new double[model.Nodes.Count, model.Nodes.Count];
            kappa[0, 0]     = 1;
            kappa[model.Nodes.Count - 1, model.Nodes.Count - 1] = 1;
            IMatrix penalty = Matrix.CreateFromArray(kappa);
            int     id      = linearSystem.Subdomain.ID;

            dummyWeakImpositionTimesTemperature[id]     = penalty.Multiply(temperature[id]);
            conductivityTimesTemperature[id]            = provider.ConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            conductivityTimesTemperature[id]            = conductivityTimesTemperature[id].LinearCombination(1, dummyWeakImpositionTimesTemperature[id], 1);
            stabilizingConductivityTimesTemperature[id] = provider.StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);

            IVector rhsResult    = conductivityTimesTemperature[id].Subtract(rhs[id]);
            var     rhsResultnew = rhsResult.LinearCombination(1, stabilizingConductivityTimesTemperature[id], -timeStep);

            rhsResultnew.ScaleIntoThis(-timeStep);

            //rhsPrevious[id] = rhs[id];
            return(rhsResultnew);
        }
コード例 #2
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = (capacity/dt^2-diffusionConductivity/dt-massTransportConductivity/dt+stabilizingConductivity)*temperature - (StabilizingRhs - rhs/dt))
            // result = -dt(conductuvity*temperature - rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            double a0 = 1 / Math.Pow(timeStep, 2);
            double a1 = 1 / (2 * timeStep);
            double a2 = 1 / timeStep;
            int    id = linearSystem.Subdomain.ID;

            diffusionConductivityTimesTemperature[id]     = provider.DiffusionConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            massTransportConductivityTimesTemperature[id] = provider.MassTransportConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            var conductivityTimesTemperature = diffusionConductivityTimesTemperature[id].LinearCombination(1, massTransportConductivityTimesTemperature[id], 1);

            stabilizingConductivityTimesTemperature[id] = provider.StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);

            IVector rhsResult    = conductivityTimesTemperature.Subtract(rhs[id]);
            var     rhsResultnew = rhsResult.LinearCombination(1, stabilizingConductivityTimesTemperature[id], -timeStep);

            rhsResultnew.ScaleIntoThis(-timeStep);

            //rhsPrevious[id] = rhs[id];
            return(rhsResultnew);
        }
コード例 #3
0
        public static void CheckStaticCondensation()
        {
            double tolerance = 1E-10;

            Model model = CreateModel();
            int   id    = model.Subdomains.First().ID;

            var solver  = (new SkylineSolver.Builder()).BuildSolver(model);
            var problem = new ProblemStructural(model, solver);

            // Prepare model
            model.ConnectDataStructures();

            // Order dofs and initialize linear system
            solver.OrderDofs(true);
            ILinearSystem linearSystem = solver.LinearSystems.First().Value;

            linearSystem.Reset(); // Necessary to define the linear system's size

            // Build and assign global matrices
            (IMatrixView Kff, IMatrixView Kfc, IMatrixView Kcf, IMatrixView Kcc) =
                problem.CalculateSubMatrices(model.Subdomains.First());
            linearSystem.Matrix = Kff;

            // Static condensation: Kcondensed = Kcc - Kcf * inv(Kff) * Kfc
            Dictionary <int, Matrix> invKffTimesKfc = solver.InverseSystemMatrixTimesOtherMatrix(
                new Dictionary <int, IMatrixView>()
            {
                { id, Kfc }
            });
            IMatrixView condensedK = Kcc.Subtract(Kcf.MultiplyRight(invKffTimesKfc[id]));

            // Checks
            Assert.True(expectedCondensedK.Equals(condensedK, tolerance));
        }
コード例 #4
0
            //TODO: perhaps this should be done in Initialize(). Nope, Initialize is not called when using PCPG.
            private (IMatrixView globalStiffness, IVectorView globalForces) BuildGlobalLinearSystem()
            {
                // PcgSolver uses CSR matrices which are efficient for calculating f-K*u
                var pcgBuilder = new PcgAlgorithm.Builder();

                pcgBuilder.MaxIterationsProvider = new FixedMaxIterationsProvider(1); // No need to solve though.
                var solverBuilder = new PcgSolver.Builder();

                solverBuilder.DofOrderer   = originalDofOrderer;
                solverBuilder.PcgAlgorithm = pcgBuilder.Build();
                PcgSolver solver = solverBuilder.BuildSolver(singleSubdomainModel);

                // Let MSolve follow the usual analysis routine, to create all necessary data structures.
                IStaticProvider problemProvider = createProblemProvider(singleSubdomainModel, solver);
                var             linearAnalyzer  = new LinearAnalyzer(singleSubdomainModel, solver, problemProvider);
                var             staticAnalyzer  = new StaticAnalyzer(singleSubdomainModel, solver, problemProvider, linearAnalyzer);

                staticAnalyzer.Initialize();
                try
                {
                    staticAnalyzer.Solve();
                }
                catch (IterativeSolverNotConvergedException)
                { }

                // Extract the global matrix and rhs
                ILinearSystem linearSystem = solver.LinearSystems.First().Value;

                return(linearSystem.Matrix, linearSystem.RhsVector);
            }
コード例 #5
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, int modelNo, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = -dt(conductuvity*temperature + rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            int id = linearSystem.Subdomain.ID;

            //TODO: instead of creating a new Vector and then trying to set ILinearSystem.RhsVector, clear it and operate on it.

            // uu = a0 * v + a2 * v1 + a3 * v2
            uu[modelNo][id] = v[modelNo][id].LinearCombination(a0, v1[modelNo][id], a2);
            uu[modelNo][id].AxpyIntoThis(v2[modelNo][id], a3);

            // uc = a1 * v + a4 * v1 + a5 * v2
            uc[modelNo][id] = v[modelNo][id].LinearCombination(a1, v1[modelNo][id], a4);
            uc[modelNo][id].AxpyIntoThis(v2[modelNo][id], a5);

            uum[modelNo][id] = providers[modelNo].MassMatrixVectorProduct(linearSystem.Subdomain, uu[modelNo][id]);
            ucc[modelNo][id] = providers[modelNo].DampingMatrixVectorProduct(linearSystem.Subdomain, uc[modelNo][id]);

            IVector rhsResult = uum[modelNo][id].Add(ucc[modelNo][id]);

            if (addRhs)
            {
                rhsResult.AddIntoThis(rhs[modelNo][id]);
            }
            return(rhsResult);
        }
コード例 #6
0
        public static void CheckSubmatrices()
        {
            double tolerance = 1E-10;

            Model model = CreateModel();
            int   id    = model.Subdomains.First().ID;

            var solver  = (new SkylineSolver.Builder()).BuildSolver(model);
            var problem = new ProblemStructural(model, solver);

            // Prepare model
            model.ConnectDataStructures();

            // Order dofs and initialize linear system
            solver.OrderDofs(true);
            ILinearSystem linearSystem = solver.LinearSystems.First().Value;

            linearSystem.Reset(); // Necessary to define the linear system's size

            // Build and assign global matrices
            (IMatrixView Kff, IMatrixView Kfc, IMatrixView Kcf, IMatrixView Kcc) =
                problem.CalculateSubMatrices(model.Subdomains.First());

            // Checks
            Assert.True(expectedKff.Equals(Kff, tolerance));
            Assert.True(expectedKcf.Transpose().Equals(Kfc, tolerance));
            Assert.True(expectedKcf.Equals(Kcf, tolerance));
            Assert.True(expectedKcc.Equals(Kcc, tolerance));
        }
コード例 #7
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = (capacity/dt^2-diffusionConductivity/dt-massTransportConductivity/dt+stabilizingConductivity)*temperature - (StabilizingRhs - rhs/dt))
            // result = -dt(conductuvity*temperature - rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            int id = linearSystem.Subdomain.ID;

            double[,] kappa = new double[model.Nodes.Count, model.Nodes.Count];
            kappa[0, 0]     = 1;
            kappa[model.Nodes.Count - 1, model.Nodes.Count - 1] = 1;
            IMatrix penalty = Matrix.CreateFromArray(kappa);
            double  a0      = 1 / Math.Pow(timeStep, 2);
            double  a1      = 1 / (2 * timeStep);
            double  a2      = 1 / timeStep;

            dummyWeakImpositionTimesTemperature[id] = penalty.Multiply(temperature[id]);
            dummyWeakImpositionTimesTemperature[id].ScaleIntoThis(a2);
            capacityTimesTemperature[id] = provider.CapacityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            capacityTimesTemperature[id].ScaleIntoThis(a0);
            diffusionConductivityTimesTemperature[id] = provider.DiffusionConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            diffusionConductivityTimesTemperature[id].ScaleIntoThis(a2);
            diffusionConductivityTimesTemperature[id].AddIntoThis(dummyWeakImpositionTimesTemperature[id]);
            massTransportConductivityTimesTemperature[id] = provider.MassTransportConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            massTransportConductivityTimesTemperature[id].ScaleIntoThis(a2);
            stabilizingConductivityTimesTemperature[id] = provider.StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            rhs[id].ScaleIntoThis(a2);
            var rhsResult = capacityTimesTemperature[id].Subtract(diffusionConductivityTimesTemperature[id]);

            rhsResult.SubtractIntoThis(massTransportConductivityTimesTemperature[id].Subtract(stabilizingConductivityTimesTemperature[id]));
            rhsResult.SubtractIntoThis(stabilizingRhs[id].Subtract(rhs[id]));
            return(rhsResult);
        }
コード例 #8
0
        public IVector GetOtherRhsComponents(ILinearSystem linearSystem, IVector currentSolution)
        {
            #region old code
            //// u[id]: old solution
            //// v[id]: current solution
            //// vv: old acceleration
            //// v2: current acceleration
            //// v1: current velocity
            ////double vv = v2[id].Data[j];
            ////v2[id].Data[j] = a0 * (v[id].Data[j] - u[id].Data[j]) - a2 * v1[id].Data[j] - a3 * vv;
            ////v1[id].Data[j] += a6 * vv + a7 * v2[id].Data[j];

            //int id = subdomain.ID;
            //Vector<double> currentAcceleration = new Vector<double>(subdomain.Solution.Length);
            //Vector<double> currentVelocity = new Vector<double>(subdomain.Solution.Length);
            //Vector<double> uu = new Vector<double>(subdomain.Solution.Length);
            //Vector<double> uc = new Vector<double>(subdomain.Solution.Length);
            //for (int j = 0; j < subdomain.Rhs.Length; j++)
            //{
            //    currentAcceleration.Data[j] = a0 * (currentSolution[j] - v[id].Data[j]) - a2 * v1[id].Data[j] - a3 * v2[id].Data[j];
            //    currentVelocity.Data[j] = v1[id].Data[j] + a6 * v2[id].Data[j] + a7 * currentAcceleration.Data[j];
            //    uu.Data[j] = a0 * currentSolution[j] + a2 * currentVelocity.Data[j] + a3 * currentAcceleration.Data[j];
            //    uc.Data[j] = a1 * currentSolution[j] + a4 * currentVelocity.Data[j] + a5 * currentAcceleration.Data[j];
            //}

            //Vector<double> tempResult = new Vector<double>(subdomain.Solution.Length);
            //Vector<double> result = new Vector<double>(subdomain.Solution.Length);
            //provider.MassMatrixVectorProduct(subdomain, uu, tempResult.Data);
            //result.Add(tempResult);

            //provider.DampingMatrixVectorProduct(subdomain, uc, tempResult.Data);
            //result.Add(tempResult);

            //return result.Data;

            //Vector<double> uu = new Vector<double>(subdomain.Solution.Length);
            //Vector<double> uc = new Vector<double>(subdomain.Solution.Length);
            //int id = subdomain.ID;
            //for (int j = 0; j < subdomain.Rhs.Length; j++)
            //{
            //    uu.Data[j] = -a0 * (v[id].Data[j] - currentSolution[j]) - a2 * v1[id].Data[j] - a3 * v2[id].Data[j];
            //    uc.Data[j] = -a1 * (v[id].Data[j] - currentSolution[j]) - a4 * v1[id].Data[j] - a5 * v2[id].Data[j];
            //}
            //provider.MassMatrixVectorProduct(subdomain, uu, tempResult.Data);
            //result.Add(tempResult);
            //provider.DampingMatrixVectorProduct(subdomain, uc, tempResult.Data);
            //result.Add(tempResult);

            ////CalculateRhsImplicit(subdomain, result.Data, false);
            ////result.Scale(-1d);
            #endregion

            // result = a0 * (M * u) + a1 * (C * u)

            IVector result = providers[0].MassMatrixVectorProduct(linearSystem.Subdomain, currentSolution);
            IVector temp   = providers[0].DampingMatrixVectorProduct(linearSystem.Subdomain, currentSolution);
            result.LinearCombinationIntoThis(a0, temp, a1);
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// Calculates inertia forces and damping forces.
        /// </summary>
        public IVector GetOtherRhsComponents(ILinearSystem linearSystem, IVector currentSolution)
        {
            IVector result = provider.MassMatrixVectorProduct(linearSystem.Subdomain, currentSolution);
            IVector temp   = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, currentSolution);

            result.LinearCombinationIntoThis(a0, temp, a1);
            return(result);
        }
コード例 #10
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            int id = linearSystem.Subdomain.ID;

            capacityTimesTemperature[id]     = provider.MassMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            conductivityTimesTemperature[id] = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);

            IVector rhsResult = rhsPrevious[id].LinearCombination(1 - beta, rhs[id], beta);

            rhsResult.AxpyIntoThis(capacityTimesTemperature[id], 1 / timeStep);
            rhsResult.AxpyIntoThis(conductivityTimesTemperature[id], -(1 - beta));

            rhsPrevious[id] = rhs[id];
            return(rhsResult);
        }
コード例 #11
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?

            // result = (1-b)* rhsPrevious + beta * rhs + 1/dt * Capacity * temperature - (1-b) * Conductivity * temperature
            int id = linearSystem.Subdomain.ID;

            capacityTimesTemperature[id]     = provider.MassMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
            conductivityTimesTemperature[id] = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);

            IVector rhsResult = rhsPrevious[id].LinearCombination(1 - beta, rhs[id], beta);

            rhsResult.AxpyIntoThis(capacityTimesTemperature[id], 1 / timeStep);
            rhsResult.AxpyIntoThis(conductivityTimesTemperature[id], -(1 - beta));

            rhsPrevious[id] = rhs[id];
            return(rhsResult);
        }
コード例 #12
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?

            // result = (1-b)* rhsPrevious + beta * rhs + 1/dt * 1stOrderMatrix * unknown - (1-b) * 0thOrderMatrix * unknown
            int id = linearSystem.Subdomain.ID;

            firstOrderMatrixTimesUnknown[id]  = provider.MassMatrixVectorProduct(linearSystem.Subdomain, unknown[id]);
            zerothOrderMatrixTimesUnknown[id] = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, unknown[id]);

            IVector rhsResult = rhsPrevious[id].LinearCombination(1 - beta, rhs[id], beta);

            rhsResult.AxpyIntoThis(firstOrderMatrixTimesUnknown[id], 1 / timeStep);
            rhsResult.AxpyIntoThis(zerothOrderMatrixTimesUnknown[id], -(1 - beta));

            rhsPrevious[id] = rhs[id];
            return(rhsResult);
        }
コード例 #13
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, int modelNo, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = -dt(conductuvity*temperature + rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            int id = linearSystem.Subdomain.ID;

            firstOrderMatrixTimesUnknown[modelNo][id]  = providers[modelNo].MassMatrixVectorProduct(linearSystem.Subdomain, unknown[modelNo][id]);
            secondOrderMatrixTimesUnknown[modelNo][id] = providers[modelNo].DampingMatrixVectorProduct(linearSystem.Subdomain, unknown[modelNo][id]);

            IVector rhsResult = rhsPrevious[modelNo][id].LinearCombination(1 - beta, rhs[modelNo][id], beta);

            rhsResult.AxpyIntoThis(firstOrderMatrixTimesUnknown[modelNo][id], 1 / timeStep);
            rhsResult.AxpyIntoThis(secondOrderMatrixTimesUnknown[modelNo][id], -(1 - beta));

            rhsPrevious[modelNo][id] = rhs[modelNo][id];
            return(rhsResult);
        }
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, int modelNo, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = -dt(conductuvity*temperature + rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            int id = linearSystem.Subdomain.ID;

            conductivityTimesTemperature[modelNo][id]            = providers[modelNo].ConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[modelNo][id]);
            stabilizingConductivityTimesTemperature[modelNo][id] = providers[modelNo].StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[modelNo][id]);

            IVector rhsResult    = conductivityTimesTemperature[modelNo][id].Subtract(rhs[modelNo][id]);
            var     rhsResultnew = rhsResult.LinearCombination(1, stabilizingConductivityTimesTemperature[modelNo][id], -timeStep);

            rhsResultnew.ScaleIntoThis(-timeStep);

            //rhsPrevious[id] = rhs[id];
            return(rhsResultnew);
        }
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, int modelNo, bool addRhs)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = -dt(conductuvity*temperature + rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            double a0 = 1 / Math.Pow(timeStep, 2);
            double a1 = 1 / (2 * timeStep);
            double a2 = 1 / timeStep;
            int    id = linearSystem.Subdomain.ID;

            capacityTimesTemperature[modelNo][id] = providers[modelNo].CapacityMatrixVectorProduct(linearSystem.Subdomain, temperature[modelNo][id]);
            capacityTimesTemperature[modelNo][id].ScaleIntoThis(a0);
            rhs[modelNo][id].ScaleIntoThis(a2);
            var rhsResult = capacityTimesTemperature[modelNo][id].Subtract(stabilizingRhs[modelNo][id]);

            rhsResult.AddIntoThis(rhs[modelNo][id]);

            return(rhsResult);
        }
コード例 #16
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, int ti)
        {
            //TODO: what is the meaning of addRhs? Do we need this when solving dynamic thermal equations?
            //TODO: stabilizingRhs has not been implemented

            // result = (capacity/dt^2-diffusionConductivity/dt-massTransportConductivity/dt+stabilizingConductivity)*temperature - (StabilizingRhs - rhs/dt))
            // result = -dt(conductuvity*temperature - rhs -dt(stabilizingConductivity*temperature + StabilizingRhs))
            int    id = linearSystem.Subdomain.ID;
            double a0 = 1 / Math.Pow(timeStep, 2);
            double a1 = 1 / (2 * timeStep);
            double a2 = 1 / timeStep;

            if (timeIncrement < BDForder - 1)
            {
                capacityTimesTemperature[id] = provider.CapacityMatrixVectorProduct(linearSystem.Subdomain, temperature[BDForder][id]);
                capacityTimesTemperature[id].ScaleIntoThis(a0);
                //stabilizingConductivityTimesTemperature[id] = provider.StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
                rhs[id].ScaleIntoThis(a2);
                var rhsResult = capacityTimesTemperature[id].Subtract(stabilizingRhs[id]);
                rhsResult.AddIntoThis(rhs[id]);
                return(rhsResult);
            }
            else
            {
                effectiveTemperature[id].Clear();
                for (int i = 0; i < BDForder; i++)
                {
                    var a = temperature[i][id].Scale(BDFcoeff[BDForder - 1, i]);
                    effectiveTemperature[id].AddIntoThis(a);
                }
                capacityTimesTemperature[id] = provider.CapacityMatrixVectorProduct(linearSystem.Subdomain, effectiveTemperature[id]);
                capacityTimesTemperature[id].ScaleIntoThis(-a0);
                //stabilizingConductivityTimesTemperature[id] = provider.StabilizingConductivityMatrixVectorProduct(linearSystem.Subdomain, temperature[id]);
                var rhsLoads = rhs[id].LinearCombination(a2, stabilizingRhs[id], 1);
                rhsLoads.ScaleIntoThis(BDFcoeff[BDForder - 1, BDForder + 1]);
                var rhsResult = capacityTimesTemperature[id].Add(rhsLoads);
                return(rhsResult);
            }
        }
コード例 #17
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            int id = linearSystem.Subdomain.ID;

            uu[id] = v[id].LinearCombination(a0, v1[id], a2);
            uu[id].AxpyIntoThis(v2[id], a3);

            uc[id] = v[id].LinearCombination(a1, v1[id], a4);
            uc[id].AxpyIntoThis(v2[id], a5);

            uum[id] = provider.MassMatrixVectorProduct(linearSystem.Subdomain, uu[id]);
            ucc[id] = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, uc[id]);

            IVector rhsResult = uum[id].Add(ucc[id]);

            if (addRhs)
            {
                rhsResult.AddIntoThis(rhs[id]);
            }

            return(rhsResult);
        }
コード例 #18
0
        private IVector CalculateRhsImplicit(ILinearSystem linearSystem, bool addRhs)
        {
            //TODO: instead of creating a new Vector and then trying to set ILinearSystem.RhsVector, clear it and operate on it.
            int id = linearSystem.Subdomain.ID;

            // uu = a0 * v + a2 * v1 + a3 * v2
            uu[id] = v[id].LinearCombination(a0, v1[id], a2);
            uu[id].AxpyIntoThis(v2[id], a3);

            // uc = a1 * v + a4 * v1 + a5 * v2
            uc[id] = v[id].LinearCombination(a1, v1[id], a4);
            uc[id].AxpyIntoThis(v2[id], a5);

            uum[id] = provider.MassMatrixVectorProduct(linearSystem.Subdomain, uu[id]);
            ucc[id] = provider.DampingMatrixVectorProduct(linearSystem.Subdomain, uc[id]);

            IVector rhsResult = uum[id].Add(ucc[id]);

            if (addRhs)
            {
                rhsResult.AddIntoThis(rhs[id]);
            }
            return(rhsResult);
        }
コード例 #19
0
 public IVector GetOtherRhsComponents(ILinearSystem linearSystem, IVector currentSolution)
 {
     //TODO: use a ZeroVector class that avoid doing useless operations or refactor this method. E.g. let this method
     // alter the child analyzer's rhs vector, instead of the opposite (which is currently done).
     return(linearSystem.CreateZeroVector());
 }
コード例 #20
0
 /// <summary>
 /// Calculates inertia forces.
 /// </summary>
 public IVector GetOtherRhsComponents(ILinearSystem linearSystem, IVector currentSolution)
 {
     return(provider.MassMatrixVectorProduct(linearSystem.Subdomain, currentSolution));
 }
コード例 #21
0
 public NEUWriter(Model model, ILinearSystem subdomain)
 {
     this.model     = model;
     this.subdomain = subdomain;
 }
コード例 #22
0
 public Rod2DResults(Subdomain subdomain, ILinearSystem linearSystem)
 {
     this.subdomain    = subdomain;
     this.linearSystem = linearSystem;
 }
コード例 #23
0
 /// <summary>
 /// Calculates other components of the right-hand-side vector
 /// </summary>
 public IVector GetOtherRhsComponents(ILinearSystem linearSystem, IVector currentSolution)
 {
     return(linearSystem.CreateZeroVector());
 }