Calculating stiffness matrix for specific cells in mesh #3031
-
I have a simple 2D mesh, say
But is there a way to perform this calculation cell by cell? Any help would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
If you make a But, what do you want to do with these cell-wise matrices? There might well be a better way to achieve what you want. |
Beta Was this translation helpful? Give feedback.
Arbitrary weights are in some sense harder than depending on length and shape regularity since you need to be able to associate them with the correct edges and then pull them out again (which is not trivial because if you store them as a Function they will be evaluated at quadrature points whereas you want to "see" the basis vector).
On the other hand, the length of each relevant edge can be computed with
sqrt(dot(cev[0, :], cev[0, :]))
(for edge 0, say). I do not think there is a symbolic expression for the shape regularity coefficient of a given cell, however, this is easier. If you have some way of computing it, you can store it in ashape_regularity = Function(FunctionSpace(mesh, "DG"…