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

Sheath thickness functions #401

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jasperbeckers
Copy link
Member

Adds matrix and Child law sheath thickness functions to parameters.py. These are important in characterizing a plasma and defining criteria for the use of probes and other diagnostics (one of the items of #339).

@StanczakDominik
Copy link
Member

We sorta agreed a while ago to increase the line character limit for our code to 100. We should really make that more visible somehow.

@jasperbeckers
Copy link
Member Author

That's great! But are we going to refactor all current code for the new limit?

@StanczakDominik
Copy link
Member

Oh no, that would be a massive waste of time! I just mention that because the other changes you made to this module looked like you were shortening lines to fit 80, and I just wanted to keep you from wasting time on that :)

@StanczakDominik StanczakDominik added this to the v0.2 milestone Apr 24, 2018
@StanczakDominik
Copy link
Member

I would kinda like to keep the current feature set before v0.1. Would you be fine with not merging this PR before that's done?

@StanczakDominik StanczakDominik self-requested a review April 24, 2018 18:43
@jasperbeckers
Copy link
Member Author

Yes, seems like a good plan.

Copy link
Contributor

@lemmatum lemmatum left a comment

Choose a reason for hiding this comment

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

Improve the tests a bit and then this should be good to merge.


lambda_D = Debye_length(T_e, n_s)

s = (np.sqrt(2) / 3) * lambda_D * (2 * e * V_0 / T_e) ** 0.75
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the units here work out? Does astropy.units know that V/eV is unitless?

We might want to put these things in terms of kelvins or at least allow for interoperability (as per prior discussions).


V_0 = 80 * u.V

assert matrix_sheath_thickness(V_0, n_e).unit.is_equivalent(u.m)
Copy link
Contributor

Choose a reason for hiding this comment

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

separate methods for each assert.


assert matrix_sheath_thickness(V_0, n_e).unit.is_equivalent(u.m)

assert np.isclose(matrix_sheath_thickness(V_0, n_e).value, 1.329823977068723e-05)
Copy link
Contributor

Choose a reason for hiding this comment

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

error string message for when asserts fail.

@pep8speaks
Copy link

pep8speaks commented May 1, 2018

Hello @jasperbeckers! Thanks for updating your pull request.

Line 1173:5: E128 continuation line under-indented for visual indent

Comment last updated on August 11, 2018 at 09:42 Hours UTC

samurai688
samurai688 previously approved these changes May 19, 2018
Sheath potential in units convertible to V.

n_s : ~astropy.units.Quantity
Sheath ion density in units convertible to m**-3.
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be good to include some more description here of exactly which density is meant, since in the Child-law sheath the ion density is changing throughout the sheath. I'm 95% sure here you mean the density at the "sheath edge", or the point at which the ions have been accelerated to the Bohm speed through the presheath, and quasineutrality begins to break down. I think for a collisionless presheath this density is 1/sqrt(e) n_i ~= 0.606 n_i of the "bulk" plasma density n_i outside the presheath.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and make sure to make this clear throughout the Langmuir probe code.

lemmatum
lemmatum previously approved these changes May 20, 2018
Copy link
Contributor

@lemmatum lemmatum left a comment

Choose a reason for hiding this comment

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

I'm happy with merging this - just some minor suggested fixes.

@@ -273,7 +273,8 @@ def swept_probe_analysis(probe_characteristic, probe_area, gas,
Estimate of the ion saturation current in units of Am^-2.

"hot_fraction" : float
Estimate of the total hot (energetic) electron fraction.
Estimate of the total hot (energetic) electron fraction. Only supplied
if bimaxwellian is True.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is minor, but I would call it a "bi-Maxwellian"

Copy link
Member

@StanczakDominik StanczakDominik May 28, 2018

Choose a reason for hiding this comment

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

re: @lemmatum: "bi-Maxwellian" is a better name, but it won't work as an argument.

@@ -974,7 +990,8 @@ def plasma_frequency(n, particle='e-', z_mean=None):
# using user provided average ionization
Z = z_mean
Z = np.abs(Z)
# TODO REPLACE WITH Z = np.abs(_grab_charge(particle, z_mean)), some bugs atm
# TODO REPLACE WITH Z = np.abs(_grab_charge(particle, z_mean)), some
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you going to do this? If not, raise it as a separate issue.

Sheath potential in units convertible to V.

n_s : ~astropy.units.Quantity
Sheath ion density in units convertible to m**-3.
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and make sure to make this clear throughout the Langmuir probe code.

If one or more of the supplied parameters are not of the correct type.

~astropy.units.UnitConversionError
If one or more parameter cannot be succesfully converted to the
Copy link
Contributor

Choose a reason for hiding this comment

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

parameters, plural

respective unit.

ValueError
If one or more parameter does not have an appropriate value.
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above - fix throughout

-----
The Child law sheath model is self-consistent in terms of ion density
throughout the sheath and assumes a large sheath potential compared to the
electron temperature. The sheath thickness is given by
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, is there a good or commonly used criterion for this? For example, a potential 100x larger than electron temperature?

V_0 = 80 * u.V

def test_correct_unit(self):
assert matrix_sheath_thickness(self.V_0, n_e).unit.is_equivalent(u.m), \
Copy link
Contributor

Choose a reason for hiding this comment

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

replace continuation slash

V_0 = 80 * u.V

def test_correct_unit(self):
assert Child_law_sheath_thickness(T_e, self.V_0, n_e).unit.is_equivalent(u.m), \
Copy link
Contributor

Choose a reason for hiding this comment

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

replace continuation slash

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

The code looks good, but I think there's a few doc fixes that would make this look much better!

@@ -273,7 +273,8 @@ def swept_probe_analysis(probe_characteristic, probe_area, gas,
Estimate of the ion saturation current in units of Am^-2.

"hot_fraction" : float
Estimate of the total hot (energetic) electron fraction.
Estimate of the total hot (energetic) electron fraction. Only supplied
if bimaxwellian is True.
Copy link
Member

@StanczakDominik StanczakDominik May 28, 2018

Choose a reason for hiding this comment

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

re: @lemmatum: "bi-Maxwellian" is a better name, but it won't work as an argument.

'n_s': {'units': u.m ** -3, 'can_be_negative': False}
})
def matrix_sheath_thickness(V_0, n_s):
r"""Calculate the matrix sheath thickness for a high potential sheath.
Copy link
Member

Choose a reason for hiding this comment

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

I think this could potentially be more descriptive than repeating the function's name, but I don't really have any better suggestions!

>>> matrix_sheath_thickness(80 * u.V, 1e18 * u.m**-3)
<Quantity 9.40327552e-05 m>

"""
Copy link
Member

Choose a reason for hiding this comment

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

We could probably use a reference here.

>>> Child_law_sheath_thickness(1e6 * u.K, 80 * u.V, 1e18 * u.m**-3)
<Quantity 5.17439662e-05 m>

"""
Copy link
Member

Choose a reason for hiding this comment

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

Likewise, a reference would be nice to have here.

errStr = (f"The test result value of matrix_sheath_thickness is not correct "
f"and returns {test_result} instead of {expected}.")

assert test, errStr
Copy link
Member

Choose a reason for hiding this comment

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

I really think we need to start using http:https://docs.astropy.org/en/stable/api/astropy.tests.helper.assert_quantity_allclose.html?highlight=assert this function rather than run our custom checks! I'll just keep grumbling in reviews about it, I guess.

@lemmatum
Copy link
Contributor

lemmatum commented Aug 9, 2018

bump can we resolve conflicts, get those minor fixes done, and merge this?

@lemmatum
Copy link
Contributor

lemmatum commented Nov 7, 2018

bump the 2nd

@namurphy namurphy modified the milestones: v0.2.0, v0.3.0, Future Apr 30, 2019
@github-actions
Copy link

github-actions bot commented Apr 2, 2021

This pull request will be closed in 14 days due to a year of inactivity unless the stale label or comment is removed.

@github-actions github-actions bot added the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label Apr 2, 2021
@StanczakDominik StanczakDominik removed the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label Apr 13, 2021
@StanczakDominik StanczakDominik self-assigned this Apr 13, 2021
@StanczakDominik
Copy link
Member

StanczakDominik commented Apr 13, 2021

I will try to pick this up and finally get it merged!

... sometime for 0.7 :)

@StanczakDominik StanczakDominik modified the milestones: Future, 0.7.0 Apr 13, 2021
@StanczakDominik StanczakDominik removed this from the 0.7.0 milestone Jul 20, 2021
@StanczakDominik StanczakDominik added the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label Nov 23, 2021
@StanczakDominik StanczakDominik removed their assignment Nov 24, 2021
@rocco8773 rocco8773 dismissed stale reviews from lemmatum and samurai688 via 199dde6 February 26, 2022 21:19
@namurphy namurphy added the status: dormant PRs that are stalled label May 26, 2023
@github-actions github-actions bot removed the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label Sep 9, 2023
@namurphy namurphy added this to the Future milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants