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

Support complete elliptic integrals of 1st and 2nd type in Parser #3225

Merged

Conversation

aveksler1
Copy link
Contributor

Summary

We want to use complete elliptic integrals from cmath, comp_ellint_1 and comp_ellint_2 in the parser in order to make it easier to load in magnetic fields from coils in WarpX. I added these to the parser, and tested against the same functions in scipy - the results match.

Since clang does not support special functions in C++17 (https://en.cppreference.com/w/cpp/compiler_support/17#C.2B.2B17_library_features) I implemented it for GCC compilers only, following the structure of how jn is implemented in the parser.

Additional background

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@ax3l
Copy link
Member

ax3l commented Mar 29, 2023

@aveksler1 I think you might need to add GPU paths here as well. At least CUDA has a lot of special math functions, so you could check if they have what you need.

An example of bessel functions we added earlier is in ECP-WarpX/WarpX#1854
(Note: this PR is before we moved the parser upstream to AMReX.)

@WeiqunZhang
Copy link
Member

The CIs failed because we treat warnings as errors. Those warnings seem to come from Bison changing the integer type in various places from int to size_t. We need to suppress those warnings.

@aveksler1
Copy link
Contributor Author

I added a separate GPU path and have suppressed the sign comparison warnings.

@WeiqunZhang
Copy link
Member

@aveksler1 Could you merge development into this so that the Intel CI can pass?

@WeiqunZhang WeiqunZhang enabled auto-merge (squash) April 6, 2023 22:48
@WeiqunZhang WeiqunZhang merged commit d7052c6 into AMReX-Codes:development Apr 6, 2023
guj pushed a commit to guj/amrex that referenced this pull request Jul 13, 2023
…ReX-Codes#3225)

We want to use complete elliptic integrals from `cmath`, `comp_ellint_1`
and `comp_ellint_2` in the parser in order to make it easier to load in
magnetic fields from coils in WarpX. I added these to the parser, and
tested against the same functions in scipy - the results match.

Since clang does not support special functions in C++17
(https://en.cppreference.com/w/cpp/compiler_support/17#C.2B.2B17_library_features)
I implemented it for GCC compilers only, following the structure of how
`jn` is implemented in the parser.

Co-authored-by: Avigdor Veksler <[email protected]>
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.

3 participants