-
Notifications
You must be signed in to change notification settings - Fork 25
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
Surface reactions #753
Surface reactions #753
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## fenicsx #753 +/- ##
===========================================
+ Coverage 97.70% 97.75% +0.05%
===========================================
Files 43 44 +1
Lines 2048 2098 +50
===========================================
+ Hits 2001 2051 +50
Misses 47 47 ☔ View full report in Codecov by Sentry. |
festim/hydrogen_transport_problem.py
Outdated
all_bcs = self.boundary_conditions.copy() | ||
for bc in self.boundary_conditions: | ||
if isinstance(bc, F.SurfaceReactionBC): | ||
all_bcs += bc.flux_bcs | ||
all_bcs.remove(bc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhdark here all_bcs
could be a property I just don't want to modify self.boundary_conditions
@KulaginVladimir would you like to give this a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this can be merged after pulling from the fenicsx branch. Although will likely have to revisit after chemical potential integration anyhow
@jhdark I finally rebased with |
# TODO add this to the festim package | ||
class FluxFromSurfaceReaction(F.SurfaceFlux): | ||
def __init__(self, reaction: F.SurfaceReactionBC): | ||
super().__init__( | ||
F.Species(), # just a dummy species here | ||
reaction.subdomain, | ||
) | ||
self.reaction = reaction.flux_bcs[0] | ||
|
||
def compute(self, ds): | ||
self.value = fem.assemble_scalar( | ||
fem.form(self.reaction.value_fenics * ds(self.surface.id)) | ||
) | ||
self.data.append(self.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add this as a FESTIM feature
Proposed changes
This PR fixes #727
Needs to be merged after #752
Also some refactoring. Got rid of
HTransportProblem.create_flux_value_fenics
and merged it withdefine_boundary_conditions
(which breaks some of the tests). I happy to not do this here and keep it for another PR.Todo:
Types of changes
What types of changes does your code introduce to FESTIM?
Checklist
Further comments
@jhdark I chose not to make this a special case of the very generic class ParticleFluxBC (ie using a lambda function for value) to keep a simple implementation.