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

Conversation

fredrikekre
Copy link
Member

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.

Extracted from #539.

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2022

Codecov Report

Base: 92.93% // Head: 92.98% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (65e56ec) compared to base (ad09f2c).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 65e56ec differs from pull request most recent head 78cc11c. Consider uploading reports for the commit 78cc11c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
+ Coverage   92.93%   92.98%   +0.05%     
==========================================
  Files          22       22              
  Lines        3878     3892      +14     
==========================================
+ Hits         3604     3619      +15     
+ Misses        274      273       -1     
Impacted Files Coverage Δ
src/assembler.jl 99.32% <100.00%> (+0.81%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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 fredrikekre force-pushed the fe/do-not-go-gentle-into-that-good-night branch from 65e56ec to 78cc11c Compare December 6, 2022 00:07
@fredrikekre fredrikekre merged commit a80e509 into master Dec 6, 2022
@fredrikekre fredrikekre deleted the fe/do-not-go-gentle-into-that-good-night branch December 6, 2022 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants