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

Error if temperature BC or source with F.Temperature #812

Merged

Conversation

JonathanGSDUFOUR
Copy link
Contributor

@JonathanGSDUFOUR JonathanGSDUFOUR commented Jul 12, 2024

Proposed changes

Added check in the generic_simulation to prevent the use of festim.Temperature with boundary condition set on the T field (Issue #787 ).

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

Some other tests had to be slightly modified, is there a better way than what I did ?

@JonathanGSDUFOUR JonathanGSDUFOUR marked this pull request as ready for review July 12, 2024 13:22
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.55%. Comparing base (a9d6147) to head (aba4540).
Report is 100 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #812   +/-   ##
=======================================
  Coverage   99.55%   99.55%           
=======================================
  Files          61       61           
  Lines        2707     2711    +4     
=======================================
+ Hits         2695     2699    +4     
  Misses         12       12           

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

@RemDelaporteMathurin
Copy link
Collaborator

RemDelaporteMathurin commented Jul 12, 2024

Since this is about the HeatTransferProblem class I'll let @KulaginVladimir review this first (when he has time)

Copy link
Collaborator

@KulaginVladimir KulaginVladimir left a comment

Choose a reason for hiding this comment

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

Hi @JonathanGSDUFOUR. Thank you for this fix.

I have a few comments on the current implementation below. Moreover, it appears to me that your fix covers only the case when boundary conditions for the temperature field are set simultaniously with F.Temperature, but doesn't catch the cases when a source or an initial condition are set together with F.Temperature which were mentioned at the start of #787. However, I think the latter can be discussed with @RemDelaporteMathurin after his review.

festim/generic_simulation.py Outdated Show resolved Hide resolved
test/system/test_misc.py Outdated Show resolved Hide resolved
test/unit/test_boundary_conditions.py Show resolved Hide resolved
test/unit/test_boundary_conditions.py Outdated Show resolved Hide resolved
test/unit/test_initial_condition.py Outdated Show resolved Hide resolved
@KulaginVladimir KulaginVladimir added the enhancement New feature or request label Jul 12, 2024
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.

I agree with @KulaginVladimir we would need to perform this check also if Source objects are set.

Vladimir, initial temperatures are set as an argument of HeatTransferProblem right? so maybe no need to check this too? idk

festim/generic_simulation.py Outdated Show resolved Hide resolved
test/system/test_misc.py Outdated Show resolved Hide resolved
test/unit/test_boundary_conditions.py Show resolved Hide resolved
test/unit/test_boundary_conditions.py Outdated Show resolved Hide resolved
test/unit/test_initial_condition.py Outdated Show resolved Hide resolved
test/unit/test_initial_condition.py Outdated Show resolved Hide resolved
@KulaginVladimir
Copy link
Collaborator

KulaginVladimir commented Jul 12, 2024

Vladimir, initial temperatures are set as an argument of HeatTransferProblem right? so maybe no need to check this too? idk

Indeed. There is no need in such a check. I assume that I was thinking of the HTransportProblem and just transferred the thoughts to the HeatTransferProblem. What happens if we conduct a steady-state simulation and set an initial condition for solute or traps?

This is not related to the current PR anyway.

@RemDelaporteMathurin
Copy link
Collaborator

What happens if we conduct a steady-state simulation and set an initial condition for solute or traps?

I'm not entirely sure that an error is raised

@JonathanGSDUFOUR
Copy link
Contributor Author

Thank you @KulaginVladimir and @RemDelaporteMathurin for the feedback !
I started with the test in test_initial_conditions but realised Convective_flux had to be removed from the test_flux_BC_initialise because of the new error message. I will clean the duplication and extend the checks to 'Sources' too.
I'll make sure to learn from those errors !

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.

Hey @JonathanGSDUFOUR here are a few very small changes 👍

After that I think it's good to go, unless @KulaginVladimir sees something else

festim/generic_simulation.py Outdated Show resolved Hide resolved
festim/generic_simulation.py Outdated Show resolved Hide resolved
festim/generic_simulation.py Outdated Show resolved Hide resolved
festim/generic_simulation.py Outdated Show resolved Hide resolved
test/system/test_misc.py Outdated Show resolved Hide resolved
test/system/test_misc.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.

I'll let this open for a little while longer just in case someone else has comments

@RemDelaporteMathurin RemDelaporteMathurin changed the title Test for Temp and BC, with corresponding tests Error if temperature BC or source with F.Temperature Jul 24, 2024
@RemDelaporteMathurin RemDelaporteMathurin added this to the v1.3 milestone Jul 24, 2024
@RemDelaporteMathurin
Copy link
Collaborator

I think we can merge this now, @KulaginVladimir

@RemDelaporteMathurin RemDelaporteMathurin merged commit 47d7dc4 into festim-dev:main Jul 24, 2024
6 checks passed
@RemDelaporteMathurin
Copy link
Collaborator

Thank you so much for this contribution Jonathan!! 🎉

@JonathanGSDUFOUR JonathanGSDUFOUR deleted the Error_if_T_and_BC_with_T branch July 24, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn when Temperature is mixed with BCs, sources, etc.
3 participants