x_rcv = [int(round(ii / dx) + x_src) for ii in d_sr] if free_field: y_src = int(round(h_s / dx) + round(Ny / 2.) ) + 2 # BC length correction: 2*dx above, BC at index 1 y_rcv = [int(round(ii / dx) + round(Ny / 2.)) + 2 for ii in h_r] else: y_src = int(round(h_s / dx)) + 2 y_rcv = [int(round(ii / dx)) + 2 for ii in h_r] # print y_src # ============================================================================== # Calculation of the pressure # ============================================================================== depth = 1 for n in It[:-1]: # p1[x_src, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, src_dly) # hard source impl. fsrc[x_src, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, src_dly) # hard source impl. p = upd_p_fdtd_srl(p, p1, p2, fsrc, fsrc1, fsrc2, Nb, c, rho, Ts, dx, Cn, A, B, C, depth) # p = upd_vel_pbc_fdtd(p,c,rho,Ts,dx, # v_x,v_y,v1_x,v1_y, # p_bc,p1_bc, # K,a_k,gamma_k,psi_k,psi1_k,depth) if disp_inst_p: instatenous_pressure(n, Nt, p, dx, Ts, Lx, Ly, case, False) for d in range(len(d_sr)): for h in range(len(h_r)): p_saved[d, h, n] = p[x_rcv[d], y_rcv[h]] fsrc1[:, :], fsrc2[:, :] = fsrc.copy(), fsrc1.copy()
geo[i, 1:-1] = 1. j = 1 geo[1:-1, j] = 1. j = p.shape[1] - 2 geo[1:-1, j] = 1. # ============================================================================== # Hard source assignment # ============================================================================== # Normalization of the amplitude according to the FDTD signal at 0.5 m, see plot_time_signals.py (last figure) # A_tlm = 0.5 * 1. # 500 Hz A_tlm = 0.5 * 5. # 2000 Hz for n in It[:-1]: # source signal impl. I_t[x_src, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_b[x_src, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_l[x_src, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_r[x_src, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) # ============================================================================== # Calculation of the Incident and Scattered pulses (via upd_tlm.py) # ============================================================================== p = upd_p_tlm_srl_rigid(I_t, I_b, I_l, I_r) if disp_inst_p: instatenous_pressure(n, Nt, p, dx, Ts, Lx, Ly, case, False)
geo[i, 1:-1] = 1. j = 1; geo[1:-1, j] = 1. j = geo.shape[1] - 2; geo[1:-1, j] = 1. # ========================================================================= # Hard source assignment # ========================================================================= # Normalization of the amplitude according to the FDTD signal at 0.5 m, # see plot_time_signals.py (last figure) # A_tlm = 0.5 * 1. # 500 Hz A_tlm = 0.5 * 5. # 2000 Hz for n in It: # source signal impl. I_t[x_src1, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_b[x_src1, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_l[x_src1, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_r[x_src1, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_t[x_src2, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_b[x_src2, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_l[x_src2, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) I_r[x_src2, y_src] = A_tlm * src.src_select(src_typ, t, n, src_frq, src_dly) # =====================================================================
x_rcv_facade = [int(round(ii / dx)) for ii in d_sr] y_rcv = [int(round(ii / dx)) + 2 for ii in h_r] # ========================================================================= # Calculation of the pressure # ========================================================================= depth = 1 rand_delay = np.random.randint(len(x_src), size=len(x_src)) for n in It: for ii, x_src_val in enumerate(x_src): # fsrc[x_src_val, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, # src_dly) # fsrc[x_src_val, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, # src_dly + int(round(ii * dx * every_what_pts / 340. /Ts))) fsrc[x_src_val, y_src] = 1. * src.src_select( src_typ, t, n, src_frq, src_dly + int(round(rand_delay[ii] * dx * every_what_pts / 340. / Ts))) # fsrc[x_src1, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, # src_dly) # soft source impl. # fsrc[x_src2, y_src] = 1. * src.src_select(src_typ, t, n, src_frq, # src_dly) p = upd_p_fdtd_srl(p, p1, p2, fsrc, fsrc1, fsrc2, Nb, c, rho, Ts, dx, Cn, A, B, C, depth) if disp_inst_p: instatenous_pressure(n, Nt, p, dx, Ts, Lx, Ly, case, False) for d in range(len(d_sr_ref)): p_saved_ref[d, n] = p[x_rcv_0[d], y_rcv[0]] for d in range(len(d_sr)):
np.arccos((ax - ipm[iangle, idist]) * dx / rcv_dist_idx[iangle, idist]) - np.pi) elif iangle > int(len(phi_rcv) / 2): # print 'no' rcv_phi_idx[iangle, idist] = np.arccos( (ax - ipm[iangle, idist]) * dx / rcv_dist_idx[iangle, idist]) + np.pi p_circ = np.zeros((len(phi_rcv), len(rad_rcv), Nt + 1), dtype=np.complex128) # ============================================================================== # Calculation of the pressure # ============================================================================== for n in It: p1[1, 1:-1] = 1. * src.src_select(src_typ, t, n, src_frq, src_dly) # hard source impl. # fsrc[1,1:-1] = 1. * src.src_select(src_typ, t, n, src_frq, src_dly) # soft source impl. if not free_field: p = upd_p_fdtd_srl_2D_scat(p, p1, p2, fsrc, fsrc2, Nb, c, rho, Ts, dx, Cn, A, B, C, x_in_idx, y_in_idx, x_edges_idx, y_edges_idx, x_corners_idx, y_corners_idx) else: p = upd_p_fdtd_srl(p, p1, p2, fsrc, fsrc1, fsrc2, Nb, c, rho, Ts, dx, Cn, A, B, C, 1) if disp_inst_p: instatenous_pressure(n, Nt, p, dx, Ts, Lx, Ly, case, True) for m_ang in range(len(phi_rcv)):
p_saved_l1 = np.zeros( (int(round(l1max / dx)), int(round(zmax / dx)) - 1, Nt), dtype=np.complex128) # p_saved_l2 = np.zeros((int(round(l2max / dx)), len(y_l2_seq_idx), Nt), dtype=np.complex128) p_saved_l2 = np.zeros( (int(round(l2max / dx)), int(round(zmax / dx)) - 1, Nt), dtype=np.complex128) # ============================================================================== # Calculation of the pressure # ============================================================================== depth = 1 for n in It[:]: # p1[x_src_idx, y_src_idx] = 1. * src.src_select(src_typ, t, n, src_frq, src_dly) # hard source impl. fsrc[x_src_idx, y_src_idx] = 1. * src.src_select( src_typ, t, n, src_frq, src_dly) # soft source impl. p = upd_p_fdtd_srl_2D_slope(p, p1, p2, fsrc, fsrc2, Nb, c, rho, Ts, dx, Cn, A, B, C, x_in_idx, y_in_idx, x_edge_idx, y_edge_idx, x_corner_idx, y_corner_idx, slope_start_idx) if disp_inst_p: instatenous_pressure(n, Nt, p, dx, dt, Lx, Ly, case, True) p_saved_l1[:, :, n] = p[x_st_l1_idx:x_en_l1_idx, y_st_l1_idx:y_en_l1_idx] p_saved_l2[:, :, n] = p[x_st_l2_idx:x_en_l2_idx, y_st_l1_idx:y_en_l1_idx] fsrc1[:, :], fsrc2[:, :] = fsrc.copy(), fsrc1.copy() p1[:, :], p2[:, :] = p.copy(), p1.copy()