SDM with AMR#3181
Draft
debog wants to merge 89 commits into
Draft
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…l_distribution_type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SuperDropletPC was constructed with single-level (Geom,DMap,BA) constructor, leaving its internal ParGDB unaware of fine levels. After regrid, FixKIndexAMR and Redistribute silently skipped L1+, causing ParIter crashes on fine levels. Re-define the PC with ERF's AmrParGDB after construction. Made-with: Cursor
advflux_reg is only allocated for TwoWay coupling. ClearLevel unconditionally called reset() on it, segfaulting with OneWay. Made-with: Cursor
On fine AMR levels, z_phys_nd covers only the refined sub-region. Accessing ground (k=0) or roof (k=domain.bigEnd+1) indices read garbage, falsely deactivating all particles. Check zheight_box containment before access; fall back to domain extents otherwise. Also skip forEachParticleTile on levels with no particles. Made-with: Cursor
Replace bare Redistribute() with Redistribute(0,0) on L0 and ExtractAndRouteOORParticles on fine levels to avoid cross-level interference during sub-stepping. Update k-indices on all levels 0..a_lev after redistribution (particles may move between levels). Guard per-tile advection work with has_particles check. Made-with: Cursor
Fixes CUDA warning erf-model#611-D (partially overridden virtual function). Morrison now overrides the 3-arg version (delegates to 2-arg); SuperDropletsMoist now overrides the 2-arg version (aborts, since it requires a level argument). Made-with: Cursor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…itializes against its own BoxArray Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ame-hiding warning Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursor-agent@cursor.sh>
…n partial-z AMR tiles
…cle mesh ops Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts: # Source/Microphysics/ERF_EulerianMicrophysics.H # Source/Microphysics/ERF_LagrangianMicrophysics.H # Source/Microphysics/SuperDropletsMoist/ERF_SuperDropletsMoistAdvance.cpp # Source/Microphysics/SuperDropletsMoist/ERF_SuperDropletsMoistInit.cpp # Source/Microphysics/SuperDropletsMoist/ERF_SuperDropletsMoistPhaseChange.cpp # Source/Microphysics/SuperDropletsMoist/ERF_SuperDropletsMoistUtils.cpp
…qs/qg) plus qt; abort at setup if requested field is unsupported by the active moisture model
…ain metric, and pos_phys/pos_comp helpers for the upcoming computational-coordinate particle position refactor
…e floor formula (uses AMReX DefaultAssignor), drop AoS k slot, drop terrain-correction dance (FixKIndexAMR now just Redistribute), drop ExtractAndRouteOORParticles, swap mapped-z interp with plain interp; uniform-z bubble cases pass; ParticleWoA terrain and ParticleAdvect_AMR1_box mass-density gold need follow-up
…particles from crossing levels mid-coarse-step (which caused double-advection on the fine level); reintroduce a simplified ExtractAndRouteOORParticles that routes fine-level OOR particles back to L0 using DefaultAssignor [run-ci]
This reverts commit 1de10e6.
…rticle species (e.g., super_droplets_moisture_mass_density). field_name = <species>_<mesh_var> dispatches to ERFPC::computeMeshVar; per-level deposit + average down matches the existing _count pattern
…stic regression; regenerate gold files
…e MPI-rank-specific
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.
AMR support for the Lagrangian (super-droplet) moisture model.
SuperDropletsMoistoperates per-level: each level owns its super-droplet population, initializes against its ownBoxArray, advances and undergoes phase change independently, and contributes to the Eulerian moisture state via covered-coarse-cell masking and conservation-preserving average-down at sync points. Coalescence is kept invariant across levels by scaling per-level bin volume with the cumulative refinement ratio. Tagging is extended to all moisture mixing ratios (qv,qc,qi,qr,qs,qg,qt = qc + qi + qr + qs + qg) and to any particle-deposited Eulerian field of the form<species>_<mesh_var>(e.g.,super_droplets_moisture_mass_density).LagrangianMicrophysicscarries a per-levelm_moist_modelvector and exposesDefine(lev),InitializeParticles(lev, ...),Advance(lev, dt, ...),Update_State_Vars_Lev(lev, cons, z_phys_nd), andUpdate_Micro_Vars_Lev(lev, ...).NullMoist/NullMoistLagrangianand theMicrophysicsvirtual interface are updated to match.Update_State_Varsis collapsed to a single 2-argument form(cons_in, z_phys_nd); the cachedz_phys_ndpointer inSuperDropletsMoistis removed.SuperDropletPCis constructed with the multi-levelParGDB;InitializeParticles(lev, ...)seeds each level against itsBoxArray.AdvectParticlesguards against out-of-rangekon partial-z fine tiles and NaN velocity near level boundaries.EvolveParticlesuses per-levelRedistribute(0,0)on L0 andRedistribute(a_lev, a_lev)on fine levels, withExtractAndRouteOORParticles(a_lev)routing fine-level out-of-range particles back to L0 viaDefaultAssignor+filterParticles/copyParticles. This prevents mid-coarse-step cross-level moves that previously caused double-advection on the fine level.phaseChangeandCopy_Micro_to_Statemask covered coarse cells withmakeFineMaskso cells already updated by a finer level are not re-updated by the coarse advance.Copy_State_to_Microreadsqcandqrfrom state on coarse/fine boundaries forq_tconsistency;qcis recomputed from particles beforeq_tinphaseChange.fine_maskis built with the microphysics-fab ghost width.AverageDownMicroVars(finest_level)runsamrex::average_down(viaERF::AverageDownTo,do_perturbational_and_momenta=false) onRhoThetaand per-componentRhoQ_nso the coarse moisture state stays conservation-consistent with the fine state. Called pre-regrid, before plotfile writes (ERF_Plotfile.cpp), and after each level'sadvance_microphysics.refRatioinERF_SuperDropletPCCoalescence.cpp, so physical bin volume is level-invariant.ERF_Tagging.cppextendsfield_namerefinement to all moisture mixing ratios (aborts at setup if unsupported by the active moisture model) and dispatches<species>_<mesh_var>field names toERFPC::computeMeshVarwith per-level deposit + level-by-level average down, matching the existing_counttagging pattern.ERF::estTimeStepguards against empty fine levels and setsdz_minper level;ClearLevelguardsadvflux_reg->reset()against null. Fine-level ghost cells areFillPatchFineLevel-ed before each microphysics advance, andz_phys_ndaccess in particle boundary treatment is guarded for fine levels.Exec/RegTests/Bubble:inputs_BF02_dry_bubble_AMR{1,2}andinputs_3DBF02_dry_bubble{,_AMR1,_AMR2}.SDM_Bubble{2,3}D_Adv_AMR{1,2},SDM_Bubble3D_Adv,SDM_MoistBubble{2,3}D_AMR{1,2}.