Example #1
0
def mapVolField( theSourceField, meshSource, meshTarget,
                 # List of pairs of source/target patches for mapping
                 patchMap = Foam.OpenFOAM.wordHashTable(),
                 # List of target patches cutting the source domain (these need to be
                 # handled specially e.g. interpolated from inernal values)
                 cuttingPatches = Foam.OpenFOAM.wordList()
                 ) :
    from Foam.sampling import meshToMesh
    meshToMeshInterp = meshToMesh( meshSource, meshTarget, patchMap, cuttingPatches )

    return __mapVolField__( theSourceField, meshToMeshInterp, patchMap, cuttingPatches )
Example #2
0
def mapVolFields( name2VolField, meshSource, meshTarget,
                  patchMap = Foam.OpenFOAM.wordHashTable(),
                  # List of target patches cutting the source domain (these need to be
                  # handled specially e.g. interpolated from inernal values)
                  cuttingPatches = Foam.OpenFOAM.wordList()
                  ) :
    aName2VolField = dict()

    from Foam.sampling import meshToMesh
    meshToMeshInterp = meshToMesh( meshSource, meshTarget, patchMap, cuttingPatches )

    print "\nMapping fields for time", meshSource.time().timeName(), "\n"
    for aSourceField in name2VolField.values() :
        aTargetField = __mapVolField__( aSourceField, meshToMeshInterp, patchMap, cuttingPatches )
        aName2VolField[ str( aTargetField.name() ) ] = aTargetField
        pass
    
    return aName2VolField