dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #19302
[Question #122406]: assemble VariationalProblem members
New question #122406 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/122406
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 = VariationalProblem(a, L, bc)
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.fem.form.Form; proxy of <Swig Object of type 'dolfin::Form *' at 0x99fa350> >
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.fem.form.Form; proxy of <Swig Object of type 'dolfin::Form *' at 0x99fa350> >
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
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
Follow ups