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, limits=(0.0, 80.0, 0.0, 3.0),
'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) dataframe2 = krishnan.create_dataframe_forces(display_strouhal=True, display_coefficients=True, coefficient=2.0) dataframe = dataframe.append(dataframe2) print(dataframe) pyplot.style.use(os.path.join(os.environ['SNAKE'], 'snake', 'styles', 'snakeReproducibility.mplstyle')) fig, ax = pyplot.subplots(figsize=(6, 4))
import os from matplotlib import pyplot from snake.cuibm.simulation import CuIBMSimulation simulation = CuIBMSimulation(description='cuIBM (old) - CUSP-0.4.0', directory=os.path.join( os.environ['HOME'], 'simulations_cuIBM', 'revision86-cusp-0.4.0', 'flyingSnake2dRe2000AoA35_20160502', 'numericalSolution')) 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) dataframe = simulation.create_dataframe_forces(display_strouhal=True, display_coefficients=True, coefficient=2.0) dataframe2 = krishnan.create_dataframe_forces(display_strouhal=True, display_coefficients=True, coefficient=2.0) dataframe = dataframe.append(dataframe2)
from snake.petibm.simulation import PetIBMSimulation from snake.cuibm.simulation import CuIBMSimulation 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,
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, display_coefficients=True,
""" Post-processes the force coefficients from a cuIBM 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.cuibm.simulation import CuIBMSimulation simulation = CuIBMSimulation() simulation.read_forces() time_limits = (60.0, 80.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, limits=(0.0, 80.0, -0.5, 1.5), style='seaborn-dark', save_name='forceCoefficients') dataframe = simulation.create_dataframe_forces(display_strouhal=True, display_coefficients=True, coefficient=2.0) print(dataframe)
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'], 'snakeReproducibilityPackages',
# file: plotForceCoefficients.py # author: Olivier Mesnard ([email protected]) # description: Plots the instantaneous force coefficients. # Run this script from the simulation directory. from snake.cuibm.simulation import CuIBMSimulation simulation = CuIBMSimulation() 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') dataframe = simulation.create_dataframe_forces(display_strouhal=True, display_coefficients=True, coefficient=2.0) print(dataframe)
# file: plotForceCoefficientsCompareOther.py # author: Olivier Mesnard ([email protected]) # description: Plots the instantaneous force coefficients # and compare to results of another simulation. # Run this script from the simulation directory. from snake.cuibm.simulation import CuIBMSimulation simulation = CuIBMSimulation(description='cuIBM (present)') 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='', directory='') 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, coefficient=2.0) dataframe2 = other.create_dataframe_forces(display_strouhal=True, display_coefficients=True,
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, display_coefficients=True,