Perparticle sstp deposition#481
Open
pdziekan wants to merge 17 commits into
Open
Conversation
…t and we only make one step
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Lagrangian microphysics “sstp” (substepping) machinery to support depositional growth alongside condensation, and refactors the implementation into a unified condensation_deposition module that can run per-cell or per-particle logic.
Changes:
- Introduces a new runtime option
opts.depoand routes deposition through the same step path as condensation (step_cond()). - Refactors condensation/deposition code into
src/impl/condensation_deposition/**, adding per-particle deposition support and new helper kernels. - Updates ice mass bookkeeping to separate per-particle vs per-cell temporary buffers (
*_percell_gp) and aligns RH_i calculation with the selected RH formula enum.
Reviewed changes
Copilot reviewed 27 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/particles.tpp | Switches includes from legacy condensation layout to new condensation_deposition module; adds new per-particle deposition helpers. |
| src/particles_step.ipp | Adds opts.depo gating, integrates deposition into the condensation step pipeline (per-particle and per-cell paths). |
| src/impl/particles_impl.ipp | Extends impl API (new methods and new temp buffers) to support deposition and combined per-particle logic. |
| src/impl/initialization/particles_impl_init_sanity_check.ipp | Adjusts ice-related sanity checks/comments; current turb_cond + ice restriction remains. |
| src/impl/ice/particles_impl_ice_dep.ipp | Removes old deposition implementation (moved/refactored into new module). |
| src/impl/housekeeping/particles_impl_hskpng_Tpr.ipp | Updates RH_i computation to accept Tetens enum values (mapped internally to CC for ice). |
| src/impl/condensation/perparticle/perparticle_nomixing_adaptive_sstp_cond.ipp | Removes old per-particle adaptive condensation implementation (replaced by new combined file). |
| src/impl/condensation/perparticle/cond_perparticle_advance_rw2.ipp | Removes old condensation-only perparticle advance (replaced by size-advance abstraction). |
| src/impl/condensation/perparticle/apply_perparticle_drw3_to_perparticle_rv_and_th.ipp | Removes old condensation-only drv/dth application (replaced by combined liquid/ice handler). |
| src/impl/condensation_deposition/perparticle/set_perparticle_drwX_to_minus_rwX.ipp | New helper to initialize per-particle liquid delta accumulators. |
| src/impl/condensation_deposition/perparticle/set_perparticle_d_ice_mass_to_minus_ice_mass.ipp | New helper to initialize per-particle ice mass delta accumulators. |
| src/impl/condensation_deposition/perparticle/release_arrays_for_perparticle_sstp.ipp | Releases only the temp arrays required for enabled processes (cond/depo). |
| src/impl/condensation_deposition/perparticle/perparticle_nomixing_adaptive_sstp_cond.ipp | New combined adaptive per-particle substepping for condensation and deposition. |
| src/impl/condensation_deposition/perparticle/perparticle_advance_size.ipp | New wrapper selecting RH and advancing either liquid (rw2) or ice (ice_a/ice_c). |
| src/impl/condensation_deposition/perparticle/perparticle_advance_hlpr.ipp | Generalizes the old perparticle_advance_rw2 into an ice-templated helper. |
| src/impl/condensation_deposition/perparticle/init_perparticle_sstp.ipp | Initializes per-particle substepping state for new particles when exact SSTP is enabled. |
| src/impl/condensation_deposition/perparticle/calculate_noncond_perparticle_sstp_delta.ipp | Computes the non-condensation state deltas used during substeps. |
| src/impl/condensation_deposition/perparticle/calc_perparticle_T.ipp | Extracts per-particle temperature computation into a standalone routine. |
| src/impl/condensation_deposition/perparticle/apply_perparticle_drw3_or_d_ice_mass_to_perparticle_rv_and_th.ipp | Applies per-particle liquid/ice phase-change deltas consistently into rv/th. |
| src/impl/condensation_deposition/perparticle/apply_perparticle_cond_change_to_percell_rv_and_th.ipp | Consolidates post-substep state reconciliation (mixing vs non-mixing mode). |
| src/impl/condensation_deposition/perparticle/apply_noncond_perparticle_sstp_delta.ipp | Applies per-substep fractions of the non-condensation deltas. |
| src/impl/condensation_deposition/perparticle/add_perparticle_rwX_to_drwX.ipp | Accumulates per-particle liquid changes across substeps (optionally storing rw3). |
| src/impl/condensation_deposition/perparticle/add_perparticle_ice_mass_to_d_ice_mass.ipp | Accumulates per-particle ice-mass changes across substeps (optionally storing ice mass). |
| src/impl/condensation_deposition/perparticle/acquire_arrays_for_perparticle_sstp.ipp | Allocates only the temp arrays required for enabled processes (cond/depo). |
| src/impl/condensation_deposition/percell/sstp_percell_step.ipp | New per-cell substep scalar state stepping for rv/th/rhod. |
| src/impl/condensation_deposition/percell/particles_impl_depo.ipp | New per-cell deposition kernel with optional SGS supersaturation handling. |
| src/impl/condensation_deposition/percell/particles_impl_cond.ipp | New per-cell condensation kernel (refactored from old location). |
| src/impl/condensation_deposition/common/sstp_save.ipp | New shared SSTP state snapshot helper (per-particle vs per-cell behavior). |
| src/impl/condensation_deposition/common/particles_impl_depo_common.ipp | Adds depositional growth math helpers and advance_ice_ac functor. |
| src/impl/condensation_deposition/common/particles_impl_cond_common.ipp | Refactors condensation common utilities; adjusts advance functor behavior for ice particles. |
| src/impl/condensation_deposition/common/cond_depo_common.ipp | New shared utilities (massdiff2drv, rw2->rwX) used by both cond and depo. |
| src/impl/condensation_deposition/common/apply_perparticle_sgs_supersat.ipp | New helper advancing SGS supersaturation per substep. |
| src/impl/common/save_liq_ice_content_before_change.ipp | Switches ice change storage to d_ice_mass_percell_gp. |
| src/impl/common/particles_impl_update_th_rv.ipp | Updates to use d_ice_mass_percell_gp throughout rv/th updates and guard cleanup. |
| src/impl/common/calc_liq_ice_content_change.ipp | Updates to use d_ice_mass_percell_gp for ice content change accumulation. |
| include/libcloudph++/lgrngn/opts.hpp | Adds new runtime toggle depo with default false. |
| include/libcloudph++/lgrngn/opts_init.hpp | Clarifies RH formula behavior for ice when using Tetens enum values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 37 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
src/impl/condensation_deposition/perparticle/perparticle_nomixing_adaptive_sstp_cond.ipp:218
- The liquid convergence condition uses
abs(drw2 < ...), which takesabs()of a boolean and effectively turns the second part of the condition into a constant 0/1. This breaks adaptive substepping selection and can lead to incorrect or unstable time stepping decisions.
src/impl/condensation_deposition/perparticle/perparticle_nomixing_adaptive_sstp_cond.ipp:233 - The ice convergence check compares
da_dt_relto the epsilon threshold twice and never checksdc_dt_relagainst epsilon. This can accept non-converged changes in the c-axis (or reject converged ones) and leads to inconsistent adaptive substep counts for ice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.