Пример #1
0
def calcGCells(pos, mesh, rho, nInt=0):
    """
    """
    G = pg.RMatrix(len(pos), mesh.cellCount())
    rules = pg.IntegrationRules()

    for i, p in enumerate(pos):
        for cId, c in enumerate(mesh.cells()):
            Z = 0.0

            if nInt == 0:
                for j in range(c.nodeCount()):
                    A = c.node(j)
                    B = c.node((j + 1) % c.nodeCount())
                    # negative Z as all cells are numbered counterclockwise
                    Z -= 2.0 * pg.lineIntegraldGdz(A.pos() - p, B.pos() - p)
            #                    Z += lineIntegralZ(A.pos() - p, B.pos() - p)
            else:

                for j, t in enumerate(rules.abscissa(c, nInt)):
                    w = rules.weights(c, nInt)[j]
                    Z += 2.0 * w * functor(c.shape().xyz(t), p)
                #                for j, t in enumerate(rules.quaAbscissa(nInt)):
                #                    w = rules.quaWeights(nInt)[j]
                #                    Z += 2.0 * w * functor(c.shape().xyz(t), p)

                Z *= c.jacobianDeterminant()

            # negative Z because all cells are numbered counterclockwise
            G[i][c.id()] = Z

    return G * rho * 6.67384e-11 * 1e5, G
Пример #2
0
def calcGCells(pos, mesh, rho, nInt=0):
    """
    """
    G = pg.RMatrix(len(pos), mesh.cellCount())
    rules = pg.IntegrationRules()

    for i, p in enumerate(pos):
        for cId, c in enumerate(mesh.cells()):
            Z = 0.

            if nInt == 0:
                for j in range(c.nodeCount()):
                    A = c.node(j)
                    B = c.node((j + 1) % c.nodeCount())
                    # negative Z as all cells are numbered counterclockwise
                    Z -= 2.0 * pg.lineIntegraldGdz(A.pos() - p, B.pos() - p)
#                    Z += lineIntegralZ(A.pos() - p, B.pos() - p)
            else:

                for j, t in enumerate(rules.abscissa(c, nInt)):
                    w = rules.weights(c, nInt)[j]
                    Z += 2.0 * w * functor(c.shape().xyz(t), p)


#                for j, t in enumerate(rules.quaAbscissa(nInt)):
#                    w = rules.quaWeights(nInt)[j]
#                    Z += 2.0 * w * functor(c.shape().xyz(t), p)

                Z *= c.jacobianDeterminant()

            # negative Z because all cells are numbered counterclockwise
            G[i][c.id()] = Z

    return G * rho * 6.67384e-11 * 1e5, G
Пример #3
0
def calcPolydgdz(pnts, poly, density):
    """
       Calculate gravimetric response at given points for a polygon with
       relative density change. pnts must be numbered clockwise. Otherwise
       change the sign of the result. Return values are in mGal.
    """
    gz = pg.RVector(len(pnts), 0.0)

    for i, p in enumerate(pnts):
        for j in range(len(poly)):
            a = poly[j]
            b = poly[(j + 1) % len(poly)]
            gz[i] += pg.lineIntegraldGdz(a - p, b - p)
    #            gz[i] += lineIntegralZ(a - p, b - p)
    return gz * density * 2.0 * 6.67384e-11 * 1e5
Пример #4
0
def calcPolydgdz(pnts, poly, density):
    """
       Calculate gravimetric response at given points for a polygon with
       relative density change. pnts must be numbered clockwise. Otherwise
       change the sign of the result. Return values are in mGal.
    """
    gz = pg.RVector(len(pnts), 0.0)

    for i, p in enumerate(pnts):
        for j in range(len(poly)):
            a = poly[j]
            b = poly[(j + 1) % len(poly)]
            gz[i] += pg.lineIntegraldGdz(a - p, b - p)
#            gz[i] += lineIntegralZ(a - p, b - p)
    return gz * density * 2.0 * 6.67384e-11 * 1e5
Пример #5
0
def calcGBounds(pos, mesh, rho):
    """ ??
    """
    G = pg.RMatrix(len(pos), mesh.cellCount())

    for i, p in enumerate(pos):
        for cId, b in enumerate(mesh.boundaries()):
            A = b.node(0)
            B = b.node(1)
            #            Z = lineIntegralZ(A.pos() - p, B.pos() - p)
            Z = pg.lineIntegraldGdz(A.pos() - p, B.pos() - p)

            if b.leftCell():
                G[i][b.leftCell().id()] = G[i][b.leftCell().id()] - Z
            if b.rightCell():
                G[i][b.rightCell().id()] = G[i][b.rightCell().id()] + Z

    return G * rho * 2.0 * 6.67384e-11 * 1e5, G
Пример #6
0
def calcGBounds(pos, mesh, rho):
    """ ??
    """
    G = pg.RMatrix(len(pos), mesh.cellCount())

    for i, p in enumerate(pos):
        for cId, b in enumerate(mesh.boundaries()):
            A = b.node(0)
            B = b.node(1)
            #            Z = lineIntegralZ(A.pos() - p, B.pos() - p)
            Z = pg.lineIntegraldGdz(A.pos() - p, B.pos() - p)

            if b.leftCell():
                G[i][b.leftCell().id()] = G[i][b.leftCell().id()] - Z
            if b.rightCell():
                G[i][b.rightCell().id()] = G[i][b.rightCell().id()] + Z

    return G * rho * 2.0 * 6.67384e-11 * 1e5, G