Created
February 29, 2016 13:17
-
-
Save wence-/610f270b0f4dda38dde9 to your computer and use it in GitHub Desktop.
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
| from firedrake import * | |
| mesh = UnitSquareMesh(1, 1) | |
| V = FunctionSpace(mesh, 'CG', 1) | |
| u = TrialFunction(V) | |
| v = TestFunction(V) | |
| f = Function(V) | |
| problem = LinearVariationalProblem(u*v*dx, v*dx, f) | |
| solver = LinearVariationalSolver(problem) | |
| def monitor(snes, it, rnorm, constant): | |
| constant.assign(10) | |
| some_const = Constant(1) | |
| solver.snes.setMonitor(monitor, args=(some_const, )) | |
| solver.solve() | |
| print some_const.dat.data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment