Assemble an optimality system
Hi,
I'm working on a problem in optimization with pde constraints, but I have some difficulties in trying to implement it.
Computing the stiffness and mass matrix in FEniCS works fine, but I need to collect them in an optimality system.
Some specifically, what I need is a 3x3 block matrix consisting of some blocks of stiffness and mass matrices
(as well as their transpose), a block of the identity matrix as well as some blocks of a zero matrix.
Any idea how to do this in FEniCS?
I have made a code in Octave which solves the problem above in general, so I may dump the matrices to file,
and solve it there, but my guess is that I could solve this faster staying in Python.
However, when I try to dump the file, I get the following error :
"Could not convert _00c24702000000
The code leading up to the error is:
a = (inner(grad(v), grad(u)) - v*u)*dx
L = v*g*dx
A = assemble(a)
b = assemble(L)
scipy.io.
Also, I wonder if there is an easy way to drop specific columns from, say the mass matrix ?
(in Octave I just did "B = B(:,[x != 0])" to drop the columns where a corresponding vector x was equal to zero.)
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Ole Elvetun for more information if necessary.