示例#1
0
 def fixme_test_mesh_read_rectangle_from_dudley_file(self):
     mydomain1 = Rectangle(n0=8,
                           n1=10,
                           order=1,
                           l0=1.,
                           l1=1.,
                           optimize=False)
     mydomain2 = ReadMesh(
         os.path.join(DUDLEY_TEST_MESH_PATH, "rectangle_8x10.fly"))
     self.domainsEqual(mydomain1, mydomain2)
示例#2
0
 def fixme_test_mesh_read_brick_from_dudley_file(self):
     mydomain1 = Brick(n0=8,
                       n1=10,
                       n2=12,
                       order=1,
                       l0=1.,
                       l1=1.,
                       l2=1.,
                       optimize=False)
     mydomain2 = ReadMesh(
         os.path.join(DUDLEY_TEST_MESH_PATH, "brick_8x10x12.fly"))
     self.domainsEqual(mydomain1, mydomain2)
示例#3
0
 def test_flyTags(self):
     dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH, "tagtest2.fly"))
     tags = sorted(dom.showTagNames().split(', '))
     self.assertEqual(tags, sorted(['tag1', 'tag2', 'tag3', 'tag4', 'All']))
     self.assertEqual(dom.getTag('tag1'), 5, 'error with tag1')
     self.assertEqual(dom.getTag('tag2'), 8, 'error with tag2,')
     self.assertEqual(dom.getTag('tag3'), 6, 'error with tag3')
     self.assertEqual(dom.getTag('tag4'), 7, 'error with tag4')
     self.assertEqual(dom.getTag('All'), 10, 'error with All')
     self.assertRaises(ValueError, dom.getTag, 'tag6')
 def test_ReadWriteTagNames(self):
     file="hex_2D_order2.msh"
     test = os.path.join(DUDLEY_WORKDIR,"test.fly")
     dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,file),3,optimize=False)
     insertTagNames(dom,A=1,B=2)
     dom.write(test)
     dom2 = ReadMesh(test,3,optimize=False)
     t=getTagNames(dom)
     self.assertTrue(len(t)==6)
     self.assertTrue("A" in t)
     self.assertTrue("B" in t)
     self.assertTrue(dom2.getTag("A") == 1)
     self.assertTrue(dom2.getTag("B") == 2)
     self.assertTrue(dom2.isValidTagName("A"))
     self.assertTrue(dom2.isValidTagName("B"))
示例#5
0
#  Parameter
#
DIM = 2
MESHFILE = "sub.fly"
ETA = 1.e22 * U.Pa * U.sec
V_MAX = 1. * U.cm / U.yr
ALPHA = 30 * U.DEG
STRIKE = 10 * U.DEG
DIP = 30 * U.DEG
N = 1  # boudary layer control

g = 9.81 * U.m / U.sec**2
#
#  derived values
#
dom = ReadMesh(MESHFILE)
DIM = dom.getDim()
bb = boundingBox(dom)
LX = bb[0][1] - bb[0][0]
if DIM == 3: LY = bb[1][1] - bb[1][0]
DEPTH = bb[DIM - 1][1] - bb[DIM - 1][0]

sc = StokesProblemCartesian(dom)
x = dom.getX()
#
v = Vector(0., Solution(dom))
mask = Vector(0., Solution(dom))
#
#  in subduction zone:
#
示例#6
0
#
DIM = 2
MESHFILE = "sub.fly"
ETA = 1.0e22 * U.Pa * U.sec
V_MAX = 1.0 * U.cm / U.yr
ALPHA = 30 * U.DEG
STRIKE = 10 * U.DEG
DIP = 30 * U.DEG
N = 1  # boudary layer control


g = 9.81 * U.m / U.sec ** 2
#
#  derived values
#
dom = ReadMesh(MESHFILE)
DIM = dom.getDim()
bb = boundingBox(dom)
LX = bb[0][1] - bb[0][0]
if DIM == 3:
    LY = bb[1][1] - bb[1][0]
DEPTH = bb[DIM - 1][1] - bb[DIM - 1][0]

sc = StokesProblemCartesian(dom)
x = dom.getX()
#
v = Vector(0.0, Solution(dom))
mask = Vector(0.0, Solution(dom))
#
#  in subduction zone:
#
示例#7
0
        # print "p:",inf(p),sup(p)
        # print "u:",inf(u),sup(u)
        self.__pde_u.setValue(y_contact=-p)
        return self.__pde_u.getSolution()

    def solve_g(self, u, tol=1.e-8):
        dp = Vector(0., FunctionOnContactZero(self.domain))
        h = FunctionOnContactZero(self.domain).getSize()
        # print jump(u)-self.slip
        dp[0] = (self.slip[0] - jump(u[0])) * lam_mu / h
        dp[1] = (self.slip[1] - jump(u[1])) * lam_mu / h
        dp[2] = (self.slip[2] - jump(u[2])) * lam_mu / h
        return dp


dom = ReadMesh("meshfault3D.fly", integrationOrder=-1)
prop = SlippingFault(dom)
d = dom.getDim()
x = dom.getX()[0]
# x=dom.getX()[d-1]
mask = whereZero(x - inf(x)) * numpy.ones((d, ))
x = FunctionOnContactZero(dom).getX()
s = numpy.array([-100000., 1., 1.])
for i in range(3):
    d = fend[i] - fstart[i]
    if d > 0:
        q = (x[i] - fstart[i]) / d
        s = q * (1 - q) * 4 * s
    elif d < 0:
        q = (x[i] - fend[i]) / d
        s = q * (1 - q) * 4 * s
 def setUp(self):
      self.domain = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
      self.order = 1
示例#9
0
         # print "p:",inf(p),sup(p)
         # print "u:",inf(u),sup(u)
         self.__pde_u.setValue(y_contact=-p)
         return  self.__pde_u.getSolution()

      def solve_g(self,u,tol=1.e-8):
         dp=Vector(0.,FunctionOnContactZero(self.domain))
         h=FunctionOnContactZero(self.domain).getSize()
         # print jump(u)-self.slip
         dp[0]=(self.slip[0]-jump(u[0]))*lam_mu/h
         dp[1]=(self.slip[1]-jump(u[1]))*lam_mu/h
         dp[2]=(self.slip[2]-jump(u[2]))*lam_mu/h
         return  dp


dom=ReadMesh("meshfault3D.fly",integrationOrder=-1)
prop=SlippingFault(dom)
d=dom.getDim()
x=dom.getX()[0]
# x=dom.getX()[d-1]
mask=whereZero(x-inf(x))*numpy.ones((d,))
x=FunctionOnContactZero(dom).getX()
s=numpy.array([-100000.,1.,1.])
for i in range(3):
     d=fend[i]-fstart[i]
     if d>0:
         q=(x[i]-fstart[i])/d
         s=q*(1-q)*4*s
     elif d<0:
         q=(x[i]-fend[i])/d
         s=q*(1-q)*4*s