當前位置: 首頁>>代碼示例>>Python>>正文


Python TimeStepping.newtonSolve方法代碼示例

本文整理匯總了Python中siconos.kernel.TimeStepping.newtonSolve方法的典型用法代碼示例。如果您正苦於以下問題:Python TimeStepping.newtonSolve方法的具體用法?Python TimeStepping.newtonSolve怎麽用?Python TimeStepping.newtonSolve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在siconos.kernel.TimeStepping的用法示例。


在下文中一共展示了TimeStepping.newtonSolve方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: empty

# 需要導入模塊: from siconos.kernel import TimeStepping [as 別名]
# 或者: from siconos.kernel.TimeStepping import newtonSolve [as 別名]
s.setComputeResiduY(True)
s.setComputeResiduR(True)

filippov.initialize(s);

# matrix to save data
dataPlot = empty((N+1,5))
control = empty((N+1,))
dataPlot[0, 0] = t0
dataPlot[0, 1:3] = process.x()
dataPlot[0, 3] = myProcessInteraction.lambda_(0)[0]
dataPlot[0, 4] = myProcessInteraction.lambda_(0)[1]
# time loop
k = 1
while(s.hasNextEvent()):
     s.newtonSolve(1e-14, 30)
     dataPlot[k, 0] = s.nextTime()
     dataPlot[k, 1] = process.x()[0]
     dataPlot[k, 2] = process.x()[1]
     dataPlot[k, 3] = myProcessInteraction.lambda_(0)[0]
     dataPlot[k, 4] = myProcessInteraction.lambda_(0)[1]
     control[k] = process.r()[1]
     k += 1
     s.nextStep()
     #print s.nextTime()

# save to disk
np.savetxt('output.txt', dataPlot)
# plot interesting stuff
plt.subplot(411)
plt.title('s')
開發者ID:fperignon,項目名稱:siconos,代碼行數:33,代碼來源:ZhuravlevTwisting.py

示例2: empty

# 需要導入模塊: from siconos.kernel import TimeStepping [as 別名]
# 或者: from siconos.kernel.TimeStepping import newtonSolve [as 別名]
s.insertNonSmoothProblem(osnspb)
s.setComputeResiduY(True)
s.setComputeResiduR(True)

filippov.initialize(s);

# matrix to save data
dataPlot = empty((N+1,5))
dataPlot[0, 0] = t0
dataPlot[0, 1:3] = process.x()
dataPlot[0, 3] = myProcessInteraction.lambda_(0)[0]
dataPlot[0, 4] = myProcessInteraction.lambda_(0)[1]
# time loop
k = 1
while(s.hasNextEvent()):
     s.newtonSolve(1e-12, 40)
     dataPlot[k, 0] = s.nextTime()
     dataPlot[k, 1] = process.x()[0]
     dataPlot[k, 2] = process.x()[1]
     dataPlot[k, 3] = myProcessInteraction.lambda_(0)[0]
     dataPlot[k, 4] = myProcessInteraction.lambda_(0)[1]
     k += 1
     s.nextStep()
     #print s.nextTime()

# save to disk
savetxt('output.txt', dataPlot)
# plot interesting stuff
subplot(411)
title('s')
plot(dataPlot[:,0], dataPlot[:,1])
開發者ID:fperignon,項目名稱:siconos,代碼行數:33,代碼來源:Zhuravlev.py


注:本文中的siconos.kernel.TimeStepping.newtonSolve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。