Skip to content
Discussion options

You must be logged in to vote

Your loop is wrong in two ways: First, this

K = get_matrix(op)

gives you the global assembled stiffness matrix. The restriction of the assembled matrix to the dofs of a cell is NOT the local stiffness matrix. The local stiffness matrices are obtained BEFORE ASSEMBLY, i.e

using Gridap.Arrays
u = get_trial_fe_basis(V)
v = get_fe_basis(V)
K_e = get_array(((σ  ε₀(u))  ε₀(v)) * dΩ)

Second, you are forgetting about the contributions from the Dirichlet dofs, which you can't. The complete cell dofs you can get as

using Gridap.FESpaces
cell_dofs = get_cell_dof_values(uh)

That said, just use an integral like you did in your first post.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@JordiManyer
Comment options

Answer selected by sy-nguyen-van
@sy-nguyen-van
Comment options

@sy-nguyen-van
Comment options

@JordiManyer
Comment options

@sy-nguyen-van
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants