Skip to content

Refactor Modal Aerosol Model (MAM) and aerosol deposition science code and move to atmos_phys - #1642

Open
jimmielin wants to merge 10 commits into
ESCOMP:cam_developmentfrom
jimmielin:hplin/mam_atmos_phys
Open

jimmielin wants to merge 10 commits into
ESCOMP:cam_developmentfrom
jimmielin:hplin/mam_atmos_phys

Conversation

@jimmielin

@jimmielin jimmielin commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Partially resolves #1614

List all files eliminated:

D       src/chemistry/aerosol/aer_drydep_mod.F90
D       src/chemistry/aerosol/cldaero_mod.F90
D       src/chemistry/aerosol/dust_common.F90
D       src/chemistry/aerosol/dust_sediment_mod.F90
D       src/chemistry/aerosol/sox_cldaero_mod.F90
D       src/chemistry/aerosol/sslt_sections.F90
D       src/chemistry/aerosol/wetdep.F90
D       src/physics/cam/ndrop.F90
  - entirely moved to atmospheric_physics (portable science).

D       src/chemistry/aerosol/aero_convproc.F90
D       src/chemistry/aerosol/mo_setsox.F90
D       src/chemistry/modal_aero/modal_aero_coag.F90
D       src/chemistry/modal_aero/modal_aero_gasaerexch.F90
D       src/chemistry/modal_aero/modal_aero_newnuc.F90
D       src/chemistry/modal_aero/modal_aero_rename.F90
D       src/chemistry/utils/modal_aero_calcsize.F90
D       src/chemistry/utils/modal_aero_wateruptake.F90
  - split: portable science moved to atmospheric_physics
    CAM wrappers with CAM-specific code left in *_cam.F90.

List all files added and what they do:

A       src/chemistry/aerosol/aero_convproc_cam.F90
  - CAM wrapper for the portable aero_convproc module.

A       src/chemistry/aerosol/mo_setsox_cam.F90
  - CAM wrapper for the portable mo_setsox aqueous sulfur chemistry module.

A       src/chemistry/aerosol/wetdep_cam.F90
  - CAM host interface for the portable wetdep module.
    Keeps gas-phase Henry's law scavenging (wetdepg).

A       src/chemistry/modal_aero/modal_aero_coag_cam.F90
  - CAM wrapper for the portable modal_aero_coag module.
    Resolves coagulation-pair tables from CAM constituents metadata.

A       src/chemistry/modal_aero/modal_aero_gasaerexch_cam.F90
  - CAM wrapper for the portable modal_aero_gasaerexch module.
    Resolves CAM-specific species indices and registers history fields.

A       src/chemistry/modal_aero/modal_aero_newnuc_cam.F90
  - CAM wrapper for the portable modal_aero_newnuc module.

A       src/chemistry/modal_aero/modal_aero_rename_cam.F90
  - CAM wrapper for the portable modal_aero_rename module.
    Publishes resolved renaming-pair tables consumed by calcsize and gasaerexch.

A       src/chemistry/utils/modal_aero_calcsize_cam.F90
  - CAM wrapper for the portable modal_aero_calcsize module.

A       src/chemistry/utils/modal_aero_wateruptake_cam.F90
  - CAM wrapper for the portable modal_aero_wateruptake module.

List all existing files that have been modified, and describe the changes:

M       bld/configure
  - add atmos_phys/schemes/modal_aero to build paths.

M       src/chemistry/aerosol/aero_wetdep_cam.F90
  - use aero_convproc_cam and wetdep_cam instead of the deleted modules.
  - move below-cloud scavenging coefficient table (init_bcscavcoef) to the portable wetdep module
    and called from init.

M       src/chemistry/aerosol/aerosol_optics_core.F90
  - thread top_lev, t, pmid, h2ommr, cldn through optics SW/LW routines
    so that diagnostic radiation lists can recompute water uptake portably.

M       src/chemistry/aerosol/aerosol_state_mod.F90
  - add aero_wet_volume abstract interface carrying atmospheric state
    (top_lev, t, pmid, h2ommr, cldn) for portable water uptake recompute.
  - update water_uptake, wet_volume, water_volume deferred interfaces.

M       src/chemistry/aerosol/bulk_aerosol_state_mod.F90
M       src/chemistry/aerosol/carma_aerosol_state_mod.F90
  - use updated aerosol_state water_uptake/wet_volume/water_volume
    interfaces that thread through model state (bfb).

M       src/chemistry/aerosol/modal_aero_data.F90
  - add modal_strat_sulfate flag (moved from modal_aero_wateruptake).

M       src/chemistry/aerosol/modal_aerosol_state_mod.F90
  - remove direct pbuf access for DGNUM/DGNUMWET/QAERWAT; use
    get_mode_dry_diameter/wet_diameter/aer_water accessors from
    aerosol_mmr_host instead.
  - add water_uptake_diag_fn procedure pointer and registration routine
    so the portable wateruptake code can be called for diagnostic
    radiation lists without host-model coupling.

M       src/chemistry/aerosol/refractive_aerosol_optics_mod.F90
  - thread top_lev and atmospheric state through the constructor for the
    portable water uptake call.

M       src/chemistry/bulk_aero/aero_model.F90
  - use wetdep_cam, mo_setsox_cam, aero_drydep_core CAM interfaces.
  - remove inidrydep call (now internal to portable aero_drydep_core).
  - update dust_sediment_tend, wetdepa_v1, calcram calls to portable interfaces.

M       src/chemistry/bulk_aero/dust_model.F90
  - update dust_set_params call to portable interface (pass pi, rair, gravit).

M       src/chemistry/carma_aero/aero_model.F90
  - use mo_setsox_cam instead of mo_setsox.

M       src/chemistry/geoschem/chemistry.F90
  - use mo_setsox_cam instead of mo_setsox.

M       src/chemistry/modal_aero/aero_model.F90
  - use *_cam wrappers for coag, gasaerexch, newnuc, rename, calcsize init calls.
  - use mo_setsox_cam instead of mo_setsox.
  - call portable _run entry points (modal_aero_gasaerexch_run, etc.)
    instead of the old _sub routines.
  - use portable aero_drydep_core (modal_aero_depvel_part, calcram)
    instead of aer_drydep_mod; thread explicit physics constants.
  - update dust_sediment_tend calls to portable interface.
  - remove unused d3ddflux code path.
  - get modal_strat_sulfate from modal_aero_data instead of
    modal_aero_wateruptake.

M       src/chemistry/modal_aero/dust_model.F90
  - use portable modal_dust_emissions module for dust emission initialization
    and runtime; remove inline dust_dmt_grd/dust_stk_crc arrays.

M       src/chemistry/modal_aero/seasalt_model.F90
  - use portable modal_seasalt_emissions_run instead of inline sea-salt
    emission calculation; accept u_bottom, v_bottom, zmid_bottom instead
    of precomputed u10cubed.

M       src/physics/cam/aerosol_mmr_host.F90
  - add get_mode_dry_diameter, get_mode_wet_diameter, get_mode_aer_water
    accessors for DGNUM/DGNUMWET/QAERWAT pbuf fields.

M       src/physics/cam/aerosol_optics_cam.F90
  - pass atmospheric state (t, pmid, h2ommr, cldn) through
    aerosol_optics_sw_bin/lw_bin and wet_volume/water_volume calls for
    portable water uptake recompute on diagnostic radiation lists.

M       src/physics/cam/microp_aero.F90
  - move dropmixnuc CAM interface code (tendency field registration,
    ptend initialization, history output) from ndrop into microp_aero.
  - pass explicit physics constants to ndrop_init.

M       src/physics/cam/physpkg.F90
M       src/physics/cam7/physpkg.F90
  - use modal_aero_calcsize_cam and modal_aero_wateruptake_cam instead
    of the deleted modules.

M       src/physics/carma/cam/carma_intr.F90
  - update clddiag, wetdepa_v1, wetdepa_v2 calls to portable interfaces
    (explicit constants, removed unused args).

hplin-ucar and others added 2 commits August 10, 2026 12:31
… atmos_phys

This is the first step to CCPP conversion of MAM. This PR completes the CAM side work.
It refactors CAM-specific code into CAM interfaces (_cam suffix) and includes the MAM core
science code sourced from the atmos_phys external.

Refactor into portable code: modal_aero_calcsize, wateruptake, gasaerexch, rename

Refactor into portable code: modal_aero_calcsize, wateruptake, gasaerexch

Initial try at converting modal_aero_calcsize into portable code.

Initial try at converting modal_aero_wateruptake into portable code.

Put modal_aero_calcdry_run back in the portable subroutine and eliminate dual-path method - move to CAM interface.

Cleanup; rewire modal_strat_sulfate

Initial attempt for modal_aero_gasaerexch portability

Build fixes.

Alternate approach for modal_strat_sulfate (put in modal_aero_data) that does not need circular depends

Diagnostic b4b (partial) fix; loffset build fix

B4B fix for gasaerexch.

B4B fixes

Various cleanup; thread through rair

B4B fix 3

Thread pi through calcsize_dry_run

Initial attempt for modal_aero_rename portability.

Follow-up cleanups to modal_aero_rename refactor.

Refactor into portable code: modal_aero_newnuc (tendency-return).

Refactor into portable code: modal_aero_coag (in-place vmr, dqdt diagnostic-only).

Refactor into portable code: mo_setsox aqueous sulfur chemistry (setsox_sub + sox_cldaero + cldaero portable; mo_setsox_cam wrapper).

Refactor into portable code: aero_activate (activate_aerosol) + wetdep split; rewire convproc call sites.

Extract the Abdul-Razzak & Ghan activation kernel activate_aerosol from ndrop.F90 into portable aero_activate.F90.

Split wetdep.F90 into portable science (clddiag, wetdepa_v1, wetdepa_v2)

Refactor into portable code: full aero_convproc split + impaction tables to wetdep.

Remove pre-existing dead code from wetdep scavenging routines (unused dummies/locals).

Remove pre-existing dead code from aerosol drydep path.

Refactor into portable code: aerosol drydep leaves + dust_sediment_mod.

Remove aer_drydep_mod.F90: fully dead after the drydep portable split.

Behavior-neutral; separate commit so CAM regression b4b can bisect it.

Remove pre-existing dead code from MAM dust/seasalt emissions path.

Refactor into portable code: MAM dust + seasalt emissions cores.

Rename to avoid naming conflict with GEOS-Chem

Remove pre-existing dead code from ndrop gas-mixing path.

Refactor into portable code: ndrop (dropmixnuc) droplet activation core.

Unify the calcsize/wateruptake diag path in modal_aerosol_state_mod for CAM and CAM-SIMA.

Cleanup modal_aero_calcsize/wateruptake diag paths as they are moved to portable code.
@jimmielin
jimmielin marked this pull request as ready for review August 25, 2026 20:22
@jimmielin
jimmielin requested a review from fvitt August 31, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants