Пример #1
0
 def get_corr_pred(self, U, dU, t_n, t_n1, update_state, algorithmic):
     '''Get the corrector and predictor for the given increment
     of unknown .
     '''
     n_c = self.fets.n_nodal_dofs
     U_Ia = U.reshape(-1, n_c)
     U_Eia = U_Ia[self.I_Ei]
     eps_Emab = np.einsum('Eimabc,Eic->Emab', self.B_Eimabc, U_Eia)
     dU_Ia = dU.reshape(-1, n_c)
     dU_Eia = dU_Ia[self.I_Ei]
     deps_Emab = np.einsum('Eimabc,Eic->Emab', self.B_Eimabc, dU_Eia)
     D_Emabef, sig_Emab = self.mats.get_corr_pred(eps_Emab, deps_Emab, t_n,
                                                  t_n1, update_state,
                                                  algorithmic,
                                                  **self.state_arrays)
     K_Eicjd = self.integ_factor * np.einsum('Emicjdabef,Emabef->Eicjd',
                                             self.BB_Emicjdabef, D_Emabef)
     n_E, n_i, n_c, n_j, n_d = K_Eicjd.shape
     K_E = K_Eicjd.reshape(-1, n_i * n_c, n_j * n_d)
     dof_E = self.dof_Eia.reshape(-1, n_i * n_c)
     K_subdomain = SysMtxArray(mtx_arr=K_E, dof_map_arr=dof_E)
     f_Eic = self.integ_factor * np.einsum(
         'm,Eimabc,Emab,Em->Eic', self.fets.w_m, self.B_Eimabc, sig_Emab,
         self.det_J_Em)
     f_Ei = f_Eic.reshape(-1, n_i * n_c)
     F_dof = np.bincount(dof_E.flatten(), weights=f_Ei.flatten())
     F_int = F_dof
     norm_F_int = np.linalg.norm(F_int)
     return K_subdomain, F_int, norm_F_int
Пример #2
0
 def map_field_to_K(self, D_Lbc):
     K_Lipbjqd = np.einsum('Lipabjqcd,Lac->Lipbjqd', self.B_Lipabjqcd,
                           D_Lbc)
     _, n_i, n_p, n_c, _, _, _ = K_Lipbjqd.shape
     K_Lij = K_Lipbjqd.reshape(-1, n_i * n_p * n_c, n_i * n_p * n_c)
     o_Li = self.o_Lipa.reshape(-1, n_i * n_p * n_c)
     return SysMtxArray(mtx_arr=K_Lij, dof_map_arr=o_Li)
Пример #3
0
    def get_corr_pred(self, sctx, U, dU, tn, tn1, F_int, *args, **kw):

        n_e_dofs = self.fets_eval.n_e_dofs
        #
        K_ECidDjf = self.BB_ECidDjf + self.NN_ECidDjf * self.G
        K_Eij = K_ECidDjf.reshape(-1, n_e_dofs, n_e_dofs)
        #
        dU_ECid = dU[self.dof_ECid]
        f_ECid = np.einsum('ECidDjf,EDjf->ECid', K_ECidDjf, dU_ECid)
        f_Ei = f_ECid.reshape(-1, self.fets_eval.n_e_dofs)
        F_I = np.bincount(self.dof_E.flatten(), weights=f_Ei.flatten())
        F_int[self.dofs] += F_I
        #
        return SysMtxArray(mtx_arr=K_Eij, dof_map_arr=self.dof_E)
Пример #4
0
    def get_corr_pred(self,
                      U,
                      dU,
                      tn,
                      tn1,
                      F_int,
                      step_flag='predictor',
                      update_state=False,
                      *args,
                      **kw):

        if update_state:
            self.state_array_n[...] = self.state_array_n1[...]

        mats = self.mats_eval
        w_m = self.fets_eval.w_m
        A_C = self.fets_eval.A_C

        sa_n = self.state_array_n
        U_EiCd = U[self.dof_EiCd]
        dU_EiCd = dU[self.dof_EiCd]

        n_e_dofs = self.fets_eval.n_e_dofs
        B_EmisCd = self.B_EmisC[..., np.newaxis]
        eps_Ems = np.einsum('EmisCd,EiCd->Ems', B_EmisCd, U_EiCd)
        deps_Ems = np.einsum('EmisCd,EiCd->Ems', B_EmisCd, dU_EiCd)
        sig_Ems, D_Emsr, sa_n1 = mats.get_corr_pred2(eps_Ems, deps_Ems, tn,
                                                     tn1, sa_n)
        self.state_array_n1 = sa_n1
        K_EiCdjDf = np.einsum('m,s,EmisCd,Emsr,EmjrDf,Em->EiCdjDf', w_m, A_C,
                              B_EmisCd, D_Emsr, B_EmisCd, self.J_det_Em)
        K_Eij = K_EiCdjDf.reshape(-1, n_e_dofs, n_e_dofs)
        f_EiCd = np.einsum('m,s,EmisCd,Ems,Em->EiCd', w_m, A_C, B_EmisCd,
                           sig_Ems, self.J_det_Em)
        f_Ei = f_EiCd.reshape(-1, n_e_dofs)
        F_dof = np.bincount(self.dof_E.flatten(), weights=f_Ei.flatten())
        F_int[self.dofs] += F_dof
        return SysMtxArray(mtx_arr=K_Eij, dof_map_arr=self.dof_E)
Пример #5
0
map2d_ijkl2a = np.array([[[[0, 0], [0, 0]], [[2, 2], [2, 2]]],
                         [[[2, 2], [2, 2]], [[1, 1], [1, 1]]]])
map2d_ijkl2b = np.array([[[[0, 2], [2, 1]], [[0, 2], [2, 1]]],
                         [[[0, 2], [2, 1]], [[0, 2], [2, 1]]]])

D_abef = D_ab[map2d_ijkl2a, map2d_ijkl2b]
# print 'D_stress', D_abef
# print 'D_stress', D_abef.shape

K_Eicjd = np.einsum('Emicjdabef,abef->Eicjd', BB_Emicjdabef, D_abef)
# print 'K_Eicjd', K_Eicjd.shape
n_E, n_i, n_c, n_j, n_d = K_Eicjd.shape
K_E = K_Eicjd.reshape(n_E, n_i * n_c, n_j * n_d)
# print 'K_Eicjd', K_E
dof_E = dof_Eia.reshape(n_E, n_i * n_c)
K_subdomain = SysMtxArray(mtx_arr=K_E, dof_map_arr=dof_E)
K = SysMtxAssembly()
K.sys_mtx_arrays.append(K_subdomain)
# print 'K', K
print '-----------------------------------------'
fixed_dofs = mesh[0, :, 0, :].dofs.flatten()
for dof in fixed_dofs:
    K.register_constraint(dof, 0)
F = np.zeros((dof_Ia.size))
K.apply_constraints(F)
# print F.shape
loaded_dofs = mesh[-1, :, -1, :].dofs.flatten()
for dof in loaded_dofs:
    F[dof] = -1000.0
U = K.solve(F)
# print 'U', U
Пример #6
0
 def new_tangent_operator(self):
     '''
     Return the tangent operator used for the time stepping
     '''
     return SysMtxArray()