OOMMF Home next up previous contents index
Next: Data Table Display: mmDataTable Up: OOMMF Documentation Previous: Micromagnetic Problem File Source:


The 2D Micromagnetic Solver: mmSolve2D

mmSolve2D Screen Shot

Overview
The application mmSolve2D is a micromagnetic computation engine capable of solving problems defined on two-dimensional square grids of three-dimensional spins. Within the OOMMF architecture, mmSolve2D is both a server and a client application. mmSolve2D is a client of problem description server applications, data table display and storage applications, and vector field display and storage applications. mmSolve2D is the server of a solver control service for which the only client is mmLaunch. It is through this service that mmLaunch provides a user interface window (shown above) on behalf of mmSolve2D.

Launching
mmSolve2D may be started either by selecting the mmSolve2D button on mmLaunch, or from the command line via

tclsh oommf.tcl mmSolve2D [standard options] [-restart <0|1>]

-restart <0|1>
Affects the behavior of the solver when a new problem is loaded. Default value is 0. When launched with -restart 1, the solver will look for basename.log and basename*.omf files to restart a previous run from the last saved state (where basename is the ``Base Output Filename'' specified in the input MIF problem specification file). If these files cannot be found, then a warning is issued and the solver falls back to the default behavior (-restart 0) of starting the problem from scratch. The specified -restart setting holds for all problems fed to the solver, not just the first. (There is currently no interactive way to change the value of this switch.)

Since mmSolve2D does not present any user interface window of its own, it depends on mmLaunch to provide an interface on its behalf. The entry for an instance of mmSolve2D in the Threads column of any running copy of mmLaunch has a checkbutton next to it. This button toggles the presence of a user interface window through which the user may control that instance of mmSolve2D. The user interface window is divided into panels, providing user interfaces to the Inputs, Outputs, and Controls of mmSolve2D.

Note on Tk dependence: If a problem is loaded that uses a bitmap mask file, and if that mask file is not in the PPM P3 (text) format, then mmSolve2D will launch any2ppm to convert it into the PPM P3 format. Since any2ppm requires Tk, at the time the mask file is read a valid display must be available. See the any2ppm documentation for details.

Inputs
The top panel of the user interface window may be opened and closed by toggling the Inputs checkbutton. When open, the Inputs panel reveals two subpanels. The left subpanel contains a list of the inputs required by mmSolve2D. There is only one item in the list: ProblemDescription. When ProblemDescription is selected, the right subpanel (labeled Source Threads) displays a list of applications that can supply a problem description. The user selects from among the listed applications the one from which mmSolve2D should request a problem description.

Outputs
When mmSolve2D has outputs available to be controlled, a Scheduled Outputs checkbutton appears in the user interface window. Toggling the Scheduled Outputs checkbutton causes a bottom panel to open and close in the user interface window. When open, the Scheduled Outputs panel contains three subpanels. The Outputs subpanel is filled with a list of the types of output mmSolve2D can generate while solving the loaded problem. The three elements in this list are TotalField, for the output of a vector field representing the total effective field, Magnetization, for the output of a vector field representing the current magnetization state of the grid of spins, and DataTable, for the output of a table of data values describing other quantities of interest calculated by mmSolve2D.

Upon selecting one of the output types from the Outputs subpanel, a list of applications appears in the Destination Threads subpanel which provide a display and/or storage service for the type of output selected. The user may select from this list those applications to which the selected type of output should be sent.

For each application selected, a final interface is displayed in the Schedule subpanel. Through this interface the user may set the schedule according to which the selected type of data is sent to the selected application for display or storage. The schedule is described relative to events in mmSolve2D. An Iteration event occurs at every step in the solution of the ODE. A ControlPoint event occurs whenever the solver determines that a control point specification is met. (Control point specs are discussed in the Experiment parameters paragraph in the MIF documentation, and are triggered by solver equilibrium, simulation time, and iteration count conditions.) An Interactive event occurs for a particular output type whenever the corresponding ``Interactive Outputs'' button is clicked in the Runtime Control panel. The Interactive schedule gives the user the ability to interactively force data to be delivered to selected display and storage applications. For the Iteration and ControlPoint events, the granularity of the output delivery schedule is under user control. For example, the user may elect to send vector field data describing the current magnetization state to an mmDisp instance for display every 25 iterations of the ODE, rather than every iteration.

The quantities included in DataTable output produced by mmSolve2D include:

In addition, the solver automatically keeps a log file that records the input problem specification and miscellaneous runtime information. The name of this log file is basename.log, where basename is the ``Base Output Filename'' specified in the input problem specification. If this file already exists, then new entries are appended to the end of the file.

Controls
The middle section of the user interface window contains a series of buttons providing user control over the solver. After a problem description server application has been selected, the LoadProblem button triggers a fetch of a problem description from the selected server. The LoadProblem button may be selected at any time to (re-)load a problem description from the currently selected server. After loading a new problem the solver goes automatically into a paused state. (If no problem description server is selected when the LoadProblem button is invoked, nothing will happen.) The Reset button operates similarly, except that the current problem specifications are used.

Once a problem is loaded, the solver can be put into any of three states: run, relax and pause. Selecting Relax puts the solver into the ``relax'' state, where it runs until a control point is reached, after which the solver pauses. If the Relax button is reselected after reaching a control point, then the solver will simply re-pause immediately. The Field+ or Field- button must be invoked to change the applied field state. (Field state schedules are discussed below.) The Run selection differs in that when a control point is reached, the solver automatically steps the nominal applied field to the next value, and continues. In ``run'' mode the solver will continue to process until there are no more applied field states in the problem description. At any time the Pause button may be selected to pause the solver. The solver will stay in this state until the user reselects either Run or Relax. The current state of the solver is indicated in the Status line in the center panel of the user interface window.

The problem description (in MIF format) specifies a fixed applied field schedule. This schedule defines an ordered list of applied fields, which the solver in ``run'' mode steps through in sequence. The Field- and Field+ buttons allow the user to interactively adjust the applied field sequence. Each click on the Field+ button advances forward one step through the specified schedule, while Field- reverses that process. In general, the step direction is not related to the magnitude of the applied field. Also note that hitting these buttons does not generate a ``ControlPoint'' event. In particular, if you are manually accelerating the progress of the solver through a hysteresis loop, and want to send non-ControlPoint data to a display or archive widget before advancing the field, then you must use the appropriate ``Interactive Output'' button.

The second row of buttons in the interaction control panel, TotalField, Magnetization and DataTable, allow the user to view the current state of the solver at any time. These buttons cause the solver to send out data of the corresponding type to all applications for which the ``Interactive'' schedule button for that data type has been selected, as discussed in the Outputs section above.

At the far right of the solver controls is the Exit button, which terminates mmSolve2D. Simply closing the user interface window does not terminate mmSolve2D, but only closes the user interface window. To kill the solver the Exit button must be pressed.

Details
Given a problem description, mmSolve2D integrates the Landau-Lifshitz equation [7,9]
\begin{displaymath}
\frac{d\textbf{M}}{dt} = -\gamma\,\textbf{M}\times\textbf{H...
...tbf{M}\times\left(\textbf{M}\times\textbf{H}_{\rm eff}\right),
\end{displaymath} (1)
where

M is the pointwise magnetization (A/m),
Heff is the pointwise effective field (A/m),
$ \gamma$ is the gyromagnetic ratio (m/(A.s)),
$ \alpha$ is the damping coefficient (dimensionless).
The effective field is defined as
\begin{displaymath}
\textbf{H}_{\rm eff} = -\mu_0^{-1} \frac{\partial E}{\partial\textbf{M}}.
\end{displaymath}
The average energy density E is a function of M specified by Brown's equations [4], including crystalline anisotropy, exchange, self-magnetostatic (demagnetization) and applied field (Zeeman) terms.

The micromagnetic problem is impressed upon a regular 2D grid of squares, with 3D magnetization spins positioned at the centers of the cells. Note that the constraint that the grid be composed of square elements takes priority over the requested size of the grid. The actual size of the grid used in the computation will be the nearest integral multiple of the grid's cell size to the requested size. It is important when comparing the results from grids with different cell sizes to account for the possible change in size of the overall grid. At present, Neumann boundary conditions are assumed.

The crystalline anisotropy and applied field energy terms are calculated assuming constant magnetization in each cell. The exchange energy is calculated using the eight-neighbor bilinear interpolation described in [5]. The more common four-neighbor scheme is available as a compile-time option. See the file app/mmsolve/magelt.cc for details.

The self-magnetostatic field is calculated as the convolution of the magnetization against a kernel that describes the cell to cell magnetostatic interaction. The convolution is evaluated using fast Fourier transform (FFT) techniques. Several kernels are supported; these are selected as part of the problem description in MIF format. Each kernel represents a different interpretation of the discrete magnetization. The recommended model is ConstMag, which assumes the magnetization is constant in each cell, and computes the average demagnetization field through the cell using formulae from [12] and [2].

The Landau-Lifshitz ODE (1) is integrated using a second order predictor-corrector technique of the Adams type. The right side of (1) at the current and previous step is extrapolated forward in a linear fashion, and is integrated across the new time interval to obtain a quadratic prediction for M at the next time step. (At each stage the spins are renormalized to Ms before evaluating the energy and effective fields.) The right side of (1) is evaluated at the predicted M, which is then combined with the value at the current step to produce a linear interpolation of dM/dt across the new interval. This is then integrated to obtain the final estimate of M at the new step. The local (one step) error of this procedure should be O(dt3).

The step is accepted if the total energy of the system decreases, and the maximum error between the predicted and final M is smaller than a nominal value. If the step is rejected, then the step size is reduced and the integration procedure is repeated. If the step is accepted, then the error between the predicted and final M is used to adjust the size of the next step. No fixed ratio between the previous and current time step is assumed.

A fourth order Runge-Kutta solver is used to prime the predictor-corrector solver, and is used as a backup in case the predictor-corrector fails to find a valid step. The Runge-Kutta solver is not selectable as the primary solver at runtime, but may be so selected at compile time by defining the RUNGE_KUTTA_ODE macro. See the file app/mmsolve/grid.cc for all details of the integration procedure.

For a given applied field, the integration continues until a control point is reached. A control point event may be raised by the ODE iteration count, elapsed simulation time, or by the maximum value of |M×Heff|/Ms2 dropping below a specified control point -torque value (implying an equilibrium state has been reached).

Known Bugs
mmSolve2D requires the damping coefficient to be non-zero. See the MIF documentation for details on specifying the damping coefficient.

When multiple copies of mmLaunch are used, each can have its own interface to a running copy of mmSolve2D. When the interface presented by one copy of mmLaunch is used to set the output schedule in mmSolve2D, those settings are not reflected in the interfaces presented by other copies of mmLaunch. For example, although the first interface sets a schedule that DataTable data is to be sent to an instance of mmGraph every third Iteration, there is no indication of that schedule presented to the user in the second interface window. It is unusual to have more than one copy of mmLaunch running simultaneously. However, this bug also appears when one copy of mmLaunch is used to load a problem and start a solver, and later a second copy of mmLaunch is used to monitor the status of that running solver.

A bug in the network traffic handling code of Tcl on Windows 95 and Windows 98 systems can sometimes interfere with communications between the control interface of mmSolve2D and the actual computation engine. If mmSolve2D is sending out data to two or more data display services every iteration, the network traffic used to send out that data can ``crowd out'' the receipt of control messages from the control interface. You may observe this as a long delay between the time you click the Pause button and the time the solver stops iterating. This bug first appeared in Tcl release 8.0.3, and remained through Tcl release 8.1.1. It is fixed in Tcl releases 8.2 and later, which we recommend for OOMMF users on Windows 95 or Windows 98 systems. Other platforms do not have this problem.


OOMMF Home next up previous Contents index

OOMMF Documentation Team
January 15, 2004