# 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.petibm.simulation import PetIBMSimulation from snake.body import Body simulation = PetIBMSimulation() simulation.read_grid() body = Body(file_path='flyingSnake2dAoA35ds0.004.body') for time_step in simulation.get_time_steps(): simulation.read_fields('vorticity', time_step) simulation.plot_contour('vorticity', field_range=[-5.0, 5.0, 101], filled_contour=True, view=[-0.75, -1.0, 1.50, 1.0], bodies=body, width=8.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) simulation_directory = dirs['petibm011_vorticity']['Re2000AoA35'] simulation = PetIBMSimulation(directory=simulation_directory) simulation.read_grid(file_path=os.path.join(simulation.directory, 'grid.txt')) time_steps = [47500, 130000, 132500, 160000] file_paths_in = [] for time_step in time_steps: simulation.read_fields('vorticity', time_step) simulation.plot_contour('vorticity', field_range=[-5.0, 5.0, 101], time_increment=0.0004, view=[-1.0, -2.0, 8.0, 2.0], colorbar=(True if time_step == time_steps[-1] else False), width=6.0, dpi=300, style='snakeReproducibility') file_paths_in.append(os.path.join(simulation.directory,
# file: plotVorticitySnakeSubtractPetIBM20150807.py # author: Olivier Mesnard ([email protected]) # description: Plots the 2D vorticity field near the snake # and subtract the solution from previous simulation. # Run this script from the simulation directory. import os from snake.petibm.simulation import PetIBMSimulation from snake.body import Body simulation = PetIBMSimulation() simulation.read_grid() other = PetIBMSimulation(description='PetIBM (previous)', directory=('{}/simulations_PetIBM/flyingSnake/2d/' 'cuibmGrid/velocityCGPoissonBiCGStab/' 'flyingSnake2dRe2000AoA35_20150807' ''.format(os.environ['HOME']))) other.read_grid() body = Body(file_path='flyingSnake2dAoA35ds0.004.body') for time_step in simulation.get_time_steps(): simulation.read_fields('vorticity', time_step) other.read_fields('vorticity', time_step) simulation.subtract(other, 'vorticity', 'vorticity-subtracted') simulation.plot_contour('vorticity-subtracted', field_range=[-5.0, 5.0, 101],
dest='map', 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) simulation_directory = dirs['petibm011_vorticity']['Re2000AoA35'] simulation = PetIBMSimulation(directory=simulation_directory) simulation.read_grid(file_path=os.path.join(simulation.directory, 'grid.txt')) time_steps = [47500, 130000, 132500, 160000] file_paths_in = [] for time_step in time_steps: simulation.read_fields('vorticity', time_step) simulation.plot_contour( 'vorticity', field_range=[-5.0, 5.0, 101], time_increment=0.0004, view=[-1.0, -2.0, 8.0, 2.0], colorbar=(True if time_step == time_steps[-1] else False), width=6.0, dpi=300, style='snakeReproducibility') file_paths_in.append(