Skip to content

fenicsx: Flux BC support#737

Merged
RemDelaporteMathurin merged 17 commits into
festim-dev:fenicsxfrom
jhdark:new_flux_bc
Apr 9, 2024
Merged

fenicsx: Flux BC support#737
RemDelaporteMathurin merged 17 commits into
festim-dev:fenicsxfrom
jhdark:new_flux_bc

Conversation

@jhdark
Copy link
Copy Markdown
Collaborator

@jhdark jhdark commented Apr 4, 2024

Proposed changes

With this change, users will be able to impose flux boundary conditions:

$-D\nabla c_{\mathrm{m}} \cdot \mathbf{n} = f(x, y, z, t) \ \mathrm{on} \ \partial\Omega$

Users can implement this like:

my_model.boundary_conditions = [
        F.FluxBC(subdomain=right, value=10, species=H),
]

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
Copy Markdown

codecov Bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.51%. Comparing base (916c11c) to head (89e6de0).

❗ Current head 89e6de0 differs from pull request most recent head 044ea98. Consider uploading reports for the commit 044ea98 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx     #737      +/-   ##
===========================================
+ Coverage    98.39%   98.51%   +0.12%     
===========================================
  Files           27       28       +1     
  Lines         1434     1554     +120     
===========================================
+ Hits          1411     1531     +120     
  Misses          23       23              

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

Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment on lines +65 to +66
if self.value is None:
return False
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't this a bit dangerous? Say I check if it's time-dependent before assigning it a value by mistake, I may think it's not time-dpeendent but then it becomes time dependent if the value is say a function of time.

Should we raise an error instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is valid, but would be worth changing the other cases of this property in other classes too

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Opened an issue to track progress on this #744

Comment thread festim/boundary_conditions/flux_bc.py
Args:
t (float): the time
"""
if callable(self.value):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this needed? I would replace by if self.time_dependent? what if it isn't? should we raise an error? or just a print?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is how we also handle it in sources, and Dirichlet bc, so maybe we could change this for all of them in another PR?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good with me

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I opened an issue #743 to remind us of this

@RemDelaporteMathurin RemDelaporteMathurin added enhancement New feature or request fenicsx Issue that is related to the fenicsx support labels Apr 4, 2024
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py
Comment thread festim/heat_transfer_problem.py Outdated
Comment thread festim/heat_transfer_problem.py
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py
Comment thread festim/boundary_conditions/flux_bc.py
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py Outdated
Comment thread festim/boundary_conditions/flux_bc.py Outdated
@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator

@jhdark just a couple of documentation changes and then I think we are good to go with this one. We will later add concentration dependent (Robin) ParticleFluxBC

Co-authored-by: Rémi Delaporte-Mathurin <40028739+RemDelaporteMathurin@users.noreply.github.com>
@RemDelaporteMathurin RemDelaporteMathurin merged commit d13eabe into festim-dev:fenicsx Apr 9, 2024
@jhdark jhdark deleted the new_flux_bc branch March 3, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request fenicsx Issue that is related to the fenicsx support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants