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

fix and test transform_vector_cartesian_to_cylinder #4094

Merged
merged 2 commits into from
Jan 15, 2021

Conversation

christophlohrmann
Copy link
Contributor

Description of changes:

  • Fixes missing sqrt in calculation of vector transformation
  • Unit test the function

@jngrad
Copy link
Member

jngrad commented Jan 15, 2021

Looks like these equations from the failing tests have the wrong unit for the velocity:
https://github.com/espressomd/espresso/blob/python/testsuite/python/observable_cylindricalLB.py#L109-L110
https://github.com/espressomd/espresso/blob/python/testsuite/python/observable_cylindrical.py#L95-L97
Working out v_x and v_y backwards from the expressions in the utils function, I think the correct values should be:

            r = np.sqrt(position[0]**2 + position[1]**2)
            v_y = (r * self.v_phi + position[1] * self.v_r) / r
            v_x = (r * self.v_r - position[1] * v_y) / position[0]

but with these, phi values from the core are different from the reference values by a factor sqrt(2), and have the wrong signs.

@christophlohrmann
Copy link
Contributor Author

I changed the velocity calculation. Will push in a minute

Copy link
Member

@jngrad jngrad left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@jngrad jngrad added this to the Espresso 4.2 milestone Jan 15, 2021
@jngrad jngrad added automerge Merge with kodiak BugFix Core labels Jan 15, 2021
@kodiakhq kodiakhq bot merged commit 87be319 into espressomd:python Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants