diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 883cc74..f55b863 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -14,3 +14,4 @@ | alanjhewitt | Alan J Hewitt | Met Office | 2026-07-12 | | mn416 | Matthew Naylor | University of Cambridge | 2026-07-24 | | t00sa | Sam Clarke-Green | Met Office | 2026-09-10 | +| mcdalvi | Mohit Dalvi | Met Office | 2026-10-06 | diff --git a/src/control/core/interface/ukca_diagnostics_output_mod.F90 b/src/control/core/interface/ukca_diagnostics_output_mod.F90 index 8f62eff..470a47b 100644 --- a/src/control/core/interface/ukca_diagnostics_output_mod.F90 +++ b/src/control/core/interface/ukca_diagnostics_output_mod.F90 @@ -701,7 +701,7 @@ SUBROUTINE output_diag_status(error_code_ptr, group, diagnostics, & IF (PRESENT(error_message)) error_message = '' IF (PRESENT(error_routine)) error_routine = '' -IF (ALLOCATED(diagnostics%requests_ptr(dgroup_flat_real)%varnames)) THEN +IF (ALLOCATED(diagnostics%requests_ptr(group)%varnames)) THEN n_req = diagnostics%n_request(group) IF (SIZE(status_flags) /= n_req) THEN error_code_ptr = errcode_diag_mismatch @@ -710,10 +710,7 @@ SUBROUTINE output_diag_status(error_code_ptr, group, diagnostics, & 'diagnostics (group ', group, ')' END IF ELSE - error_code_ptr = errcode_diag_mismatch - WRITE(message_txt,'(A,I0,A)') & - 'Status flag array present but diagnostic requests are not set ' // & - '(group ', group, ')' + n_req = 0 END IF IF (error_code_ptr > 0) THEN diff --git a/src/control/core/interface/ukca_diagnostics_set_ptrs_mod.F90 b/src/control/core/interface/ukca_diagnostics_set_ptrs_mod.F90 index a6608b1..b764e2a 100644 --- a/src/control/core/interface/ukca_diagnostics_set_ptrs_mod.F90 +++ b/src/control/core/interface/ukca_diagnostics_set_ptrs_mod.F90 @@ -169,20 +169,8 @@ SUBROUTINE set_diag_ptrs_1d_domain(error_code_ptr, ukca_config, diagnostics, & ELSE ! No request array set up for this group - diagnostics%n_request(dgroup_flat_real) = 0 - ! Check data array is absent - IF (PRESENT(data_flat_real)) THEN - error_code_ptr = errcode_diag_mismatch - IF (ASSOCIATED(diag2d_copy_out)) THEN - message_txt = message_txt_data_array_redundant // ' (flat real group)' - ELSE - message_txt = & - 'Array present for unrequested diagnostic output (flat real group)' - END IF - END IF - END IF IF (error_code_ptr > 0) THEN @@ -235,22 +223,8 @@ SUBROUTINE set_diag_ptrs_1d_domain(error_code_ptr, ukca_config, diagnostics, & ELSE ! No request array set up for this group - diagnostics%n_request(dgroup_fullht_real) = 0 - ! Check data array is absent - IF (PRESENT(data_fullht_real)) THEN - error_code_ptr = errcode_diag_mismatch - IF (ASSOCIATED(diag3d_copy_out)) THEN - message_txt = message_txt_data_array_redundant // & - ' (full height real group)' - ELSE - message_txt = & - 'Array present for unrequested diagnostic output ' // & - '(full height real group)' - END IF - END IF - END IF IF (error_code_ptr > 0) THEN @@ -261,7 +235,7 @@ SUBROUTINE set_diag_ptrs_1d_domain(error_code_ptr, ukca_config, diagnostics, & END IF ! Record number of spatial dimensions in use for each diagnostic group -! and set pointers +! and set pointers only if any diagnostics are requested in this call. IF (ASSOCIATED(diag2d_copy_out)) THEN diagnostics%dimension_out(dgroup_flat_real) = imdi @@ -275,13 +249,15 @@ SUBROUTINE set_diag_ptrs_1d_domain(error_code_ptr, ukca_config, diagnostics, & diagnostics%dimension_out(dgroup_fullht_real) = 1 END IF -IF (PRESENT(data_flat_real)) THEN +IF ( PRESENT(data_flat_real) .AND. & + diagnostics%n_request(dgroup_flat_real) > 0 ) THEN diagnostics%value_0d_real_ptr => data_flat_real ELSE NULLIFY(diagnostics%value_0d_real_ptr) END IF -IF (PRESENT(data_fullht_real)) THEN +IF ( PRESENT(data_fullht_real) .AND. & + diagnostics%n_request(dgroup_fullht_real) > 0 ) THEN diagnostics%value_1d_real_ptr => data_fullht_real ELSE NULLIFY(diagnostics%value_1d_real_ptr) @@ -408,20 +384,8 @@ SUBROUTINE set_diag_ptrs_3d_domain(error_code_ptr, ukca_config, diagnostics, & ELSE ! No request array set up for this group - diagnostics%n_request(dgroup_flat_real) = 0 - ! Check data array is absent - IF (PRESENT(data_flat_real)) THEN - error_code_ptr = errcode_diag_mismatch - IF (ASSOCIATED(diag2d_copy_out)) THEN - message_txt = message_txt_data_array_redundant // ' (flat real group)' - ELSE - message_txt = & - 'Array present for unrequested diagnostic output (flat real group)' - END IF - END IF - END IF IF (error_code_ptr > 0) THEN @@ -476,22 +440,8 @@ SUBROUTINE set_diag_ptrs_3d_domain(error_code_ptr, ukca_config, diagnostics, & ELSE ! No request array set up for this group - diagnostics%n_request(dgroup_fullht_real) = 0 - ! Check data array is absent - IF (PRESENT(data_fullht_real)) THEN - error_code_ptr = errcode_diag_mismatch - IF (ASSOCIATED(diag3d_copy_out)) THEN - message_txt = message_txt_data_array_redundant // & - ' (full height real group)' - ELSE - message_txt = & - 'Array present for unrequested diagnostic output ' // & - '(full height real group)' - END IF - END IF - END IF IF (error_code_ptr > 0) THEN @@ -502,7 +452,7 @@ SUBROUTINE set_diag_ptrs_3d_domain(error_code_ptr, ukca_config, diagnostics, & END IF ! Record number of spatial dimensions in use for each diagnostic group -! and set pointers +! and set pointers only if any diagnostics are requested in this call. IF (ASSOCIATED(diag2d_copy_out)) THEN diagnostics%dimension_out(dgroup_flat_real) = imdi @@ -516,13 +466,15 @@ SUBROUTINE set_diag_ptrs_3d_domain(error_code_ptr, ukca_config, diagnostics, & diagnostics%dimension_out(dgroup_fullht_real) = 3 END IF -IF (PRESENT(data_flat_real)) THEN +IF (PRESENT(data_flat_real) .AND. & + diagnostics%n_request(dgroup_flat_real) > 0 ) THEN diagnostics%value_2d_real_ptr => data_flat_real ELSE NULLIFY(diagnostics%value_2d_real_ptr) END IF -IF (PRESENT(data_fullht_real)) THEN +IF (PRESENT(data_fullht_real) .AND. & + diagnostics%n_request(dgroup_fullht_real) > 0 ) THEN diagnostics%value_3d_real_ptr => data_fullht_real ELSE NULLIFY(diagnostics%value_3d_real_ptr)