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

Trap density xdmf fix #564

Merged
merged 18 commits into from
Aug 11, 2023

Conversation

jhdark
Copy link
Collaborator

@jhdark jhdark commented Aug 10, 2023

Proposed changes

fix for issue #563

This would allow users to export the TrapDensityXDMF in a multi-material system

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 the bug Something isn't working label Aug 10, 2023
festim/exports/exports.py Show resolved Hide resolved
festim/exports/trap_density_xdmf.py Show resolved Hide resolved
festim/generic_simulation.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (dc07375) 98.82% compared to head (4a10452) 98.82%.
Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #564   +/-   ##
=======================================
  Coverage   98.82%   98.82%           
=======================================
  Files          55       55           
  Lines        2038     2045    +7     
=======================================
+ Hits         2014     2021    +7     
  Misses         24       24           
Files Changed Coverage Δ
festim/exports/exports.py 97.67% <100.00%> (+0.11%) ⬆️
festim/exports/trap_density_xdmf.py 100.00% <100.00%> (ø)
festim/generic_simulation.py 100.00% <100.00%> (ø)

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

festim/exports/exports.py Outdated Show resolved Hide resolved
@@ -16,13 +16,27 @@ def __init__(self, trap, **kwargs) -> None:

self.trap = trap

def write(self, t):
def write(self, t, dx, log_level):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't have it as an argument.

Imagine if we want to have this everywhere then you'd have to pass log_level literally everywhere.

Maybe let's forget about this for this PR.

What may be a solution is to have log_level an attribute of FESTIM.

Instead of:

my_model.log_level = 20

we'd have

import festim

festim.log_level = 20

That way, log_level can be accessed from anywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This would be a nice solution, i'll remove it from the function

festim/exports/exports.py Outdated Show resolved Hide resolved
else:
F -= f.inner(self.trap.density[0], v) * dx(mat.id)

if log_level < 40:
Copy link
Collaborator

Choose a reason for hiding this comment

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

following the above comments, the use for log-level here would be

if festim.log_level < 40:

festim/generic_simulation.py Outdated Show resolved Hide resolved
test/unit/test_exports/test_trap_density_xdmf_export.py Outdated Show resolved Hide resolved
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.

Looks good to me thanks James!

@RemDelaporteMathurin RemDelaporteMathurin merged commit 6716ec5 into festim-dev:main Aug 11, 2023
3 checks passed
@jhdark jhdark deleted the trap_density_xdmf_fix branch October 10, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] TrapDensityXDMF projects value over whole domain
2 participants