Skip to content

Support for XDMF export#613

Merged
RemDelaporteMathurin merged 11 commits into
fenicsxfrom
xdmf-export
Oct 18, 2023
Merged

Support for XDMF export#613
RemDelaporteMathurin merged 11 commits into
fenicsxfrom
xdmf-export

Conversation

@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator

Proposed changes

This PR adds a class to support XDMF export.

The XDMF format isn't maintained anymore so we may end up dropping support for it one day, but for now this is still a very valid option for exporting CG type functions.

Usage

    my_model = F.HydrogenTransportProblem()
    my_model.mesh = F.Mesh1D(vertices=np.linspace(0, 1))
    my_mat = F.Material(D_0=1.9e-7, E_D=0.2, name="my_mat")
    my_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, 1], material=my_mat)
    my_model.subdomains = [my_subdomain]
    my_model.temperature = 500.0
    my_model.species = [F.Species("H")]

    my_model.exports = [F.XDMFExport(filename="test.xdmf", field=my_model.species)]

    my_model.initialise()
    my_model.run(1)

Other:

  • slight refactoring of the VTX define

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)

@RemDelaporteMathurin RemDelaporteMathurin added the fenicsx Issue that is related to the fenicsx support label Oct 18, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 18, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (2b4b095) 96.68% compared to head (46103eb) 96.97%.

Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx     #613      +/-   ##
===========================================
+ Coverage    96.68%   96.97%   +0.29%     
===========================================
  Files           12       13       +1     
  Lines          362      397      +35     
===========================================
+ Hits           350      385      +35     
  Misses          12       12              
Files Coverage Δ
festim/__init__.py 72.00% <100.00%> (+1.16%) ⬆️
festim/exports/vtx.py 100.00% <100.00%> (ø)
festim/exports/xdmf.py 100.00% <100.00%> (ø)
festim/hydrogen_transport_problem.py 97.76% <100.00%> (-0.04%) ⬇️

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

Copy link
Copy Markdown
Collaborator

@jhdark jhdark left a comment

Choose a reason for hiding this comment

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

LGTM, the only thing is, its one thing verifying a file is created, but is there any way we can test the value in the output file to ensure its exporting correctly? Perhaps not

Comment thread festim/exports/xdmf.py Outdated
Co-authored-by: James Dark <65899899+jhdark@users.noreply.github.com>
@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator Author

LGTM, the only thing is, its one thing verifying a file is created, but is there any way we can test the value in the output file to ensure its exporting correctly? Perhaps not

Yeah no it isn't possible to read the file (XDMF or VTX) programmatically right now.
We need to wait until checkpointing is added to dolfinx (it'll likely be added to VTX only).

The best we can do at the moment is checking the file is created and manual testing...

@RemDelaporteMathurin RemDelaporteMathurin merged commit 4d4a65a into fenicsx Oct 18, 2023
@RemDelaporteMathurin RemDelaporteMathurin deleted the xdmf-export branch October 18, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fenicsx Issue that is related to the fenicsx support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants