Skip to content

Instantly share code, notes, and snippets.

@wd15
Last active August 29, 2015 14:06
Show Gist options
  • Save wd15/00366e8f8833eb2f218f to your computer and use it in GitHub Desktop.
Save wd15/00366e8f8833eb2f218f to your computer and use it in GitHub Desktop.
Plotting subdomain with FiPy
import fipy as fp
L = 12
nx = 200.
ny = nx
dx = L/nx
dy = L/ny
mesh = fp.Grid2D(nx=nx, ny=ny, dx=dx, dy=dy) + [[-L/2]]
x, y = mesh.getCellCenters()
X, Y = mesh.faceCenters
phi = fp.CellVariable(name = "solution variable",
mesh = mesh,
value = x * y)
width = L / 2.
viewer = fp.Viewer(vars=phi,
limits={'xmin': -width / 2, 'xmax': width / 2, 'ymin': -width / 2, 'ymax': width / 2, 'datamax': 4.})
viewer.plot()
raw_input('stopped')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment