-
Notifications
You must be signed in to change notification settings - Fork 25
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
Heat of transport as a function of temperature #468
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mougenj for this feature! We needed this!
Can you format your code using black please?
you can format a file by running
black demos/demo_Soret.py
If you don't have black installed run
pip install black
I also made some minor comments.
@@ -350,7 +350,10 @@ def eval_cell(self, value, x, ufc_cell): | |||
subdomain_id = self._vm[cell] | |||
material = self._materials.find_material_from_id(subdomain_id) | |||
|
|||
value[0] = material.free_enthalpy + self._T(x) * material.entropy | |||
if callable(material.heat_transport): | |||
value[0] = material.heat_transport(self._T(x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this line is not tested, is it possible to add or adapt an existing test to test with a heat of transport as a callable?
@@ -0,0 +1,108 @@ | |||
# Demo conditions from https://doi.org/10.1063/5.0071935 | |||
|
|||
from copyreg import constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need that line?
from copyreg import constructor |
) | ||
|
||
#### PARAMETERS | ||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have this import at the top of the file
def thermal_cond(T): | ||
return 10.846*ln(T + DOLFIN_EPS)**2 - 184.22*ln(T + DOLFIN_EPS) + 872.47 | ||
|
||
constR=8.31446 # J/mol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constR=8.31446 # J/mol | |
constR = 8.31446 # J/mol |
Formatting
D_0=8.35e-8, #m2/s | ||
E_D=0.06, #eV, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D_0=8.35e-8, #m2/s | |
E_D=0.06, #eV, | |
D_0=8.35e-8, # m2/s | |
E_D=0.06, # eV, |
Formatting
#### DIFFUSIVE ATOM | ||
x = F.x | ||
flux = 1e21 # flux in He m-2 s-1 | ||
distribution = (x <= 10e-9) * 1e9/16.39 * (7.00876507 + 0.6052078 * x*1e9 - 3.01711048 *(x*1e9)**2 + 1.36595786 * (x*1e9)**3 - 0.295595 * (x*1e9)**4 + 0.03597462 * (x*1e9)**5 - 0.0025142 * (x*1e9)**6 + 0.0000942235 * (x*1e9)**7 - 0.0000014679 * (x*1e9)**8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we format this?
|
||
my_model.exports = F.Exports([derived_quantities] + txt_exports.exports) | ||
|
||
#### LET'S GO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#### LET'S GO | |
#### Run the simulation |
I understand the drop in coverage! Therefore: needs to be replaced by self.heat_of_transport = None Similarily, These lines were not hit by the test suite explaining why coverage decreased. |
Proposed changes
Soret coefficient as a callable. See issue 458.
Types of changes
What types of changes does your code introduce to FESTIM?
Checklist
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...