本文整理匯總了Python中Problem.Problem.get_drag_force方法的典型用法代碼示例。如果您正苦於以下問題:Python Problem.get_drag_force方法的具體用法?Python Problem.get_drag_force怎麽用?Python Problem.get_drag_force使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Problem.Problem
的用法示例。
在下文中一共展示了Problem.get_drag_force方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: int
# 需要導入模塊: from Problem import Problem [as 別名]
# 或者: from Problem.Problem import get_drag_force [as 別名]
from scitools.std import plot
from numpy import linspace, array, zeros
import sys
v0 = 0
T = 100
dt = 0.01
N = int(T/float(dt))
parameters = read_file(sys.argv[1:])
problem = Problem(parameters)
problem.set_initial_condition(v0);
c = Solver(problem)
c.set_timestep(dt)
v = c.solve(T)
v = array(v)
F_d = zeros(N)
for i in range(N):
F_d[i] = problem.get_drag_force(v[i])
F_g = zeros(N) + problem.get_gravity_force()
F_b = zeros(N) + problem.get_buoyancy_force()
time = linspace(0,dt*N,N);
plot(time,F_d,time,F_g,time,F_b, legend=['drag','gravity','buoyancy'])
raw_input()