本文整理汇总了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])