def V_EH_computation(self, CFIE_coeff, TENETHNH, target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, EXCITATION, FORMULATION): V_EH_tmp = computeV_EH(target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, EXCITATION, 'F') N_test = len(list_of_test_edges_numbers) V_EH = zeros((2 * N_test, 4), 'D') V_EH[:N_test] = V_EH_tmp eta_0 = sqrt(mu_0 / (eps_0 * eps_r_out)) if (FORMULATION == "CFIE"): # we have CFIE coeff = CFIE_coeff TE, NE, TH, NH = TENETHNH[0], TENETHNH[1], TENETHNH[2], TENETHNH[3] CFIE = array([ TE * coeff, NE * coeff, -TH * (1.0 - coeff) * eta_0, -NH * (1.0 - coeff) * eta_0 ], 'D') self.V = V_EH[:, 0] * CFIE[0] for i in range(1, 4): self.V += V_EH[:, i] * CFIE[i] elif (FORMULATION == "PMCHWT"): self.V = 1.0 / eta_0 * V_EH[:, 0] self.V[N_test:2 * N_test] = eta_0 * V_EH[:N_test, 2] elif (FORMULATION == "JMCFIE"): coeff = CFIE_coeff self.V = zeros(2 * N_test, 'D') self.V[:N_test] = coeff * V_EH_tmp[:, 0] + (1.0 - coeff) * sqrt( mu_0 / (eps_0 * eps_r_out)) * V_EH_tmp[:, 3] self.V[N_test:2 * N_test] = coeff * sqrt( mu_0 / (eps_0 * eps_r_out)) * V_EH_tmp[:, 2] - ( 1.0 - coeff) * V_EH_tmp[:, 1] else: pass
def V_EH_computation(self, CFIE, target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, EXCITATION): self.V_EH = computeV_EH(target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, EXCITATION, 'F') self.V_CFIE = self.V_EH[:, 0] * CFIE[0] for i in range(1, 4): self.V_CFIE += self.V_EH[:, i] * CFIE[ i] * target_mesh.RWGNumber_CFIE_OK
def testVolakisMoM(path, targetName, f, M0M_FULL_PRECISION): # data generation of Volakis article, IEEE Antennas and Propagation Magazine, December 1992 # for this purpose we use the MoM routines with no FMM or MLFMA write_geo(path, targetName, 'lc', c/f/10.0) executeGmsh(path, targetName, 0) z_offset = 0.0 targetDimensions_scaling_factor = 1.0 languageForMeshConstruction = "Python" target_mesh = MeshClass(path, targetName, targetDimensions_scaling_factor, z_offset, languageForMeshConstruction, 'GMSH', '.msh') target_mesh.constructFromGmshFile() N_RWG = target_mesh.N_RWG w = 2. * pi * f eps_r = 1. mu_r = 1. coeff = 0.2 TDS_APPROX = 0 Z_s = 0.0 CFIE = array([coeff, 0.0, 0.0, -(1.0-coeff) * 377], 'D') list_of_test_edges_numbers = arange(N_RWG,dtype='i')#.astype('i')#[0::6] list_of_src_edges_numbers = arange(N_RWG,dtype='i')#.astype('i')#[2::6] print("Target_MoM instanciation") target_MoM = Target_MoM(CFIE, list_of_test_edges_numbers, list_of_src_edges_numbers, target_mesh, w, eps_r, mu_r, TDS_APPROX, Z_s, MOM_FULL_PRECISION) print("Matrix inversion...") target_MoM.compute_Y_CFIE() T = target_mesh.T if 'plate' in targetName: theta = 80.0/180.0 * pi # cone angle in radians else: theta = 90.0/180.0 * pi phis = arange(0., 181, 1) / 180.0 * pi sigmas_HH = zeros(len(phis), 'f') sigmas_VV = zeros(len(phis), 'f') for polarization in ['HH', 'VV']: print("polarization " + polarization) index = 0 r_obs = zeros(3).astype('d') # observation point for the incoming field for phi in phis: sys.stdout.write("\r" + "%.4s" %str(phis[0]/pi*180.) + " -> phi = %.4s" %str(phi/pi*180.) + " -> %.4s" %str(phis[-1]/pi*180.)) sys.stdout.flush() # unit vectors computation r_hat = array([sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)], 'd') theta_hat = array([cos(theta)*cos(phi), cos(theta)*sin(phi), -sin(theta)], 'd') phi_hat = array([-sin(phi), cos(phi), 0.0], 'd') # excitation parameters computation J_dip_factor = 1.0 if polarization=='HH': J_dip = J_dip_factor * phi_hat # HH polarization E_0 = phi_hat * (1.0 + 0.0j) else: J_dip = J_dip_factor * -theta_hat # VV polarization E_0 = -theta_hat * (1.0 + 0.0j) R_dip = 300.0 * c/f # we wanna be in far field r_dip = R_dip * r_hat # excitation vector computation k_hat = -r_hat r_ref = r_obs V_EH = V_EH_plane(E_0, k_hat, r_ref, list_of_test_edges_numbers, target_mesh.RWGNumber_CFIE_OK, target_mesh.RWGNumber_signedTriangles, target_mesh.RWGNumber_edgeVertexes, target_mesh.RWGNumber_oppVertexes, target_mesh.vertexes_coord, w, eps_r, mu_r) V_CFIE = zeros(V_EH.shape[0], complex) for i in range(4): V_CFIE += V_EH[:,i] * CFIE[i] # scattered field computation I_CFIE = dot(target_MoM.Y_CFIE, V_CFIE) # we compute the scattered fields by reciprocity V_EH = computeV_EH(target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, 'dipole', 'F') E_scatt = sum(I_CFIE * V_EH[:,0])/J_dip_factor # incoming field computation Delta_r = (r_dip - r_obs) # sigma computation P_scatt = real(E_scatt*conj(E_scatt)) P_inc = real(dot(E_0, conj(E_0))) if polarization=='HH': sigmas_HH[index] = 4*pi* sum(Delta_r**2) * P_scatt/P_inc else: sigmas_VV[index] = 4*pi* sum(Delta_r**2) * P_scatt/P_inc index = index + 1 print return sigmas_HH, sigmas_VV
#computeCurrentsVisualization(w, target_mesh, target_MoM.I_CFIE) # now we try the iterative method #count = 0 #I_CFIE_bicgstab = bicgstab(target_MoM.Z_CFIE_J, target_MoM.V_CFIE, x0=None, tol=1.0e-05, maxiter=1000, xtype=None, callback=itercount) #V = V_EH_computation(self, CFIE_coeff, TENETHNH, target_mesh, J_dip, r_dip, w, eps_r, mu_r, list_of_test_edges_numbers, 'dipole', FORMULATION) #print("bicgstab MoM RCS =", -sum(I_CFIE_bicgstab[0]*V[:,0]), "# of iterations =", count) ## computation of the scattered fields E_0 = array([-1.0, 0.0, 0.0], 'D') k_hat = array([0., 0., -1.0], 'd') r_ref = zeros(3, 'd') #sum(triangles_centroids, axis=0)/T J_obs = array([1.0, 0.0, 0.0], 'D') E_x, E_inc_x, E_tot_x = [], [], [] for z in arange(-3., -2., 0.05): r_obs = array([0.0, 0.0, z], 'd') V_EH = computeV_EH(target_mesh, J_obs, r_obs, w, eps_r, mu_r, list_of_test_edges_numbers, 'dipole', 'F') E_x.append(sum(-target_MoM.I_CFIE * V_EH[:, 0])) E_inc_x.append(E_0[0] * exp(-1.j * k_out * dot(k_hat, r_obs - r_ref))) E_tot_x.append(E_x[-1] + E_inc_x[-1]) print(z, E_x[-1], E_tot_x[-1]) fr = open('E_tot_x_real.txt', 'w') fi = open('E_tot_x_imag.txt', 'w') for elem in E_tot_x: fr.write(str(real(elem)) + '\n') fi.write(str(imag(elem)) + '\n') fr.close() fi.close() from pylab import rc, plot, show, xlabel, ylabel, xticks, yticks, grid, legend, title #rc('text', usetex=True)