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


Python CuIBMSimulation.get_mean_forces方法代码示例

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


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

示例1: CuIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]
cd_original = 2.0*simulation.forces[0].mean['value']
cl_original = 2.0*simulation.forces[1].mean['value']

# Computes the mean coefficients from the cuIBM simulations
# reported in Krishnan et al. (2014).
# The force coefficients are averaged between 32 and 64 time-units.
cd_krishnan, cl_krishnan = [], []
for re in ['Re1000', 'Re2000']:
  for aoa in ['AoA25', 'AoA30', 'AoA35', 'AoA40']:
    simulation_directory = os.path.join(os.environ['SNAKE'],
                                        'resources',
                                        'flyingSnake2d_cuibm_anush',
                                        'flyingSnake2d'+re+aoa)
    krishnan = CuIBMSimulation(directory=simulation_directory)
    krishnan.read_forces()
    krishnan.get_mean_forces(limits=[32.0, 64.0])
    cd_krishnan.append(2.0*krishnan.forces[0].mean['value'])
    cl_krishnan.append(2.0*krishnan.forces[1].mean['value'])


# plot figure
aoa  = [25, 30, 35, 40]
pyplot.style.use(os.path.join(os.environ['SNAKE'], 
                              'snake', 
                              'styles', 
                              'snakeReproducibility.mplstyle'))
fig = pyplot.figure(figsize=(6, 8))
gs = gridspec.GridSpec(3, 2, 
                       height_ratios=[1, 1, 0.5])
ax1 = pyplot.subplot(gs[0, :])
ax2 = pyplot.subplot(gs[1, :])
开发者ID:barbagroup,项目名称:snake-repro,代码行数:33,代码来源:plotForceCoefficientsVsAoA.py

示例2: CuIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]
published into Krishnan et al., 2014).

This script reads the forces, computes the mean forces within a given range,
computes the Strouhal number within a range, plots the force coefficients,
saves the figure, and prints a data-frame that contains the mean values.
"""

import os

from snake.cuibm.simulation import CuIBMSimulation


simulation = CuIBMSimulation(description='present')
simulation.read_forces()
time_limits = (32.0, 64.0)
simulation.get_mean_forces(limits=time_limits)
simulation.get_strouhal(limits=time_limits, order=200)

krishnan = CuIBMSimulation(description='Krishnan et al. (2014)')
filepath = os.path.join(os.environ['SNAKE'],
                        'resources',
                        'flyingSnake2d_cuibm_anush',
                        'flyingSnake2dRe2000AoA35',
                        'forces')
krishnan.read_forces(file_path=filepath)
krishnan.get_mean_forces(limits=time_limits)
krishnan.get_strouhal(limits=time_limits, order=200)

simulation.plot_forces(display_coefficients=True,
                       coefficient=2.0,
                       display_extrema=True, order=200,
开发者ID:barbagroup,项目名称:cuIBM,代码行数:33,代码来源:plotForceCoefficientsCompareKrishnanEtAl2014.py

示例3: CuIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]

if snake.__version__ != '0.1.2':
  warnings.warn('The figures were originally created with snake-0.1.2, '+
                'you are using snake-{}'.format(snake.__version__))

# Computes the mean force coefficients from the cuIBM simulation
# with grid-spacing h=0.006 in the uniform region and atol=1.0E-06 for the 
# Poisson solver.
# The force coefficients are averaged between 32 and 64 time-units.
simulation_directory = os.path.join(os.path.dirname(__file__), 
                                    'h0.006_vatol16_patol6_dt0.0002')
simulation = CuIBMSimulation(description='atol=1.0E-06',
                             directory=simulation_directory)
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])

# Computes the mean force coefficients from the cuIBM simulation
# with grid-spacing h=0.006 in the uniform region and atol=1.0E-08 for the 
# Poisson solver.
# The force coefficients are averaged between 32 and 64 time-units.
simulation_directory = os.path.join(os.path.dirname(__file__), 
                                    'h0.006_vatol16_patol8_dt0.0002')
simulation2 = CuIBMSimulation(description='atol=1.0E-08',
                              directory=simulation_directory)
simulation2.read_forces()
simulation2.get_mean_forces(limits=[32.0, 64.0])

# Creates a table with the time-averaged force coefficients.
dataframe = simulation.create_dataframe_forces(display_coefficients=True,
                                               coefficient=2.0)
开发者ID:barbagroup,项目名称:snake-repro,代码行数:32,代码来源:plotForceCoefficientsCompareATol2.py

示例4: PetIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]

simulation = PetIBMSimulation(description='PetIBM')
simulation.read_forces()
time_limits = (32.0, 64.0)
simulation.get_mean_forces(limits=time_limits)
simulation.get_strouhal(limits=time_limits, order=200)

krishnan = CuIBMSimulation(description='Krishnan et al. (2014)')
filepath = os.path.join(os.environ['SNAKE'],
                        'resources',
                        'flyingSnake2d_cuibm_anush',
                        'flyingSnake2dRe2000AoA35',
                        'forces')
krishnan.read_forces(file_path=filepath)
krishnan.get_mean_forces(limits=time_limits)
krishnan.get_strouhal(limits=time_limits, order=200)

simulation.plot_forces(display_coefficients=True,
                       coefficient=2.0,
                       display_extrema=True, order=200,
                       limits=(0.0, 80.0, 0.0, 3.0),
                       other_simulations=krishnan,
                       other_coefficients=2.0,
                       style='mesnardo',
                       save_name='forceCoefficientsCompareKrishnanEtAl2014')

dataframe = simulation.create_dataframe_forces(display_strouhal=True,
                                               display_coefficients=True,
                                               coefficient=2.0)
dataframe2 = krishnan.create_dataframe_forces(display_strouhal=True,
开发者ID:barbagroup,项目名称:cuIBM,代码行数:32,代码来源:plotForceCoefficientsCompareKrishnanEtAl2014.py

示例5: print

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]
import snake
from snake.cuibm.simulation import CuIBMSimulation


print('\nPython version:\n{}'.format(sys.version))
print('\nsnake version: {}\n'.format(snake.__version__))

simulation = CuIBMSimulation(description='cuIBM (current) - CUSP-0.4.0',
                             directory=os.path.join(os.environ['HOME'],
                                                    'snakeReproducibilityPackages',
                                                    'cuibm',
                                                    'current',
                                                    'cusp040',
                                                    'Re2000AoA35'))
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])
simulation.get_strouhal(limits=[32.0, 64.0], order=200)

other = CuIBMSimulation(description='cuIBM (current) - CUSP-0.5.1',
                        directory=os.path.join(os.environ['HOME'],
                                                    'snakeReproducibilityPackages',
                                                    'cuibm',
                                                    'current',
                                                    'cusp051',
                                                    'Re2000AoA35'))
other.read_forces()
other.get_mean_forces(limits=[32.0, 64.0])
other.get_strouhal(limits=[32.0, 64.0], order=200)

revision86 = CuIBMSimulation(description='cuIBM (old) - CUSP-0.4.0',
                             directory=os.path.join(os.environ['HOME'],
开发者ID:pfsq,项目名称:snake-repro,代码行数:33,代码来源:plotForceCoefficientsRe2000AoA35CurrentRevision86.py

示例6: CuIBMSimulation

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]
if snake.__version__ != '0.1.2':
  warnings.warn('The figures were originally created with snake-0.1.2, '+
                'you are using snake-{}'.format(snake.__version__))


cases = []
fx, fy = [], []
resolutions = ['h=0.00267', 'h=0.004', 'h=0.006']
time_limits = (20.0, 28.0)

for resolution in resolutions:
  case = CuIBMSimulation(directory=os.path.join(os.path.dirname(__file__),
                                                resolution.replace('=', '')),
                         description=resolution)
  case.read_forces()
  case.get_mean_forces(limits=time_limits)
  fx.append(case.forces[0].mean['value'])
  fy.append(case.forces[1].mean['value'])
  cases.append(case)

# Calculates the observed order of convergence for the time-averaged force
# coefficients.
ratio = 1.5
order = numpy.log((fx[2]-fx[1])/(fx[1]-fx[0]))/numpy.log(ratio)
print(order)
order = numpy.log((fy[2]-fy[1])/(fy[1]-fy[0]))/numpy.log(ratio)
print(order)

# Plots the instantaneous force coefficients obtained with different meshes.
fig, ax = pyplot.subplots(figsize=(6, 4))
ax.grid(True, zorder=0)
开发者ID:barbagroup,项目名称:snake-repro,代码行数:33,代码来源:plotForceCoefficients.py

示例7: open

# 需要导入模块: from snake.cuibm.simulation import CuIBMSimulation [as 别名]
# 或者: from snake.cuibm.simulation.CuIBMSimulation import get_mean_forces [as 别名]
                    type=str, 
                    default=script_directory, 
                    help='directory where to save the figures')
args = parser.parse_args()
with open(args.map, 'r') as infile:
  dirs = yaml.load(infile)


# Plots the instantaneous force coefficients at Re=1000 and AoA=35deg
# using a current version of cuIBM with CUSP-0.5.1
# and compares to the results reported in Krishnan et al. (2014).
simulation_directory = dirs['cuibm-current-cusp051']['Re1000AoA35']
simulation = CuIBMSimulation(description='cuIBM (current) - cusp-0.5.1',
                             directory=simulation_directory)
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])
simulation.get_strouhal(limits=[32.0, 64.0], order=200)

krishnan = CuIBMSimulation(description='Krishnan et al. (2014)')
krishnan.read_forces(file_path=os.path.join(os.environ['SNAKE'],
                                            'resources',
                                            'flyingSnake2d_cuibm_anush',
                                            'flyingSnake2dRe1000AoA35',
                                            'forces'))
krishnan.get_mean_forces(limits=[32.0, 64.0])
krishnan.get_strouhal(limits=[32.0, 64.0], order=200)

dataframe = simulation.create_dataframe_forces(display_strouhal=True,
                                               display_coefficients=True,
                                               coefficient=2.0)
dataframe2 = krishnan.create_dataframe_forces(display_strouhal=True,
开发者ID:barbagroup,项目名称:snake-repro,代码行数:33,代码来源:plotForceCoefficients.py


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