Example #1
0
def interrogateWallPatches( mesh ):
    # Search for wall patches faces and store normals
    
    faceId = -1
    patchId = -1
    nWallFaces = 0
    wallNormal = ref.vector.zero

    patches = mesh.boundary()
    
    for patchi in range( patches.size() ):
        currPatch = patches[ patchi ]
        
        if ref.wallFvPatch.ext_isA( currPatch ):
            nf = currPatch.nf()
            
            for facei in range( nf.size() ):
                nWallFaces = nWallFaces +1
                if nWallFaces == 1:
                    wallNormal = -nf()[ facei ]
                    faceId = facei
                    patchId = patchi
                    pass
                elif nWallFaces == 2:
                    wallNormal2 = -nf()[ facei ]
                    #- Check that wall faces are parallel
                    if ref.mag( wallNormal & wallNormal2 ) > 1.01 or ref.mag( wallNormal & wallNormal2 ) < 0.99:
                        ref.ext_Info() << "wall faces are not parallel for patches " << patches[ patchId ].name() << " and " \
                                       << currPatch.name() << nl
                        import os; os.abort()
                        pass
                    pass
                else:
                    ref.ext_Info() << "number of wall faces > 2"<< nl
                    import os; os.abort()
                    pass
                pass
            pass
        pass

    if nWallFaces == 0:
        ref.ext_Info() << "No wall patches identified"
        import os; os.abort()
        pass
    else:
        ref.ext_Info()<< "Generating wall data for patch: " << patches[ patchId ].name() << ref.nl
        pass
    pass


    # store local id of near-walll cell to process
    cellId = patches[ patchId ].faceCells()[ faceId ];

    # create position array for graph generation
    y = wallNormal & ( mesh.C().internalField() - mesh.C().ext_boundaryField()[ patchId ][ faceId ] )

    ref.ext_Info() << "    Height to first cell centre y0 = " << y[ cellId ] << ref.nl
    
    return faceId, patchId, nWallFaces, wallNormal, cellId, y
Example #2
0
def evaluateNearWall(turbulence, U, y, faceId, patchId, nWallFaces, wallNormal,
                     cellId, flowDirection):

    # Evaluate near-wall behaviour
    tmp = turbulence.ext_nu()
    nu = tmp.ext_boundaryField()[patchId][faceId]

    tmp = turbulence.ext_nut()
    nut = turbulence.ext_nut().ext_boundaryField()[patchId][faceId]

    tmp = turbulence.devReff()
    R = tmp.ext_boundaryField()[patchId][faceId]

    epsilon = turbulence.ext_epsilon()[cellId]

    # scalar omega = turbulence->omega()()[cellId]
    k = turbulence.ext_k()[cellId]

    magUp = (U[cellId] - U.ext_boundaryField()[patchId][faceId]).mag()

    tauw = flowDirection & R & wallNormal

    from math import sqrt
    uTau = sqrt(ref.mag(tauw))

    yPlus = uTau * y[cellId] / (nu + ref.ROOTVSMALL)

    uPlus = magUp / (uTau + ref.ROOTVSMALL)

    nutPlus = nut / nu

    kPlus = k / (pow(uTau, 2) + ref.ROOTVSMALL)

    epsilonPlus = epsilon * nu / (pow(uTau, 4) + ref.ROOTVSMALL)

    # scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL)

    Rey = magUp * y[cellId] / nu

    ref.ext_Info() << "Rey = " << Rey << ", uTau = " << uTau << ", nut+ = " << nutPlus  \
                   << ", y+ = " << yPlus << ", u+ = " << uPlus << ", k+ = " << kPlus << ", epsilon+ = " << epsilonPlus \
                   << ref.nl
    pass
Example #3
0
def evaluateNearWall( turbulence, U, y, faceId, patchId, nWallFaces, wallNormal, cellId, flowDirection ):

     # Evaluate near-wall behaviour
     tmp = turbulence.ext_nu() 
     nu = tmp.ext_boundaryField()[ patchId ][ faceId ]

     tmp = turbulence.ext_nut()
     nut = turbulence.ext_nut().ext_boundaryField()[ patchId ][ faceId ]

     tmp = turbulence.devReff()
     R = tmp.ext_boundaryField()[ patchId ][ faceId ]

     epsilon = turbulence.ext_epsilon()[ cellId ]
     
     # scalar omega = turbulence->omega()()[cellId]
     k = turbulence.ext_k()[ cellId ]

     magUp = ( U[ cellId ] - U.ext_boundaryField()[ patchId ][ faceId ] ).mag()
     
     tauw = flowDirection & R & wallNormal
     
     from math import sqrt
     uTau = sqrt( ref.mag( tauw ) )
     
     yPlus = uTau * y[ cellId ] / ( nu + ref.ROOTVSMALL )
     
     uPlus = magUp / ( uTau + ref.ROOTVSMALL )

     nutPlus = nut / nu

     kPlus = k / ( pow( uTau, 2 ) + ref.ROOTVSMALL )
     
     epsilonPlus = epsilon * nu / ( pow( uTau, 4 ) + ref.ROOTVSMALL )

     # scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL)
     
     Rey = magUp * y[ cellId ] / nu

     ref.ext_Info() << "Rey = " << Rey << ", uTau = " << uTau << ", nut+ = " << nutPlus  \
                    << ", y+ = " << yPlus << ", u+ = " << uPlus << ", k+ = " << kPlus << ", epsilon+ = " << epsilonPlus \
                    << ref.nl
     pass
Example #4
0
def interrogateWallPatches(mesh):
    # Search for wall patches faces and store normals

    faceId = -1
    patchId = -1
    nWallFaces = 0
    wallNormal = ref.vector.zero

    patches = mesh.boundary()

    for patchi in range(patches.size()):
        currPatch = patches[patchi]

        if ref.wallFvPatch.ext_isA(currPatch):
            nf = currPatch.nf()

            for facei in range(nf.size()):
                nWallFaces = nWallFaces + 1
                if nWallFaces == 1:
                    wallNormal = -nf()[facei]
                    faceId = facei
                    patchId = patchi
                    pass
                elif nWallFaces == 2:
                    wallNormal2 = -nf()[facei]
                    #- Check that wall faces are parallel
                    if ref.mag(wallNormal & wallNormal2) > 1.01 or ref.mag(
                            wallNormal & wallNormal2) < 0.99:
                        ref.ext_Info() << "wall faces are not parallel for patches " << patches[ patchId ].name() << " and " \
                                       << currPatch.name() << nl
                        import os
                        os.abort()
                        pass
                    pass
                else:
                    ref.ext_Info() << "number of wall faces > 2" << nl
                    import os
                    os.abort()
                    pass
                pass
            pass
        pass

    if nWallFaces == 0:
        ref.ext_Info() << "No wall patches identified"
        import os
        os.abort()
        pass
    else:
        ref.ext_Info() << "Generating wall data for patch: " << patches[
            patchId].name() << ref.nl
        pass
    pass

    # store local id of near-walll cell to process
    cellId = patches[patchId].faceCells()[faceId]

    # create position array for graph generation
    y = wallNormal & (mesh.C().internalField() -
                      mesh.C().ext_boundaryField()[patchId][faceId])

    ref.ext_Info(
    ) << "    Height to first cell centre y0 = " << y[cellId] << ref.nl

    return faceId, patchId, nWallFaces, wallNormal, cellId, y