aerosol: give radmod the particle radius the namelist asked for - #60
Open
Sohex wants to merge 1 commit into
Open
aerosol: give radmod the particle radius the namelist asked for#60Sohex wants to merge 1 commit into
Sohex wants to merge 1 commit into
Conversation
`apart`, the aerosol particle radius, is declared twice: in `aeromod` and in
`radmod`, both defaulting to 50 nm. Only aeromod's is in a namelist. `aero_ini`
reads `aero_nl` into aeromod's copy and use-associates `l_aerorad` and
`aerofile` from radmod, but not `apart`, so radmod's copy keeps its compiled
default however the run is configured.
Both halves of the shortwave aerosol optical depth then disagree about the
particle. `aerocore` calls `mmr2n(mmr, apart, rhop, ...)` with aeromod's value,
so the number density `nrho` is right for the particle the run asked for.
`radmod`'s `aeroprof` then computes
daerod = nrho * PI * apart**2 * qex1 * zdz
with radmod's value. For a fixed mass mixing ratio `nrho` goes as 1/r**3 and the
optical depth as nrho*r**2, so a consistent calculation goes as 1/r; with the
two copies disagreeing the model computes nrho(r_true) * r_radmod**2 instead,
and
tau_computed / tau_intended = (50e-9 / r_true)**2
Both defaults are 50 nm, so nothing happens until a run sets `apart` -- but a
run that sets it is exactly a run that meant to.
WHY IT IS INVISIBLE. radmod also declares `namelist/aero_nl/` including its own
`apart`, and nothing in radmod ever opens or reads that namelist; `aero_ini` is
the only reader and it reads aeromod's group. So radmod looks wired up and is
not. That declaration is removed here, because leaving it is what makes the
defect impossible to see by reading.
THE FIX is two lines of mechanism: `aero_ini` copies its namelist value into
radmod's, and `radini` broadcasts it beside the `l_aerorad` broadcast that is
already there. The two variables stay separate because radmod cannot use
aeromod -- aeromod already uses radmod, and make_plasim compiles it second.
Worth knowing for anyone with results from this module: the scaling is quadratic
and unforgiving. At a 500 nm particle the radiation sees 1% of the intended
optical depth; at 1 um, 0.25%.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
apart, the aerosol particle radius, is declared twice -- inaeromodand inradmod, both defaulting to 50 nm -- and only aeromod's is in a namelist.aero_inireadsaero_nlinto aeromod's copy and use-associatesl_aeroradandaerofilefrom radmod, but notapart, so radmod's copy keeps its compiled default however the run is configured.The two halves of the shortwave optical depth then disagree about the particle.
aerocorecallsmmr2n(mmr, apart, rhop, ...)with aeromod's value, so the number densitynrhois right for the particle the run asked for.radmod'saeroprofthen computeswith radmod's value. For fixed mass
nrhogoes as 1/r³ and the optical depth as nrho·r², so a consistent calculation goes as 1/r; with the copies disagreeing the model computesnrho(r_true) * r_radmod², andτ_computed / τ_intended = (50e-9 / r_true)²
Both defaults are 50 nm, so nothing happens until a run sets
apart— but a run that sets it is exactly a run that meant to. At 500 nm the radiation sees 1% of the intended optical depth; at 1 µm, 0.25%.Why it is invisible
radmodalso declaresnamelist/aero_nl/including its ownapart, and nothing in radmod ever opens or reads that namelist —aero_iniis the only reader and it reads aeromod's group. So radmod looks wired up and is not. That declaration is removed here, because leaving it is what makes the defect impossible to see by reading.The fix
Two lines of mechanism:
aero_inicopies its namelist value into radmod's, andradinibroadcasts it beside thel_aeroradbroadcast already there. The two variables stay separate because radmod cannotuseaeromod — aeromod already uses radmod, andmake_plasimcompiles it second.Compiles at T21/8. No behaviour change for any run that leaves
apartat its default.