Exemplo n.º 1
0
#              and compares to results from Krishnan et al. (2014).

import os
import sys

from matplotlib import pyplot

import snake
from snake.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation

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

simulation = IBAMRSimulation(
    description='IBAMR',
    directory=os.path.join(os.environ['HOME'], 'snakeReproducibilityPackages',
                           'ibamr', 'bodyMarkers', 'Re2000AoA30'))
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',
    'flyingSnake2dRe2000AoA30', '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)
Exemplo n.º 2
0
"""
Plots the 2D velocity magnitude from a IBAMR simulation at saved time-steps
using the visualization software VisIt.
"""

from snake.ibamr.simulation import IBAMRSimulation

simulation = IBAMRSimulation()

body_name = 'flyingSnake2dAoA35ds004filledInside'  # file name (no extension)
simulation.plot_field_contours_visit('velocity-magnitude', (0.0, 2.0),
                                     body=body_name,
                                     solution_folder='numericalSolution',
                                     view=(-0.75, -1.0, 1.50, 1.0),
                                     width=800)
Exemplo n.º 3
0
# file: plotVorticitySnake.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D vorticity field near the snake.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

simulation.plot_field_contours_visit(
    "vorticity",
    (-5.0, 5.0),
    body="flyingSnake2dAoA35ds004filledInside",
    solution_folder="numericalSolution",
    view=(-0.75, -1.0, 1.50, 1.0),
    width=800,
)
Exemplo n.º 4
0
# file: plotForceCoefficients.py
# author: Olivier Mesnard ([email protected])
# description: Plots the instantaneous force coefficients.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])
simulation.get_strouhal(limits=[32.0, 64.0], 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),
                       save_name='forceCoefficients')
simulation.plot_forces(display_coefficients=True,
                       coefficient=-2.0,
                       display_extrema=True, order=200,
                       limits=(0.0, 100.0, 0.0, 3.0),
                       save_name='forceCoefficientsExtended')
dataframe = simulation.create_dataframe_forces(display_strouhal=True,
                                               display_coefficients=True,
                                               coefficient=-2.0)
print(dataframe)
Exemplo n.º 5
0
# compute mean coefficients of each IBAMR simulations with boundary markers
cd_boundary, cl_boundary = [], []
directory = os.path.join(os.environ['HOME'], 'simulations_IBAMR',
                         'flyingSnake2d', 'discretizedBoundary')
folders = [
    'flyingSnake2dRe1000AoA25_20150717', 'flyingSnake2dRe1000AoA30_20150717',
    'flyingSnake2dRe1000AoA35_stabilized_20150907',
    'flyingSnake2dRe1000AoA40_20150717',
    'flyingSnake2dRe2000AoA25_stabilized_20150728',
    'flyingSnake2dRe2000AoA30_stabilized_20150907',
    'flyingSnake2dRe2000AoA35_stabilized_20150727',
    'flyingSnake2dRe2000AoA40_stabilized_20150907'
]
for folder in folders:
    simulation = IBAMRSimulation(directory=os.path.join(directory, folder))
    simulation.read_forces()
    simulation.get_mean_forces(limits=[32.0, 64.0])
    cd_boundary.append(-2.0 * simulation.forces[0].mean['value'])
    cl_boundary.append(-2.0 * simulation.forces[1].mean['value'])

# compute mean coefficients of each IBAMR simulations with body markers
cd_body, cl_body = [], []
directory = os.path.join(os.environ['HOME'], 'simulations_IBAMR',
                         'flyingSnake2d', 'discretizedBody')
folders = [
    'flyingSnake2dRe1000AoA25_20151123', 'flyingSnake2dRe1000AoA30_20151123',
    'flyingSnake2dRe1000AoA35_20151123', 'flyingSnake2dRe1000AoA40_20151123',
    'flyingSnake2dRe2000AoA25_20151119', 'flyingSnake2dRe2000AoA30_20151123',
    'flyingSnake2dRe2000AoA35_20151115', 'flyingSnake2dRe2000AoA40_20151123'
]
Exemplo n.º 6
0
#              and saves it as .png and .pdf files.


import os
import shutil

from snake.ibamr.simulation import IBAMRSimulation


simulation_directory = os.path.join(os.environ['HOME'],
                                    'simulations_IBAMR',
                                    'flyingSnake2d',
                                    'discretizedBoundary',
                                    'flyingSnake2dRe2000AoA35_20150717')

simulation = IBAMRSimulation(directory=simulation_directory)

simulation.plot_field_contours_visit('vorticity', (-5.0, 5.0),
                                     body='flyingSnake2dAoA35ds004',
                                     solution_folder='numericalSolution',
                                     view=(-2.0, -5.0, 15.0, 5.0),
                                     width=600,
                                     states=(56, 57, 1))

file_path_source = os.path.join(simulation.directory, 
                               'images', 
                               'vorticity_-2.00_-5.00_15.00_5.00',
                               'vorticity0000056.png')
# copy .png file here
file_name_destination = 'ibamr_vorticity56Re2000AoA35_zeroGradientOutlet.png'
shutil.copy(file_path_source, file_name_destination)
Exemplo n.º 7
0
# file: plotVorticity.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D vorticity field
#              and saves it as .png and .pdf files.

import os
import shutil

from snake.ibamr.simulation import IBAMRSimulation

simulation_directory = os.path.join(os.environ['HOME'], 'simulations_IBAMR',
                                    'flyingSnake2d', 'discretizedBoundary',
                                    'flyingSnake2dRe2000AoA35_20150717')

simulation = IBAMRSimulation(directory=simulation_directory)

simulation.plot_field_contours_visit('vorticity', (-5.0, 5.0),
                                     body='flyingSnake2dAoA35ds004',
                                     solution_folder='numericalSolution',
                                     view=(-2.0, -5.0, 15.0, 5.0),
                                     width=600,
                                     states=(56, 57, 1))

file_path_source = os.path.join(simulation.directory, 'images',
                                'vorticity_-2.00_-5.00_15.00_5.00',
                                'vorticity0000056.png')
# copy .png file here
file_name_destination = 'ibamr_vorticity56Re2000AoA35_zeroGradientOutlet.png'
shutil.copy(file_path_source, file_name_destination)
# copy as .pdf here
file_name_destination = 'ibamr_vorticity56Re2000AoA35_zeroGradientOutlet.pdf'
Exemplo n.º 8
0
# file: plotVorticity.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D vorticity field.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

simulation.plot_field_contours_visit('vorticity', (-5.0, 5.0),
                                     body='flyingSnake2dAoA35ds004filledInside',
                                     solution_folder='numericalSolution',
                                     view=(-2.0, -5.0, 15.0, 5.0),
                                     width=800)
Exemplo n.º 9
0
# file: plotPressure.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D pressure field.
# Run this script from the simulation directory.

from snake.ibamr.simulation import IBAMRSimulation

simulation = IBAMRSimulation()

simulation.plot_field_contours_visit(
    'pressure', (-1.0, 0.5),
    body='flyingSnake2dAoA35ds004filledInside',
    solution_folder='numericalSolution',
    view=(-15.0, -15.0, 15.0, 15.0),
    width=800)
Exemplo n.º 10
0
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D vorticity field
#              and saves it as .png and .pdf files.

import os
import sys
import shutil

import snake
from snake.ibamr.simulation import IBAMRSimulation

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

simulation = IBAMRSimulation(
    directory=os.path.join(os.environ['HOME'], 'snakeReproducibilityPackages',
                           'ibamr', 'zeroGradientOutlet', 'Re2000AoA35'))
simulation.plot_field_contours_visit('vorticity', (-5.0, 5.0),
                                     body='flyingSnake2dAoA35ds004',
                                     solution_folder='numericalSolution',
                                     view=(-2.0, -5.0, 15.0, 5.0),
                                     width=600,
                                     states=(56, 57, 1))

file_path_source = os.path.join(simulation.directory, 'images',
                                'vorticity_-2.00_-5.00_15.00_5.00',
                                'vorticity0000056.png')
# copy .png file here
file_name_destination = 'ibamr_vorticity56Re2000AoA35_zeroGradientOutlet.png'
shutil.copy(file_path_source, file_name_destination)
# copy as .pdf here
# file: plotLiftCoefficientCompareKrishnanEtAl2014.py
# author: Olivier Mesnard ([email protected])
# description: Plots the instantaneous lift coefficient
#              and compare to results from Krishnan et al. (2014).
# Run this script from the simulation directory.


import os

from snake.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation


simulation = IBAMRSimulation(description='IBAMR')
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='{}/resources/flyingSnake2d_cuibm_anush/'
                               'flyingSnake2dRe2000AoA35/forces'
                               ''.format(os.environ['SNAKE']))
krishnan.get_mean_forces(limits=[32.0, 64.0])
krishnan.get_strouhal(limits=[32.0, 64.0], order=200)

simulation.plot_forces(indices=[1],
                       display_coefficients=True,
                       coefficient=-2.0,
                       display_extrema=True, order=200,
                       limits=(0.0, 80.0, 0.0, 3.0),
                       other_simulations=krishnan,
Exemplo n.º 12
0
# file: plotLiftCoefficientCompareKrishnanEtAl2014.py
# author: Olivier Mesnard ([email protected])
# description: Plots the instantaneous lift coefficient
#              and compare to results from Krishnan et al. (2014).
# Run this script from the simulation directory.

import os

from snake.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation

simulation = IBAMRSimulation(description='IBAMR')
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='{}/resources/flyingSnake2d_cuibm_anush/'
                     'flyingSnake2dRe2000AoA35/forces'
                     ''.format(os.environ['SNAKE']))
krishnan.get_mean_forces(limits=[32.0, 64.0])
krishnan.get_strouhal(limits=[32.0, 64.0], order=200)

simulation.plot_forces(indices=[1],
                       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,
Exemplo n.º 13
0
# file: plotVelocityMagnitudeSnake.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D velocity-magnitude field near the snake.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

simulation.plot_field_contours_visit('velocity-magnitude', (0.0, 2.0),
                                     body='flyingSnake2dAoA35ds004filledInside',
                                     solution_folder='numericalSolution',
                                     view=(-0.75, -1.0, 1.50, 1.0),
                                     width=800)
import os
import yaml
import argparse

from matplotlib import pyplot

import snake
from snake.ibamr.simulation import IBAMRSimulation

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__))

directory = os.path.join(os.path.dirname(__file__), 'rtol10')
simulation = IBAMRSimulation(description='rtol=1.0E-10', directory=directory)
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])

directory = os.path.join(os.path.dirname(__file__), 'rtol6')
loose = IBAMRSimulation(description='rtol=1.0E-06', directory=directory)
loose.read_forces()
loose.get_mean_forces(limits=[32.0, 64.0])

dataframe = simulation.create_dataframe_forces(display_coefficients=True,
                                               coefficient=-2.0)
dataframe2 = loose.create_dataframe_forces(display_coefficients=True,
                                           coefficient=-2.0)
dataframe = dataframe.append(dataframe2)
print(dataframe)
Exemplo n.º 15
0
# file: plotVelocityMagnitudeSnake.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D velocity-magnitude field near the snake.
# Run this script from the simulation directory.

from snake.ibamr.simulation import IBAMRSimulation

simulation = IBAMRSimulation()

simulation.plot_field_contours_visit(
    'velocity-magnitude', (0.0, 2.0),
    body='flyingSnake2dAoA35ds004filledInside',
    solution_folder='numericalSolution',
    view=(-0.75, -1.0, 1.50, 1.0),
    width=800)
Exemplo n.º 16
0
# file: plotForceCoefficientsRe2000AoA30.py
# author: Olivier Mesnard ([email protected])
# description: Plots the instantaneous force coefficients
#              and compares to results from Krishnan et al. (2014).

import os

from matplotlib import pyplot

from snake.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation

simulation = IBAMRSimulation(description='IBAMR',
                             directory=os.path.join(
                                 os.environ['HOME'], 'simulations_IBAMR',
                                 'flyingSnake2d', 'discretizedBody',
                                 'flyingSnake2dRe2000AoA30_20151123'))
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='{}/resources/flyingSnake2d_cuibm_anush/'
                     'flyingSnake2dRe2000AoA30/forces'
                     ''.format(os.environ['SNAKE']))
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)
parser.add_argument('--save-dir', 
                    dest='save_directory', 
                    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)

# Computes the mean coefficients from the IBAMR simulations with surface markers.
# The force coefficients are averaged between 32 and 64 time-units.
cd_surface, cl_surface = [], []
for re in ['Re1000', 'Re2000']:
  for aoa in ['AoA25', 'AoA30', 'AoA35', 'AoA40']:
    simulation_directory = dirs['ibamr_forceCoefficientsVsAoA']['surfaceMarkers'][re][aoa]
    simulation = IBAMRSimulation(directory=simulation_directory)
    simulation.read_forces()
    simulation.get_mean_forces(limits=[32.0, 64.0])
    cd_surface.append(-2.0*simulation.forces[0].mean['value'])
    cl_surface.append(-2.0*simulation.forces[1].mean['value'])

# Computes the mean coefficients from the IBAMR simulations with body markers.
# The force coefficients are averaged between 32 and 64 time-units.
cd_body, cl_body = [], []
for re in ['Re1000', 'Re2000']:
  for aoa in ['AoA25', 'AoA30', 'AoA35', 'AoA40']:
    simulation_directory = dirs['ibamr_forceCoefficientsVsAoA']['bodyMarkers'][re][aoa]
    simulation = IBAMRSimulation(directory=simulation_directory)
    simulation.read_forces()
    simulation.get_mean_forces(limits=[32.0, 64.0])
    cd_body.append(-2.0*simulation.forces[0].mean['value'])
import argparse

from matplotlib import pyplot

import snake
from snake.ibamr.simulation import IBAMRSimulation


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__))


directory = os.path.join(os.path.dirname(__file__),
                         'cfl0.1')
simulation = IBAMRSimulation(description='cfl=0.1',
                             directory=directory)
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])

directory = os.path.join(os.path.dirname(__file__),
                         'cfl0.3')
loose = IBAMRSimulation(description='cfl=0.3',
                        directory=directory)
loose.read_forces()
loose.get_mean_forces(limits=[32.0, 64.0])

dataframe = simulation.create_dataframe_forces(display_coefficients=True,
                                               coefficient=-2.0)
dataframe2 = loose.create_dataframe_forces(display_coefficients=True,
                                           coefficient=-2.0)
dataframe = dataframe.append(dataframe2)
Exemplo n.º 19
0
"""
Plots the 2D pressure field from a IBAMR simulation at saved time-steps using
the visualization software VisIt.
"""

from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

body_name = 'flyingSnake2dAoA35ds004filledInside'  # file name (no extension)
simulation.plot_field_contours_visit('pressure', (-1.0, 0.5),
                                     body=body_name,
                                     solution_folder='numericalSolution',
                                     view=(-15.0, -15.0, 15.0, 15.0),
                                     width=800)
Exemplo n.º 20
0
"""
Post-processes the force coefficients from a IBAMR simulation.

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.
"""

from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()
simulation.read_forces()
time_limits = (32.0, 64.0)
simulation.get_mean_forces(limits=time_limits)
simulation.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),
                       style='mesnardo',
                       save_name='forceCoefficients')

dataframe = simulation.create_dataframe_forces(display_strouhal=True,
                                               display_coefficients=True,
                                               coefficient=-2.0)
print(dataframe)
Exemplo n.º 21
0
"""
Plots the 2D velocity magnitude from a IBAMR simulation at saved time-steps
using the visualization software VisIt.
"""

from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

body_name = 'flyingSnake2dAoA35ds004filledInside'  # file name (no extension)
simulation.plot_field_contours_visit('velocity-magnitude', (0.0, 2.0),
                                     body=body_name,
                                     solution_folder='numericalSolution',
                                     view=(-0.75, -1.0, 1.50, 1.0),
                                     width=800)
"""
Post-processes the force coefficients from a IBAMR simulation and compare them
to cuIBM ones (obtained by Anush Krishnan and
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.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation

simulation = IBAMRSimulation(description='IBAMR')
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,
                    type=str,
                    default=os.path.join(script_directory, 'map.yaml'),
                    help='file containing the list of simulation directories')
parser.add_argument('--save-dir',
                    dest='save_directory',
                    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)

# plot the instantaneous force coefficients at Re=2000 and AoA=30deg
# and compare to the results reported in Kirshnan et al. (2014)
simulation_directory = dirs['ibamr_forceCoefficientsRe2000']['AoA30']
simulation = IBAMRSimulation(description='IBAMR',
                             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',
    'flyingSnake2dRe2000AoA30', '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,
Exemplo n.º 24
0
# file: plotPressure.py
# author: Olivier Mesnard ([email protected])
# description: Plots the 2D pressure field.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation


simulation = IBAMRSimulation()

simulation.plot_field_contours_visit('pressure', (-1.0, 0.5),
                                     body='flyingSnake2dAoA35ds004filledInside',
                                     solution_folder='numericalSolution',
                                     view=(-15.0, -15.0, 15.0, 15.0),
                                     width=800)
import os
import sys

from matplotlib import pyplot

import snake
from snake.ibamr.simulation import IBAMRSimulation
from snake.cuibm.simulation import CuIBMSimulation


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

simulation = IBAMRSimulation(description='IBAMR',
                             directory=os.path.join(os.environ['HOME'],
                                                    'snakeReproducibilityPackages',
                                                    'ibamr',
                                                    'bodyMarkers',
                                                    'Re2000AoA30'))
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',
                                            'flyingSnake2dRe2000AoA30',
                                            'forces'))
krishnan.get_mean_forces(limits=[32.0, 64.0])
krishnan.get_strouhal(limits=[32.0, 64.0], order=200)
Exemplo n.º 26
0
# file: plotForceCoefficientsCompareOther.py
# author: Olivier Mesnard ([email protected])
# description: Plots the instantaneous force coefficients
#              and compare to results from other simulation.
# Run this script from the simulation directory.


from snake.ibamr.simulation import IBAMRSimulation
from snake.petibm.simulation import PetIBMSimulation


simulation = IBAMRSimulation(description='IBAMR')
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])
simulation.get_strouhal(limits=[32.0, 64.0], order=200)

other = PetIBMSimulation(description='other',
                         directory='other')
other.read_forces()
other.get_mean_forces(limits=[32.0, 64.0])
other.get_strouhal(limits=[32.0, 64.0], 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=other,
                       other_coefficients=2.0,
                       save_name='forceCoefficientsCompareOther')
dataframe = simulation.create_dataframe_forces(display_strouhal=True,
                                               display_coefficients=True,
saved in the present directory.
"""

import os

from matplotlib import pyplot

import snake
from snake.ibamr.simulation import IBAMRSimulation

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__))

directory = os.path.join(os.path.dirname(__file__), 'h0.002')
simulation = IBAMRSimulation(description='h=0.002', directory=directory)
simulation.read_forces()
simulation.get_mean_forces(limits=[32.0, 64.0])

directory = os.path.join(os.path.dirname(__file__), 'h0.004')
other = IBAMRSimulation(description='h=0.004', directory=directory)
other.read_forces()
other.get_mean_forces(limits=[32.0, 64.0])

dataframe = simulation.create_dataframe_forces(display_coefficients=True,
                                               coefficient=-2.0)
dataframe2 = other.create_dataframe_forces(display_coefficients=True,
                                           coefficient=-2.0)
dataframe = dataframe.append(dataframe2)
print(dataframe)
Exemplo n.º 28
0
"""
Plots the 2D vorticity field from a IBAMR simulation at saved time-steps using
the visualization software VisIt.
"""

from snake.ibamr.simulation import IBAMRSimulation

simulation = IBAMRSimulation()

body_name = 'flyingSnake2dAoA35ds004filledInside'  # file name (no extension)
simulation.plot_field_contours_visit('vorticity', (-5.0, 5.0),
                                     body=body_name,
                                     solution_folder='numericalSolution',
                                     view=(-2.0, -5.0, 15.0, 5.0),
                                     width=800)