Exemplo n.º 1
0
    bench = Benchmarker()

    bench.start()

    Length = N * 2.5 / 100.
    nx = N
    ny = N
    dx = Length / nx
    dy = Length / ny
    radius = Length / 4.
    seedCenter = (Length / 2., Length / 2.)
    initialTemperature = -0.4
    from fipy.meshes.grid2D import Grid2D
    mesh = Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)

    bench.stop('mesh')

    bench.start()

    timeStepDuration = 5e-5
    tau = 3e-4
    alpha = 0.015
    c = 0.02
    N = 4.
    kappa1 = 0.9
    kappa2 = 20.    
    tempDiffusionCoeff = 2.25
    theta = 0.
    from fipy.variables.cellVariable import CellVariable
    phase = CellVariable(name='phase field', mesh=mesh, hasOld=1)
    x, y = mesh.getCellCenters()[...,0], mesh.getCellCenters()[...,1]
Exemplo n.º 2
0
    if numberOfElements != -1:
        pos = trenchSpacing * cellsBelowTrench / 4 / numberOfElements
        sqr = trenchSpacing * (trenchDepth + boundaryLayerDepth) \
              / (2 * numberOfElements)
        cellSize = pos + numerix.sqrt(pos**2 + sqr)
    else:
        cellSize = 0.1e-7

    yCells = cellsBelowTrench \
             + int((trenchDepth + boundaryLayerDepth) / cellSize)

    xCells = int(trenchSpacing / 2 / cellSize)
    from fipy.meshes.grid2D import Grid2D
    mesh = Grid2D(dx=cellSize, dy=cellSize, nx=xCells, ny=yCells)

    bench.stop('mesh')

    bench.start()

    narrowBandWidth = numberOfCellsInNarrowBand * cellSize
    from fipy.models.levelSet.distanceFunction.distanceVariable import \
        DistanceVariable

    distanceVar = DistanceVariable(name='distance variable',
                                   mesh=mesh,
                                   value=-1,
                                   narrowBandWidth=narrowBandWidth,
                                   hasOld=1)

    bottomHeight = cellsBelowTrench * cellSize
    trenchHeight = bottomHeight + trenchDepth
Exemplo n.º 3
0
Arquivo: mesh.py Projeto: ghorn/Eg
    $ python setup.py efficiency_test
"""
__docformat__ = 'restructuredtext'

if __name__ == "__main__":

    from fipy.tools.parser import parse

    from benchmarker import Benchmarker
    bench = Benchmarker()

    numberOfElements = parse('--numberOfElements',
                             action='store',
                             type='int',
                             default=100)

    bench.start()

    from fipy.tools import numerix
    nx = int(numerix.sqrt(numberOfElements))
    ny = nx
    dx = 1.
    dy = 1.

    from fipy.meshes.grid2D import Grid2D
    mesh = Grid2D(nx=nx, ny=nx, dx=dx, dy=dy)

    bench.stop('mesh')

    print bench.report(numberOfElements=numberOfElements)
Exemplo n.º 4
0
Arquivo: mesh.py Projeto: ghorn/Eg
r"""
This example benchmarks the speed and memory usage of creating a mesh. Run:
    
    $ python setup.py efficiency_test
"""
__docformat__ = 'restructuredtext'

if __name__ == "__main__":
        
    from fipy.tools.parser import parse

    from benchmarker import Benchmarker
    bench = Benchmarker()

    numberOfElements = parse('--numberOfElements', action = 'store', type = 'int', default = 100)

    bench.start()

    from fipy.tools import numerix
    nx = int(numerix.sqrt(numberOfElements))
    ny = nx
    dx = 1.
    dy = 1.

    from fipy.meshes.grid2D import Grid2D
    mesh = Grid2D(nx = nx, ny = nx, dx = dx, dy = dy)

    bench.stop('mesh')

    print bench.report(numberOfElements=numberOfElements)