Skip to content

Instantly share code, notes, and snippets.

@wd15
Created January 30, 2014 20:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wd15/8717979 to your computer and use it in GitHub Desktop.
Save wd15/8717979 to your computer and use it in GitHub Desktop.
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