def Wavebreaking_modulation(kr, K, theta, azimuth, u_10, fetch, wind_dir, tsc, polarization): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ if polarization == 'VH': print('no modulation cross-pol') return nphi = theta.shape[0] ind = np.where(np.degrees(azimuth) == wind_dir)[0] # divergence of the sea surface current divergence = np.gradient(tsc[:, :, 0], 1e3, axis=1) + np.gradient( tsc[:, :, 1], 1e3, axis=0) # NRCS of plumes wb0 = np.exp(-np.tan(theta)**2 / const.Swb) / ( np.cos(theta)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta[1] - theta[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function # in radians azimuth of breaking surface area: -pi/2,pi/2 # phi1 = np.linspace(-np.pi/2, np.pi/2, nphi) phi1 = np.linspace(-np.pi, np.pi, nphi) nk = 1024 q = np.zeros([tsc.shape[0], tsc.shape[1]]) WB = np.zeros([tsc.shape[0], tsc.shape[1]]) for ii in np.arange(tsc.shape[0]): for jj in np.arange(tsc.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_func(KK, K[ii, jj], u_10[ii, jj], fetch, azimuth, divergence[ii, jj]) Bkdir = kudryavtsev05(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + abs(T.reshape(nk, 1))) n, alpha = param(KK, u_10[ii, jj], fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - azimuth[ind]) * lamda, phi1) / lamda_k WB[ii, jj] = wb0[jj] * (1 + Mwb[jj] * const.theta_wb * Awb) return WB, q
def eq_wb(kr, theta_eq, eq_azi, u_10, fetch, spec_name, polarization): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ nphi = theta_eq.shape[0] # Spectral model # Omni directional spectrum model name specf = spec.models[spec_name] # NRCS of plumes wb0 = np.exp(-np.tan(theta_eq)**2 / const.Swb) / ( np.cos(theta_eq)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta_eq[1] - theta_eq[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function # in radians azimuth of breaking surface area: -pi/2,pi/2 # phi1 = np.linspace(-np.pi / 2, np.pi / 2, nphi) phi1 = np.linspace(-np.pi, np.pi, nphi) nk = 1024 K = np.linspace(10 * spec_peak(u_10, fetch), knb, nk) # K = np.linspace(spec_peak(u_10, fetch), knb, nk) if spec_name == 'elfouhaily': # Directional spectrum model name spreadf = spread.models[spec_name] Bkdir = specf(K.reshape(nk, 1), u_10, fetch) * spreadf( K.reshape(nk, 1), phi1, u_10, fetch) * K.reshape(nk, 1)**3 else: Bkdir = specf(K.reshape(nk, 1), u_10, fetch, phi1) n, alpha = param(K, u_10, fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * K.reshape(nk, 1)) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, K, axis=0) lamda_k = np.trapz(lamda_k, K) q = const.cq * lamda_k if polarization == 'VH': WB = CP_breaking(theta_eq)[:, 0] else: Awb = np.trapz(np.cos(phi1 - eq_azi.reshape(nphi, 1)) * lamda, phi1, axis=1) / lamda_k WB = wb0 * (1 + Mwb * const.theta_wb * Awb) return WB, q
def eq_wb_mo(kr, K, theta_eq, eq_azi, u_10, fetch, div): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ # NRCS of plumes wb0 = np.exp(-np.tan(theta_eq)**2 / const.Swb) / ( np.cos(theta_eq)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta_eq[1] - theta_eq[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function phi1 = np.linspace(-np.pi, np.pi, 37) nk = 1024 q = np.zeros([div.shape[0], div.shape[1]]) WB = np.zeros([div.shape[0], div.shape[1]]) for ii in np.arange(div.shape[0]): for jj in np.arange(div.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_func(KK, K[ii, jj], u_10[ii, jj], fetch, phi1, div[ii, jj]) Bkdir = kudryavtsev05(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + abs(T.reshape(nk, 1))) n, alpha = param(KK, u_10[ii, jj], fetch) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - eq_azi[jj]) * lamda, phi1) / lamda_k WB[ii, jj] = wb0[jj] * (1 + Mwb[jj] * const.theta_wb * Awb) return WB, q
def Wave_breaking_new(K, kr, theta, azimuth, u_10, fetch, spec_name, tsc): """ :param kp: :param kr: :param theta: :param azi: :param u_10: :param fetch: :return: """ nphi = theta.shape[0] divergence = np.gradient(tsc[:, :, 0], 1e3, axis=1) + np.gradient( tsc[:, :, 1], 1e3, axis=0) # Spectral model # Omni directional spectrum model name specf = spec.models[spec_name] # NRCS of plumes wb0 = np.exp(-np.tan(theta)**2 / const.Swb) / ( np.cos(theta)**4 * const.Swb ) + const.yitawb / const.Swb # Kudryavstev 2003a equation (60) knb = min(const.br * kr, const.kwb) # tilting transfer function dtheta = theta[1] - theta[0] Mwb = np.gradient(wb0, dtheta) / wb0 # distribution function phi1 = (np.arange(nphi) * np.pi / nphi).reshape( 1, nphi ) - np.pi / 2 # in radians azimuth of breaking surface area: -pi/2,pi/2 nk = 1024 nazi = azimuth.shape[0] q = np.zeros([u_10.shape[0], u_10.shape[1]]) WB = np.zeros([u_10.shape[0], u_10.shape[1], nazi, nphi]) for ii in np.arange(u_10.shape[0]): for jj in np.arange(u_10.shape[1]): KK = np.linspace(10 * spec_peak(u_10[ii, jj], fetch), knb, nk) T = Trans_single(KK.reshape(nk, 1), K[ii, jj], u_10[ii, jj], fetch, azimuth, spec_name, divergence[ii, jj]) if spec_name == 'elfouhaily': spreadf = spread.models[spec_name] Bkdir = specf(KK.reshape(nk, 1), u_10[ii, jj], fetch) * (1 + np.abs(T)) * spreadf( KK.reshape(nk, 1), phi1, u_10[ii, jj], fetch) * KK.reshape(nk, 1)**3 else: Bkdir = specf(KK.reshape(nk, 1), u_10[ii, jj], fetch, phi1) * (1 + np.abs(T)) n, alpha = param(KK, u_10[ii, jj]) lamda = (Bkdir / alpha.reshape(nk, 1))**(n.reshape(nk, 1) + 1) / ( 2 * KK.reshape(nk, 1) ) # distribution of breaking front lengths lamda_k = np.trapz(lamda, phi1, axis=1) lamda = np.trapz(lamda, KK, axis=0) lamda_k = np.trapz(lamda_k, KK) q[ii, jj] = const.cq * lamda_k Awb = np.trapz(np.cos(phi1 - azimuth.reshape(nazi, 1)) * lamda, phi1, axis=1) / lamda_k Awb = Awb.reshape(nazi, 1) WB[ii, jj, :, :] = wb0.reshape( 1, nphi) * (1 + Mwb.reshape(1, nphi) * const.theta_wb * Awb) return WB, q