Ejemplo n.º 1
0
    def test_Differential(self):
        lam=2.
        mu=1.
        INC=0.01
        domain=ripBrick(20,20,min(99,20*mpisize-1) , d2=mpisize)

        xb=FunctionOnBoundary(domain).getX()
        m=whereZero(xb[2]-1)
        w=m*[0,0,1]
        d=m*2.5
        acw=Subsidence(domain, w,d, lam, mu )

        x=Function(domain).getX()
        P0=x[0]*x[1]
        args0=acw.getArguments(P0)
        d0=acw.getDefect(P0, *args0)
        grad_d=acw.getGradient(P0, *args0)

        dP=exp(-(length(x-[0.5,0.5,0.5])/0.06)**2)
        P1=P0+INC*dP
        args1=acw.getArguments(P1)
        d1=acw.getDefect(P1, *args1)
        ref=abs((d1-d0)/INC)
        self.assertLess(abs((d1-d0)/INC-integrate(grad_d* dP)), ref * 1.e-5)

        dP=exp(-(length(x-[0.3,0.3,0.5])/0.06)**2)
        P2=P0-INC*dP
        args2=acw.getArguments(P2)
        d2=acw.getDefect(P2, *args2)
        ref=abs((d2-d0)/INC)
        self.assertLess(abs((d2-d0)/INC+integrate(grad_d* dP)), ref * 1.e-5)
Ejemplo n.º 2
0
    def test_Differential(self):
        lam=2.
        mu=1.
        INC=0.01
        domain=ripBrick(20,20,min(99,20*mpisize-1) , d2=mpisize)

        xb=FunctionOnBoundary(domain).getX()
        m=whereZero(xb[2]-1)
        w=m*[0,0,1]
        d=m*2.5
        acw=Subsidence(domain, w,d, lam, mu )

        x=Function(domain).getX()
        P0=x[0]*x[1]
        args0=acw.getArguments(P0)
        d0=acw.getDefect(P0, *args0)
        grad_d=acw.getGradient(P0, *args0)

        dP=exp(-(length(x-[0.5,0.5,0.5])/0.06)**2)
        P1=P0+INC*dP
        args1=acw.getArguments(P1)
        d1=acw.getDefect(P1, *args1)
        ref=abs((d1-d0)/INC)
        self.assertLess(abs((d1-d0)/INC-integrate(grad_d* dP)), ref * 1.e-5)

        dP=exp(-(length(x-[0.3,0.3,0.5])/0.06)**2)
        P2=P0-INC*dP
        args2=acw.getArguments(P2)
        d2=acw.getDefect(P2, *args2)
        ref=abs((d2-d0)/INC)
        self.assertLess(abs((d2-d0)/INC+integrate(grad_d* dP)), ref * 1.e-5)
Ejemplo n.º 3
0
    def test_all(self):
        domain=ripBrick(50,50,20*mpisize-1, d2=mpisize)

        ps=IsostaticPressure(domain, level0=1., coordinates=None)
        g=Vector(0., Function(domain))
        rho=Scalar(100, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*981.
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))

        g=Vector([0,0,-10], Function(domain))
        rho=Scalar(0, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*26700
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))

        g=Vector([0,0,-10], Function(domain))
        rho=Scalar(100, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*(981.+26700+1000)
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))
Ejemplo n.º 4
0
    def test_all(self):
        domain=ripBrick(50,50,20*mpisize-1, d2=mpisize)

        ps=IsostaticPressure(domain, level0=1., coordinates=None)
        g=Vector(0., Function(domain))
        rho=Scalar(100, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*981.
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))

        g=Vector([0,0,-10], Function(domain))
        rho=Scalar(0, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*26700
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))

        g=Vector([0,0,-10], Function(domain))
        rho=Scalar(100, Function(domain))
        p0=ps.getPressure(g, rho)
        p_ref=-(1.-domain.getX()[2])*(981.+26700+1000)
        self.assertLess(Lsup(p0-p_ref), 1e-6 * Lsup(p_ref))
Ejemplo n.º 5
0
    def test_PDE(self):
        lam=2.
        mu=1.

        domain=ripBrick(20,20,max(19,2*mpisize-1), d2=mpisize)

        xb=FunctionOnBoundary(domain).getX()
        m=whereZero(xb[2]-1)
        w=m*[0,0,1]
        d=m*2.5
        acw=Subsidence(domain, w,d, lam, mu )

        P0=10.
        args0=acw.getArguments(P0)
        u=args0[0]
        self.assertLess(Lsup(u[0]), 1.e-8)
        self.assertLess(Lsup(u[1]), 1.e-8)
        self.assertLess(Lsup(u[2]-2.5*domain.getX()[2]), 1.e-8)

        dd=acw.getDefect(P0, *args0)

        self.assertTrue( dd >= 0.)
        self.assertTrue( dd <= 1e-7 * 2.5 )
Ejemplo n.º 6
0
    def test_PDE(self):
        lam=2.
        mu=1.

        domain=ripBrick(20,20,max(19,2*mpisize-1), d2=mpisize)

        xb=FunctionOnBoundary(domain).getX()
        m=whereZero(xb[2]-1)
        w=m*[0,0,1]
        d=m*2.5
        acw=Subsidence(domain, w,d, lam, mu )

        P0=10.
        args0=acw.getArguments(P0)
        u=args0[0]
        self.assertLess(Lsup(u[0]), 1.e-8)
        self.assertLess(Lsup(u[1]), 1.e-8)
        self.assertLess(Lsup(u[2]-2.5*domain.getX()[2]), 1.e-8)

        dd=acw.getDefect(P0, *args0)

        self.assertTrue( dd >= 0.)
        self.assertTrue( dd <= 1e-7 * 2.5 )