Add user-defined Spin Map#1297
Conversation
|
The Python bindings for the user-facing inputs, which use SmallMatrix type, need support similar to what we used for the LinearMap element. |
|
Added a type for the 3x6 matrix and 3x1 vector in AMReX-Codes/pyamrex#538 now. |
Matrix & vector type commonly used in accelerator physics w/ spin. See BLAST-ImpactX/impactx#1297
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
| dspinmax = dspin.max() | ||
|
|
||
| print("Change in the spin:") | ||
| print("||delta s||_max", dspinmax) |
There was a problem hiding this comment.
I see in CI:
Change in the spin:
||delta s||_max 2.2705360483651895e-09
atol=1.5e-12
There was a problem hiding this comment.
Yes. The version of the test based on the C++ input works within this tolerance. However, the Python version does not (yet). Maybe something is being done in single-precision...?
There was a problem hiding this comment.
The macOS and Tooling CI (Ubuntu) runs that show the larger tolerance are also in double precision.
There was a problem hiding this comment.
The difference is probably from parallel execution. The failing runs have MPI enabled. So maybe just not converged enough at the current resolution (no. of particles)...?
There was a problem hiding this comment.
Hm. The no. of particles should no be relevant in this example, because the change in the spin should be zero (to machine precision) for every particle.
There was a problem hiding this comment.
Makes sense. Also, bot inputs & py are run with MPI as I just checked, but the inputs pass.
I compared the lattices in both and the Python one forgets to comment in the full lattice.
There was a problem hiding this comment.
I saw you bumped the tolerance in the end.
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
This PR adds an element that applies a user-defined spin map to the spin variables
(sx, sy, sz)--a functionality that is similar to that of the user-defined LinearMap element. The LinearMap element is also updated for spin support--it leaves spin unaffected.development#1333Follow-up: Investigate the loss of precision (1e-12 -> 1e-9) that occurs when Python input is used.
See Issue #1342