|
| 1 | +# `s_test_suite_compatibility.m` Documentation |
| 2 | + |
| 3 | +## Overview |
| 4 | +`s_test_suite_compatibility.m` verifies that the finite difference (`m_imr_fd`) and spectral (`m_imr_spectral`) solvers produce compatible results under various model configurations, including thermal effects. |
| 5 | + |
| 6 | +## Major Sections |
| 7 | + |
| 8 | +1. **Initialization** |
| 9 | + - Clears workspace (`clc`, `clear`, `close`). |
| 10 | + - Adds necessary paths: `toolchain/`, `src/forward_solver/`, and `tests/`. |
| 11 | + - Loads test identifiers from `file_ids.mat`. |
| 12 | + |
| 13 | +2. **Preallocation** |
| 14 | + - Computes `num_tests` as the product of parameter combinations. |
| 15 | + - Initializes `errors_fd`, `errors_sp`, and `failed_tests` arrays. |
| 16 | + |
| 17 | +3. **Parameter Setup** |
| 18 | + - Defines parameter vectors: |
| 19 | + - `muvec`: viscosity values |
| 20 | + - `Gvec`: shear modulus values |
| 21 | + - `alphaxvec`: strain-softening exponents |
| 22 | + - `lambda1vec`: relaxation times |
| 23 | + - Sets error threshold (`threshold = 1e-4`) and counter (`count = 1`). |
| 24 | + |
| 25 | +4. **Nested Test Loop** |
| 26 | + - Loops over combinations of: |
| 27 | + `radial` (1–4), `bubtherm` (0/1), `medtherm` (0/1), `stress` (0–5), |
| 28 | + `mu`, `G`, `alphax`, `lambda1` indices. |
| 29 | + - For each combination: |
| 30 | + 1. Constructs `varin` parameter-value pairs. |
| 31 | + 2. Loads reference results: `Rf` and `Rs` from test MAT files. |
| 32 | + 3. Runs `m_imr_fd` and compares output `Rf_test`; computes L2 error. |
| 33 | + 4. Runs `m_imr_spectral` and compares output `Rs_test`; computes L2 error. |
| 34 | + 5. Records failures where error exceeds `threshold`. |
| 35 | + |
| 36 | +5. **Summary and Exit** |
| 37 | + - Truncates and cleans `failed_tests`. |
| 38 | + - If all tests passed, prints success and calls `exit(0)`. |
| 39 | + - Otherwise, prints failed test indices and raises an error. |
| 40 | + |
| 41 | +## Inputs |
| 42 | + |
| 43 | +| Name | Description | |
| 44 | +|------------------|------------------------------------------------| |
| 45 | +| `file_ids.mat` | MAT-file defining `ids` (list of test case IDs)| |
| 46 | +| `m_imr_fd` | Finite difference solver function | |
| 47 | +| `m_imr_spectral` | Spectral solver function | |
| 48 | + |
| 49 | +## Outputs |
| 50 | + |
| 51 | +- **Console output**: |
| 52 | + - L2 norm error for each finite-difference and spectral test. |
| 53 | + - Summary line: pass or fail with indices. |
| 54 | +- **Exit code**: |
| 55 | + - `0` if all tests pass. |
| 56 | + - Error thrown (non-zero) if any test fails. |
| 57 | + |
| 58 | +## Notes |
| 59 | + |
| 60 | +- `num_tests` covers all combinations of radial, thermal, stress, and material parameters. |
| 61 | +- Tests use reduced mesh sizes (`Nt=70, Mt=70` for FD; `Nt=12, Mt=12` for spectral) for speed. |
0 commit comments