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

User-Defined Linear Map #743

Open
wants to merge 39 commits into
base: development
Choose a base branch
from

Conversation

cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Oct 15, 2024

This is a duplicate of the draft PR #714 owned by cemitch99. Close #538

Follow-up PR will add

  • return transport matrices in each element
  • push for covariance matrix
    • add: ImpactX::track_envelope

@cemitch99 cemitch99 changed the title Topic covariance and transport maps Transport and Covariance Matrices Oct 15, 2024
Correct naming in elements.cpp binding for LinearMap.
{
}

//LinearTransport () = default;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
cemitch99 and others added 4 commits October 23, 2024 15:15
Correct argument declaration for Python bindings of LinearMap in elements.cpp.
Document "Name" parameter in LinearMap.
@ax3l ax3l self-requested a review January 6, 2025 04:48
@ax3l ax3l self-assigned this Jan 6, 2025
@ax3l
Copy link
Member

ax3l commented Jan 6, 2025

@cemitch99 please fetch branch again before continuing, I pushed a few updates for Python, docs and examples (they pass already :) ).

src/python/elements.cpp Outdated Show resolved Hide resolved
ax3l added 2 commits January 6, 2025 00:23
Use parser for inputs. Needs upstream AMReX fix.
@ax3l ax3l changed the title Transport and Covariance Matrices User-Defined Linear Element Jan 6, 2025
WeiqunZhang pushed a commit to AMReX-Codes/amrex that referenced this pull request Jan 7, 2025
## Summary

`ParmParse::queryAddWithParser` might manipulate the internal state and
should not be a const method.

These parser functions might need a unit test in AMReX?

## Additional background

First seen in ECP-WarpX/impactx#743

## Checklist

The proposed changes:
- [x] 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
@cemitch99 cemitch99 changed the title User-Defined Linear Element User-Defined Linear MAP Jan 7, 2025
@cemitch99 cemitch99 changed the title User-Defined Linear MAP User-Defined Linear Map Jan 7, 2025
Comment on lines +6 to +7
This implements the same FODO cell as the :ref:`stable FODO cell example <examples-fodo>`.
However, in the example here we define *additional user-defined, custom linear elements* by providing a custom matrix.
Copy link
Member

@ax3l ax3l Jan 10, 2025

Choose a reason for hiding this comment

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

TODO: In the analysis script of the FODO example, we should compare also values of the reference particle, in particular s and energy.

And reference particle pushing (drifting), if thick.
@ax3l ax3l force-pushed the topic-covariance-and-transport-maps branch from 0be1a9b to 317e6bf Compare January 10, 2025 03:39
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

That's a very cool example, thank you!

examples/linear_map/README.rst Outdated Show resolved Hide resolved
examples/linear_map/README.rst Outdated Show resolved Hide resolved
examples/linear_map/README.rst Outdated Show resolved Hide resolved
examples/linear_map/input_map.in Show resolved Hide resolved
The matrix elements are 1-indexed.
The transport matrix :math:`R` is defaulted to the identity matrix, so only matrix entries that are differing from that need to be specified.

TODO: describe units to put in the R entries.
Copy link
Member

Choose a reason for hiding this comment

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

TODO: Doc

A custom, linear transport matrix.

TODO: describe units to put in the R entries.
Copy link
Member

Choose a reason for hiding this comment

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

TODO: Doc

@@ -82,7 +82,7 @@ function(add_impactx_test name input is_mpi analysis_script plot_script)
amrex.throw_exception = 1
amrex.signal_handling = 0
impactx.always_warn_immediately=1
impactx.abort_on_warning_threshold=low
impactx.abort_on_warning_threshold=medium
Copy link
Member

Choose a reason for hiding this comment

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

Gotta check if we can keep it on low and only overwrite for the example.

See the :ref:` example <examples-fodo-userdef>` for Python and inputs file syntax to specify a custom linear element.

The entries of the transport matrix are ordered for multiplication with the beam vector :math:`x,px,y,py,t,pt`.
The units of the transport matrix :math:`R` elements are... TODO
Copy link
Member

Choose a reason for hiding this comment

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

TODO: Doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: elements Elements/external fields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User-Defined Linear Map
2 participants