/// <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); }
/// <summary> /// グローバル行列を組み立てます。 /// </summary> private DoubleSparseMatrix Assembler(Particle part) { _S.Clear(); _K.Clear(); _A.Clear(); _D.Clear(); Func <Axis, DoubleDenseMatrix> func = d => GetVelocity(part, d); var elements = _fem.Elements; var diff = part.GetDiffusion(); AssembleDiffusionMatrix(_D, func, diff); AssembleAdvectionMatrix(_A, func, diff); AssembleBoundaryIntegralMatrix(_K, func); AssembleSourceMatrix(_S, func, diff, part.GetSourceDerivative(part.Spcs) - NablaVelocityFactory(part)); var J = -_D + _S - _A + _K; return(J); }