Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Python file with short test case for FiPy in parallel
import time
import fipy as fp
import numpy as np
np.random.seed(1)
L = 1.
N = 30
m = fp.GmshGrid3D(nx=N, ny=N, nz=N, dx=L / N, dy=L / N, dz=L / N)
v = fp.CellVariable(mesh=m)
v0 = np.random.random(m.numberOfCells)
v[:] = v0.copy()
eqn = fp.TransientTerm() == fp.DiffusionTerm()
eqn.solve(v, dt=1.)
v[:] = v0.copy()
print m.numberOfCells
t0 = time.time()
eqn.solve(v, dt=1.)
print time.time() - t0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment