def load(self, collapseload = True): ''' The load vector (due to the boundary conditions)''' delta = self.delta dik = delta / (1j * self.k) B = self.B # todo - check the cross terms. Works okay with delta = 1/2. GB = self.loadassembly.assemble([[(1-delta) * B, (1-delta) *B], [-dik* B, -dik *B]]) # GB = self.loadassembly.assemble([[-(1-delta) * B, (1-delta) *B], # [dik* B, -dik *B]]) # print 'GB', self.entity, GB.tocsr() return pms.sumrhs(self.mesh, GB) if collapseload else pms.sumleftfaces(self.mesh,GB)
def __init__(self, compinfo, skelcompinfo, skelftob, sd, tracebc): self.volumeassembly = skelcompinfo.volumeAssembly() self.traceassembly = compinfo.faceAssembly(compinfo.faceVandermondes(skelftob)) self.sd = sd self.EM = pms.ElementMatrices(skelcompinfo.problem.mesh) self.sumleft = lambda G: pms.sumleftfaces(compinfo.problem.mesh, G) self.tracebc = tracebc # skeletob = skelcompinfo.basis # indicesandsizes = np.vstack((skeletob.getIndices()[:-1], skeletob.getSizes())).T # localindicesandsizes = indicesandsizes[np.array(self.EM.I.diagonal(), dtype=bool)] etob = compinfo.basis indicesandsizes = np.vstack((etob.getIndices()[:-1], etob.getSizes())).T localindicesandsizes = indicesandsizes[compinfo.problem.mesh.partition] self.idxs = np.concatenate([np.arange(i, i + s, dtype=int) for (i, s) in localindicesandsizes])
def trace(self): ''' projects onto the space spanned by the bdyinfo ''' return pms.sumleftfaces(self.mesh, )