Skip to content

Conversation

@BenjaminTJohnson
Copy link
Contributor

Adding a new finite‑difference consistency test to the ctest suite and wired it to run TL‑FD and TL‑AD checks. The test prints per‑channel deltas, uses the existing in‑code profile/surface data (no extra binaries), and is enabled for atms_n21 and cris-fsr_n21.
v.abi_g19 is included only if its coeffs are present.

@BenjaminTJohnson BenjaminTJohnson changed the title initial commit of finite difference TL/AD test finite difference TL/AD ctest Jan 10, 2026
@BenjaminTJohnson BenjaminTJohnson self-assigned this Jan 10, 2026
Copy link
Contributor

@chengdang chengdang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new tests are working as expected!

        Start 193: test_FD_consistency_atms_n21
190/196 Test #193: test_FD_consistency_atms_n21 .....................   Passed    0.39 sec
        Start 194: test_AD_consistency_atms_n21
191/196 Test #194: test_AD_consistency_atms_n21 .....................   Passed    0.02 sec
        Start 195: test_FD_consistency_cris-fsr_n21
192/196 Test #195: test_FD_consistency_cris-fsr_n21 .................   Passed    0.26 sec
        Start 196: test_AD_consistency_cris-fsr_n21

I only have a couple of minor questions on the tolerance value, otherwise I think this is ready to merge.

RTSolution(l,PROFILE_IDX)%Radiance
tl = RTSolution_TL(l,PROFILE_IDX)%Radiance
diff = ABS(fd - tl)
tol = ATOL + RTOL * MAX(ABS(fd), ABS(tl))
Copy link
Contributor

@chengdang chengdang Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why is this tol defined this way?

INTEGER :: arg_count
REAL(fp) :: fd, tl, diff, tol, max_diff
REAL(fp) :: lhs, rhs, rel
REAL(fp), PARAMETER :: AD_RTOL = 1.0e-3_fp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I'm sure there are some scientific basics for setting up these, could be empirical?

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.

2 participants