Skip to content

Instantly share code, notes, and snippets.

View edwinksl's full-sized avatar

Edwin Khoo edwinksl

View GitHub Profile
% Code for http://stackoverflow.com/a/37982813/486919
function schrodinger_equation
close all
clc
psi0 = [0;1];
hbar = 1;
% t = 0:1:100;
@edwinksl
edwinksl / quasi-neutral-1D-electrolyte.py
Created January 17, 2016 04:29
FiPy quasi-neutral 1D electrolyte
import fipy as fp
solver = fp.LinearGMRESSolver()
Lx = 1.
nx = 1000
dx = Lx/nx
mesh = fp.Grid1D(nx=nx, dx=dx)
phi = fp.CellVariable(name="elec. potential", mesh=mesh, value=0.)
c_m = fp.CellVariable(name="conc.", mesh=mesh, value=1.0)