Пример #1
0
        IGamma = (gradMag > 1. / gamma) * (1 / gradMag - gamma) + gamma
        diffusionCoeff = phaseSq * (s * IGamma + epsilon**2)

        thetaGradDiff = theta.getFaceGrad() - theta.getFaceGradNoMod()
        sourceCoeff = (diffusionCoeff * thetaGradDiff).getDivergence()

        from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
        return TransientTerm(thetaTransientCoeff * phaseModSq * pFunc) == \
                   ImplicitDiffusionTerm(diffusionCoeff) \
                   + sourceCoeff

    thetaEq = buildThetaEquation(phase, theta)

    bench.stop('terms')

    theta.updateOld()
    phase.updateOld()
    thetaEq.solve(theta, dt = timeStepDuration)
    phaseEq.solve(phase, dt = timeStepDuration)

    bench.start()

    ##from profiler import Profiler
    ##from profiler import calibrate_profiler
    ##fudge = calibrate_profiler(10000)
    ##profile = Profiler('profile-HEAD-i686', fudge=fudge)

    for i in range(steps):
        theta.updateOld()
        phase.updateOld()
        thetaEq.solve(theta, dt = timeStepDuration)
Пример #2
0
        IGamma = (gradMag > 1. / gamma) * (1 / gradMag - gamma) + gamma
        diffusionCoeff = phaseSq * (s * IGamma + epsilon**2)

        thetaGradDiff = theta.getFaceGrad() - theta.getFaceGradNoMod()
        sourceCoeff = (diffusionCoeff * thetaGradDiff).getDivergence()

        from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
        return TransientTerm(thetaTransientCoeff * phaseModSq * pFunc) == \
                   ImplicitDiffusionTerm(diffusionCoeff) \
                   + sourceCoeff

    thetaEq = buildThetaEquation(phase, theta)

    bench.stop('terms')

    theta.updateOld()
    phase.updateOld()
    thetaEq.solve(theta, dt=timeStepDuration)
    phaseEq.solve(phase, dt=timeStepDuration)

    bench.start()

    ##from profiler import Profiler
    ##from profiler import calibrate_profiler
    ##fudge = calibrate_profiler(10000)
    ##profile = Profiler('profile-HEAD-i686', fudge=fudge)

    for i in range(steps):
        theta.updateOld()
        phase.updateOld()
        thetaEq.solve(theta, dt=timeStepDuration)