Пример #1
0
 def __init__(self, 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("Target_MoM instanciation...")
     signSurfObs, signSurfSrc = 1.0, 1.0  # no dielectric target here
     target_mesh.RWGNumber_M_CURRENT_OK *= 0
     self.Z_CFIE_J, self.Z_CFIE_M = Z_CFIE_MoM(
         CFIE, list_of_test_edges_numbers, list_of_src_edges_numbers,
         target_mesh.RWGNumber_CFIE_OK, target_mesh.RWGNumber_M_CURRENT_OK,
         target_mesh.RWGNumber_signedTriangles,
         target_mesh.RWGNumber_edgeVertexes,
         target_mesh.RWGNumber_oppVertexes, target_mesh.vertexes_coord, w,
         eps_r, mu_r, signSurfObs, signSurfSrc, TDS_APPROX, Z_s,
         MOM_FULL_PRECISION)
     self.iter_counter = 0
Пример #2
0
    def __init__(self, CFIE_coeff, TENETHNH, list_of_test_edges_numbers,
                 list_of_src_edges_numbers, target_mesh, w, eps_r_out,
                 mu_r_out, eps_r_in, mu_r_in, MOM_FULL_PRECISION, FORMULATION):
        self.numberOfMedia = sum(target_mesh.IS_CLOSED_SURFACE) + 1
        print("MOM.py: number of possible media =", self.numberOfMedia)
        print("Target_MoM instanciation...")
        t0 = time.clock()
        TDS_APPROX, Z_s = 0, 0.0 + 0.0j
        N_J, N_M = len(list_of_test_edges_numbers), len(
            list_of_test_edges_numbers)
        self.Z = zeros((N_J + N_M, N_J + N_M), 'D')

        if FORMULATION == "CFIE":  # we have CFIE
            print("OK, using CFIE formulation")
            print(
                "dielectricTarget_MoM: computing the outside interactions...")
            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) * sqrt(mu_0 / (eps_0 * eps_r_out)), -NH *
                (1.0 - coeff) * sqrt(mu_0 / (eps_0 * eps_r_out))
            ], 'D')
            signSurfObs, signSurfSrc = 1.0, 1.0
            self.Z[:N_J, :N_J], self.Z[:N_J, N_J:N_J + N_M] = Z_CFIE_MoM(
                CFIE, list_of_test_edges_numbers, list_of_src_edges_numbers,
                target_mesh.RWGNumber_CFIE_OK,
                target_mesh.RWGNumber_M_CURRENT_OK,
                target_mesh.RWGNumber_signedTriangles,
                target_mesh.RWGNumber_edgeVertexes,
                target_mesh.RWGNumber_oppVertexes, target_mesh.vertexes_coord,
                w, eps_r_out, mu_r_out, signSurfObs, signSurfSrc, TDS_APPROX,
                Z_s, MOM_FULL_PRECISION)

            print("dielectricTarget_MoM: computing the inside interactions...")
            CFIE = array([
                TE * coeff, NE * coeff, -TH *
                (1.0 - coeff) * sqrt(mu_0 / (eps_0 * eps_r_in)), -NH *
                (1.0 - coeff) * sqrt(mu_0 / (eps_0 * eps_r_in))
            ], 'D')
            signSurfObs, signSurfSrc = -1.0, -1.0
            self.Z[N_J:N_J + N_M, :N_J], self.Z[
                N_J:N_J + N_M, N_J:N_J + N_M] = Z_CFIE_MoM(
                    CFIE, list_of_test_edges_numbers,
                    list_of_src_edges_numbers, target_mesh.RWGNumber_CFIE_OK,
                    target_mesh.RWGNumber_M_CURRENT_OK,
                    target_mesh.RWGNumber_signedTriangles,
                    target_mesh.RWGNumber_edgeVertexes,
                    target_mesh.RWGNumber_oppVertexes,
                    target_mesh.vertexes_coord, w, eps_r_in, mu_r_in,
                    signSurfObs, signSurfSrc, TDS_APPROX, Z_s,
                    MOM_FULL_PRECISION)

        elif FORMULATION == "PMCHWT":  # we have PMCHWT
            print("OK, using PMCHWT formulation")
            print(
                "dielectricTarget_MoM: computing the outside interactions...")
            signSurfObs, signSurfSrc = 1.0, 1.0
            CFIE_for_PMCHWT = array([1.0, 0., 0., 0.], 'D')
            Z_EJ, Z_EM = Z_CFIE_MoM(
                CFIE_for_PMCHWT, list_of_test_edges_numbers,
                list_of_src_edges_numbers, target_mesh.RWGNumber_CFIE_OK,
                target_mesh.RWGNumber_M_CURRENT_OK,
                target_mesh.RWGNumber_signedTriangles,
                target_mesh.RWGNumber_edgeVertexes,
                target_mesh.RWGNumber_oppVertexes, target_mesh.vertexes_coord,
                w, eps_r_out, mu_r_out, signSurfObs, signSurfSrc, TDS_APPROX,
                Z_s, MOM_FULL_PRECISION)
            #TENETHNH = array([1.0, 0.0, 1.0, 0.0])
            #Z_EJ, Z_nE_J, Z_HJ, Z_nH_J = Z_EH_J_MoM(TENETHNH, list_of_test_edges_numbers, list_of_src_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_out, mu_r_out, signSurfObs, signSurfSrc, TDS_APPROX, Z_s, MOM_FULL_PRECISION)
            #Z_EM = -Z_HJ
            eta_0 = sqrt(mu_0 / (eps_0 * eps_r_out))
            self.Z[:N_J, :
                   N_J], self.Z[:N_J, N_J:N_J +
                                N_M] = 1.0 / eta_0 * Z_EJ, 1.0 / eta_0 * Z_EM
            self.Z[N_J:N_J + N_M, :N_J] = -eta_0 * Z_EM  # Z_HJ = -Z_EM
            self.Z[N_J:N_J + N_M, N_J:N_J + N_M] = eta_0 * (
                eps_0 * eps_r_out /
                (mu_0 * mu_r_out)) * Z_EJ  # Z_HM = eps/mu * Z_EJ

            print("dielectricTarget_MoM: computing the inside interactions...")
            signSurfObs, signSurfSrc = -1.0, -1.0
            Z_EJ, Z_EM = Z_CFIE_MoM(
                CFIE_for_PMCHWT, list_of_test_edges_numbers,
                list_of_src_edges_numbers, target_mesh.RWGNumber_CFIE_OK,
                target_mesh.RWGNumber_M_CURRENT_OK,
                target_mesh.RWGNumber_signedTriangles,
                target_mesh.RWGNumber_edgeVertexes,
                target_mesh.RWGNumber_oppVertexes, target_mesh.vertexes_coord,
                w, eps_r_in, mu_r_in, signSurfObs, signSurfSrc, TDS_APPROX,
                Z_s, MOM_FULL_PRECISION)
            #Z_EJ, Z_nE_J, Z_HJ, Z_nH_J = Z_EH_J_MoM(TENETHNH, list_of_test_edges_numbers, list_of_src_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_in, mu_r_in, signSurfObs, signSurfSrc, TDS_APPROX, Z_s, MOM_FULL_PRECISION)
            #Z_EM = -Z_HJ
            eta_1 = sqrt(mu_0 / (eps_0 * eps_r_in))
            self.Z[:N_J, :N_J] += 1.0 / eta_1 * Z_EJ
            self.Z[:N_J, N_J:N_J + N_M] += 1.0 / eta_1 * Z_EM
            self.Z[N_J:N_J + N_M, :N_J] += -eta_1 * Z_EM  # Z_HJ = -Z_EM
            self.Z[N_J:N_J + N_M, N_J:N_J + N_M] += eta_1 * (
                eps_0 * eps_r_in /
                (mu_0 * mu_r_in)) * Z_EJ  # Z_HM = eps/mu * Z_EJ

        elif FORMULATION == "JMCFIE":
            print("OK, using JMCFIE formulation")
            print(
                "dielectricTarget_MoM: computing the outside interactions...")
            signSurfObs, signSurfSrc = 1.0, 1.0
            coeff = CFIE_coeff
            TENETHNH = array([1.0, 1.0, 1.0, 1.0])
            Z_tE_J, Z_nE_J, Z_tH_J, Z_nH_J = Z_EH_J_MoM(
                TENETHNH, list_of_test_edges_numbers,
                list_of_src_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_out, mu_r_out, signSurfObs, signSurfSrc, TDS_APPROX,
                Z_s, MOM_FULL_PRECISION)
            self.Z[:N_J, :N_J] = coeff * Z_tE_J + (1.0 - coeff) * sqrt(
                mu_0 / (eps_0 * eps_r_out)) * Z_nH_J
            # Z_EM = -Z_HJ, Z_HM = eps/mu * Z_EJ
            #self.Z[:N_J,N_J:N_J + N_M] =  coeff * Z_tE_M + (1.0-coeff) * sqrt(mu_0/(eps_0*eps_r_out)) *  Z_nH_M
            self.Z[:N_J,
                   N_J:N_J + N_M] = -coeff * Z_tH_J + (1.0 - coeff) * sqrt(
                       mu_0 /
                       (eps_0 * eps_r_out)) * (eps_0 * eps_r_out /
                                               (mu_0 * mu_r_out)) * Z_nE_J
            self.Z[N_J:N_J + N_M, :N_J] = coeff * sqrt(
                mu_0 / (eps_0 * eps_r_out)) * Z_tH_J - (1.0 - coeff) * Z_nE_J
            self.Z[N_J:N_J + N_M, N_J:N_J +
                   N_M] = coeff * sqrt(mu_0 / (eps_0 * eps_r_out)) * (
                       eps_0 * eps_r_out /
                       (mu_0 * mu_r_out)) * Z_tE_J + (1.0 - coeff) * Z_nH_J

            print("dielectricTarget_MoM: computing the inside interactions...")
            signSurfObs, signSurfSrc = -1.0, -1.0
            Z_tE_J, Z_nE_J, Z_tH_J, Z_nH_J = Z_EH_J_MoM(
                TENETHNH, list_of_test_edges_numbers,
                list_of_src_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_in, mu_r_in, signSurfObs, signSurfSrc, TDS_APPROX,
                Z_s, MOM_FULL_PRECISION)
            self.Z[:N_J, :N_J] -= coeff * Z_tE_J + (1.0) * (
                1.0 - coeff) * sqrt(mu_0 / (eps_0 * eps_r_in)) * Z_nH_J
            # Z_EM = -Z_HJ, Z_HM = eps/mu * Z_EJ
            #self.Z[:N_J,N_J:N_J + N_M] =  coeff * Z_tE_M + (1.0-coeff) * sqrt(mu_0/(eps_0*eps_r_out)) *  Z_nH_M
            self.Z[:N_J, N_J:N_J +
                   N_M] -= -coeff * Z_tH_J + (1.0) * (1.0 - coeff) * sqrt(
                       mu_0 / (eps_0 * eps_r_in)) * (eps_0 * eps_r_in /
                                                     (mu_0 * mu_r_in)) * Z_nE_J
            self.Z[N_J:N_J + N_M, :N_J] -= coeff * sqrt(
                mu_0 /
                (eps_0 * eps_r_in)) * Z_tH_J - (1.0) * (1.0 - coeff) * Z_nE_J
            self.Z[
                N_J:N_J + N_M,
                N_J:N_J + N_M] -= coeff * sqrt(mu_0 / (eps_0 * eps_r_in)) * (
                    eps_0 * eps_r_in /
                    (mu_0 * mu_r_in)) * Z_tE_J + (1.0) * (1.0 - coeff) * Z_nH_J
        else:
            print("use another formulation please. Error.")
            sys.exit(1)

        print("Done. time =", time.clock() - t0, "seconds")
        self.iter_counter = 0