Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not assemble zero contributions from local to global matrix #543

Merged
merged 1 commit into from
Dec 6, 2022

Commits on Dec 6, 2022

  1. Do not assemble zero contributions from local to global matrix

    With this patch, entries from the local matrix that are zero are ignored
    and never added to the global matrix. More importantly, it is now
    allowed to have missing stored entries in the global matrix if the
    contribution that would have been added there is zero.
    
    A concrete example where this is useful: Consider a two-field problem
    with unknowns (u, p) and test functions (v, q) where there is no
    coupling between, for example, p and q. In the global block matrix K =
    [A B; C D], D will be zero, and there is therefore no need to allocate
    entries in K corresponding to all couplings between p- and q-dofs. (Note
    though that currently it is not possible to create such a sparsity
    pattern because create_sparsity_pattern assumes full coupling between
    fields.) However, when assembling the local matrix k = [a b; c d] it is
    much easier to use a dense matrix, and simply initialize d to zero.
    After this patch it is perfectly fine to assemble the matrix k into K,
    even if the global entries for d are missing.
    fredrikekre committed Dec 6, 2022
    Configuration menu
    Copy the full SHA
    78cc11c View commit details
    Browse the repository at this point in the history