Skip to content

Fix isw_calc_Er=2 MtOvR_spec bug, document Om_tE input, add roundtrip tests#83

Open
krystophny wants to merge 4 commits intomainfrom
fix-isw-calc-er-2-docs-and-tests
Open

Fix isw_calc_Er=2 MtOvR_spec bug, document Om_tE input, add roundtrip tests#83
krystophny wants to merge 4 commits intomainfrom
fix-isw-calc-er-2-docs-and-tests

Conversation

@krystophny
Copy link
Copy Markdown
Member

Summary

  • Bug fix: isw_calc_Er=2 read Om_tE from the profile but never computed MtOvR_spec from it. The output path (isw_calc_Er >= 1) would try to write an unallocated array. Now write_multispec_output_a has an ELSE IF (isw_calc_Er .EQ. 2) branch that computes MtOvR_spec via Om_tE_to_MtOvR_spec.
  • Doc-comment fix: isw_calc_Er in ntv_mod.f90 now describes all three modes (0/1/2) instead of just "on/off".
  • Ambipolarity warning fix: The else-clause said "isw_calc_er is 0" even when the value was 2; now prints the actual value.
  • Reference input: DOC/neo2.in.ql-full now documents isw_calc_Er=0/1/2 and the Om_tE namelist parameter.
  • Tests: Fortran roundtrip (mode 1 output -> mode 2 input -> identical MtOvR_spec) and perturbation (half Om_tE -> half MtOvR). Python HDF5 roundtrip, absence, and half-profile tests.

Verification

Tests pass after fix

$ make test
Test project /home/ert/code/NEO-2/build/TEST
    Start 1: nrutil_test
1/2 Test #1: nrutil_test ......................   Passed    0.08 sec
    Start 2: er_rotation_test
2/2 Test #2: er_rotation_test .................   Passed    0.08 sec

100% tests passed, 0 tests failed out of 2
$ cd python/test && python -c "from test_generate_multispec_input import *; \
  test_omte_profile_hdf5_roundtrip(); test_omte_absent_when_not_provided(); \
  test_half_omte_differs(); print('All tests passed.')"
All tests passed.

Test plan

  • Fortran unit tests pass (make test)
  • Python multispec tests pass
  • CI golden-record tests pass

When isw_calc_Er=2, Om_tE was read from the profile but MtOvR_spec
was never computed from it. The output path (isw_calc_Er >= 1) tried
to write the unallocated MtOvR_spec array, which would crash.

Also update the isw_calc_Er doc-comment to describe all three modes
and fix the ambipolarity warning message for mode 2.
Add descriptions for isw_calc_Er=0/1/2 and the new Om_tE namelist
parameter in DOC/neo2.in.ql-full.
Fortran: add mode1->mode2 roundtrip test (same Om_tE gives same
MtOvR_spec) and half-Om_tE test (different input gives linearly
different output).

Python: add Om_tE HDF5 roundtrip (write/read/verify), absence test
(no Om_tE key means no dataset), and half-profile comparison test.
Python script that runs NEO-2-QL three times using golden record data:
  1) isw_calc_Er=1: self-consistent Er from ambipolarity
  2) isw_calc_Er=2: feed the Om_tE from run 1 back via namelist
  3) isw_calc_Er=2: feed half Om_tE as perturbation

Verifies transport coefficients match between modes 1 and 2, that
Om_tE/MtOvR are correctly passed through, and that different Om_tE
input produces different MtOvR output. Uses reduced resolution for
faster execution (NTV off, lag=2, leg=2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant