-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: development
Are you sure you want to change the base?
Changes from 10 commits
4e2a733
5d09112
7d95ca5
65c9bd0
2ad47d2
c2fe2be
a5df0a3
b2f158c
0044f78
cd4c989
a9888ce
817cc51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
*/ | ||
#include "ImpactX.H" | ||
#include "particles/elements/All.H" | ||
#include "particles/elements/mixin/lineartransport.H" | ||
|
||
#include <AMReX.H> | ||
#include <AMReX_BLProfiler.H> | ||
|
@@ -436,6 +437,23 @@ namespace detail | |
read_element(sub_element_name, m_lattice, nslice_default, mapsteps_default); | ||
} | ||
} | ||
} else if (element_type == "linear_map") | ||
{ | ||
auto a = detail::query_alignment(pp_element); | ||
|
||
elements::LinearTransport::Map6x6 transport_map; | ||
for (int i=1; i<=6; ++i) { | ||
for (int j=1; j<=6; ++j) { | ||
Comment on lines
+445
to
+446
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Memo to Axel: default is F-order of |
||
amrex::ParticleReal R_ij = (i == j) ? 1.0 : 0.0; | ||
std::string name = "R" + std::to_string(i) + std::to_string(j); | ||
pp_element.queryAdd(name.c_str(), R_ij); | ||
|
||
transport_map(i, j) = R_ij; | ||
} | ||
} | ||
std::cout << "Caution: A user-provided linear map is used. Transport may not be symplectic." << "\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is a good location for the warning manager, using a |
||
|
||
m_lattice.emplace_back(LinearMap(transport_map, a["dx"], a["dy"], a["rotation_degree"]) ); | ||
} else { | ||
amrex::Abort("Unknown type for lattice element " + element_name + ": " + element_type); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* Copyright 2022-2024 The Regents of the University of California, through Lawrence | ||
* Berkeley National Laboratory (subject to receipt of any required | ||
* approvals from the U.S. Dept. of Energy). All rights reserved. | ||
* | ||
* This file is part of ImpactX. | ||
* | ||
* Authors: Chad Mitchell, Axel Huebl | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
#ifndef IMPACTX_DISTRIBUTION_COVARIANCE_MATRIX_H | ||
#define IMPACTX_DISTRIBUTION_COVARIANCE_MATRIX_H | ||
|
||
#include <AMReX_Array.H> | ||
#include <AMReX_REAL.H> | ||
|
||
|
||
namespace impactx | ||
{ | ||
/** this is a 6x6 matrix */ | ||
using CovarianceMatrix = amrex::Array2D<amrex::ParticleReal, 1, 6, 1, 6>; | ||
|
||
} // namespace impactx::distribution | ||
|
||
#endif // IMPACTX_DISTRIBUTION_COVARIANCE_MATRIX_H |
There was a problem hiding this comment.
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.