示例#1
0
    def generate_slow_HTI_PDE_solution(self):
        pde = LinearPDESystem(self.domain)
        pde.getSolverOptions().setSolverMethod(SolverOptions.HRZ_LUMPING)
        pde.setSymmetryOn()

        dim = pde.getDim()
        X = self.domain.getX()
        y = Vector([2., 3., 4.][:dim], DiracDeltaFunctions(self.domain))
        du = grad(X * X)
        D = 2500. * kronecker(dim)
        pde.setValue(X=pde.createCoefficient('X'))
        sigma = pde.getCoefficient('X')
        if dim == 3:
            e11 = du[0, 0]
            e22 = du[1, 1]
            e33 = du[2, 2]

            sigma[0, 0] = self.c11 * e11 + self.c13 * (e22 + e33)
            sigma[1, 1] = self.c13 * e11 + self.c33 * e22 + self.c23 * e33
            sigma[2, 2] = self.c13 * e11 + self.c23 * e22 + self.c33 * e33

            s = self.c44 * (du[2, 1] + du[1, 2])
            sigma[1, 2] = s
            sigma[2, 1] = s

            s = self.c66 * (du[2, 0] + du[0, 2])
            sigma[0, 2] = s
            sigma[2, 0] = s

            s = self.c66 * (du[0, 1] + du[1, 0])
            sigma[0, 1] = s
            sigma[1, 0] = s

        else:
            e11 = du[0, 0]
            e22 = du[1, 1]
            sigma[0, 0] = self.c11 * e11 + self.c13 * e22
            sigma[1, 1] = self.c13 * e11 + self.c33 * e22

            s = self.c66 * (du[1, 0] + du[0, 1])
            sigma[0, 1] = s
            sigma[1, 0] = s

        pde.setValue(D=D, X=-sigma, y_dirac=y)
        return pde.getSolution()
    def __init__(self, domain, w, d, lam, mu, coordinates=None, tol=1e-8):
        """
        Creates a new subsidence on the given domain

        :param domain: domain of the model
        :type domain: `Domain`
        :param w: data weighting factors and direction
        :type w: ``Vector`` with ``FunctionOnBoundary``
        :param d: displacement measured at surface
        :type d: ``Scalar`` with ``FunctionOnBoundary``
        :param lam: 1st Lame coefficient
        :type lam: ``Scalar`` with ``Function``
        :param lam: 2st Lame coefficient/Shear modulus
        :type lam: ``Scalar`` with ``Function``
        :param coordinates: defines coordinate system to be used (not supported yet))
        :type coordinates: `ReferenceSystem` or `SpatialCoordinateTransformation`
        :param tol: tolerance of underlying PDE
        :type tol: positive ``float``
        """
        super(Subsidence, self).__init__()
        DIM = domain.getDim()

        self.__pde = LinearPDESystem(domain)
        self.__pde.setSymmetryOn()
        self.__pde.getSolverOptions().setTolerance(tol)
        #... set coefficients ...
        C = self.__pde.createCoefficient('A')
        for i in range(DIM):
            for j in range(DIM):
                C[i, i, j, j] += lam
                C[i, j, i, j] += mu
                C[i, j, j, i] += mu
        x = domain.getX()
        msk = whereZero(x[DIM - 1]) * kronecker(DIM)[DIM - 1]
        for i in range(DIM - 1):
            xi = x[i]
            msk += (whereZero(xi - inf(xi)) +
                    whereZero(xi - sup(xi))) * kronecker(DIM)[i]
        self.__pde.setValue(A=C, q=msk)

        self.__w = interpolate(w, FunctionOnBoundary(domain))
        self.__d = interpolate(d, FunctionOnBoundary(domain))
nstep    =   3000
dt       =   1.
small    =   EPSILON
w_step=max(int(nstep/50),1)*0+1
toler    =   0.001
teta1    =    0.5
teta2    =    0.5
teta3    =    1  # =0 split A; =1 split B

# create domain:
dom=Rectangle(int(nel*L/min(L,H)),int(nel*H/min(L,H)),order=1, l0=L, l1=H)
x=dom.getX()


momentumStep1=LinearPDESystem(dom) 
momentumStep1.setValue(q=whereZero(x[0])*[1.,0.]+whereZero(x[1])*[0.,1.]) # fix x0=0 and x1=0
face_mask=whereZero(FunctionOnBoundary(dom).getX()[1])

pressureStep2=LinearSinglePDE(dom) 
pressureStep2.setReducedOrderOn() 
pressureStep2.setValue(q=whereZero(x[0]-L)+whereZero(x[1]-H))

momentumStep3=LinearPDESystem(dom)
momentumStep3.setValue(q=whereZero(x[0])*[1.,0.]+whereZero(x[1])*[0.,1.])
#
#   initial values:
#
U=Vector(0.,Solution(dom)) 
p=ro*g*(L-ReducedSolution(dom).getX()[0])*(H-ReducedSolution(dom).getX()[1])/3 
p=ro*g*(H-ReducedSolution(dom).getX()[1])
示例#4
0
    dom = Brick(NE_L, NE_L, NE_H, l0=L, l1=L, l2=H, order=1, optimize=True)

BBOX = boundingBox(dom)
DIM = dom.getDim()
x = dom.getX()
#
#   initial values:
#
sigma = Tensor(0., Function(dom))
eps_e = Tensor(0., Function(dom))
if CASE == 2 or CASE == 3:
    alpha = ALPHA_0 * exp(-length(Function(dom).getX() - xc)**2 / WWW**2)
else:
    alpha = Scalar(ALPHA_0, Function(dom))

pde = LinearPDESystem(dom)
pde.setSymmetryOn()
pde.getSolverOptions().setSolverMethod(pde.getSolverOptions().DIRECT)

fixed_v_mask = Vector(0, Solution(dom))
v0 = Vector(0., ContinuousFunction(dom))
if CASE == 1 or CASE == 2:
    for d in range(DIM):
        fixed_v_mask += whereZero(x[d] - BBOX[d][0]) * unitVector(d, DIM)
        if d == DIM - 1:
            fixed_v_mask += whereZero(x[d] - BBOX[d][1]) * unitVector(d, DIM)
            v0[d] = (x[d] - BBOX[d][0]) / (BBOX[d][1] - BBOX[d][0]) * VMAX
else:
    for d in range(DIM):
        fixed_v_mask += whereZero(x[d] - BBOX[d][0]) * unitVector(d, DIM)
        if d == 0: