예제 #1
0
  
  l01=Line(p0,p1)
  l13=Line(p1,p3)
  l32=Line(p3,p2)
  l20=Line(p2,p0)
  
  l45=Line(p4,p5)
  l57=Line(p5,p7)
  l76=Line(p7,p6)
  l64=Line(p6,p4)
  
  l15=Line(p1,p5)
  l40=Line(p4,p0)
  l37=Line(p3,p7)
  l62=Line(p6,p2)

  bottom=PlaneSurface(-CurveLoop(l01,l13,l32,l20))
  top=PlaneSurface(CurveLoop(l45,l57,l76,l64))
  front=PlaneSurface(CurveLoop(l01,l15,-l45,l40))
  back=PlaneSurface(CurveLoop(l32,-l62,-l76,-l37))
  left=PlaneSurface(CurveLoop(-l40,-l64,l62,l20))
  right=PlaneSurface(CurveLoop(-l15,l13,l37,-l57))
  v=Volume(SurfaceLoop(top,bottom,front,back,left,right))
  des.addItems(v, PropertySet("subduction", left))

des.setScriptFileName("sub.geo")
des.setMeshFileName("sub.msh")

dom=MakeDomain(des, useMacroElements=True)
dom.write("sub.fly")
예제 #2
0
l01=Line(p0,p1)
l13=Line(p1,p3)
l32=Line(p3,p2)
l20=Line(p2,p0)

l45=Line(p4,p5)
l57=Line(p5,p7)
l76=Line(p7,p6)
l64=Line(p6,p4)

l15=Line(p1,p5)
l40=Line(p4,p0)
l37=Line(p3,p7)
l62=Line(p6,p2)

bottom=PlaneSurface(CurveLoop(l01,l13,l32,l20))
top=PlaneSurface(CurveLoop(l45,l57,l76,l64))
front=PlaneSurface(CurveLoop(l01,l15,-l45,l40))
back=PlaneSurface(CurveLoop(l32,-l62,-l76,-l37))
left=PlaneSurface(CurveLoop(-l40,-l64,l62,l20))
right=PlaneSurface(CurveLoop(-l15,l13,l37,-l57))
v=Volume(SurfaceLoop(top,-bottom,front,back,left,right))

des=Design(dim=3, order=2, element_size = 0.1, keep_files=True)
des.setScriptFileName("brick.geo")
des.addItems(v, top, bottom, back, front, left , right)

des.setFileFormat(des.STL)
des.setMeshFileName("brick.stl")
des.generate()
예제 #3
0
    # surface
    bblock = PlaneSurface(bblockloop)

    #clockwise check as splines must be set as polygons in the point order
    #they were created. Otherwise get a line across plot.
    bblockloop2 = CurveLoop(mysp, Line(x2, p2), Line(p2, p1), Line(p1, x1))

    ################################################CREATE MESH FOR ESCRIPT
    # Create a Design which can make the mesh
    d = Design(dim=2, element_size=dx, order=2)
    # Add the subdomains and flux boundaries.
    d.addItems(PropertySet("top",tblock),PropertySet("bottom",bblock),\
                                         PropertySet("linetop",l30))
    # Create the geometry, mesh and Escript domain
    d.setScriptFileName(os.path.join(save_path, "example08c.geo"))
    d.setMeshFileName(os.path.join(save_path, "example08c.msh"))
    domain = MakeDomain(d, optimizeLabeling=True)
    x = domain.getX()
    print("Domain has been generated ...")

    lam = Scalar(0, Function(domain))
    lam.setTaggedValue("top", lam1)
    lam.setTaggedValue("bottom", lam2)
    mu = Scalar(0, Function(domain))
    mu.setTaggedValue("top", mu1)
    mu.setTaggedValue("bottom", mu2)
    rho = Scalar(0, Function(domain))
    rho.setTaggedValue("top", rho1)
    rho.setTaggedValue("bottom", rho2)

    ##########################################################ESTABLISH PDE
예제 #4
0
__copyright__="""Copyright (c) 2003-2016 by The University of Queensland
http://www.uq.edu.au
Primary Business: Queensland, Australia"""
__license__="""Licensed under the Apache License, version 2.0
http://www.apache.org/licenses/LICENSE-2.0"""
__url__="https://launchpad.net/escript-finley"

from esys.escript import *
from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain


p0=Point(0.,0.)
p1=Point(1.,0.)
p2=Point(1.,1.)
p3=Point(0.,1.)

l01=Line(p0,p1)
l12=Line(p1,p2)
l23=Line(p2,p3)
l30=Line(p3,p0)

s=PlaneSurface(CurveLoop(l01,l12,l23,l30))
des=Design(dim=2, order=1, element_size = 1, keep_files=True)
des.setMeshFileName("rec.geo")
des.addItems(s)

dom=MakeDomain(des)
dom.write("rec.fly")
    l01 = Line(p0, p1)
    l13 = Line(p1, p3)
    l32 = Line(p3, p2)
    l20 = Line(p2, p0)

    l45 = Line(p4, p5)
    l57 = Line(p5, p7)
    l76 = Line(p7, p6)
    l64 = Line(p6, p4)

    l15 = Line(p1, p5)
    l40 = Line(p4, p0)
    l37 = Line(p3, p7)
    l62 = Line(p6, p2)

    bottom = PlaneSurface(-CurveLoop(l01, l13, l32, l20))
    top = PlaneSurface(CurveLoop(l45, l57, l76, l64))
    front = PlaneSurface(CurveLoop(l01, l15, -l45, l40))
    back = PlaneSurface(CurveLoop(l32, -l62, -l76, -l37))
    left = PlaneSurface(CurveLoop(-l40, -l64, l62, l20))
    right = PlaneSurface(CurveLoop(-l15, l13, l37, -l57))
    v = Volume(SurfaceLoop(top, bottom, front, back, left, right))
    des.addItems(v, PropertySet("subduction", left))

des.setScriptFileName("sub.geo")
des.setMeshFileName("sub.msh")

dom = MakeDomain(des, useMacroElements=True)
dom.write("sub.fly")
예제 #6
0
l12=Line(p1, p2)
l23=Line(p2, p3)
l30=Line(p3, p0)
c=CurveLoop(l01, l12, l23, l30)

# A small triangular cutout
x0=Point(0.1, 0.1, 0.0)
x1=Point(0.5, 0.1, 0.0)
x2=Point(0.5, 0.2, 0.0)
x01=Line(x0, x1)
x12=Line(x1, x2)
x20=Line(x2, x0)
cutout=CurveLoop(x01, x12, x20)

# Create the surface with cutout
s=PlaneSurface(c, holes=[cutout])

# Create a Design which can make the mesh
d=Design(dim=2, element_size=0.05)

# Add the trapezoid with cutout
d.addItems(s)

# Create the geometry, mesh and Escript domain
d.setScriptFileName("trapezoid.geo")
d.setMeshFileName("trapezoid.msh")
domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)

# Create a file that can be read back in to python with 
domain.write("trapezoid.fly")
예제 #7
0
l01 = Line(p0, p1)
l13 = Line(p1, p3)
l32 = Line(p3, p2)
l20 = Line(p2, p0)

l45 = Line(p4, p5)
l57 = Line(p5, p7)
l76 = Line(p7, p6)
l64 = Line(p6, p4)

l15 = Line(p1, p5)
l40 = Line(p4, p0)
l37 = Line(p3, p7)
l62 = Line(p6, p2)

bottom = PlaneSurface(CurveLoop(l01, l13, l32, l20))
top = PlaneSurface(CurveLoop(l45, l57, l76, l64))
front = PlaneSurface(CurveLoop(l01, l15, -l45, l40))
back = PlaneSurface(CurveLoop(l32, -l62, -l76, -l37))
left = PlaneSurface(CurveLoop(-l40, -l64, l62, l20))
right = PlaneSurface(CurveLoop(-l15, l13, l37, -l57))
v = Volume(SurfaceLoop(top, -bottom, front, back, left, right))

des = Design(dim=3, order=2, element_size=0.1, keep_files=True)
des.setScriptFileName("brick.geo")
des.addItems(v, top, bottom, back, front, left, right)

des.setFileFormat(des.STL)
des.setMeshFileName("brick.stl")
des.generate()
예제 #8
0
l01 = Line(p0, p1)
l13 = Line(p1, p3)
l32 = Line(p3, p2)
l20 = Line(p2, p0)

l45 = Line(p4, p5)
l57 = Line(p5, p7)
l76 = Line(p7, p6)
l64 = Line(p6, p4)

l15 = Line(p1, p5)
l40 = Line(p4, p0)
l37 = Line(p3, p7)
l62 = Line(p6, p2)

bottom = PlaneSurface(-CurveLoop(l01, l13, l32, l20))
top = PlaneSurface(CurveLoop(l45, l57, l76, l64))
front = PlaneSurface(CurveLoop(l01, l15, -l45, l40))
back = PlaneSurface(CurveLoop(l32, -l62, -l76, -l37))
left = PlaneSurface(CurveLoop(-l40, -l64, l62, l20))
right = PlaneSurface(CurveLoop(-l15, l13, l37, -l57))
v = Volume(SurfaceLoop(top, bottom, front, back, left, right))
des = Design(dim=3, order=2, element_size=1, keep_files=True)
des.addItems(PropertySet("V", v), PropertySet("bottom", bottom))
des.setScriptFileName("dom.geo")
des.setMeshFileName("dom.msh")

dom = MakeDomain(des)
dom.write("brick.fly")
예제 #9
0
:var __url__: url entry point on documentation
:var __version__: version
:var __date__: date of the version
"""

__author__ = "Lutz Gross, [email protected]"

from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain

p0 = Point(0., 0., 0., local_scale=0.01)
p1 = Point(1., 0., 0.)
p2 = Point(1., 1., 0.)
p3 = Point(0., 1., 0.)
l01 = Line(p0, p1)
l12 = Line(p1, p2)
l23 = Line(p2, p3)
l23.setElementDistribution(20)
l30 = Line(p3, p0)
c = CurveLoop(l01, l12, l23, l30)
s = PlaneSurface(c)

d = Design(dim=2, element_size=0.3)
d.setScriptFileName("refine.geo")
d.setMeshFileName("refine.msh")
d.addItems(s)

dom = MakeDomain(d)
dom.write("refine.fly")
    left_back_fault=getCutLine(Point(fault_mid_back-fault_w_back/2,length,0.), layers_left_at_back, offset=True)

    right_back_fault=getCutLine(Point(fault_mid_back+fault_w_back/2,length,0.), layers_right_at_back, offset=True)
    right_back_edge=getCutLine(Point(width,length,0.), layers_right_at_back, offset=False)

    PS={}
    FF=[]
    front_to_back_left_top, front_to_back_left_bot, PS, FF=addVolume(left_front_edge, left_back_edge, left_front_fault, left_back_fault, PS, FF, layers_left_at_front, filter_left=False)
    front_to_back_right_top, front_to_back_right_bot, PS, FF=addVolume(right_front_edge, right_back_edge, right_front_fault, right_back_fault, PS, FF, layers_right_at_front, filter_left=True)

    fault_line_top_front=Line(front_to_back_left_top.getStartPoint(), front_to_back_right_top.getStartPoint())
    fault_line_bot_front=Line(front_to_back_left_bot.getStartPoint(), front_to_back_right_bot.getStartPoint())
    fault_line_top_back=Line(front_to_back_left_top.getEndPoint(), front_to_back_right_top.getEndPoint())
    fault_line_bot_back=Line(front_to_back_left_bot.getEndPoint(), front_to_back_right_bot.getEndPoint())

    FF.append(PlaneSurface(CurveLoop(front_to_back_left_top,fault_line_top_back,-front_to_back_right_top,-fault_line_top_front)))
    FF.append(-PlaneSurface(CurveLoop(front_to_back_left_bot,fault_line_bot_back,-front_to_back_right_bot,-fault_line_bot_front)))

    FF.append(PlaneSurface(CurveLoop(*tuple([ -fault_line_top_front,fault_line_bot_front ]+left_front_fault+[ -l for l in right_front_fault ]))))
    FF.append(-PlaneSurface(CurveLoop(*tuple([ -fault_line_top_back,fault_line_bot_back ]+left_back_fault+[ -l for l in right_back_fault ]))))


    # war 120
    des=Design(dim=3, order=1, element_size = 400*m, keep_files=True)
    des.addItems(*tuple(PS.values()))
    des.addItems(PropertySet("fault",Volume(SurfaceLoop( *tuple(FF)))))
    des.setMeshFileName(os.path.join(save_path,"fault.msh"))
    dom=MakeDomain(des)
    dom.write(os.path.join(save_path,"fault.fly"))

예제 #11
0
:var __date__: date of the version
"""

__author__="Lutz Gross, [email protected]"

from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain
p0=Point(0.,0.,0.)
p1=Point(1.,0.,0.)
p2=Point(1.,1.,0.)
p3=Point(0.,1.,0.)
l01=Line(p0,p1)
l12=Line(p1,p2)
l23=Line(p2,p3)
l30=Line(p3,p0)
c=CurveLoop(l01,l12,l23,l30)
s=PlaneSurface(c)

d=Design(dim=2,element_size=0.05)
d.setScriptFileName("quad.geo")
d.setMeshFileName("quad.msh")
d.addItems(s)

pl1=PropertySet("sides",l01,l23)
pl2=PropertySet("top_and_bottom",l12,l30)
d.addItems(pl1,pl2)

dom=MakeDomain(d)
dom.write("quad.fly")
예제 #12
0
파일: quad.py 프로젝트: svn2github/Escript
:var __date__: date of the version
"""

__author__="Lutz Gross, [email protected]"

from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain
p0=Point(0.,0.,0.)
p1=Point(1.,0.,0.)
p2=Point(1.,1.,0.)
p3=Point(0.,1.,0.)
l01=Line(p0,p1)
l12=Line(p1,p2)
l23=Line(p2,p3)
l30=Line(p3,p0)
c=CurveLoop(l01,l12,l23,l30)
s=PlaneSurface(c)

d=Design(dim=2,element_size=0.05)
d.setScriptFileName("quad.geo")
d.setMeshFileName("quad.msh")
d.addItems(s)

pl1=PropertySet("sides",l01,l23)
pl2=PropertySet("top_and_bottom",l12,l30)
d.addItems(pl1,pl2)

dom=MakeDomain(d)
dom.write("quad.fly")
예제 #13
0
    left_back_fault=getCutLine(Point(fault_mid_back-fault_w_back/2,length,0.), layers_left_at_back, offset=True)

    right_back_fault=getCutLine(Point(fault_mid_back+fault_w_back/2,length,0.), layers_right_at_back, offset=True)
    right_back_edge=getCutLine(Point(width,length,0.), layers_right_at_back, offset=False)

    PS={}
    FF=[]
    front_to_back_left_top, front_to_back_left_bot, PS, FF=addVolume(left_front_edge, left_back_edge, left_front_fault, left_back_fault, PS, FF, layers_left_at_front, filter_left=False)
    front_to_back_right_top, front_to_back_right_bot, PS, FF=addVolume(right_front_edge, right_back_edge, right_front_fault, right_back_fault, PS, FF, layers_right_at_front, filter_left=True)

    fault_line_top_front=Line(front_to_back_left_top.getStartPoint(), front_to_back_right_top.getStartPoint())
    fault_line_bot_front=Line(front_to_back_left_bot.getStartPoint(), front_to_back_right_bot.getStartPoint())
    fault_line_top_back=Line(front_to_back_left_top.getEndPoint(), front_to_back_right_top.getEndPoint())
    fault_line_bot_back=Line(front_to_back_left_bot.getEndPoint(), front_to_back_right_bot.getEndPoint())

    FF.append(PlaneSurface(CurveLoop(front_to_back_left_top,fault_line_top_back,-front_to_back_right_top,-fault_line_top_front)))
    FF.append(-PlaneSurface(CurveLoop(front_to_back_left_bot,fault_line_bot_back,-front_to_back_right_bot,-fault_line_bot_front)))

    FF.append(PlaneSurface(CurveLoop(*tuple([ -fault_line_top_front,fault_line_bot_front ]+left_front_fault+[ -l for l in right_front_fault ]))))
    FF.append(-PlaneSurface(CurveLoop(*tuple([ -fault_line_top_back,fault_line_bot_back ]+left_back_fault+[ -l for l in right_back_fault ]))))


    # war 120
    des=Design(dim=3, order=1, element_size = 400*m, keep_files=True)
    des.addItems(*tuple(PS.values()))
    des.addItems(PropertySet("fault",Volume(SurfaceLoop( *tuple(FF)))))
    des.setMeshFileName(os.path.join(save_path,"fault.msh"))
    dom=MakeDomain(des)
    dom.write(os.path.join(save_path,"fault.fly"))

예제 #14
0
:var __licence__: licence agreement
:var __url__: url entry point on documentation
:var __version__: version
:var __date__: date of the version
"""

__author__="Lutz Gross, [email protected]"

from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain
p0=Point(0.,0.,0.,local_scale=0.01)
p1=Point(1.,0.,0.)
p2=Point(1.,1.,0.)
p3=Point(0.,1.,0.)
l01=Line(p0,p1)
l12=Line(p1,p2)
l23=Line(p2,p3)
l23.setElementDistribution(20)
l30=Line(p3,p0)
c=CurveLoop(l01,l12,l23,l30)
s=PlaneSurface(c)

d=Design(dim=2,element_size=0.3)
d.setScriptFileName("refine.geo")
d.setMeshFileName("refine.msh")
d.addItems(s)

dom=MakeDomain(d)
dom.write("refine.fly")
예제 #15
0
l12=Line(p1, p2)
l23=Line(p2, p3)
l30=Line(p3, p0)
c=CurveLoop(l01, l12, l23, l30)

# A small triangular cutout
x0=Point(0.1, 0.1, 0.0)
x1=Point(0.5, 0.1, 0.0)
x2=Point(0.5, 0.2, 0.0)
x01=Line(x0, x1)
x12=Line(x1, x2)
x20=Line(x2, x0)
cutout=CurveLoop(x01, x12, x20)

# Create the surface with cutout
s=PlaneSurface(c, holes=[cutout])

# Create a Design which can make the mesh
d=Design(dim=2, element_size=0.05)

# Add the trapezoid with cutout
d.addItems(s)

# Create the geometry, mesh and Escript domain
d.setScriptFileName("trapezoid.geo")
d.setMeshFileName("trapezoid.msh")
domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)

# Create a file that can be read back in to python with 
domain.write("trapezoid.fly")
예제 #16
0
__copyright__ = """Copyright (c) 2003-2018 by The University of Queensland
http://www.uq.edu.au
Primary Business: Queensland, Australia"""
__license__ = """Licensed under the Apache License, version 2.0
http://www.apache.org/licenses/LICENSE-2.0"""
__url__ = "https://launchpad.net/escript-finley"

from esys.escript import *
from esys.pycad import *
from esys.pycad.gmsh import Design
from esys.finley import MakeDomain

p0 = Point(0., 0.)
p1 = Point(1., 0.)
p2 = Point(1., 1.)
p3 = Point(0., 1.)

l01 = Line(p0, p1)
l12 = Line(p1, p2)
l23 = Line(p2, p3)
l30 = Line(p3, p0)

s = PlaneSurface(CurveLoop(l01, l12, l23, l30))
des = Design(dim=2, order=1, element_size=1, keep_files=True)
des.setMeshFileName("rec.geo")
des.addItems(s)

dom = MakeDomain(des)
dom.write("rec.fly")
예제 #17
0
    # surface
    bblock = PlaneSurface(bblockloop)

    # clockwise check as splines must be set as polygons in the point order
    # they were created. Otherwise get a line across plot.
    bblockloop2 = CurveLoop(mysp, Line(x2, p2), Line(p2, p1), Line(p1, x1))

    ################################################CREATE MESH FOR ESCRIPT
    # Create a Design which can make the mesh
    d = Design(dim=2, element_size=dx, order=2)
    # Add the subdomains and flux boundaries.
    d.addItems(PropertySet("top", tblock), PropertySet("bottom", bblock), PropertySet("linetop", l30))
    # Create the geometry, mesh and Escript domain
    d.setScriptFileName(os.path.join(save_path, "example08c.geo"))
    d.setMeshFileName(os.path.join(save_path, "example08c.msh"))
    domain = MakeDomain(d, optimizeLabeling=True)
    x = domain.getX()
    print("Domain has been generated ...")

    lam = Scalar(0, Function(domain))
    lam.setTaggedValue("top", lam1)
    lam.setTaggedValue("bottom", lam2)
    mu = Scalar(0, Function(domain))
    mu.setTaggedValue("top", mu1)
    mu.setTaggedValue("bottom", mu2)
    rho = Scalar(0, Function(domain))
    rho.setTaggedValue("top", rho1)
    rho.setTaggedValue("bottom", rho2)

    ##########################################################ESTABLISH PDE
예제 #18
0
파일: brick.py 프로젝트: svn2github/Escript
l32=Line(p3,p2)
l20=Line(p2,p0)

l45=Line(p4,p5)
l57=Line(p5,p7)
l76=Line(p7,p6)
l64=Line(p6,p4)

l15=Line(p1,p5)
l40=Line(p4,p0)
l37=Line(p3,p7)
l62=Line(p6,p2)

bottom=PlaneSurface(-CurveLoop(l01,l13,l32,l20))
top=PlaneSurface(CurveLoop(l45,l57,l76,l64))
front=PlaneSurface(CurveLoop(l01,l15,-l45,l40))
back=PlaneSurface(CurveLoop(l32,-l62,-l76,-l37))
left=PlaneSurface(CurveLoop(-l40,-l64,l62,l20))
right=PlaneSurface(CurveLoop(-l15,l13,l37,-l57))
v=Volume(SurfaceLoop(top,bottom,front,back,left,right))
des=Design(dim=3, order=2, element_size = 1, keep_files=True)
des.addItems(PropertySet("V",v), PropertySet("bottom",bottom))
des.setScriptFileName("dom.geo")
des.setMeshFileName("dom.msh")

dom=MakeDomain(des)
dom.write("brick.fly")