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

SurfaceKinetics docs and form #805

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

KulaginVladimir
Copy link
Collaborator

@KulaginVladimir KulaginVladimir commented Jul 9, 2024

Proposed changes

From discussions with @RemDelaporteMathurin, I suppose that there are mistakes in the variational form for SurfaceKinetics BC and API docs.

The current docs states that the BC for solute species is:
$-D \nabla c_\mathrm{m} \cdot \mathbf{n} = -\lambda_{\mathrm{IS}} \dfrac{\partial c_{\mathrm{m}}}{\partial t}- J_{\mathrm{bs}} + J_{\mathrm{sb}}.$
If $\mathbf{n}$ is the outward normal vector of the boundary, at steady-state 1D, this should yield: $D\dfrac{\partial c_\mathrm{m}}{\partial x}= -J_{\mathrm{bs}}+J_{\mathrm{sb}}$, what contradicts Pick & Sonnenberg. I assume, the correct form is:
$-D \nabla c_\mathrm{m} \cdot \mathbf{n} = \lambda_{\mathrm{IS}} \dfrac{\partial c_{\mathrm{m}}}{\partial t}+J_{\mathrm{bs}} - J_{\mathrm{sb}}.$

To check the implementation, here is a simple MMS test, based on the approach of @RemDelaporteMathurin

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)

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.55%. Comparing base (1add5fc) to head (b3dc5e3).
Report is 113 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #805   +/-   ##
=======================================
  Coverage   99.55%   99.55%           
=======================================
  Files          61       61           
  Lines        2705     2705           
=======================================
  Hits         2693     2693           
  Misses         12       12           

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

@RemDelaporteMathurin RemDelaporteMathurin added the bug Something isn't working label Jul 10, 2024
@RemDelaporteMathurin
Copy link
Collaborator

Hey I'm just looking at the signs of terms when we have a negative gradient at x=0.

Then we should have $J_{\mathrm{sb}}>J_{\mathrm{bs}} $. So in the following expression:

$-D \nabla c_\mathrm{m} \cdot \mathbf{n} = J_{\mathrm{bs}} - J_{\mathrm{sb}}.$

The first term is negative, and the RHS is also negative. Sounds good to me!

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.

Thanks for this fix.

When we take care of #798 maybe it would be beneficial to add a short derivation showing that, at x=0, steady state, then we have $D \frac{dc}{dx} = J_{\mathrm{bs}} - J_{\mathrm{sb}}$ which is what Pick & Sonnenberg have in Equation X

Also, if we are happy with the MMS test, it might be good to add it to the CI here?

@KulaginVladimir
Copy link
Collaborator Author

We can discuss the MMS. Personally, I don't like that it's defined on $t\in[0,5]$.

@KulaginVladimir
Copy link
Collaborator Author

@RemDelaporteMathurin, I added here (also in this repo) a new MMS. Let me know what you think of it.

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! Nice to have a MMS case for this!

Feel free to merge

@KulaginVladimir KulaginVladimir merged commit 02f79ad into festim-dev:main Jul 10, 2024
6 checks passed
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.

2 participants