本文整理汇总了Python中snake.cuibm.simulation.CuIBMSimulation.read_pressure方法的典型用法代码示例。如果您正苦于以下问题:Python CuIBMSimulation.read_pressure方法的具体用法?Python CuIBMSimulation.read_pressure怎么用?Python CuIBMSimulation.read_pressure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snake.cuibm.simulation.CuIBMSimulation
的用法示例。
在下文中一共展示了CuIBMSimulation.read_pressure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CuIBMSimulation
# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import read_pressure [as 别名]
'you are using snake-{}'.format(snake.__version__))
atol_min, atol_max = 5, 16
time_step = 1500
main_directory = os.path.dirname(__file__)
reference_directory = os.path.join(main_directory,
'atol16')
reference = CuIBMSimulation(directory=reference_directory,
description='atol=1.0E-16')
reference.read_forces()
fx_reference = reference.forces[0].values[-1]
fy_reference = reference.forces[1].values[-1]
reference.read_grid()
p_reference = reference.read_pressure(time_step)
qx_reference, qy_reference = reference.read_fluxes(time_step)
fx_errors, fy_errors = [], []
p_errors = []
qx_errors, qy_errors = [], []
for atol in range(atol_min, atol_max):
directory = os.path.join(main_directory,
'atol{}'.format(atol))
simu = CuIBMSimulation(directory=directory,
description='1.0E-{}'.format(atol))
simu.read_forces()
fx = simu.forces[0].values[-1]
fy = simu.forces[1].values[-1]
simu.read_grid()
示例2: zip
# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import read_pressure [as 别名]
refinement_ratio = 2.0
fx, fy = [], []
p = []
qx, qy = [], []
main_directory = os.path.dirname(__file__)
for time_increment, final_time_step in zip(time_increments, final_time_steps):
directory = os.path.join(main_directory, time_increment.replace("=", ""))
simu = CuIBMSimulation(directory=directory, description=time_increment)
simu.read_forces()
fx.append(simu.forces[0].values[-1])
fy.append(simu.forces[1].values[-1])
simu.read_grid()
p_simu = simu.read_pressure(final_time_step)
p.append(p_simu.values)
qx_simu, qy_simu = simu.read_fluxes(final_time_step)
qx.append(qx_simu.values)
qy.append(qy_simu.values)
file_path = os.path.join(os.path.dirname(__file__), "temporalConvergence.txt")
with open(file_path, "w") as outfile:
outfile.write("\n* Drag force:\n")
outfile.write("Value and relative difference with the reference value (smallest dt)\n")
outfile.write("\t{}: {}\n".format(time_increments[0], fx[0]))
for i in (1, 2):
outfile.write("\t{}: {} ({}%)\n".format(time_increments[i], fx[i], (fx[i] - fx[0]) / fx[0] * 100.0))
outfile.write(
"Observed order of convergence: {}\n".format(