Created
January 30, 2014 20:23
-
-
Save wd15/8717979 to your computer and use it in GitHub Desktop.
Python file with short test case for FiPy in parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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