Cloudlab case - #210
Open
pdziekan wants to merge 7 commits into
Open
Cloudlab case#210pdziekan wants to merge 7 commits into
pdziekan wants to merge 7 commits into
Conversation
…grngn to the cloudlab case definition
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “cloudlab” model case and introduces a mechanism for cases to update runtime options on a per-timestep basis (used to control microphysics options like the aerosol source), alongside a few microphysics/diagnostic tweaks.
Changes:
- Add new
cloudlabcase implementation and register it in the runtime case selector. - Add a per-timestep case hook (
CasesCommon::setopts(rt_params_t&, int timestep)) and plumbing to invoke it from solvers before each timestep. - Extend Lagrangian diagnostics (additional wet moments) and expose a
depoCLI option for Lagrangian microphysics.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/solvers/slvr_lgrngn.hpp | Adds per-timestep setopts_ante_step() override that delegates to a runtime callback. |
| src/solvers/slvr_common.hpp | Splits pre-step logic into hook_ante_step() + virtual setopts_ante_step(). |
| src/solvers/lgrngn/hook_mixed_rhs_ante_step_lgrngn.hpp | Alters handling of cloudph_opts.src after the first step. |
| src/solvers/lgrngn/hook_ante_step_lgrngn.hpp | Adds (commented-out) debug scaffolding. |
| src/solvers/lgrngn/hook_ante_loop_lgrngn.hpp | Tweaks source enabling and increases n_sd_max headroom; records source bounds. |
| src/solvers/lgrngn/diag_lgrngn.hpp | Records additional wet-moment diagnostics for cloud/rain drops. |
| src/solvers/blk_2m/slvr_blk_2m_common.hpp | Adds per-timestep setopts_ante_step() override + runtime callback field. |
| src/solvers/blk_1m/slvr_blk_1m_common.hpp | Adds per-timestep setopts_ante_step() override + runtime callback field. |
| src/run_hlpr.cpp | Registers the new cloudlab case and wires case per-timestep option updates into params. |
| src/opts/opts_lgrngn.hpp | Adds depo option to the Lagrangian microphysics option parsing. |
| src/cases/CLOUDLAB.hpp | Implements the Cloudlab case and per-timestep seeding/source control. |
| src/cases/CasesCommon.hpp | Adds a new virtual setopts(rt_params_t&, int timestep) hook for cases. |
Suppressed comments (4)
src/solvers/lgrngn/hook_mixed_rhs_ante_step_lgrngn.hpp:70
params.cloudph_opts.srcis no longer disabled after it is used for GCCN initialization. Withgccn > 0this leaves the aerosol source enabled for the rest of the run (and likely explodes SD count / changes physics). Restore the originalsrc=falseswitch-off here; the new per-timestep case hook can still re-enable it later when needed (e.g., for Cloudlab seeding).
if(this->timestep == 1)
{
// turn off aerosol src, because it was only used to initialize gccn below some height
// params.cloudph_opts.src = false;
// if relaxation is to be done, turn it on after gccn were created by src
if(params.user_params.relax_ccn)
params.cloudph_opts.rlx = true;
}
src/solvers/lgrngn/diag_lgrngn.hpp:150
- Comment is incorrect: this records
diag_wet_mom(2)(2nd moment), not "0th" moment.
// recording 0th wet mom of radius of rain drops (r>25um)
prtcls->diag_wet_rng(25.e-6, 1);
prtcls->diag_wet_mom(2);
this->record_aux("rain_rw_mom2", prtcls->outbuf());
src/solvers/lgrngn/diag_lgrngn.hpp:165
- Comment is incorrect: this records
diag_wet_mom(1)(1st moment), not "0th" moment.
// recording 0th wet mom of radius of cloud drops (.5um< r < 25um)
prtcls->diag_wet_rng(.5e-6, 25.e-6);
prtcls->diag_wet_mom(1);
this->record_aux("cloud_rw_mom1", prtcls->outbuf());
src/solvers/lgrngn/diag_lgrngn.hpp:170
- Comment is incorrect: this records
diag_wet_mom(2)(2nd moment), not "0th" moment.
// recording 0th wet mom of radius of cloud drops (.5um< r < 25um)
prtcls->diag_wet_rng(.5e-6, 25.e-6);
prtcls->diag_wet_mom(2);
this->record_aux("cloud_rw_mom2", prtcls->outbuf());
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+137
to
+140
| p.setopts_ante_step = [case_instance = case_ptr.get()](rt_params_t ¶ms, const int timestep) | ||
| { | ||
| case_instance->setopts(params, timestep); | ||
| }; |
Comment on lines
+110
to
+114
| void setopts_ante_step() override | ||
| { | ||
| params.setopts_ante_step(params, this->timestep); | ||
| parent_t::setopts_ante_step(); | ||
| } |
Comment on lines
+156
to
+160
| void setopts_ante_step() override | ||
| { | ||
| params.setopts_ante_step(params, this->timestep); | ||
| parent_t::setopts_ante_step(); | ||
| } |
Comment on lines
+164
to
+168
| void setopts_ante_step() override | ||
| { | ||
| params.setopts_ante_step(params, this->timestep); | ||
| parent_t::setopts_ante_step(); | ||
| } |
Comment on lines
126
to
+131
| // space for SD created via relaxation, impossible to know exactly how many will be added, because it depends on washout of SD... | ||
| int n_sd_from_rlx_dry_distros = params.cloudph_opts_init.rlx_sd_per_bin * params.cloudph_opts_init.rlx_bins * params.cloudph_opts_init.nz * 100; // room for 100 rounds of full relaxation... | ||
| params.cloudph_opts_init.n_sd_max += n_sd_from_rlx_dry_distros; | ||
|
|
||
| params.cloudph_opts_init.n_sd_max += 1e6; // temporary for source | ||
|
|
Comment on lines
+142
to
+146
| // recording 1th wet mom of radius of rain drops (r>25um) | ||
| prtcls->diag_wet_rng(25.e-6, 1); | ||
| prtcls->diag_wet_mom(1); | ||
| this->record_aux("rain_rw_mom1", prtcls->outbuf()); | ||
|
|
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.