Skip to content
Discussion options

You must be logged in to vote
  1. You need to pass the constraint handler to allocate_matrix becuase the constraints changes the sparsity pattern in the case of periodic constraints, e.g.

    M = allocate_matrix(dh, ch)
    K = allocate_matrix(dh, ch)
  2. The operation A = M .+ (Δt .* K) results in A having different sparsity pattern because some values in M and K are zero, and these indices are not preserved in broadcasting... I don't know what that best way to fix this is, but perhaps build A like this instead (which works since we know M and K have identical patterns):

    A = copy(M)
    A.nzval .= M.nzval .+ Δt .* K.nzval

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@alex-fu27
Comment options

@koehlerson
Comment options

@koehlerson
Comment options

@alex-fu27
Comment options

Answer selected by alex-fu27
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants