On Aug 23 2007, Jake Ostien wrote:
Hi,
I am trying to compute some reaction forces, currently I am trying to
assemble the stiffness matrix and compute the matrix vector product
with the converged solution vector to get a vector of forces. Here
is what I am trying.
<u is the converged solution>
Matrix A;
assemble(A, *a, mesh);
Vector f;
A.mat().mult(u.vector().vec(), f.vec());
First an issue. I am getting a seg fault coming in
DiscreteFunction::interpolate as part of the assemble step. I
haven't figured out why yet, but I'm looking.
Next, a few questions.
Is there an easier (or cleaner) way to accomplish this?
Yes, you should be able to assemble a linear form which will contain
the reaction forces. For elasticity, plasticity, etc
L = -grad(v)*sigma*dx - v*f*dx (f is the body force)
Assemble this into a vector, and the vector will contain the reaction
forces.