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

Avoid af.mean #46

Open
shyams2 opened this issue Jul 23, 2018 · 0 comments
Open

Avoid af.mean #46

shyams2 opened this issue Jul 23, 2018 · 0 comments

Comments

@shyams2
Copy link
Contributor

shyams2 commented Jul 23, 2018

It was found that af.mean gives strange results when initial density of both species are unequal . For instance, when electrons are given a number density of 1, with ion density set to zero:

print('MEAN DENSITY')
n = nls.compute_moments('density')
print(af.mean(n[:, 0, :, :]))
print(af.mean(n[:, 1, :, :]))

print('MEAN DENSITY-2')
n = nls.compute_moments('density')
print(np.mean(np.array(n[:, 0, :, :])))
print(np.mean(np.array(n[:, 1, :, :])))

This gives the output:

MEAN DENSITY
0.5061728395061662
0.49382716049382086
MEAN DENSITY-2
0.9999999999999873
0.0

Similarly, with electron density = 1 and ion density = 2:

MEAN DENSITY
1.493827160493803
1.5061728395061484
MEAN DENSITY-2
0.9999999999999873
1.999999999999965

However, when both species are set with density = 1:

MEAN DENSITY
0.999999999999985
0.9999999999999848
MEAN DENSITY-2
0.9999999999999873
0.9999999999999825
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

No branches or pull requests

1 participant