assemble VariationalProblem members
Hello,
In Python, I am trying to encapsulate a problem stated in weak form: a(v,u) = L(v) for all v in V (nonlinear or not). The first option that came to my mind is to use
problem = VariationalProb
Now I can do
A = assemble(a, mesh=mesh) ; b = assemble(L, mesh=mesh) ; bc.apply(A,b)
but I cannot do
A = assemble(problem.a, mesh=mesh) ; b = assemble(problem.L, mesh=mesh)
Somehow assemble() doesn't want to work on the members of 'problem'. It returns:
Unable to convert object to a UFL form: <dolfin.
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (4, 0))
[...]
UFLException: Unable to convert object to a UFL form: <dolfin.
I don't *have* to use VariationalProblem to encapsulate the data, but I need to be able to get A and b somehow. I saw in a previous post that one could subclass NonlinearProblem. That would be fine for me, but I have 2 questions:
1) Is there a recommended way to encapsulate a and L so that they can be assemble()'d?
2) Could you please show an example usage of calling problem.F and problem.J when problem is a VariationalProblem? That just might answer the question.
Thanks in advance!
Dominique
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Garth Wells
- Solved:
- Last query:
- Last reply: