diff options
author | 2023-08-10 21:43:57 -0700 | |
---|---|---|
committer | 2023-08-11 04:43:57 +0000 | |
commit | 1d67cba10d34a65542294efaed6f02f6c3284ab0 (patch) | |
tree | 1c03bdcc39573ee7a200e8095c296639f6f6d804 /Source/Python/WarpXWrappers.cpp | |
parent | 0d998613b311a87e7da496ef7368c3b7649a779c (diff) | |
download | WarpX-1d67cba10d34a65542294efaed6f02f6c3284ab0.tar.gz WarpX-1d67cba10d34a65542294efaed6f02f6c3284ab0.tar.zst WarpX-1d67cba10d34a65542294efaed6f02f6c3284ab0.zip |
Add Python wrapper to set the lens strength (#3748)
* Add Python wrapper to set the lens strength
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Correct missing `c_real`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add assert message
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r-- | Source/Python/WarpXWrappers.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index 8d3be68be..02cee52e0 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -773,6 +773,21 @@ namespace warpx.m_poisson_boundary_handler.setPotentialEB(potential); } + void warpx_setPlasmaLensStrength (const int i_lens, const amrex::Real strength_E, const amrex::Real strength_B ) { + auto & mypc = WarpX::GetInstance().GetPartContainer(); + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( i_lens >= mypc.h_repeated_plasma_lens_strengths_E.size(), + "i_lens is larger than the number of plasma lenses."); + mypc.h_repeated_plasma_lens_strengths_E[i_lens] = strength_E; + mypc.h_repeated_plasma_lens_strengths_B[i_lens] = strength_B; + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, + mypc.h_repeated_plasma_lens_strengths_E.begin(), mypc.h_repeated_plasma_lens_strengths_E.end(), + mypc.d_repeated_plasma_lens_strengths_E.begin()); + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, + mypc.h_repeated_plasma_lens_strengths_B.begin(), mypc.h_repeated_plasma_lens_strengths_B.end(), + mypc.d_repeated_plasma_lens_strengths_B.begin()); + amrex::Gpu::synchronize(); + } + void mypc_Redistribute () { auto & mypc = WarpX::GetInstance().GetPartContainer(); mypc.Redistribute(); |