当前位置: 首页>>代码示例>>Python>>正文


Python CuIBMSimulation.read_fluxes方法代码示例

本文整理汇总了Python中snake.cuibm.simulation.CuIBMSimulation.read_fluxes方法的典型用法代码示例。如果您正苦于以下问题:Python CuIBMSimulation.read_fluxes方法的具体用法?Python CuIBMSimulation.read_fluxes怎么用?Python CuIBMSimulation.read_fluxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在snake.cuibm.simulation.CuIBMSimulation的用法示例。


在下文中一共展示了CuIBMSimulation.read_fluxes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CuIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import read_fluxes [as 别名]
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()
  p = simu.read_pressure(time_step)
开发者ID:barbagroup,项目名称:snake-repro,代码行数:32,代码来源:plotIterativeErrors.py

示例2: zip

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import read_fluxes [as 别名]
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(
            observed_order_of_convergence(fx[0], fx[1], fx[2], refinement_ratio)
        )
开发者ID:barbagroup,项目名称:snake-repro,代码行数:33,代码来源:getTemporalConvergence.py


注:本文中的snake.cuibm.simulation.CuIBMSimulation.read_fluxes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。