""" 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) # Plots the instantaneous force coefficients.
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)
# 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' ] for folder in folders:
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) print(dataframe)
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) # Plots the instantaneous force coefficients
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)