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

[Draft] Transport and Covariance Matrices #714

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

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Sep 24, 2024

General structure.

Co-authored-by: Chad Mitchell <[email protected]>
@ax3l ax3l added component: core Core ImpactX functionality component: elements Elements/external fields labels Sep 24, 2024
@ax3l ax3l requested a review from cemitch99 September 24, 2024 22:35
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
src/initialization/InitDistribution.cpp Fixed Show fixed Hide fixed
{
}

//LinearTransport () = default;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
cemitch99 and others added 6 commits September 25, 2024 15:36
Update initialization of LinearMap element.
Finish implementation of LinearMap element push.
Initialize covariance matrix from distribution parameters.
src/particles/elements/Drift.H Outdated Show resolved Hide resolved
Comment on lines +43 to +49
// zero out the 6x6 matrix
CovarianceMatrix cv;
for (int i=1; i<=6; ++i) {
for (int j = 1; j <= 6; ++j) {
cv(i, j) = 0.0;
}
}
Copy link
Member Author

@ax3l ax3l Sep 26, 2024

Choose a reason for hiding this comment

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

Memo to Axel: default is F-order of amrex::Array2D. Double check loop indices are effective.

Comment on lines +443 to +444
for (int i=1; i<=6; ++i) {
for (int j=1; j<=6; ++j) {
Copy link
Member Author

@ax3l ax3l Sep 26, 2024

Choose a reason for hiding this comment

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

Memo to Axel: default is F-order of amrex::Array2D. Double check loop indices are effective.

ax3l pushed a commit to AMReX-Codes/amrex that referenced this pull request Oct 3, 2024
Add amrex::SmallMatrix class with compile time size.

Useful for, e.g.:
- ECP-WarpX/impactx#714
- ECP-WarpX/impactx#702
@cemitch99 cemitch99 mentioned this pull request Oct 10, 2024
transport_map(i, j) = R_ij;
}
}
std::cout << "Caution: A user-provided linear map is used. Transport may not be symplectic." << "\n";
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is a good location for the warning manager, using a low severity warning

Comment on lines +56 to +60
for (int i=1; i<=6; ++i) {
for (int j = 1; j <= 6; ++j) {
m_transport_map(i, j) = R(i, j);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
for (int i=1; i<=6; ++i) {
for (int j = 1; j <= 6; ++j) {
m_transport_map(i, j) = R(i, j);
}
}
m_transport_map = R;

Comment on lines +96 to +97
amrex::Array1D<amrex::ParticleReal,1,6> vectorin;
amrex::Array1D<amrex::ParticleReal,1,6> vectorout;
Copy link
Member Author

Choose a reason for hiding this comment

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

Can use amrex::SmallVector

Comment on lines +105 to +112
for (int i=1; i<=6; ++i) {

vectorout(i) = 0.0;
for (int j = 1; j <= 6; ++j) {
vectorout(i) += m_transport_map(i, j) * vectorin(j);
}

}
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
for (int i=1; i<=6; ++i) {
vectorout(i) = 0.0;
for (int j = 1; j <= 6; ++j) {
vectorout(i) += m_transport_map(i, j) * vectorin(j);
}
}
vectorout = m_transport_map * vectorin;

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

Successfully merging this pull request may close these issues.

2 participants