MIDAS

The octave/ folder is a fully self-contained, GNU Octave-compatible port of the model, for anyone without a MATLAB license. It covers the same physics and outputs as matlab/, either from the command line (Run_MIDAS) or through its own interactive GUI (MIDAS_GUI) - a rebuild covering the same fields as the MATLAB App Designer app, since Octave can’t open that file format at all.

MIDAS was originally written for and developed in MATLAB. matlab//GUI/ are the mature, primary implementation; this port was only recently run under a real Octave interpreter for the first time, surfacing (and fixing) a number of Octave-only compatibility bugs - see CHANGELOG.md - with more possibly still to find. Something that misbehaves under Octave but works fine in MATLAB is likely a porting gap, not a physics/numerics issue - please report it. If you have a MATLAB license, prefer it when runtime matters - Octave measured about 4.5x slower here even with plotting off entirely, after a since-applied fix cut what was originally a much larger gap (see Performance below), and the GUI’s live-updating plot is slower still (see Performance).

Requirements

Linux:

sudo apt-get install -y octave
octave --eval "pkg install -forge io image"

Windows: install Octave first (octave.org/download, or winget install --id GNU.Octave - both verified to give the same result: no qt toolkit, see below), then:

octave --eval "pkg install -forge io image"

macOS (Homebrew):

brew install octave
octave --eval "pkg install -forge io image"

Graphics toolkit

qt is strongly recommended if available. Verified on Windows: neither the winget install GNU.Octave package nor the official octave.org Windows installer (11.3.0) ships qt - only fltk/gnuplot, both flagged by Octave itself as unmaintained. fltk’s broken LaTeX self-test is worked around (octave/ no longer requests the 'latex' interpreter at all - see Differences from the MATLAB version below). Figure export still hangs for any 2-D color-mapped content, not specific to one plotting function (contourf and pcolor both hang identically) - see octave/README.md for the full detail. This looks like a broader fltk/GL2PS limitation, not a MIDAS bug; until qt is available, avoid exporting the phase-diagram panels (or any color-mapped plot) under Octave on Windows.

The full plotting/export pipeline has since been run end-to-end under Octave; several further compatibility bugs it surfaced (a legend() crash, a make_movie/GIF failure, missing parula/sgtitle) have been fixed - see CHANGELOG.md.

Usage

octave
>> Run_MIDAS

Same workflow as matlab/ - MIDAS_Params.m is the default, or swap in any of the six example configurations.

Performance

If you have a MATLAB license, prefer it for anything beyond a quick check - Octave is still slower than MATLAB here, independent of plotting (see also the GUI-specific redraw cost in Performance), though far less than it used to be.

Originally (before the thomasSolve fix below), measured directly on this machine at full resolution, doPlot = false (pure numerics, no plotting at all): Example1_Baseline took 48.2 s under MATLAB vs. 1040.5 s under Octave - about 21.6x slower. Profiling a shorter Octave run (same full grid, t_tot = 1) traced the large majority of this to one function: thomasSolve (MIDAS_Main.m’s hand-written tridiagonal solver, called once per phase per implicit diffusion step) accounted for 42 of 69 seconds - 61% of total runtime - across 6,360 calls, each running a ~200-iteration scalar for-loop twice (forward sweep, then back-substitution). MATLAB’s JIT compiles this kind of tight indexed-scalar loop efficiently; Octave’s interpreter does not, so the same algorithm that is cheap under MATLAB dominated the whole run under Octave.

Fixed (octave/ only - see Differences from the MATLAB version): octave/MIDAS_Main.m’s thomasSolve now solves the same tridiagonal system via a sparse-matrix backslash (\) instead of that hand-written loop, handing the work to a compiled solver instead of the interpreter. Verified to still agree with matlab/GUI within the documented 1e-9 tolerance (tests/compare_results.m). Re-measured at full resolution after the fix: Example1_Baseline dropped from 1040.5 s to 214.7 s - a 4.85x speedup, bringing Octave from 21.6x down to about 4.5x slower than MATLAB’s 48.2 s for the same run. (Example3_ThermalBump - 90.0 s under MATLAB - still didn’t complete under Octave within the time available even after the fix, so no post-fix ratio is reported for it; treat the Example1 figure as representative, not universal.)

Differences from the MATLAB version

Status

Actually run under a real Octave interpreter (11.3.0, Windows) end-to-end - all six examples plus the full live-plotting and post-run export pipeline - surfacing and fixing several real bugs that MATLAB-only logic-verification had missed (see CHANGELOG.md). Note: .github/scripts/smoke_test.m (run by ci-octave.yml) sets doPlot = false throughout, so CI does not exercise MIDAS_Main.m’s own live-plotting branch - the verification above was done manually, not by CI.