本文整理汇总了Python中snake.cuibm.simulation.CuIBMSimulation.get_time_steps方法的典型用法代码示例。如果您正苦于以下问题:Python CuIBMSimulation.get_time_steps方法的具体用法?Python CuIBMSimulation.get_time_steps怎么用?Python CuIBMSimulation.get_time_steps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snake.cuibm.simulation.CuIBMSimulation
的用法示例。
在下文中一共展示了CuIBMSimulation.get_time_steps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CuIBMSimulation
# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_time_steps [as 别名]
"""
Computes, plots, and saves the 2D vorticity field from a cuIBM simulation at
saved time-steps.
"""
from snake.cuibm.simulation import CuIBMSimulation
simulation = CuIBMSimulation()
simulation.read_grid()
for time_step in simulation.get_time_steps():
simulation.read_fields('vorticity', time_step)
simulation.plot_contour('vorticity',
field_range=(-5.0, 5.0, 101),
view=(-1.0, -5.0, 15.0, 5.0),
cmap='viridis',
style='seaborn-dark',
width=8.0)
示例2: CuIBMSimulation
# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_time_steps [as 别名]
import os
from matplotlib import pyplot
from snake.cuibm.simulation import CuIBMSimulation
from snake.solutions.ghiaEtAl1982 import GhiaEtAl1982
directory = os.getcwd()
# Reads the velocity fields from files.
simulation = CuIBMSimulation(directory=directory,
description='cuIBM')
simulation.read_grid(file_path=os.path.join(directory, 'grid'))
time_step = simulation.get_time_steps()[-1]
simulation.read_fields(['x-velocity', 'y-velocity'], time_step)
# Grabs the mid-cavity velocity values.
y, u = simulation.fields['x-velocity'].get_vertical_gridline_values(0.5)
x, v = simulation.fields['y-velocity'].get_horizontal_gridline_values(0.5)
# Gets the centerline velocities at Re=100 reported in Ghia et al. (1982).
file_path = os.path.join(os.environ['CUIBM_DIR'],
'data',
'ghia_et_al_1982_lid_driven_cavity.dat')
ghia = GhiaEtAl1982(file_path=file_path, Re=100)
# Plots the instantaneous drag coefficients.
images_directory = os.path.join(directory, 'images')
if not os.path.isdir(images_directory):
os.makedirs(images_directory)