@@ -470,6 +470,7 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
470
470
use iso_c_binding
471
471
! character(1024) :: domain_file ! file containing domain info (set my input)
472
472
use seq_comm_mct, only: mboxid ! iMOAB id for MPAS ocean migrated mesh to coupler pes
473
+ use seq_comm_mct, only: mbixid ! iMOAB id for MPAS sea-ice migrated mesh to coupler pes
473
474
use seq_comm_mct, only: mblxid ! iMOAB id for lnd migrated mesh to coupler pes
474
475
use seq_comm_mct, only: mbaxid ! iMOAB id for atm migrated mesh to coupler pes
475
476
use seq_comm_mct, only: mbrxid ! iMOAB id for rof migrated mesh to coupler pes
@@ -658,6 +659,14 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
658
659
call shr_sys_abort(subname// ' ERROR in writing ocn mesh coupler ' )
659
660
endif
660
661
endif
662
+ if (mbixid >= 0 ) then
663
+ ierr = iMOAB_WriteMesh(mbixid, trim (' cplIceWithAream.h5m' // C_NULL_CHAR), &
664
+ trim (' ;PARALLEL=WRITE_PART' // C_NULL_CHAR))
665
+ if (ierr .ne. 0 ) then
666
+ write (logunit,* ) subname,' error in writing ice mesh coupler '
667
+ call shr_sys_abort(subname// ' ERROR in writing ice mesh coupler ' )
668
+ endif
669
+ endif
661
670
if (mbrxid >= 0 ) then
662
671
ierr = iMOAB_WriteMesh(mbrxid, trim (' cplRofWithAream.h5m' // C_NULL_CHAR), &
663
672
trim (' ;PARALLEL=WRITE_PART' // C_NULL_CHAR))
@@ -776,8 +785,10 @@ subroutine component_init_areacor_moab (comp, mbccid, mbcxid, seq_flds_c2x_fluxe
776
785
777
786
! For only component pes
778
787
if (comp(1 )% iamin_compid) then
779
- ! Allocate and initialize area correction factors on component processes
788
+ ! Allocate and initialize area correction factors on component processes
780
789
! get areas, first allocate memory
790
+ ! Side Note:: !!! TODO mblsize on component side is always the size of comp domain for mct, too
791
+ ! that is the whole point, we are using the same order, and the same grid size as mct driver
781
792
lsize = comp(1 )% mblsize
782
793
allocate (areas (lsize, 3 )) ! lsize is along grid; read mask too
783
794
allocate (factors (lsize, 2 ))
@@ -847,7 +858,22 @@ subroutine component_init_areacor_moab (comp, mbccid, mbcxid, seq_flds_c2x_fluxe
847
858
nfields= mct_list_nitem (temp_list)
848
859
call mct_list_clean(temp_list)
849
860
861
+ ! above aream work is irrelevant with this:
862
+ ! as a quick fix, set the correction factors on component side, on MOAB tags mdl2drv and drv2mdl
863
+ ! exactly as those from mct; hopefully, we will see zero differences with MOABCOMP
850
864
865
+ lsize = comp(1 )% mblsize
866
+ tagname = ' mdl2drv' // C_NULL_CHAR
867
+ ierr = iMOAB_SetDoubleTagStorage(mbccid , tagname, lsize , comp(1 )% mbGridType, comp(1 )% mdl2drv)
868
+ if (ierr .ne. 0 ) then
869
+ call shr_sys_abort(subname// ' cannot set new mdl2drv values for moab like those for mct ' )
870
+ endif
871
+ tagname = ' drv2mdl' // C_NULL_CHAR
872
+ ierr = iMOAB_SetDoubleTagStorage(mbccid , tagname, lsize , comp(1 )% mbGridType, comp(1 )% drv2mdl)
873
+ if (ierr .ne. 0 ) then
874
+ call shr_sys_abort(subname// ' cannot set new mdldrv2mdl2drv values for moab like those for mct ' )
875
+ endif
876
+
851
877
allocate (vals(lsize, nfields))
852
878
tagname = trim (seq_flds_c2x_fluxes)// C_NULL_CHAR
853
879
arrsize = lsize * nfields
@@ -859,9 +885,11 @@ subroutine component_init_areacor_moab (comp, mbccid, mbcxid, seq_flds_c2x_fluxe
859
885
do i= 1 ,lsize
860
886
rmask = areas(i,3 )
861
887
if ( abs (rmask) >= 1.0e-06 ) then
862
- fact = factors(i,1 ) ! mdl2drv tag
888
+ ! fact = factors(i,1) ! mdl2drv tag
889
+ ! do nt use what we computed; use the values from mct driver
890
+ fact = comp(1 )% mdl2drv(i)
863
891
do j= 1 ,nfields
864
- vals(i,j) = fact * vals(i,j)
892
+ vals(i,j) = vals(i,j) * fact
865
893
enddo
866
894
endif
867
895
enddo
@@ -1271,7 +1299,7 @@ subroutine factor_moab_comp(comp, type, seq_flds_fluxes)
1271
1299
endif
1272
1300
do i= 1 ,comp% mblsize
1273
1301
do j= 1 ,nfields
1274
- vals(i,j) = factors(i ) * vals(i,j )
1302
+ vals(i,j) = vals(i,j ) * factors(i )
1275
1303
enddo
1276
1304
enddo
1277
1305
0 commit comments