#!/usr/bin/env python import glob import numpy as np import matplotlib.pyplot as plt import yt from isentropic_vortex_helpers import read_input cmaps = { 'density': 'viridis', 'temp': 'magma', 'x_velocity': 'RdBu_r', 'y_velocity': 'RdBu_r', } prob_parm = read_input('inputs_ex', prefix='prob.') print('Problem parameters from inputs_ex:\n', prob_parm) ainf = np.sqrt(prob_parm['gamma'] * 287.0 * prob_parm['T_inf']) uinf = prob_parm['M_inf'] * ainf * np.cos(prob_parm['alpha']) vinf = prob_parm['M_inf'] * ainf * np.sin(prob_parm['alpha']) print('speed of sound:', ainf) print('freestream:', uinf, vinf) pltfiles = glob.glob('plt?????') pltfiles.sort() print('Solutions found:', pltfiles) xx, yy = None, None kidx = 0 fields = ['density', 'temp', 'x_velocity', 'y_velocity'] minmax = {field: None for field in fields} # plot ranges
#!/usr/bin/env python import sys import os import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import yt from isentropic_vortex_helpers import read_input, IsentropicVortex try: results_dir = sys.argv[1] except IndexError: results_dir = '.' prob_parm = read_input(os.path.join(results_dir,'inputs_ex'),prefix='prob.') pltfiles = glob.glob(os.path.join(results_dir,'plt?????')) pltfiles.sort() print('Solutions found:',pltfiles) ds = yt.load(os.path.join(results_dir, pltfiles[0])) # generate reference solution refsoln = IsentropicVortex(**prob_parm) xx,yy,rho0,u0,v0,p0,T0 = refsoln.evaluate(ds.domain_left_edge, ds.domain_right_edge, ds.domain_dimensions) # calculate rms errors it = []