Skip to content

Conversation

@jhdark
Copy link
Collaborator

@jhdark jhdark commented Oct 28, 2025

Proposed changes

Fix for #1043

With these changes, a new property is added to the HydrogenTransportProblem class: all_bcs. This was something that was done during the define_boundary_conditions conditions but now has been removed.

Additionally, to fix the bug in #1043, a new define_boundary_conditions has been added to HydrogenTransportProblemDiscontinuous as the create_value_fenics function was failing previously, as the solution was never passed to the species. This is more of a light fix in that sense, and the class could do with an overhaul to handle that better. What do you think @RemDelaporteMathurin ?

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.87%. Comparing base (1e21a25) to head (e389dbf).
⚠️ Report is 11 commits behind head on fenicsx.

Files with missing lines Patch % Lines
src/festim/boundary_conditions/flux_bc.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx    #1044      +/-   ##
===========================================
- Coverage    94.87%   94.87%   -0.01%     
===========================================
  Files           44       44              
  Lines         3085     3100      +15     
===========================================
+ Hits          2927     2941      +14     
- Misses         158      159       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhdark jhdark marked this pull request as ready for review October 28, 2025 20:23
@jhdark jhdark added bug Something isn't working enhancement New feature or request fenicsx Issue that is related to the fenicsx support labels Oct 28, 2025
Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easy enough fix

Comment on lines 304 to 313
@property
def all_bcs(self):
"""Returns all boundary conditions, including fluxes from surface reactions"""
all_boundary_conditions = []
for bc in self.boundary_conditions:
if isinstance(bc, boundary_conditions.SurfaceReactionBC):
all_boundary_conditions.extend(bc.flux_bcs)
else:
all_boundary_conditions.append(bc)
return all_boundary_conditions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflecting on it now, the problem I have with having this as a property is that now the problem class has 2 attributes that are similar: self.boundary_conditions and self.all_bcs...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make all_bcs hidden instead? just _all_bcs?

spe.test_function = sub_test_functions[idx]

def define_boundary_conditions(self):
# @jhdark this all_bcs could be a property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha

@RemDelaporteMathurin RemDelaporteMathurin merged commit 19a899f into festim-dev:fenicsx Nov 21, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request fenicsx Issue that is related to the fenicsx support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants