Skip to content

Avoid af.mean #46

Description

@shyams2

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions