• 締切済み

一次元静電粒子コードについて・・(つづき1)

' 粒子の運動 For IP = 1 To NPT XNM = X(IP) / DX + 0.5:IXP = Int(XNM):IXM1 = IXP - 1 If IXM1 <= 0 Then IXM1 = IM - 1 - IXM1: B = XNM - IXP If IXP = 0 Then IXP = IM - 1:EP = E(IXP) * B + E(IXM1) * (1 - B) V(IP) = V(IP)-EP * DT: X(IP) = X(IP) + V(IP) * DT If X(IP) > XMAX Then X(IP) = X(IP) - XMAX If X(IP) < 0 Then X(IP) = XMAX + X(IP) Next IP ' 電荷密度の計算 For I = 1 To IM - 1 RO(I) = -1 Next I For IP = 1 To NPT XNM = X(IP) / DX:IXP = Int(XNM) B = XNM - IXP :If IXP = 0 Then IXP = IM - 1 IXP1 = IXP + 1 :If IXP1 = IM Then IXP1 = 1 RO(IXP) = RO(IXP) + PW * (1 - B):RO(IXP1) = RO(IXP1) + PW * B Next IP RO(IM) = RO(1) For I = 1 To IM - 1 RO(I) = RO(I) * DX * DX Next I ' 静電ポテンシャルの計算 For I = 2 To IM - 1 A(I, 1) = 1:A(I, 2) = -2:A(I, 3) = 1:A(I, 4) = RO(I) Next I A(1, 4) = 0 :A(1, 2) = 1:A(IM, 4) = 0:A(IM, 2) = 1:BO = -2 ' -------ガウスの消去法------- '前進消去法 NN = 1:N = IM:NNP1 = NN + 1:NN2 = 2 * NNP1 For I = 1 To N - 1 For J = NN2 To NNP1 Step -1 A(I, J) = A(I, J) / A(I, NNP1) Next J IPNN = I + NN:If IPNN > N Then IPNN = N For L = I + 1 To IPNN For K = NNP1 + I - L + 1 To 2 * NN + 1 + I - L A(L, K) = A(L, K) - A(I, K + L - I) * A(L, NNP1 + I - L) Next K A(L, NN2) = A(L, NN2) - A(I, NN2) * A(L, NNP1 + I - L) Next L Next I つづく 関連URL:http://www.okweb.ne.jp/kotaeru.php3?q=449543

みんなの回答

回答No.1

管理者より: 続きの質問があるのでそちらをご参照下さい

参考URL:
http://www.okweb.ne.jp/kotaeru.php3?q=449556

関連するQ&A