Skip to content

Commit 371f126

Browse files
committed
Merge branch 'stephenprice/correct_logic_in_seq_diag_glc_mct' (PR #7505)
Fix logic around g2x and x2g vector index calculation This PR corrects the "first_time" logic around the calculation of indices for the glc coupling vectors g2x and x2g. Because the calls to x2g and g2x happen in budgets1 and budgets2, respectively, both sets of indices need to be calculated at the same time if the first_time logic is to be used so that these calculations only happen once. This fix has been tested and confirmed working. [BFB]
2 parents 8c5bed9 + f5ab22c commit 371f126

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

driver-mct/main/seq_diag_mct.F90

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,15 +1355,24 @@ subroutine seq_diag_glc_mct( glc, frac_g, infodata, do_x2g, do_g2x )
13551355

13561356
ip = p_inst
13571357

1358-
if( present(do_g2x))then ! do fields from glc to coupler (g2x_)
1358+
if (first_time) then
13591359

1360-
if (first_time) then
1360+
! we calc these both first rather then in their respective "if" constructs
1361+
! below to avoid g2x indices not getting calculated (because the call to
1362+
! x2g and g2x happen separately, in budgets1 and budgets2, respectively).
13611363

1362-
index_g2x_Fogg_rofl = mct_aVect_indexRA(g2x_g,'Fogg_rofl')
1363-
index_g2x_Fogg_rofi = mct_aVect_indexRA(g2x_g,'Fogg_rofi')
1364-
index_g2x_Figg_rofi = mct_aVect_indexRA(g2x_g,'Figg_rofi')
1364+
! indices needed for g2x
1365+
index_g2x_Fogg_rofl = mct_aVect_indexRA(g2x_g,'Fogg_rofl')
1366+
index_g2x_Fogg_rofi = mct_aVect_indexRA(g2x_g,'Fogg_rofi')
1367+
index_g2x_Figg_rofi = mct_aVect_indexRA(g2x_g,'Figg_rofi')
13651368

1366-
end if
1369+
! indices needed for x2g
1370+
index_x2g_Flgl_qice = mct_aVect_indexRA(x2g_g,'Flgl_qice')
1371+
index_g2x_Sg_icemask = mct_avect_indexRA(g2x_g,'Sg_icemask')
1372+
1373+
end if
1374+
1375+
if( present(do_g2x))then ! do fields from glc to coupler (g2x_)
13671376

13681377
ic = c_glc_gr
13691378
kArea = mct_aVect_indexRA(dom_g%data,afldname)
@@ -1382,13 +1391,6 @@ subroutine seq_diag_glc_mct( glc, frac_g, infodata, do_x2g, do_g2x )
13821391

13831392
if( present(do_x2g))then ! do fields from coupler to glc (x2g_)
13841393

1385-
if (first_time) then
1386-
1387-
index_x2g_Flgl_qice = mct_aVect_indexRA(x2g_g,'Flgl_qice')
1388-
index_g2x_Sg_icemask = mct_avect_indexRA(g2x_g,'Sg_icemask')
1389-
1390-
end if
1391-
13921394
l2gacc_lx_cnt_avg = prep_glc_get_l2gacc_lx_cnt_avg() ! counter for how many times SMB flux accumulation has occured
13931395
ic = c_glc_gs
13941396
kArea = mct_aVect_indexRA(dom_g%data,afldname)

0 commit comments

Comments
 (0)