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

changed the "_get_diffusion_coefficient" function for temperature adjustment #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YitongPan1
Copy link

changed the "_get_diffusion_coefficient" function for temperature adjustment

Summary

Major changes:

  • feature 1: ...
  • fix 1: ...

Todos

If this is work in progress, what else needs to be done?

  • feature 2: ...
  • fix 2:

Checklist

  • Google format doc strings added.
  • Code linted with ruff. (For guidance in fixing rule violates, see rule list)
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • I have run the tests locally and they passed.

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

changed the "_get_diffusion_coefficient" function for temperature adjustment
Comment on lines +2208 to +2212
if abs(T_sol - T_ref) > 1:
D_final = D * np.exp(d / T_sol - d / T_ref) * mu_ref / mu
# skip temperature correction if within 1 degree
else:
D_final = D
Copy link
Member

Choose a reason for hiding this comment

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

This can be made more compact by not definining D_final until later, e.g.

# Only correct temperature if more than 1 degree different from T_ref
if abs(T_sol - T_ref) > 1:
    D *= np.exp(d / T_sol - d / T_ref) * mu_ref / mu

and then you don't need the else block

@rkingsbury
Copy link
Member

Thanks @YitongPan1 ! Can you please update the first post with an expanded description of what this PR does?

Also, it appears that due to a recent update in monty, all the tests are failing with an error related to text encoding.

We strongly encourage explicit `encoding`, and we would use UTF-8 by default as per PEP 686 with zopen(path, "rt") as f:

What we need to do is add encoding='utf8' to all calls to zopen. Can you try to fix that, either in this PR or in a separate PR?

(Just so you're aware, the continuous integration tests we use here are configured so that any warning actually raises an error. This is very strict but helps us identify future deprecations problems, which is the case here.)

@rkingsbury
Copy link
Member

The maggma issue is fixed - see materialsproject/maggma#1030. I will trigger the tests to run again.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.81%. Comparing base (4570baf) to head (ca98253).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   81.79%   81.81%   +0.02%     
==========================================
  Files           9        9              
  Lines        1494     1496       +2     
  Branches      256      257       +1     
==========================================
+ Hits         1222     1224       +2     
  Misses        226      226              
  Partials       46       46              

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants