Skip to content

Add support for number-density deposition by ionization level#1354

Merged
MaxThevenet merged 67 commits into
Hi-PACE:developmentfrom
huixingjian:ion_diagnose
Apr 10, 2026
Merged

Add support for number-density deposition by ionization level#1354
MaxThevenet merged 67 commits into
Hi-PACE:developmentfrom
huixingjian:ion_diagnose

Conversation

@huixingjian
Copy link
Copy Markdown
Contributor

@huixingjian huixingjian commented Feb 6, 2026

This PR adds the option hipace.deposit_n to deposit the number density into the field n_<plasma_name>. If hipace.deposit_n_ion_levels = 1 is enabled, the number density is also deposited separately for each ionization level of every plasma species into fields of the form n_<plasma_name>_ionlev_N.

Test:
when ``hipace.deposit_n=1`, number density is deposited. Here seeing the plot with clear guiding channel and plasma blowout

截屏2026-04-01 15 30 36

With `hipace.deposit_n_ion_levels=1``, test with argon

截屏2026-04-01 15 40 35

Comment thread src/particles/plasma/MultiPlasma.cpp Outdated
@huixingjian huixingjian changed the title [WIP]Add function to deposite rho of different ionization levels Add function to deposit number density for each ionization levels Apr 1, 2026
@huixingjian huixingjian changed the title Add function to deposit number density for each ionization levels Add support for number-density deposition by ionization level Apr 1, 2026
Comment thread src/particles/plasma/MultiPlasma.cpp Outdated
Comment thread src/particles/plasma/MultiPlasma.H Outdated
Comment thread src/particles/deposition/PlasmaDepositCurrent.cpp Outdated
Comment thread src/particles/deposition/PlasmaDepositCurrent.cpp Outdated
auto [shape_y, j] = shape_factor<depos_order>(ymid, iy);

const amrex::Real charge_density = q_invvol * shape_x * shape_y;
const amrex::Real num_density = invvol * shape_x * shape_y * ptd.rdata(PlasmaIdx::w)[ip];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add const amrex::Real w = ptd.rdata(PlasmaIdx::w)[ip] at the top after vy = ... so we don't have to access the value multiple times.

Comment thread src/particles/deposition/PlasmaDepositCurrent.cpp Outdated
Comment thread src/particles/deposition/PlasmaDepositCurrent.cpp
const bool deposit_jx_jy, const bool deposit_jz, const bool deposit_rho,
const bool deposit_chi, const bool deposit_rhomjz,
amrex::Vector<amrex::Geometry> const& gm, int const lev)
const bool deposit_chi, const bool deposit_rhomjz,const bool deposit_n,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const bool deposit_chi, const bool deposit_rhomjz,const bool deposit_n,
const bool deposit_chi, const bool deposit_rhomjz, const bool deposit_n,

Comment thread src/Hipace.cpp Outdated
m_multi_plasma.DepositCurrent(m_fields, WhichSlice::This, true, false,
m_deposit_rho || m_deposit_rho_individual, true, true, m_3D_geom, lev);
m_deposit_rho || m_deposit_rho_individual,
true, true, m_deposit_n ||m_deposit_n_ion_levels,m_3D_geom, lev);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
true, true, m_deposit_n ||m_deposit_n_ion_levels,m_3D_geom, lev);
true, true, m_deposit_n || m_deposit_n_ion_levels, m_3D_geom, lev);

Same thing in the call to DepositCurrent below

Comment thread src/Hipace.cpp
huixingjian and others added 6 commits April 8, 2026 10:27
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
@MaxThevenet
Copy link
Copy Markdown
Member

Thanks for the review @AlexanderSinn. @huixingjian is this ready for another review?

huixingjian and others added 2 commits April 9, 2026 15:48
Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com>
@huixingjian
Copy link
Copy Markdown
Contributor Author

Thanks for the review @AlexanderSinn. @huixingjian is this ready for another review?

Yep, it's ready now. the issues that @AlexanderSinn mentioned are all resolved

Copy link
Copy Markdown
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for this PR! As discussed offline, would be good to add CI.

Comment thread docs/source/run/parameters.rst Outdated
@MaxThevenet MaxThevenet merged commit 56165a1 into Hi-PACE:development Apr 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: diagnostics About any types of diagnostics component: plasma About the plasma species

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants