-
Notifications
You must be signed in to change notification settings - Fork 202
[WIP] Add ReadDensityFromFile capabilities - Test 1 (3D only) #4754
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
base: development
Are you sure you want to change the base?
Conversation
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.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…d-density Getting the current add-read-density up to date with the development branch
The current version in this pull request works for to read a 3D openpmd file and use the density for another simulation. There is no parallelization and further user input options to be implemented. |
…guard cells function
…lized in incorrect MFIter location
…nel test matches, but not a more asymmetrical test.
Linked here are the compilation script, input files, and Jupyter notebook that was used in development. Compilation script: Files to create the data used in the tests: input files run to test the parabolic and asymmetric cases respectively: Jupyter Notebook: (actual version is in my Google Drive - 2024-Sarah_Vickers/misc.) |
@ax3l @sevicky is it possible to input a density in a PICMI input file using a function? e.g. if I pass the function x, y, z, it will return rho(x, y, z) for the grid? this means I can add complicated density profiles directly in the input file e.g. micro/nanostructures that are limited to the functions which can be parsed by amrex |
Hi @aodhanmci, Yes, this is already possible for the string based parser syntax and does not require the feature in this pull request. We support loading density profiles with functions following this syntax:
Here is a laser-ion acceleration example that uses this from PICMI, see You can go pretty complex in those expressions as multi-line strings, but you cannot pass Python functions ( |
…lic channel test matches, but not a more asymmetrical test." This reverts commit 2518b7e.
It looks like the current code does work (including in cases with multiples boxes), if the openPMD data is C-ordered. Here are the files that I used to create a C-ordered openPMD file, and then to run the file_asymm.txt
|
260717b
to
be5278c
Compare
@@ -1047,7 +1047,7 @@ public: | |||
* \brief Load field values from a user-specified openPMD file | |||
* for a specific field (specified by `F_name`) | |||
*/ | |||
void ReadExternalFieldFromFile ( | |||
static void ReadExternalFieldFromFile ( |
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.
We could make this a free function, and move it to the Utils
folder.
int iz = std::floor((z-lo2)/m_cell_size[2]); | ||
|
||
|
||
return m_rho_array4(ix,iy,iz); |
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.
We need to make sure that we are not doing out-of-bound access here.
im unable to compile these commits (error below). Wonder if anyone can help? /global/homes/a/aodhan/src/warpx/Source/Initialization/PlasmaInjector.cpp(56): error: static assertion failed with "InjectorDensity must be trivially copyable" 1 error detected in the compilation of "/global/homes/a/aodhan/src/warpx/Source/Initialization/PlasmaInjector.cpp". following the 'ordinary' Perlmutter instructions, wonder if anyone can help? |
Thanks for reporting this @aodhanmci. The code might work on CPUs though. |
Adding the capability to read a density from openpmd file to use in particle deposition. The current version has only 3D capabilities and is not quite correct with the indexing, which I am continuing to work on but am putting this version in the pull request. Edited files are InjectorDensity.H, InjectorDensity.cpp, and SpeciesUtils.cpp, with most of the changes in the former two. I have tested it using the uniform_plasma example script to give a rho (density) file which is then read in by another input file.
Close #618
Close #3948
Added by @RemiLehe: TODO: