Exemple #1
0
def test_2DmultiRegion(verbose=0):
    """Test for loading gmsh mesh through PUMI with multiple-regions"""
    testDir = os.path.dirname(os.path.abspath(__file__))
    Model = testDir + '/TwoQuads.dmg'
    Mesh = testDir + '/TwoQuads.smb'
    domain = Domain.PUMIDomain(
        dim=2, manager=MeshAdapt.AdaptManager())  #initialize the domain

    domain.AdaptManager.reconstructedFlag = 0  #this is used to indicate that no mesh reconstruction is being done.
    domain.AdaptManager.PUMIAdapter.loadModelAndMesh(bytes(Model, 'utf-8'),
                                                     bytes(Mesh, 'utf-8'))
    domain.faceList = [[14], [12], [11], [13], [15], [16]]
    domain.boundaryLabels = [1, 2, 3, 4, 5, 6]
    domain.regList = [[41], [42]]

    mesh = MeshTools.TriangularMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()
    mesh.convertFromPUMI(domain,
                         domain.AdaptManager.PUMIAdapter,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)
    ok(mesh.elementMaterialTypes[0] == 1)
    ok(mesh.elementMaterialTypes[-1] == 2)
    def test_adaptIBM_adaptMesh(self):
        currentPath = os.path.dirname(os.path.abspath(__file__))
        runCommand = "cd " + currentPath + "; parun -l5 cylinder_so.py -C 'T=0.01 onlySaveFinalSolution=True genMesh=False usePUMI=True';"
        subprocess.check_call(runCommand, shell=True)

        #load initial mesh and extract element count
        domain = Domain.PUMIDomain(
            manager=MeshAdapt.AdaptManager())  #initialize the domain
        filePath = bytes(currentPath + '/', 'utf-8')
        domain.AdaptManager.PUMIAdapter.loadModelAndMesh(
            filePath + b"Reconstructed.dmg", filePath + b"Reconstructed.smb")
        mesh = MeshTools.TetrahedralMesh()
        mesh.convertFromPUMI(domain,
                             domain.AdaptManager.PUMIAdapter, [1], [1],
                             parallel=comm.size() > 1,
                             dim=2)
        nElements_initial = mesh.nElements_global

        #load final mesh and extract element count
        domain.AdaptManager.PUMIAdapter.loadModelAndMesh(
            filePath + b"Reconstructed.dmg", filePath + b"finalMesh.smb")
        mesh2 = MeshTools.TetrahedralMesh()
        mesh2.convertFromPUMI(domain,
                              domain.AdaptManager.PUMIAdapter, [1], [1],
                              parallel=comm.size() > 1,
                              dim=2)
        nElements_final = mesh2.nElements_global

        #adapted mesh should have less elements
        assert (nElements_final < nElements_initial)
Exemple #3
0
def test_parallelLoadPUMI(verbose=0):
    """Test to load parallel PUMI model and mesh"""
    comm = Comm.init()
    eq(comm.size(),2)
    testDir=os.path.dirname(os.path.abspath(__file__))
    domain = Domain.PUMIDomain()
    Model=testDir+ '/Prism.dmg'
    Mesh=testDir + '/Prism.smb'
    domain.PUMIMesh=MeshAdaptPUMI.MeshAdaptPUMI()
    domain.PUMIMesh.loadModelAndMesh(Model, Mesh)
    mesh = MeshTools.TetrahedralMesh()
    mesh.cmesh = cmeshTools.CMesh()
    mesh.convertFromPUMI(domain.PUMIMesh, domain.faceList, parallel = comm.size() > 1, dim = domain.nd)
    eq(mesh.nElements_global,8148)
    eq(mesh.nNodes_global,1880)
    eq(mesh.nEdges_global,11001)
    eq(mesh.nElementBoundaries_global,17270)
Exemple #4
0
def test_2DparallelLoadPUMI(verbose=0):
    """Test to load 2D parallel PUMI model and mesh"""
    comm = Comm.init()
    eq(comm.size(), 2)
    testDir = os.path.dirname(os.path.abspath(__file__))
    domain = Domain.PUMIDomain(dim=2)
    Model = testDir + '/Rectangle.dmg'
    Mesh = testDir + '/Rectangle.smb'
    domain.PUMIMesh = MeshAdaptPUMI.MeshAdaptPUMI()
    domain.PUMIMesh.loadModelAndMesh(Model, Mesh)
    mesh = MeshTools.TriangularMesh()
    mesh.cmesh = cmeshTools.CMesh()
    mesh.convertFromPUMI(domain.PUMIMesh,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)
    eq(mesh.nElements_global, 8)
    eq(mesh.nNodes_global, 10)
    eq(mesh.nEdges_global, 17)
    eq(mesh.nElementBoundaries_global, 17)
def test_2DmultiRegion(verbose=0):
    """Test for loading gmsh mesh through PUMI with multiple-regions"""
    testDir = os.path.dirname(os.path.abspath(__file__))
    Model = testDir + '/TwoQuads.dmg'
    Mesh = testDir + '/TwoQuads.smb'
    domain = Domain.PUMIDomain(dim=2)  #initialize the domain
    domain.PUMIMesh = MeshAdaptPUMI.MeshAdaptPUMI()
    domain.PUMIMesh.loadModelAndMesh(Model, Mesh)
    domain.faceList = [[14], [12], [11], [13], [15], [16]]
    domain.regList = [[41], [42]]

    mesh = MeshTools.TriangularMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()

    mesh.convertFromPUMI(domain.PUMIMesh,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)
    ok(mesh.elementMaterialTypes[0] == 1)
    ok(mesh.elementMaterialTypes[-1] == 2)
def test_poiseuilleError(verbose=0):
    """Test for loading gmsh mesh through PUMI, estimating error for 
    a Poiseuille flow case. The estimated error should be larger than the
    exact error in the seminorm"""
    testDir = os.path.dirname(os.path.abspath(__file__))
    Model = testDir + '/Couette.null'
    Mesh = testDir + '/Couette.msh'

    domain = Domain.PUMIDomain()  #initialize the domain
    domain.PUMIMesh = MeshAdaptPUMI.MeshAdaptPUMI(hmax=0.01,
                                                  hmin=0.008,
                                                  numIter=1,
                                                  sfConfig='ERM',
                                                  maType='isotropic',
                                                  logType='off')
    domain.PUMIMesh.loadModelAndMesh(Model, Mesh)
    domain.faceList = [[80], [76], [42], [24], [82], [78]]

    mesh = MeshTools.TetrahedralMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()

    nElements_initial = mesh.nElements_global
    mesh.convertFromPUMI(domain.PUMIMesh,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)

    domain.PUMIMesh.transferFieldToPUMI("coordinates", mesh.nodeArray)

    rho = numpy.array([998.2, 998.2])
    nu = numpy.array([1.004e-6, 1.004e-6])
    g = numpy.asarray([0.0, 0.0, 0.0])
    deltaT = 1.0  #dummy number
    domain.PUMIMesh.transferPropertiesToPUMI(rho, nu, g, deltaT)

    #Poiseuille Flow
    Ly = 0.2
    Lz = 0.05
    Re = 100
    Umax = Re * nu[0] / Lz

    def vOfX(x):
        return 4 * Umax / (Lz**2) * (x[2]) * (Lz - x[2])

    def dvOfXdz(x):
        return 4 * Umax / (Lz**2) * (Lz - 2 * x[2])

    #hard code solution
    vector = numpy.zeros((mesh.nNodes_global, 3), 'd')
    dummy = numpy.zeros(mesh.nNodes_global)

    vector[:, 0] = dummy
    vector[:, 1] = 4 * Umax / (Lz**2) * (mesh.nodeArray[:, 2]) * (
        Lz - mesh.nodeArray[:, 2])  #v-velocity
    vector[:, 2] = dummy
    domain.PUMIMesh.transferFieldToPUMI("velocity", vector)

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd')
    domain.PUMIMesh.transferFieldToPUMI("p", scalar)

    scalar[:, 0] = mesh.nodeArray[:, 2]
    domain.PUMIMesh.transferFieldToPUMI("phi", scalar)
    del scalar

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd') + 1.0
    domain.PUMIMesh.transferFieldToPUMI("vof", scalar)

    errorTotal = domain.PUMIMesh.get_local_error()

    # load the femspace with linear basis and get the quadrature points on a reference element
    elementQuadrature = Quadrature.SimplexGaussQuadrature(domain.nd, 3)

    ok(mesh.nNodes_element == 4)  #confirm all of the elements have 4 nodes

    #hard code computation for H1 seminorm; ideally will be reformatted using the classes within proteus
    derivativeArrayRef = [[1, 0, 0], [0, 1, 0], [0, 0, 1], [-1, -1, -1]]
    error = 0
    for eID in range(mesh.nElements_global):
        nodes = mesh.elementNodesArray[eID]
        coords = []
        for i in range(mesh.nNodes_element):
            coords.append(mesh.nodeArray[nodes[i]])
        J = numpy.matrix([[
            coords[0][0] - coords[3][0], coords[1][0] - coords[3][0],
            coords[2][0] - coords[3][0]
        ],
                          [
                              coords[0][1] - coords[3][1],
                              coords[1][1] - coords[3][1],
                              coords[2][1] - coords[3][1]
                          ],
                          [
                              coords[0][2] - coords[3][2],
                              coords[1][2] - coords[3][2],
                              coords[2][2] - coords[3][2]
                          ]])
        invJ = J.I
        detJ = numpy.linalg.det(J)
        gradPhi_h = 0
        for k in range(len(elementQuadrature.points)):
            tempQpt = 0
            zCoord = elementQuadrature.points[k][0]*coords[0][2] \
                +elementQuadrature.points[k][1]*coords[1][2] \
                +elementQuadrature.points[k][2]*coords[2][2] \
                +(1-elementQuadrature.points[k][0]-elementQuadrature.points[k][1]-elementQuadrature.points[k][2])*coords[3][2]
            for i in range(mesh.nNodes_element):
                temp = 0
                for j in range(domain.nd):
                    temp = temp + derivativeArrayRef[i][j] * invJ[j, 2]
                tempQpt = tempQpt + vector[nodes[i]][1] * temp
            exactgradPhi = dvOfXdz([0, 0, zCoord])
            gradPhi_h = gradPhi_h + tempQpt
            error = error + (exactgradPhi - gradPhi_h
                             )**2 * elementQuadrature.weights[k] * abs(detJ)

    error = sqrt(error)
    ok(error < errorTotal)
Exemple #7
0
def test_2DgmshLoadAndAdapt(verbose=0):
    """Test for loading gmsh mesh through PUMI, estimating error and adapting for 
    a 2D Couette flow case"""
    testDir=os.path.dirname(os.path.abspath(__file__))
    Model=testDir + '/Couette2D.null'
    Mesh=testDir + '/Couette2D.msh'
    domain = Domain.PUMIDomain(dim=2) #initialize the domain
    domain.PUMIMesh=MeshAdaptPUMI.MeshAdaptPUMI(hmax=0.01, hmin=0.008, numIter=1,sfConfig=b'ERM',maType=b'isotropic',targetError=1)
    domain.PUMIMesh.loadModelAndMesh(bytes(Model,'utf-8'), bytes(Mesh,'utf-8'))
    domain.faceList=[[14],[12],[11],[13]]
    domain.boundaryLabels=[1,2,3,4]

    mesh = MeshTools.TriangularMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()

    nElements_initial = mesh.nElements_global
    mesh.convertFromPUMI(domain,domain.PUMIMesh, domain.faceList,domain.regList, parallel = comm.size() > 1, dim = domain.nd)

    domain.PUMIMesh.transferFieldToPUMI(b"coordinates",mesh.nodeArray)

    rho = numpy.array([998.2,998.2])
    nu = numpy.array([1.004e-6, 1.004e-6])
    g = numpy.asarray([0.0,0.0])
    deltaT = 1.0 #dummy number
    epsFact = 1.0 #dummy number
    domain.PUMIMesh.transferPropertiesToPUMI(rho,nu,g,deltaT,epsFact)

    #Couette Flow
    Lz = 0.05
    Uinf = 2e-3
    #hard code solution
    vector=numpy.zeros((mesh.nNodes_global,3),'d')
    dummy = numpy.zeros(mesh.nNodes_global); 
    vector[:,0] = Uinf*mesh.nodeArray[:,1]/Lz #v-velocity
    vector[:,1] = dummy
    vector[:,2] = dummy
    domain.PUMIMesh.transferFieldToPUMI(b"velocity", vector)
    del vector
    del dummy

    scalar=numpy.zeros((mesh.nNodes_global,1),'d')
    domain.PUMIMesh.transferFieldToPUMI(b"p", scalar)

    scalar[:,0] = mesh.nodeArray[:,1]
    domain.PUMIMesh.transferFieldToPUMI(b"phi", scalar)
    del scalar

    scalar = numpy.zeros((mesh.nNodes_global,1),'d')+1.0
    domain.PUMIMesh.transferFieldToPUMI(b"vof", scalar)

    errorTotal=domain.PUMIMesh.get_local_error()
    ok(errorTotal<1e-14)

    #ok(domain.PUMIMesh.willAdapt(),1)

    domain.PUMIMesh.adaptPUMIMesh()
    
    mesh = MeshTools.TriangularMesh()
    mesh.convertFromPUMI(domain,domain.PUMIMesh,
                     domain.faceList,
                     domain.regList,
                     parallel = comm.size() > 1,
                     dim = domain.nd)
    nElements_final = mesh.nElements_global
    ok(nElements_final>nElements_initial)
Exemple #8
0
# domain = Domain.PlanarStraightLineGraphDomain()
# domain replacement
if useHex:
    nnx = 4 * refinement + 1
    nny = 2 * refinement + 1
    hex = True
    domain = Domain.RectangularDomain(tank_dim)
elif structured:
    nnx = 4 * refinement
    nny = 2 * refinement
    domain = Domain.RectangularDomain(tank_dim)
    boundaryTags = domain.boundaryTags

elif usePUMI and not genMesh:
    from proteus.MeshAdaptPUMI import MeshAdaptPUMI
    domain = Domain.PUMIDomain(dim=nd) #initialize the domain
    #boundaryTags=baseDomain.boundaryFlags
    he = 0.06
    adaptMeshFlag = opts.adapt#1
    adaptMesh_nSteps =3#5
    adaptMesh_numIter = 5
    hmax = he;
    hmin = he/4.0;
    hPhi = he/2.0;#/4.0
    domain.PUMIMesh=MeshAdaptPUMI.MeshAdaptPUMI(hmax=hmax, hmin=hmin, hPhi = hPhi, adaptMesh=adaptMeshFlag, numIter=adaptMesh_numIter, numAdaptSteps=adaptMesh_nSteps,  sfConfig="pseudo",logType="off",reconstructedFlag=2,gradingFact=1.2)
    domain.PUMIMesh.loadModelAndMesh("Reconstructed.dmg", "Reconstructed.smb")

else:
    domain = Domain.PlanarStraightLineGraphDomain()

if genMesh and usePUMI:
Exemple #9
0
def test_gmshLoadAndAdapt(verbose=0):
    """Test for loading gmsh mesh through PUMI, estimating error and adapting for 
    a Couette flow case"""
    testDir = os.path.dirname(os.path.abspath(__file__))
    Model = testDir + '/Couette.null'
    Mesh = testDir + '/Couette.msh'

    domain = Domain.PUMIDomain()  #initialize the domain
    domain.PUMIMesh = MeshAdaptPUMI.MeshAdaptPUMI(hmax=0.01,
                                                  hmin=0.008,
                                                  numIter=1,
                                                  sfConfig='ERM',
                                                  maType='isotropic')
    domain.PUMIMesh.loadModelAndMesh(Model, Mesh)
    domain.faceList = [[80], [76], [42], [24], [82], [78]]

    mesh = MeshTools.TetrahedralMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()

    nElements_initial = mesh.nElements_global
    mesh.convertFromPUMI(domain.PUMIMesh,
                         domain.faceList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)

    domain.PUMIMesh.transferFieldToPUMI("coordinates", mesh.nodeArray)

    rho = numpy.array([998.2, 998.2])
    nu = numpy.array([1.004e-6, 1.004e-6])
    g = numpy.asarray([0.0, 0.0, 0.0])
    domain.PUMIMesh.transferPropertiesToPUMI(rho, nu, g)

    #Couette Flow
    Lz = 0.05
    Uinf = 2e-3
    #hard code solution
    vector = numpy.zeros((mesh.nNodes_global, 3), 'd')
    dummy = numpy.zeros(mesh.nNodes_global)
    vector[:, 0] = dummy
    vector[:, 1] = Uinf * mesh.nodeArray[:, 2] / Lz  #v-velocity
    vector[:, 2] = dummy
    domain.PUMIMesh.transferFieldToPUMI("velocity", vector)
    del vector
    del dummy

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd')
    domain.PUMIMesh.transferFieldToPUMI("p", scalar)

    scalar[:, 0] = mesh.nodeArray[:, 2]
    domain.PUMIMesh.transferFieldToPUMI("phi", scalar)
    del scalar

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd') + 1.0
    domain.PUMIMesh.transferFieldToPUMI("vof", scalar)

    errorTotal = domain.PUMIMesh.get_local_error()
    ok(errorTotal < 1e-14)

    ok(domain.PUMIMesh.willAdapt(), 1)

    domain.PUMIMesh.adaptPUMIMesh()

    mesh = MeshTools.TetrahedralMesh()
    mesh.convertFromPUMI(domain.PUMIMesh,
                         domain.faceList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)
    nElements_final = mesh.nElements_global
    ok(nElements_final > nElements_initial)
Exemple #10
0
def test_gmshLoadAndAdapt(verbose=0):
    """Test for loading gmsh mesh through PUMI, estimating error and adapting for 
    a Couette flow case"""
    testDir = os.path.dirname(os.path.abspath(__file__))
    Model = testDir + '/Couette.null'
    Mesh = testDir + '/Couette.msh'

    domain = Domain.PUMIDomain(
        manager=MeshAdapt.AdaptManager())  #initialize the domain

    domain.AdaptManager.modelDict = {'flow': 0}
    domain.AdaptManager.sizeInputs = [b'error_erm']
    domain.AdaptManager.adapt = 1
    domain.AdaptManager.hmax = 0.01
    domain.AdaptManager.hmin = 0.008
    domain.AdaptManager.hphi = 0.008
    domain.AdaptManager.numIterations = 1
    domain.AdaptManager.targetError = 1

    domain.AdaptManager.PUMIAdapter.loadModelAndMesh(bytes(Model, 'utf-8'),
                                                     bytes(Mesh, 'utf-8'))
    domain.AdaptManager.PUMIAdapter.setAdaptProperties(domain.AdaptManager)

    domain.faceList = [[80], [76], [42], [24], [82], [78]]
    domain.boundaryLabels = [1, 2, 3, 4, 5, 6]

    mesh = MeshTools.TetrahedralMesh()
    mesh.cmesh = cmeshTools.CMesh()
    comm = Comm.init()

    nElements_initial = mesh.nElements_global
    mesh.convertFromPUMI(domain,
                         domain.AdaptManager.PUMIAdapter,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)

    domain.AdaptManager.PUMIAdapter.transferFieldToPUMI(
        b"coordinates", mesh.nodeArray)

    rho = numpy.array([998.2, 998.2])
    nu = numpy.array([1.004e-6, 1.004e-6])
    g = numpy.asarray([0.0, 0.0, 0.0])
    deltaT = 1.0  #dummy number
    epsFact = 1.0  #dummy number
    domain.AdaptManager.PUMIAdapter.transferPropertiesToPUMI(
        rho, nu, g, deltaT, deltaT, deltaT, epsFact)

    #Couette Flow
    Lz = 0.05
    Uinf = 2e-3
    #hard code solution
    vector = numpy.zeros((mesh.nNodes_global, 3), 'd')
    dummy = numpy.zeros(mesh.nNodes_global)
    vector[:, 0] = dummy
    vector[:, 1] = Uinf * mesh.nodeArray[:, 2] / Lz  #v-velocity
    vector[:, 2] = dummy
    domain.AdaptManager.PUMIAdapter.transferFieldToPUMI(b"velocity", vector)
    del vector
    del dummy

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd')
    domain.AdaptManager.PUMIAdapter.transferFieldToPUMI(b"p", scalar)

    scalar[:, 0] = mesh.nodeArray[:, 2]
    domain.AdaptManager.PUMIAdapter.transferFieldToPUMI(b"phi", scalar)
    del scalar

    scalar = numpy.zeros((mesh.nNodes_global, 1), 'd') + 1.0
    domain.AdaptManager.PUMIAdapter.transferFieldToPUMI(b"vof", scalar)

    errorTotal = domain.AdaptManager.PUMIAdapter.get_local_error()
    ok(errorTotal < 1e-14)

    #ok(domain.AdaptManager.willAdapt(),1)
    domain.AdaptManager.PUMIAdapter.adaptPUMIMesh(b"")

    mesh = MeshTools.TetrahedralMesh()
    mesh.convertFromPUMI(domain,
                         domain.AdaptManager.PUMIAdapter,
                         domain.faceList,
                         domain.regList,
                         parallel=comm.size() > 1,
                         dim=domain.nd)
    nElements_final = mesh.nElements_global
    ok(nElements_final > nElements_initial)
Exemple #11
0
if useHex:
    nnx=4*Refinement+1
    nny=1*Refinement+1
    nnz=2*Refinement+1
    if quas2D:
        nny=2
    hex=True
    domain = Domain.RectangularDomain(L)
else:
    boundaries=['bottom','top','front','back','left','right']
    boundaryTags=dict([(key,i+1) for (i,key) in enumerate(boundaries)])
    if structured:
        nnx=4*Refinement
        nny=2*Refinement
    else:
        domain = Domain.PUMIDomain() #initialize the domain
        #domain.numBC=6 #set number of BCs
#        domain.numAdaptSteps=1 #set number of adapt steps (loops)
        #Following sets list of face tags of geometric model as mapped from boundary Tags,
        #meaning if faceList=[[2,4],[1]] and boundaries=['left','right'], then faces with geometry tags 2 and 4 are set as 'left'
        #and face with geometric tag 4 is set as 'right'
        #The order of boundaries list is important because the last ones take precendence over the first ones,
        #which means that the geometric edge or vertex which lies on 2 or more geometric faces will be set with the boundaries tag of
        #the geomtric face which is latter in the order (email: [email protected] for any questions)
        domain.faceList=[[41],[46],[42],[44],[45],[43]]
        #set max edge length, min edge length, number of meshadapt iterations and initialize the MeshAdaptPUMI object
        he =0.5
        adaptMesh = True
        adaptMesh_nSteps = 10
        adaptMesh_numIter = 2
        domain.PUMIMesh=MeshAdaptPUMI.MeshAdaptPUMI(hmax=0.01, hmin=0.008, numIter=1,sfConfig='ERM',maType='isotropic',targetError=0.1,targetElementCount=1000)
Exemple #12
0
    'right': [2],
    'back': [3],
    'left': [4],
    'bottom': [5],
    'top': [6],
    'obstacle': [7, 8, 9, 10, 11, 12]
}

faceList = []
for boundary in boundaries:
    if boundary in faceMap:
        faceList.append(faceMap[boundary])
    else:
        faceList.append([])

domain = Domain.PUMIDomain(dim=3)
domain.faceList = faceList

adaptMesh = True
adaptMesh_nSteps = 10
adaptMesh_numIter = 3

domain.PUMIMesh = MeshAdaptPUMI.MeshAdaptPUMI(hmax=he,
                                              hmin=he,
                                              numIter=adaptMesh_numIter,
                                              sfConfig="farhad")
domain.PUMIMesh.loadModelAndMesh("floating_bar_3d.dmg", "floating_bar_3d.smb")

restrictFineSolutionToAllMeshes = False
parallelPartitioningType = MeshTools.MeshParallelPartitioningTypes.element
nLayersOfOverlapForParallel = 0
Exemple #13
0
if useHex:
    nnx=4*Refinement+1
    nny=1*Refinement+1
    nnz=2*Refinement+1
    if quas2D:
        nny=2
    hex=True
    domain = Domain.RectangularDomain(L)
else:
    boundaries=['bottom','top','front','back','left','right']
    boundaryTags=dict([(key,i+1) for (i,key) in enumerate(boundaries)])
    if structured:
        nnx=4*Refinement
        nny=2*Refinement
    else:
        domain = Domain.PUMIDomain(manager=MeshAdapt.AdaptManager()) #initialize the domain
        #domain.numBC=6 #set number of BCs
#        domain.numAdaptSteps=1 #set number of adapt steps (loops)
        #Following sets list of face tags of geometric model as mapped from boundary Tags,
        #meaning if faceList=[[2,4],[1]] and boundaries=['left','right'], then faces with geometry tags 2 and 4 are set as 'left'
        #and face with geometric tag 4 is set as 'right'
        #The order of boundaries list is important because the last ones take precendence over the first ones,
        #which means that the geometric edge or vertex which lies on 2 or more geometric faces will be set with the boundaries tag of
        #the geomtric face which is latter in the order (email: [email protected] for any questions)
        domain.faceList=[[41],[46],[42],[44],[45],[43]]
        domain.boundaryLabels=[1,2,3,4,5,6]
        #read the geometry and mesh
        testDir=os.path.dirname(os.path.abspath(__file__))
        Model = testDir + '/../Couette.null'
        Mesh = testDir + '/../Couette.msh'