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

Handle prescribed dofs in RHS of affine constraints #535

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

fredrikekre
Copy link
Member

This patch fixes affine constraints with prescribed dofs in the RHS. In particular, we allow dofs that are prescribed by just an inhomogeneity (i.e. DBC) but disallow "nesting" affine constraints.

Concretely, consider e.g. the following two constraints:

u2 = f(t)
u3 = u2 + b3

Before this patch this was not handled correctly since the inhomogeneity for u3 was taken as b3, but it should really be b3 + f(t) by substituting u2 for f(t). Since we allow for time-dependent inhomogeneities this substitution has to be done at runtime and not during close!(::ConstraintHandler).

Nested constraints, e.g.

u2 = u3
u3 = u5

are still not allowed but in the future this can be resolved in close!(::ConstraintHandler) to

u2 = u5
u3 = u5

However, this patch checks for such nesting and raises an error instead of resulting in incorrect answers as is the case before.

Fixes #530.

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2022

Codecov Report

Base: 92.31% // Head: 92.37% // Increases project coverage by +0.05% 🎉

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

❗ Current head 47cf270 differs from pull request most recent head d68f9a1. Consider uploading reports for the commit d68f9a1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
+ Coverage   92.31%   92.37%   +0.05%     
==========================================
  Files          22       22              
  Lines        3776     3805      +29     
==========================================
+ Hits         3486     3515      +29     
  Misses        290      290              
Impacted Files Coverage Δ
src/Dofs/ConstraintHandler.jl 95.09% <100.00%> (+0.16%) ⬆️

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.

@fredrikekre fredrikekre force-pushed the fe/untangle branch 3 times, most recently from 58f570b to 47cf270 Compare November 9, 2022 14:37
src/Dofs/ConstraintHandler.jl Show resolved Hide resolved
src/Dofs/ConstraintHandler.jl Outdated Show resolved Hide resolved
This patch fixes affine constraints with prescribed dofs in the RHS. In
particular, we allow dofs that are prescribed by just an inhomogeneity
(i.e. DBC) but disallow "nesting" affine constraints.

Concretely, consider e.g. the following two constraints:

    u2 = f(t)
    u3 = u2 + b3

Before this patch this was not handled correctly since the inhomogeneity
for u3 was taken as b3, but it should really be b3 + f(t) by
substituting u2 for f(t). Since we allow for time-dependent
inhomogeneities this substitution can not be done in
close!(::ConstraintHandler) and instead the effective inhomogeneity is
computed in update!.

Nested constraints, e.g.

    u2 = u3
    u3 = u5

are still not allowed but in the future this can be resolved in
close!(::ConstraintHandler) to

    u2 = u5
    u3 = u5

However, this patch checks for such nesting and raises an error instead
of resulting in incorrect answers as is the case before.

Fixes #530.
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.

Affine constraint between two DBC constraints should work
3 participants