Skip to content

Commit

Permalink
Check if diag_field_id is > 0 before calling post_data_MOM
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-c-ross committed Mar 20, 2024
1 parent d8b9b3f commit a6e177f
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions generic_tracers/generic_tracer_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3975,14 +3975,15 @@ LOGICAL FUNCTION g_send_data_0d(diag_field_id, field, time, err_msg, diag_CS)

#ifdef _USE_MOM6_DIAG
type(g_diag_ctrl), pointer :: diag_CS_ptr

if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
if(diag_field_id .gt. 0) then
if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)
g_send_data_0d = .TRUE.
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)
g_send_data_0d = .TRUE.
#else
g_send_data_0d = send_data_FMS(diag_field_id, field, time, err_msg)
#endif
Expand All @@ -4002,14 +4003,15 @@ LOGICAL FUNCTION g_send_data_1d(diag_field_id, field, time, is_in, mask, rmask,

#ifdef _USE_MOM6_DIAG
type(g_diag_ctrl), pointer :: diag_CS_ptr

if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
if(diag_field_id .gt. 0) then
if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)
g_send_data_1d = .TRUE.
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)
g_send_data_1d = .TRUE.
#else
g_send_data_1d = send_data_FMS(diag_field_id, field, time, is_in, mask, rmask, ie_in, weight, err_msg)
#endif
Expand All @@ -4030,14 +4032,15 @@ LOGICAL FUNCTION g_send_data_2d(diag_field_id, field, time, is_in, js_in, &

#ifdef _USE_MOM6_DIAG
type(g_diag_ctrl), pointer :: diag_CS_ptr

if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
if(diag_field_id .gt. 0) then
if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)!, mask=rmask)
g_send_data_2d = .TRUE.
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)!, mask=rmask)
g_send_data_2d = .TRUE.
#else
g_send_data_2d = send_data_FMS(diag_field_id, field, time, is_in, js_in, &
& mask, rmask, ie_in, je_in, weight, err_msg)
Expand All @@ -4059,14 +4062,15 @@ LOGICAL FUNCTION g_send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in,

#ifdef _USE_MOM6_DIAG
type(g_diag_ctrl), pointer :: diag_CS_ptr

if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
if(diag_field_id .gt. 0) then
if(present(diag_CS)) then
diag_CS_ptr => diag_CS
else
call g_tracer_get_diagCS(diag_CS_ptr)
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)!, mask=rmask)
g_send_data_3d = .TRUE.
endif
call post_data_MOM(diag_field_id, field, diag_CS_ptr)!, mask=rmask)
g_send_data_3d = .TRUE.
#else
g_send_data_3d = send_data_FMS(diag_field_id, field, time, is_in, js_in, ks_in, &
& mask, rmask, ie_in, je_in, ke_in, weight, err_msg)
Expand Down

0 comments on commit a6e177f

Please sign in to comment.