Skip to content

Commit 74f0837

Browse files
committed
added more documentation files
1 parent 59be5e9 commit 74f0837

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# `s_test_suite_equilibrium.m` Documentation
2+
3+
## Overview
4+
`s_test_suite_equilibrium.m` checks that both solvers correctly maintain equilibrium conditions (no dynamics) across model variations.
5+
6+
## Major Sections
7+
8+
1. **Initialization**
9+
- Clears workspace.
10+
- Adds paths: `toolchain/` and `src/forward_solver/`.
11+
12+
2. **Preallocation**
13+
- Defines `num_tests` based on parameter loops.
14+
- Initializes `errors_fd`, `errors_sp`, `failed_tests`.
15+
- Sets `threshold = 1e-14` for high-precision check.
16+
17+
3. **Parameter and Initial Condition Setup**
18+
- Sets fixed test parameters:
19+
`masstrans = 0`, `collapse = 0`,
20+
`Req = 100e-6`, `R0 = Req`, `T8 = 298.15`,
21+
`tfin = 1e-5`, `tvector = linspace(0, tfin, 100)`.
22+
23+
4. **Nested Test Loop**
24+
- Iterates over `radial` (1–4), `vapor` (0/1),
25+
`bubtherm` (0/1), `medtherm` (0/1), `stress` (0–5).
26+
- Constructs `varin` parameter sets.
27+
- Runs `m_imr_fd` and `m_imr_spectral` with fine meshes (`Nt=150,Mt=150` FD; `Nt=12,Mt=12` spectral).
28+
- Computes equilibrium error: `abs(norm(R_test,2)/10 - 1)`.
29+
- Records failures if error exceeds `threshold`.
30+
31+
5. **Summary and Exit**
32+
- Cleans up `failed_tests`.
33+
- Prints pass or fail message.
34+
- Exits with `0` on success or `1` on failure.
35+
36+
## Inputs
37+
38+
| Name | Description |
39+
|------------------|------------------------------------------------|
40+
| `m_imr_fd` | Finite difference solver function |
41+
| `m_imr_spectral` | Spectral solver function |
42+
| Script parameters| Equilibrium test parameters (e.g., `Req`, `R0`)|
43+
44+
## Outputs
45+
46+
- **Console output**: Equilibrium error norms and summary.
47+
- **Exit code**: `0` if all within `threshold`, `1` otherwise.
48+
49+
## Notes
50+
51+
- Equilibrium condition implies the bubble radius remains constant.
52+
- High-precision tolerance ensures numerical consistency.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# `s_test_suite_masstrans.m` Documentation
2+
3+
## Overview
4+
`s_test_suite_masstrans.m` validates the finite difference solver’s mass transfer implementation under various model settings.
5+
6+
## Major Sections
7+
8+
1. **Initialization**
9+
- Clears workspace.
10+
- Adds paths: `src/forward_solver/` and `tests/`.
11+
- Loads `file_ids.mat`.
12+
13+
2. **Preallocation**
14+
- Computes `num_tests`.
15+
- Initializes `errors_fd` and `failed_tests`.
16+
- Sets `threshold = 1e-5`, `count = 1`.
17+
18+
3. **Test Parameter Setup**
19+
- Defines `tvector` for simulation.
20+
- Fixes `masstrans = 1`, `vapor = 1`, `collapse = 1`.
21+
- Sets bubble geometry: `R0`, `Req`.
22+
- Defines model vectors: `radial`, `bubtherm`, `medtherm`, `stress`.
23+
24+
4. **Loop Over Test Cases**
25+
- Iterates over all combinations.
26+
- Builds `varin` parameters.
27+
- Loads reference `Rm` from test files.
28+
- Executes `m_imr_fd(...,'Nt',30,'Mt',70)`, computes L2 error.
29+
- Records failures above `threshold`.
30+
31+
5. **Summary**
32+
- Trims `failed_tests`.
33+
- Prints pass/fail summary (no automatic exit).
34+
35+
## Inputs
36+
37+
| Name | Description |
38+
|-----------------|--------------------------------------|
39+
| `file_ids.mat` | Test case identifiers |
40+
| `m_imr_fd` | Finite difference solver function |
41+
42+
## Outputs
43+
44+
- **Console output**: L2 norm errors per test and summary.
45+
- **Error flags**: `failed_tests` indices where mass transfer failed.
46+
47+
## Notes
48+
49+
- Script does not exit on failure to allow further analysis.
50+
- Uses moderate resolution (`Nt=30`, `Mt=70`) for faster execution.

0 commit comments

Comments
 (0)