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

Multispecies support #617

Merged
merged 82 commits into from
Oct 26, 2023

Conversation

jhdark
Copy link
Collaborator

@jhdark jhdark commented Oct 20, 2023

Proposed changes

With these series of changes, festim will support multispecies transport. This also will provide the foundation for future festim.Reactions() class to be implemented. With this, users can simulate the simultaneous transport of multiple mobile species.

The species being modelled will have to be given as a list of festim.species objects:

mobile_H = F.Species("H")
mobile_D = F.Species("D")
my_model.species = [mobile_H, mobile_D]

The diffusion properties of each species will need to be given as a dictionary within the festim.Material object.

my_material = F.Material(
        D_0={"H": 1.9e-7, mobile_D : 1.9e-07}, E_D={"H": 0.2, mobile_D : 0.2}, name="my_mat"
)

Keys within this dictionary can either be the name of the species as a string, or the species object.

The species will also have to be defined within the boundary conditions and exports:

my_model.boundary_conditions = [
        F.DirichletBC(subdomain=left_surface, value=1e18, species="H"),
        F.DirichletBC(subdomain=right_surface, value=1e18, species="D"),
    ]
    my_model.exports = [
        F.XDMFExport("mobile_H.xdmf", field=mobile_H),
        F.XDMFExport("mobile_D.xdmf", field=mobile_D),
        F.VTXExport("mobile_H.bp", field="H"),
        F.VTXExport("mobile_D.bp", field=mobile_D),
    ]

Again, species can either be given as the string name assigned or the species object itself.

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...

@jhdark jhdark added enhancement New feature or request fenicsx Issue that is related to the fenicsx support labels Oct 20, 2023
@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6f627cd) 97.47% compared to head (3376833) 98.17%.

Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx     #617      +/-   ##
===========================================
+ Coverage    97.47%   98.17%   +0.70%     
===========================================
  Files           16       16              
  Lines          475      549      +74     
===========================================
+ Hits           463      539      +76     
+ Misses          12       10       -2     
Files Coverage Δ
festim/__init__.py 75.00% <100.00%> (ø)
festim/boundary_conditions/dirichlet_bc.py 100.00% <ø> (ø)
festim/exports/vtx.py 100.00% <100.00%> (ø)
festim/exports/xdmf.py 100.00% <100.00%> (ø)
festim/hydrogen_transport_problem.py 99.47% <100.00%> (+1.67%) ⬆️
festim/material.py 100.00% <100.00%> (ø)
festim/species.py 97.56% <100.00%> (+0.59%) ⬆️
festim/subdomain/surface_subdomain.py 100.00% <100.00%> (ø)

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

festim/hydrogen_transport_problem.py Show resolved Hide resolved
festim/species.py Outdated Show resolved Hide resolved
festim/species.py Outdated Show resolved Hide resolved
festim/hydrogen_transport_problem.py Show resolved Hide resolved
test/test_dirichlet_bc.py Outdated Show resolved Hide resolved
test/test_multispecies_problem.py Outdated Show resolved Hide resolved
test/test_multispecies_problem.py Outdated Show resolved Hide resolved
test/test_multispecies_problem.py Outdated Show resolved Hide resolved
test/test_permeation_problem.py Outdated Show resolved Hide resolved
jhdark and others added 3 commits October 25, 2023 15:09
Co-authored-by: Rémi Delaporte-Mathurin <40028739+RemDelaporteMathurin@users.noreply.github.com>
@RemDelaporteMathurin RemDelaporteMathurin merged commit b975a64 into festim-dev:fenicsx Oct 26, 2023
7 checks passed
@jhdark jhdark deleted the multispecies_support branch November 14, 2023 18:18
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