How to use the micromagneticmodel.Damping function in micromagneticmodel

To help you get started, we’ve selected a few micromagneticmodel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubermag / oommfc / oommfc / dynamics / damping.py View on Github external
import micromagneticmodel as mm


class Damping(mm.Damping):
    """Gilbert damping dynamics term.

    This dynamics term models the Gilbert damping in the
    Landau-Lifshitz-Gilbert equation. It is defined by the Gilbert
    damping `alpha`. `alpha` is a scalar value with no units.

    .. math::

           \\frac{\\text{d}\\mathbf{m}}{\\text{d}t} = -\\alpha
           \\left(\\mathbf{m} \\times
           \\frac{\\text{d}\\mathbf{m}}{\\text{d}t} \\right)

    `alpha` can be either contant in space or spatially varying. If it
    is constant, a single value is passed, e.g. `alpha = 0.01`. On
    the other hand, if it varies in space, there are two ways how that
    can be defined. The first one is using a dictionary, where the
github ubermag / oommfc / oommfc / scripts / driver.py View on Github external
driver.evolver = oc.SpinXferEvolver()
            else:
                driver.evolver = oc.RungeKuttaEvolver()
        elif not isinstance(driver.evolver, (oc.EulerEvolver,
                                             oc.RungeKuttaEvolver,
                                             oc.SpinTEvolver,
                                             oc.SpinXferEvolver)):
            msg = f'Cannot use {type(driver.evolver)} for evolver.'
            raise TypeError(msg)

        # Extract dynamics equation parameters.
        if mm.Precession() in system.dynamics:
            driver.evolver.gamma_G = system.dynamics.precession.gamma0
        else:
            driver.evolver.do_precess = 0
        if mm.Damping() in system.dynamics:
            driver.evolver.alpha = system.dynamics.damping.alpha
        else:
            driver.evolver.alpha = 0
        if mm.ZhangLi() in system.dynamics:
            driver.evolver.u = system.dynamics.zhangli.u
            driver.evolver.beta = system.dynamics.zhangli.beta
        if mm.Slonczewski() in system.dynamics:
            driver.evolver.J = system.dynamics.slonczewski.J
            driver.evolver.mp = system.dynamics.slonczewski.mp
            driver.evolver.P = system.dynamics.slonczewski.P
            driver.evolver.Lambda = system.dynamics.slonczewski.Lambda
            driver.evolver.eps_prime = system.dynamics.slonczewski.eps_prime

        mif += oc.scripts.evolver_script(driver.evolver)

        # Extract time and number of steps.