Pull request to put the Isca Mars configurations into Isca's master - #299
Conversation
…my module in order that we can correctly calculate rrsun using the true anomaly rather than the mean anomaly. Have also added multiplication by rrsun to two-stream-grey-rad, which makes no difference to results in initial tests when ecc = 0.0
…ue anomaly, and therefore be able to do mars time-telling.
… expects orbital_period in seconds, but I had supplied it in days. This is because Alex's code expects it in days. Will fix Alex code to make it consistent.
…e of surface optical depths and albedos, assuming transparancy in the visible. Useful for working out rough values for optical depths and albedos for a simple mars model.
…ay is not the same as one mars day. Have altered rotation rate and orbital rate such that each can be set as an integer, and we end up with a length of sol which is also an integer. This can then be used as the averaging period.
…dependently. Then also only calculating rh when rh is asked for. Model now runs and looks vaguely mars-like, but dates of equinox etc still not right.
…nml, and ability to use specified temperatures for evaporation calculations in surface flux. This means that, when using a dry model where temperatures are outside standard range for sat specific humidity calculations, then false temps can be used to stop it failing.
Cores on a Mac cannot be tied in the same way that they can on linux, so core affinity is not possible. Here I am just stubbing out the core affinity functions to mimic the linux case where it cannot get the affinity info. More info in links inline in `affinity.c`.
…xis. For some reason, the interpolator will get rid of such variables when used on its own, so I modified the python to add them back.
…o idealized moist phys back in teh old GFDLMoistmodel repo on the local_heating_dev branch. This seems to work now, and should hopefully be useful. Only tried the Isidoro option, and not the input file option, but this should be fine.
Adding mac functionality to local heating branch
…cal prescribed heating input files. Seems to work alright, but problem is that local heating code always reads zeros no matter what I seem to do. Reading the created files into RRTM as an ozone does work, and reading ozone-1990 into local heating does not. Very odd. Tried everything I can think of, but we'll have to carry on testing.
…not being passed time, and therefore was not being fed to the correct interpolator within the interface type structure.
Updating from master
Local dry heating
Conflicts: src/atmos_param/two_stream_gray_rad/two_stream_gray_rad.F90
…p dry heating test case and associated script for generating heating rate. This now produced a heating array of zeros purely for test purposes.
…s and not automated compile tests.
…ing discovered by pytest.
…mn variants to prevent compilation failure.
…ase. Confirmed results bitwise identical, and have made it so that the max number of processors used for parallel compilation is 8, as this gives 32% speedup on serial compilation, but more cores does not give compilation speedup.
…oducible as random seed was not set. Now added as namelist parameter for both test cases, and verified that runs are reproducible.
…so non-Titan cases stay bit-identical to master Both update_tracers's grid-tracer branch (spectral_dynamics.F90) and the bucket-water diffusion call (idealized_moist_phys.F90) unconditionally ran a grid->spherical->grid round-trip that was only meant to support new, opt-in Titan features (do_spec_tracer_filter, damping_coeff_bucket damping). Even with those options left at their defaults (off), the round-trip isn't a no-op - it silently low-pass-filters real grid-scale structure (e.g. via floating-point reassociation in the tracer tendency, or truncation of land/ocean boundaries in the bucket case) - which broke bit-reproducibility against master for frierson, bucket_model, and realistic_continents_variable_qflux. Both call sites are now branched on their respective flags: the Titan path runs unchanged when requested, and everything else falls back to the exact pre-existing formulation. Verified bit-identical to master (eb64615) for frierson, bucket_model, and realistic_continents_variable_qflux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
7f4201d ("Important fix for two-stream") corrected frac_of_day to account for total elapsed seconds rather than just the current day's remainder, needed for solar day lengths > 86400s (Mars, Titan) where the model's internal "days" bookkeeping (fixed 86400s calendar units) and the actual solar day length diverge. Master never needed this fix and still uses the original formulation. For day_in_s == 86400 (Earth-standard), the original formulation was already correct, but the code ran the total-elapsed-seconds path unconditionally. Since that path needs mod() to strip the accumulated whole-days component back out, it introduces a small precision loss vs directly using r_seconds - breaking bit-reproducibility against master for any do_seasonal Earth-day-length case (e.g. variable_co2_grey). Branch on day_in_s == 86400 instead: Earth-standard runs get the exact pre-7f4201dd formulation back, non-Earth day lengths keep 7f4201d's fix unchanged. Verified bit-identical to master for variable_co2_grey (and frierson, bucket_model together). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Having put all of the Mars-related modifications into this P/R, nearly all of the trip tests. However, I worked with Claude to find the causes of these trip test failures, and have identified and fixed all of them. The summary of this investigation (generated by Claude) is given below: SummaryThree genuine numerical regressions between
All three are now bit-identical to master. Socrates-based trip tests ( Fix 1 —
|
|
The plan for this branch now is to attempt to track down the cause of the top-down test divergence bug. If this can be found, a fix will be applied, and then this branch can be merged. |
…actually set update_orbit's theta calculation gained an equinox_day offset and a modulo() wraparound to support a non-default calendar alignment. equinox_day defaults to 0, and theta is 2*pi-periodic either way (sin(theta) is invariant to adding whole orbits), so the new formulation is mathematically equivalent for the default case - but it reorders the multiply/divide and adds a wrap-around that's never actually needed there, which isn't bit-identical to the original even when no wrapping occurs. This broke bit-reproducibility against master for any equilibrium_t_option='top_down' run (e.g. top_down_test), the only trip test case that exercises update_orbit. Branch on equinox_day == 0: the default case gets the exact original formulation back, bit-for-bit; a non-zero equinox_day keeps the new wraparound behavior unchanged. Verified bit-identical to master for top_down_test, together with frierson, bucket_model, variable_co2_grey, and realistic_continents_variable_qflux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Claude found the fix for top-down test: Update: found and fixed the last remaining divergence (
|
| Test case | Result | Notes |
|---|---|---|
frierson |
✅ Pass | Fixed in this PR (Fix 1) |
bucket_model |
✅ Pass | Fixed in this PR (Fix 2) |
realistic_continents_variable_qflux |
✅ Pass | Fixed in this PR (Fix 1) |
variable_co2_grey |
✅ Pass | Fixed in this PR (Fix 3) |
top_down_test |
✅ Pass | Fixed in this PR (Fix 4) |
held_suarez |
✅ Pass | Unaffected, always passed |
MiMA |
✅ Pass | Unaffected, always passed |
realistic_continents_fixed_sst |
✅ Pass | Unaffected, always passed |
variable_co2_rrtm |
✅ Pass | Unaffected, always passed |
column_test |
✅ Pass | Unaffected, always passed |
socrates_aquaplanet |
✅ Pass | Previously untestable locally (env issue, not a code bug); now runs and passes |
socrates_aquaplanet_cloud |
✅ Pass | Previously untestable locally (env issue, not a code bug); now runs and passes |
ape_aquaplanet |
✅ Pass | Previously untestable locally (env issue, not a code bug); now runs and passes |
axisymmetric |
❌ Crash | Pre-existing, unrelated - master-side namelist/version-skew mismatch |
giant_planet |
❌ Crash | Pre-existing, unrelated - master-side crash |
barotropic_vort_eq_stirring |
❌ Crash | Pre-existing, unrelated - master's Fortran rejects stirring_nml option only the branch's current test scripts write |
shallow_water_stirring |
❌ Crash | Pre-existing, unrelated - same stirring_nml mismatch as above |
grey_mars |
❌ Crash | Pre-existing, unrelated - master's Fortran rejects constants_nml options only the branch's current test scripts write |
radiative_eq_mars |
❌ Crash | Pre-existing, unrelated - same constants_nml mismatch as above |
19 test cases total: 13 pass (5 newly fixed by this PR, 3 previously blocked by an unrelated local env issue, 5 always passing), 6 fail with pre-existing crashes unrelated to this PR.
|
Once the CI passes, I'm happy and ready to merge this in. After that, for Mars things, I'm going to move onto merging in Emily Ball's Isca-Mars work so that we have a test case for that too. |
|
Here's Claude's summary of the contents of this P/R: High-level summaryThis PR brings several years of accumulated Mars and Titan development work into New physics capabilitiesMars radiation and dynamics
Titan radiation and surface
Local / prescribed heating
Alternative surface flux scheme
Orbital mechanics / astronomy
New test cases
All four are wired into the trip test suite alongside the existing cases. Build, compiler compatibility, and performance
Test infrastructure improvements
Bit-reproducibility fixes (this investigation)Four of the new, default-off features above were being exercised unconditionally rather than only when requested, which silently changed results for unrelated experiments and broke bit-reproducibility against master. All four are now correctly gated behind their own namelist options, with the affected trip test cases ( |
|
OK - I'm going to merge this in now. The summary being that Isca Mars configurations as in the atmospheres paper that Geoff and I had are now available in the Isca master. |
The Isca Mars configurations haven't ever been merged into the master, and I'd like to make sure this is done ASAP.
In this P/R I have put in my grey-radiation Mars and Socrates Mars configurations without dust as test cases that can be run with the trip tests. These are the ones that are described in this paper:
https://www.mdpi.com/2073-4433/10/12/803
I'd also like to get in Emily Ball's Isca-Mars configurations that built on my Mars stuff, but I wanted to do this first. This P/R is ready for merging (pending passing the trip tests).