Skip to content

Instantly share code, notes, and snippets.

@funsim
Created November 20, 2013 12:05
Show Gist options
  • Save funsim/7562106 to your computer and use it in GitHub Desktop.
Save funsim/7562106 to your computer and use it in GitHub Desktop.
from dolfin import *
mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, "CG", 2)
f = project(Expression("sin(x[1]) * cos(x[0])"), V)
File("f.xyz") << f
@funsim
Copy link
Author

funsim commented Nov 20, 2013

funsi@bigapple:/tmp$ python test.py
Solving linear system of size 25 x 25 (PETSc Krylov solver).
Saved function u (a function) to file f.xyz in xd3d xyz format.

funsi@bigapple:/tmp$ cat f000000.xyz
0.000000e+00 0.000000e+00 2.265086e-09
5.000000e-01 0.000000e+00 5.305529e-09
1.000000e+00 0.000000e+00 3.551003e-09
0.000000e+00 5.000000e-01 4.794255e-01
5.000000e-01 5.000000e-01 4.207355e-01
1.000000e+00 5.000000e-01 2.590347e-01
0.000000e+00 1.000000e+00 8.414710e-01
5.000000e-01 1.000000e+00 7.384603e-01
1.000000e+00 1.000000e+00 4.546487e-01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment