Weakly enforced Dirichlet BCs#1158
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1158 +/- ##
==========================================
+ Coverage 94.72% 94.76% +0.03%
==========================================
Files 46 46
Lines 3508 3534 +26
==========================================
+ Hits 3323 3349 +26
Misses 185 185 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…into weak_dirichlet
…into weak_dirichlet Co-authored-by: hhy2022 <huihuay15@gmail.com>
…into weak_dirichlet
|
@jorgensd @jhdark The Docker CI for dolfinx 0.9 doesn't go pas the install and I'm confused as to why. It seems related to some pip PEP8 rules about the license in scifem being |
jhdark
left a comment
There was a problem hiding this comment.
Looks great, that was a quick turn around, are we going to add this to the discontinuous class too?
| - name: Install local package and dependencies | ||
| run: | | ||
| pip install .[test] | ||
| python -m pip install --upgrade pip |
There was a problem hiding this comment.
Oh never mind, saw the final comment on the PR
There was a problem hiding this comment.
I'll revert this cause i don't think it's related to this. See this PR scientificcomputing/scifem#213
| assert alpha is not None, ( | ||
| "Penalty parameter must be given for weakly enforced Dirichlet BCs" | ||
| ) | ||
| assert self.value_fenics is not None, ( | ||
| "value_fenics must be defined for weakly enforced Dirichlet BCs" | ||
| ) |
There was a problem hiding this comment.
Should this not be done in a setter instead? Only if the enforce_weakly is True?
There was a problem hiding this comment.
No not in a setter because then you always have to set say enforce_weakly before alpha or the opposite because there is no way to set them both at the same time.
This method is only called if enforce_weakly is True anyway.
| """ | ||
| mesh = ds.ufl_domain() | ||
| n = ufl.FacetNormal(mesh) | ||
| h = ufl.Circumradius(mesh) # FIXME this doesn't work for rectangles |
There was a problem hiding this comment.
Will this break for hex meshes or only give the wrong value? Because if it breaks, maybe we could have a mini test in here and give a more descriptive error?
There was a problem hiding this comment.
It will break. But because there is an open issue for this elswhere I'm hoping we can fix this pretty soon anyway
RemDelaporteMathurin
left a comment
There was a problem hiding this comment.
are we going to add this to the discontinuous class too?
It has already been added to the discontinuous case.
| """ | ||
| mesh = ds.ufl_domain() | ||
| n = ufl.FacetNormal(mesh) | ||
| h = ufl.Circumradius(mesh) # FIXME this doesn't work for rectangles |
There was a problem hiding this comment.
It will break. But because there is an open issue for this elswhere I'm hoping we can fix this pretty soon anyway
| assert alpha is not None, ( | ||
| "Penalty parameter must be given for weakly enforced Dirichlet BCs" | ||
| ) | ||
| assert self.value_fenics is not None, ( | ||
| "value_fenics must be defined for weakly enforced Dirichlet BCs" | ||
| ) |
There was a problem hiding this comment.
No not in a setter because then you always have to set say enforce_weakly before alpha or the opposite because there is no way to set them both at the same time.
This method is only called if enforce_weakly is True anyway.
Try setting a bound on setuptools, like: https://github.com/FEniCS/ufl/blob/main/pyproject.toml#L3 |
Description
Summary
This PR adds the possibility to weakly enforce dirichlet BCs.
Related Issues
Fixes #1153
Motivation and Context
Sometimes, it is necessary to weakly impose a Dirichlet BC (eg. flux conservation). So far FESTIM only allowed strongly enforced BCs but it wasn't too complicated to weakly enforce it in the variational formulation thanks to @jorgensd tutorials.
Type of Change
Testing
pytest)Code Quality Checklist
ruff format .)ruff check .)Documentation
Breaking Changes
Screenshots/Examples
Additional Notes