Code Monkey home page Code Monkey logo

spin-transport's Introduction

spin-transport README

This repository contains the (developing) open-source code for simulating bulk spin transport—diffusion and separation—in solid media. Multi-spin-species and magnetic resonance simulations are in development.

This is a Python and FEniCS project. FEniCS is used to numerically solve the spin transport governing partial differential equations.

End users of this project write Python code to interface with FEniCS.

Installation

One must first have a working installation of FEniCS. This README assumes the use of Docker for installation, which is documented here.

Install fenicsproject command with the following command.

curl -s https://get.fenicsproject.org | bash

Then clone this repository to the host machine.

Workflow

The FEniCS docs have a section on workflow. There are many ways to instantiate these good practices, but we recommend using the following command, which opens a Docker container, executes the <python script>, and saves the results to a local file (outside the Docker container).

fenicsproject run stable python3 <python script> <options>

Testing the installation

To verify that everything is installed correctly, run the Poisson equation demo ft01_poisson.py (source) in your container.

If you installed the fenicsproject script per the instructions above, you can use the following command (working directory: spin-transport).

$ fenicsproject run stable python3 ft01_poisson.py

If everything is working fine, the output should look something like the following.

$ fenicsproject run stable python3 ft01_poisson.py
Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
--- Instant: compiling ---
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Solving linear variational problem.
*** Warning: Degree of exact solution may be inadequate for accurate result in errornorm.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
  Ignoring precision in integral metadata compiled using quadrature representation. Not implemented.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
error_L2  = 0.00823509807335
error_max = 1.33226762955e-15

The directory spin-transport/poisson should have been created and should contain two files: solution.pvd and solution000000.vtu. These files contain the solution data.

Running a spin transport simulation

The spin_transport_01.py script can be executed with the following command.

fenicsproject run stable python3 spin_transport_01.py -p -b

The default steady state IC is derived from a system with no Bloch relaxation or pulse dynamics, which are disabled with the -p and -b command line options. The number of cells in the mesh can be changed using the -n option followed by the number of cells to use. The full list of possible commands can be viewed by using the -h option.

Plotting the results of a spin transport simulation

Use the plot.py script, as follows.

python3 plot.py

Here the -p option can be used enable plotting with subplots. The -i option is used to set the duration to wait between showing the next timestep in ms. The --start and --end options are used to specify the index of the first and last timesteps to show. The rest of the options can be viewed using the -h option.

Acknowledgement

This work is supported by a grant from the Army Research Office, Materials Science Division under grant proposal Nanoscale Spin Hyperpolarization and Imaging with PI John Marohn, PhD.

Contributors

This project stems from a collaboration among three institutions:

The lead contributor to this project is Rico Picone, PhD of Saint Martin's University, co-PI on the ARO grant. Other contributors include John Marohn, PhD (Cornell, PI), John A. Sidles, PhD (Washington), Joseph L. Garbini, PhD (Washington), and Cameron Devine (Washington).

spin-transport's People

Contributors

camerondevine avatar ricopicone avatar

Watchers

John Sidles avatar  avatar John A. Marohn avatar Corinne Isaac avatar  avatar

Forkers

camerondevine

spin-transport's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.