本文整理匯總了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')
示例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])