# %% # find ky that is at -20 dB at every chord point ky_20dBAtt = AmT.ky_att(xy_phase_ref[0], b, Mach, k0, Att=-20) # critical gust spanwise wavenumber ky_crit = k0 / beta ky_max = 1.5 * ky_20dBAtt sinc_width = 2 * np.pi / (2 * d) # get ky with spacing equal to 1/4 width of sinc function N_ky = np.int(np.ceil(ky_max / (sinc_width / 4))) Ky, dKy = np.linspace(-ky_max, ky_max, (2 * N_ky) + 1, retstep=True) Phi2 = AmT.Phi_2D(Kx, Ky, Ux, turb_intensity, length_scale, model='K')[0] # Calculate CSM for airfoil surface Sqq, Sqq_dxy = AmT.calc_airfoil_Sqq(DARP2016Setup, DARP2016Airfoil, FreqVars, Ky, Phi2) # %%*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- # display cross-spectrum magnitude, phase and coherence on aerofoil surface fig_XSpec = plt.figure(figsize=(9, 5)) # create rectangles for subplots left = 0.05 bottom = 0.1 width = 0.149 height = 0.8
for i, f in enumerate(freq[1+i_last_success:]): print('Calculating f = {:.1f} Hz...'.format(f)) # account for skipping zero and previous runs i += 1+i_last_success # frequency-related variables FreqVars = AmT.FrequencyVars(f, DARP2016Setup) (k0, Kx, Ky_crit) = FreqVars.export_values() # vector of spanwise hydrodynamic gust wavenumbers Ky_vec = AmT.ky_vector(b, d, k0, Mach, beta) # gust energy spectrum (von Karman) Phi = AmT.Phi_2D(Kx, Ky_vec, Ux, turb_intensity, length_scale)[0] # convected dipole transfer function - includes shear layer refraction Gdip = AmT.dipole_shear(XYZ_airfoil_calc, XYZ_array, XYZ_shearLayer, T_shearLayer, k0, c0, Mach) # CSM of mic array pressures MicArrayCsm = AmT.calc_radiated_Spp(DARP2016Setup, DARP2016Airfoil, FreqVars, Ky_vec, Phi, Gdip) # write real/imag components to HDF5 file, one freq/chunk at a time CsmReal[:, :, i] = MicArrayCsm.real # force diagonal of imaginary component to zero CsmImaginary[:, :, i] = MicArrayCsm.imag - np.diag(np.diag(MicArrayCsm.imag)) # use garbage collector to recover some memory