Ejemplo n.º 1
0
        /// <summary>
        /// ヤコビ行列を返します。
        /// </summary>
        /// <returns></returns>
        public DoubleSparseMatrix GetA()
        {
            var       sizeOfBlock   = _fem.NumberOfNodes;
            var       capacity      = _fem.MaxNodesPerRow;
            const int numberOfBlock = 2;
            var       J             = new DoubleSparseMatrix(numberOfBlock * sizeOfBlock, numberOfBlock * sizeOfBlock, numberOfBlock * capacity);
            var       electron      = _manager.GetParticle(Species.Electron);
            var       positive      = _manager.GetParticle(Species.Positive);
            var       elements      = _fem.Elements;

            // J11...
            var J11 = Assembler(electron);
            var rhs = _manager.GetRHSPoissonEqn();

            J.Insert(J11, 0 * sizeOfBlock, 0 * sizeOfBlock);
            // J12
            var J12r = new DoubleSparseMatrix(sizeOfBlock, sizeOfBlock, capacity);
            var J12s = new DoubleSparseMatrix(sizeOfBlock, sizeOfBlock, capacity);

            AssembleBoundaryIntegralSecondaryEmission(J12r, d => GetVelocity(positive, d));
            J.Insert(J12s - J12r, 0 * sizeOfBlock, 1 * sizeOfBlock);
            // J21
            var J21s = new DoubleSparseMatrix(sizeOfBlock, capacity);

            AssembleSourceMatrix(J21s, d => GetVelocity(positive, d), positive.GetDiffusion(), positive.GetSourceDerivative(Species.Electron));
            var J21r = new DoubleSparseMatrix(sizeOfBlock, capacity);

            J.Insert(J21s - J21r, 1 * sizeOfBlock, 0 * sizeOfBlock);
            // J22
            var J22 = Assembler(positive);

            J.Insert(J22, 1 * sizeOfBlock, 1 * sizeOfBlock);
            return(J);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 質量行列を返します。
        /// </summary>
        public DoubleSparseMatrix GetM()
        {
            var n  = _fem.NumberOfNodes;
            var m  = _fem.MaxNodesPerRow;
            var M  = new DoubleSparseMatrix(2 * n, 2 * m);
            var Mg = new DoubleSparseMatrix(n, m);
            var e  = _manager.GetParticle(Species.Electron);

            AssembleMassMatrix(Mg, d => GetVelocity(e, d), e.GetDiffusion());
            M.Insert(Mg, 0 * n, 0 * n);
            Mg.Clear();
            var p = p_manager.GetParticle(Species.Positive);

            AssembleMassMatrix(Mg, d => GetVelocity(p, d), p.GetDiffusion());
            M.Insert(Mg, 1 * n, 1 * n);
            return(M);
        }