From 4924d1d239a1aa79760dd1189e9ca51e765c0764 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Mon, 10 Jun 2024 16:04:32 -0500 Subject: [PATCH 01/10] update Makefile for cube_to_target --- .../tools/topo_tool/cube_to_target/Makefile | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/components/eam/tools/topo_tool/cube_to_target/Makefile b/components/eam/tools/topo_tool/cube_to_target/Makefile index 5a1f386b819d..98ace1a4f5bc 100644 --- a/components/eam/tools/topo_tool/cube_to_target/Makefile +++ b/components/eam/tools/topo_tool/cube_to_target/Makefile @@ -24,35 +24,14 @@ endif # Set default compile and link flags FFLAGS = -L$(LIB_NETCDF) -I$(INC_NETCDF) -#LDFLAGS = -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lcurl -lhdf5 -lhdf5_hl -mcmodel=medium -LDFLAGS = -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lcurl +LDFLAGS = -L$(LIB_NETCDF) -lnetcdf -lnetcdff # Determine platform UNAMES := $(shell uname -s) UNAMEM := $(findstring CRAY,$(shell uname -m)) #------------------------------------------------------------------------ -# Special flags for LF95 #------------------------------------------------------------------------ -# -ifeq ($(FC),lf95) - # - # Tramhill - # - INC_NETCDF :=/usr/local/netcdf-4.1.3-gcc-4.4.4-13-lf9581/include - LIB_NETCDF :=/usr/local/netcdf-4.1.3-gcc-4.4.4-13-lf9581/lib - - LDFLAGS = -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lcurl -lhdf5 -lhdf5_hl --mcmodel=medium - FFLAGS := -c --trace --trap --wide -CcdRR8 -I$(INC_NETCDF) - ifeq ($(DEBUG),TRUE) - #FFLAGS += --chk aesu -Cpp --trace - FFLAGS += -g --chk a,e,s,u --pca - else - FFLAGS += -O - endif - -endif .F90.o: $(FC) -c $(FFLAGS) $< From 47746069761e12fee44c6cfff72c65594ae4a4a4 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 11 Jun 2024 13:30:49 -0700 Subject: [PATCH 02/10] update variable intent --- .../eam/tools/topo_tool/cube_to_target/cube_to_target.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eam/tools/topo_tool/cube_to_target/cube_to_target.F90 b/components/eam/tools/topo_tool/cube_to_target/cube_to_target.F90 index 97d23fa8476f..850815efdbfc 100644 --- a/components/eam/tools/topo_tool/cube_to_target/cube_to_target.F90 +++ b/components/eam/tools/topo_tool/cube_to_target/cube_to_target.F90 @@ -1576,7 +1576,7 @@ SUBROUTINE overlap_weights(weights_lgr_index_all,weights_eul_index_all,weights_a REAL(R8), DIMENSION(jall,nreconstruction) , INTENT(OUT) :: weights_all INTEGER, DIMENSION(jall) , INTENT(OUT) :: weights_lgr_index_all - REAL(R8), DIMENSION(ncorner,ntarget), INTENT(IN) :: target_corner_lon, target_corner_lat + REAL(R8), DIMENSION(ncorner,ntarget), INTENT(INOUT) :: target_corner_lon, target_corner_lat INTEGER, DIMENSION(ncorner+1) :: ipanel_array, ipanel_tmp REAL(R8), DIMENSION(ncorner) :: lat, lon From 7c2557dd47640b5b7c6d42ce7f48fcbe220f66a7 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 11 Jun 2024 14:28:13 -0700 Subject: [PATCH 03/10] simplify Makefile some more --- .../tools/topo_tool/cube_to_target/Makefile | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/components/eam/tools/topo_tool/cube_to_target/Makefile b/components/eam/tools/topo_tool/cube_to_target/Makefile index 98ace1a4f5bc..72ffd73c2a43 100644 --- a/components/eam/tools/topo_tool/cube_to_target/Makefile +++ b/components/eam/tools/topo_tool/cube_to_target/Makefile @@ -5,26 +5,20 @@ RM = rm .SUFFIXES: .SUFFIXES: .F90 .o -# Set the compiler; note that on some platforms, FC may be defined as an -# environment variable, and we should not need to do anything here. If this -# is the case, skip setting FC, but if FC is null then set to a default. -ifeq ($(FC),$(null)) - FC = gfortran -endif -DEBUG = FALSE - -# Check for the NetCDF library and include directories -ifeq ($(LIB_NETCDF),$(null)) - LIB_NETCDF := /usr/local/lib -endif +# Set the compiler +FC := gfortran -ifeq ($(INC_NETCDF),$(null)) - INC_NETCDF := /usr/local/include -endif +# Set NetCDF library and include directories +LIB_NETCDF := $(shell nf-config --prefix)/lib +INC_NETCDF := $(shell nf-config --prefix)/include # Set default compile and link flags -FFLAGS = -L$(LIB_NETCDF) -I$(INC_NETCDF) -LDFLAGS = -L$(LIB_NETCDF) -lnetcdf -lnetcdff +FFLAGS += -L$(LIB_NETCDF) -I$(INC_NETCDF) +LDFLAGS += -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(FC),gfortran) + FFLAGS += -fallow-argument-mismatch +endif # Determine platform UNAMES := $(shell uname -s) From 6e393f6edc6e3097c5e0be60848eb4b8ddfe1d73 Mon Sep 17 00:00:00 2001 From: Iulian Grindeanu Date: Sat, 15 Jun 2024 23:06:57 -0500 Subject: [PATCH 04/10] data ice branch from data rof case --res T62_oQU120 --compset CMPASO-NYF data ice is similar so far with data atm, ocean and rof an ice_domain file is initialized and used by moab driver --- .../data_comps/dice/src/dice_comp_mod.F90 | 181 +++++++++++++++++- .../data_comps/dice/src/ice_comp_mct.F90 | 36 +++- driver-moab/main/cplcomp_exchange_mod.F90 | 82 +++++--- driver-moab/shr/seq_infodata_mod.F90 | 15 +- 4 files changed, 279 insertions(+), 35 deletions(-) diff --git a/components/data_comps/dice/src/dice_comp_mod.F90 b/components/data_comps/dice/src/dice_comp_mod.F90 index 8f3afd70bf87..94dd0c012433 100644 --- a/components/data_comps/dice/src/dice_comp_mod.F90 +++ b/components/data_comps/dice/src/dice_comp_mod.F90 @@ -33,7 +33,10 @@ module dice_comp_mod use dice_shr_mod , only: flux_Qacc0 ! namelist input -initial water accumulation value use dice_shr_mod , only: nullstr use dice_flux_atmice_mod, only: dice_flux_atmice - +#ifdef HAVE_MOAB + use seq_comm_mct, only : MPSIID ! id of moab ice app + use iso_c_binding +#endif ! !PUBLIC TYPES: implicit none private ! except @@ -111,6 +114,12 @@ subroutine dice_comp_init(Eclock, x2i, i2x, & inst_suffix, inst_name, logunit, read_restart, & scmMode, scmlat, scmlon) +#ifdef HAVE_MOAB + use iMOAB, only: iMOAB_DefineTagStorage, iMOAB_GetDoubleTagStorage, & + iMOAB_SetIntTagStorage, iMOAB_SetDoubleTagStorage, & + iMOAB_ResolveSharedEntities, iMOAB_CreateVertices, & + iMOAB_GetMeshInfo, iMOAB_UpdateMeshInfo, iMOAB_WriteMesh +#endif ! !DESCRIPTION: initialize dice model implicit none @@ -141,7 +150,17 @@ subroutine dice_comp_init(Eclock, x2i, i2x, & logical :: exists ! file existance logical integer(IN) :: nu ! unit number character(CL) :: calendar ! calendar type - +#ifdef HAVE_MOAB + character*400 tagname + real(R8) latv, lonv + integer iv, tagindex, ilat, ilon, ierr !, arrsize, nfields + real(R8), allocatable, target :: data(:) + integer(IN), pointer :: idata(:) ! temporary + real(r8), dimension(:), allocatable :: moab_vert_coords ! temporary +#ifdef MOABDEBUG + character*100 outfile, wopts +#endif +#endif !--- formats --- character(*), parameter :: F00 = "('(dice_comp_init) ',8a)" character(*), parameter :: F0L = "('(dice_comp_init) ',a, l2)" @@ -219,6 +238,120 @@ subroutine dice_comp_init(Eclock, x2i, i2x, & call shr_dmodel_rearrGGrid(SDICE%grid, ggrid, gsmap, rearr, mpicom) call t_stopf('dice_initmctdom') +#ifdef HAVE_MOAB + ilat = mct_aVect_indexRA(ggrid%data,'lat') + ilon = mct_aVect_indexRA(ggrid%data,'lon') + allocate(moab_vert_coords(lsize*3)) + do iv = 1, lsize + lonv = ggrid%data%rAttr(ilon, iv) * SHR_CONST_PI/180. + latv = ggrid%data%rAttr(ilat, iv) * SHR_CONST_PI/180. + moab_vert_coords(3*iv-2)=COS(latv)*COS(lonv) + moab_vert_coords(3*iv-1)=COS(latv)*SIN(lonv) + moab_vert_coords(3*iv )=SIN(latv) + enddo + + ! create the vertices with coordinates from MCT domain + ierr = iMOAB_CreateVertices(MPSIID, lsize*3, 3, moab_vert_coords) + if (ierr .ne. 0) & + call shr_sys_abort('Error: fail to create MOAB vertices in data ice model') + + tagname='GLOBAL_ID'//C_NULL_CHAR + ierr = iMOAB_DefineTagStorage(MPSIID, tagname, & + 0, & ! dense, integer + 1, & ! number of components + tagindex ) + if (ierr .ne. 0) & + call shr_sys_abort('Error: fail to retrieve GLOBAL_ID tag ') + + ! get list of global IDs for Dofs + call mct_gsMap_orderedPoints(gsMap, my_task, idata) + + ierr = iMOAB_SetIntTagStorage ( MPSIID, tagname, lsize, & + 0, & ! vertex type + idata) + if (ierr .ne. 0) & + call shr_sys_abort('Error: fail to set GLOBAL_ID tag ') + + ierr = iMOAB_ResolveSharedEntities( MPSIID, lsize, idata ); + if (ierr .ne. 0) & + call shr_sys_abort('Error: fail to resolve shared entities') + + deallocate(moab_vert_coords) + deallocate(idata) + + ierr = iMOAB_UpdateMeshInfo( MPSIID ) + if (ierr .ne. 0) & + call shr_sys_abort('Error: fail to update mesh info ') + + allocate(data(lsize)) + ierr = iMOAB_DefineTagStorage( MPSIID, "area:aream:frac:mask"//C_NULL_CHAR, & + 1, & ! dense, double + 1, & ! number of components + tagindex ) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to create tag: area:aream:frac:mask' ) + + data(:) = ggrid%data%rAttr(mct_aVect_indexRA(ggrid%data,'area'),:) + tagname='area'//C_NULL_CHAR + ierr = iMOAB_SetDoubleTagStorage ( MPSIID, tagname, lsize, & + 0, & ! set data on vertices + data) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to get area tag ') + + ! set the same data for aream (model area) as area + ! data(:) = ggrid%data%rAttr(mct_aVect_indexRA(ggrid%data,'aream'),:) + tagname='aream'//C_NULL_CHAR + ierr = iMOAB_SetDoubleTagStorage ( MPSIID, tagname, lsize, & + 0, & ! set data on vertices + data) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to set aream tag ') + + data(:) = ggrid%data%rAttr(mct_aVect_indexRA(ggrid%data,'mask'),:) + tagname='mask'//C_NULL_CHAR + ierr = iMOAB_SetDoubleTagStorage ( MPSIID, tagname, lsize, & + 0, & ! set data on vertices + data) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to set mask tag ') + + data(:) = ggrid%data%rAttr(mct_aVect_indexRA(ggrid%data,'frac'),:) + tagname='frac'//C_NULL_CHAR + ierr = iMOAB_SetDoubleTagStorage ( MPSIID, tagname, lsize, & + 0, & ! set data on vertices + data) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to set frac tag ') + + deallocate(data) + + ! define tags + ierr = iMOAB_DefineTagStorage( MPSIID, trim(seq_flds_x2i_fields)//C_NULL_CHAR, & + 1, & ! dense, double + 1, & ! number of components + tagindex ) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to create seq_flds_x2i_fields tags ') + + ierr = iMOAB_DefineTagStorage( MPSIID, trim(seq_flds_i2x_fields)//C_NULL_CHAR, & + 1, & ! dense, double + 1, & ! number of components + tagindex ) + if (ierr > 0 ) & + call shr_sys_abort('Error: fail to create seq_flds_i2x_fields tags ') +#ifdef MOABDEBUG + ! debug test + outfile = 'IceDataMesh.h5m'//C_NULL_CHAR + wopts = ';PARALLEL=WRITE_PART'//C_NULL_CHAR ! + ! write out the mesh file to disk + ierr = iMOAB_WriteMesh(MPSIID, trim(outfile), trim(wopts)) + if (ierr .ne. 0) then + call shr_sys_abort(subname//' ERROR in writing data mesh ice ') + endif +#endif +#endif + !---------------------------------------------------------------------------- ! Initialize MCT attribute vectors !---------------------------------------------------------------------------- @@ -388,6 +521,13 @@ subroutine dice_comp_run(EClock, x2i, i2x, & inst_suffix, logunit, read_restart, case_name) use shr_cal_mod, only : shr_cal_ymdtod2string ! !DESCRIPTION: run method for dice model +#ifdef MOABDEBUG + use iMOAB, only: iMOAB_WriteMesh +#endif +#ifdef HAVE_MOAB + use seq_flds_mod , only: seq_flds_i2x_fields + use seq_flds_mod , only: moab_set_tag_from_av +#endif implicit none ! !INPUT/OUTPUT PARAMETERS: @@ -423,6 +563,17 @@ subroutine dice_comp_run(EClock, x2i, i2x, & logical :: write_restart ! restart now character(len=18) :: date_str +#ifdef HAVE_MOAB + real(R8), allocatable, target :: datam(:) + type(mct_list) :: temp_list + integer :: size_list, index_list + type(mct_string) :: mctOStr ! + character*400 tagname, mct_field +#ifdef MOABDEBUG + integer :: cur_dice_stepno, ierr + character*100 outfile, wopts, lnum +#endif +#endif character(*), parameter :: F00 = "('(dice_comp_run) ',8a)" character(*), parameter :: F04 = "('(dice_comp_run) ',2a,2i8,'s')" character(*), parameter :: subName = "(dice_comp_run) " @@ -671,6 +822,32 @@ subroutine dice_comp_run(EClock, x2i, i2x, & call t_stopf('dice') +#ifdef HAVE_MOAB + lsize = mct_avect_lsize(i2x) ! is it the same as mct_avect_lsize(avstrm) ? + allocate(datam(lsize)) ! + call mct_list_init(temp_list ,seq_flds_i2x_fields) + size_list=mct_list_nitem (temp_list) + do index_list = 1, size_list + call mct_list_get(mctOStr,index_list,temp_list) + mct_field = mct_string_toChar(mctOStr) + tagname= trim(mct_field)//C_NULL_CHAR + call moab_set_tag_from_av(tagname, i2x, index_list, MPSIID, datam, lsize) ! loop over all a2x fields, not just a few + enddo + call mct_list_clean(temp_list) + deallocate(datam) ! maybe we should keep it around, deallocate at the final only? + +#ifdef MOABDEBUG + call seq_timemgr_EClockGetData( EClock, stepno=cur_dice_stepno ) + write(lnum,"(I0.2)")cur_dice_stepno + outfile = 'dice_comp_run_'//trim(lnum)//'.h5m'//C_NULL_CHAR + wopts = 'PARALLEL=WRITE_PART'//C_NULL_CHAR + ierr = iMOAB_WriteMesh(MPSIID, outfile, wopts) + if (ierr > 0 ) then + write(logunit,*) 'Failed to write data ice component state ' + endif +#endif + +#endif !---------------------------------------------------------------------------- ! Log output for model date !---------------------------------------------------------------------------- diff --git a/components/data_comps/dice/src/ice_comp_mct.F90 b/components/data_comps/dice/src/ice_comp_mct.F90 index e409e5989317..b38445ad2dc4 100644 --- a/components/data_comps/dice/src/ice_comp_mct.F90 +++ b/components/data_comps/dice/src/ice_comp_mct.F90 @@ -16,7 +16,11 @@ module ice_comp_mct use dice_comp_mod , only: dice_comp_init, dice_comp_run, dice_comp_final use dice_shr_mod , only: dice_shr_read_namelists use seq_flds_mod , only: seq_flds_i2x_fields, seq_flds_x2i_fields, seq_flds_i2o_per_cat - +#ifdef HAVE_MOAB + use seq_comm_mct, only : MPSIID ! iMOAB app id for ice + use iso_c_binding + use iMOAB , only: iMOAB_RegisterApplication +#endif ! !PUBLIC TYPES: implicit none private ! except @@ -51,7 +55,9 @@ module ice_comp_mct !=============================================================================== subroutine ice_init_mct( EClock, cdata, x2i, i2x, NLFilename ) - +#ifdef HAVE_MOAB + use shr_stream_mod, only: shr_stream_getDomainInfo, shr_stream_getFile +#endif ! !DESCRIPTION: initialize dice model implicit none @@ -73,6 +79,16 @@ subroutine ice_init_mct( EClock, cdata, x2i, i2x, NLFilename ) logical :: scmMode = .false. ! single column mode real(R8) :: scmLat = shr_const_SPVAL ! single column lat real(R8) :: scmLon = shr_const_SPVAL ! single column lon +#ifdef HAVE_MOAB + character(CL) :: filePath ! generic file path + character(CL) :: fileName ! generic file name + character(CS) :: timeName ! domain file: time variable name + character(CS) :: lonName ! domain file: lon variable name + character(CS) :: latName ! domain file: lat variable name + character(CS) :: hgtName ! domain file: hgt variable name + character(CS) :: maskName ! domain file: mask variable name + character(CS) :: areaName ! domain file: area variable name +#endif character(*), parameter :: subName = "(ice_init_mct) " !------------------------------------------------------------------------------- @@ -146,6 +162,22 @@ subroutine ice_init_mct( EClock, cdata, x2i, i2x, NLFilename ) inst_suffix, inst_name, logunit, read_restart, & scmMode, scmlat, scmlon) + +#ifdef HAVE_MOAB + ierr = iMOAB_RegisterApplication(trim("DICE")//C_NULL_CHAR, mpicom, compid, MPSIID) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in registering data ice comp' + call shr_sys_abort(subname//' ERROR in registering data ice comp') + endif + if (my_task == master_task) then + call shr_stream_getDomainInfo(SDICE%stream(1), filePath,fileName,timeName,lonName, & + latName,hgtName,maskName,areaName) + call shr_stream_getFile(filePath,fileName) + ! send path of ice domain to MOAB coupler. + call seq_infodata_PutData( infodata, ice_domain=fileName) + write(logunit,*), ' filename: ', filename + endif +#endif !---------------------------------------------------------------------------- ! Fill infodata that needs to be returned from dice !---------------------------------------------------------------------------- diff --git a/driver-moab/main/cplcomp_exchange_mod.F90 b/driver-moab/main/cplcomp_exchange_mod.F90 index 0e2682192697..e21d3f4554a2 100644 --- a/driver-moab/main/cplcomp_exchange_mod.F90 +++ b/driver-moab/main/cplcomp_exchange_mod.F90 @@ -1020,6 +1020,7 @@ subroutine cplcomp_moab_Init(infodata,comp) character(CL) :: rtm_mesh, rof_domain character(CL) :: lnd_domain character(CL) :: ocn_domain + character(CL) :: ice_domain ! used for data ice only? character(CL) :: atm_mesh integer :: maxMH, maxMPO, maxMLID, maxMSID, maxMRID ! max pids for moab apps atm, ocn, lnd, sea-ice, rof integer :: tagtype, numco, tagindex, partMethod, nghlay @@ -1543,37 +1544,60 @@ subroutine cplcomp_moab_Init(infodata,comp) if (comp%oneletterid == 'i' .and. maxMSID /= -1) then call seq_comm_getinfo(cplid ,mpigrp=mpigrp_cplid) ! receiver group call seq_comm_getinfo(id_old,mpigrp=mpigrp_old) ! component group pes - + ! find ice domain file if it exists; it would be for data ice model (ice_prognostic false) + call seq_infodata_GetData(infodata,ice_domain=ice_domain) if (MPI_COMM_NULL /= mpicom_old ) then ! it means we are on the component p #ifdef MOABDEBUG - outfile = 'wholeSeaIce.h5m'//C_NULL_CHAR - wopts = 'PARALLEL=WRITE_PART'//C_NULL_CHAR - ierr = iMOAB_WriteMesh(MPSIID, outfile, wopts) - if (ierr .ne. 0) then - write(logunit,*) subname,' error in writing sea-ice' - call shr_sys_abort(subname//' ERROR in writing sea-ice') - endif + outfile = 'wholeSeaIce.h5m'//C_NULL_CHAR + wopts = 'PARALLEL=WRITE_PART'//C_NULL_CHAR + ierr = iMOAB_WriteMesh(MPSIID, outfile, wopts) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in writing sea-ice' + call shr_sys_abort(subname//' ERROR in writing sea-ice') + endif #endif ! start copy from ocean code - ! send sea ice mesh to coupler - ierr = iMOAB_SendMesh(MPSIID, mpicom_join, mpigrp_cplid, id_join, partMethod) - if (ierr .ne. 0) then - write(logunit,*) subname,' error in sending sea ice mesh to coupler ' - call shr_sys_abort(subname//' ERROR in sending sea ice mesh to coupler ') - endif - if (MPSIID >= 0) then - ierr = iMOAB_GetMeshInfo ( MPSIID, nvert, nvise, nbl, nsurf, nvisBC ) - comp%mbApCCid = MPSIID ! phys atm - comp%mbGridType = 1 ! 0 or 1, pc or cells - comp%mblsize = nvise(1) ! vertices - endif - - endif + if (MPSIID >= 0) then + ierr = iMOAB_GetMeshInfo ( MPSIID, nvert, nvise, nbl, nsurf, nvisBC ) + comp%mbApCCid = MPSIID ! ice imoab app id + endif + if ( trim(ice_domain) == 'none' ) then ! regular ice model + comp%mbGridType = 1 ! 0 or 1, pc or cells + comp%mblsize = nvise(1) ! cells + ! send sea ice mesh to coupler + ierr = iMOAB_SendMesh(MPSIID, mpicom_join, mpigrp_cplid, id_join, partMethod) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in sending sea ice mesh to coupler ' + call shr_sys_abort(subname//' ERROR in sending sea ice mesh to coupler ') + endif + else + comp%mbGridType = 0 ! 0 or 1, pc or cells + comp%mblsize = nvert(1) ! vertices + endif + endif if (MPI_COMM_NULL /= mpicom_new ) then ! we are on the coupler pes appname = "COUPLE_MPASSI"//C_NULL_CHAR ! migrated mesh gets another app id, moab moab sea ice to coupler (mbix) ierr = iMOAB_RegisterApplication(trim(appname), mpicom_new, id_join, mbixid) - ierr = iMOAB_ReceiveMesh(mbixid, mpicom_join, mpigrp_old, id_old) + if ( trim(ice_domain) == 'none' ) then ! regular ice model + ierr = iMOAB_ReceiveMesh(mbixid, mpicom_join, mpigrp_old, id_old) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in receiving ice mesh in coupler ' + call shr_sys_abort(subname//' ERROR in receiving sea ice mesh in coupler ') + endif + else + ! we need to read the mesh ice (domain file) + ierr = iMOAB_LoadMesh(mbixid, trim(ice_domain)//C_NULL_CHAR, & + "PARALLEL=READ_PART;PARTITION_METHOD=SQIJ;VARIABLE=;NO_CULLING;REPARTITION", 0) + if ( ierr /= 0 ) then + write(logunit,*) 'Failed to load ice domain mesh on coupler' + call shr_sys_abort(subname//' ERROR Failed to load ice domain mesh on coupler ') + endif + if (seq_comm_iamroot(CPLID)) then + write(logunit,'(A)') subname//' load ice domain mesh from file '//trim(ice_domain) + endif + + endif tagtype = 1 ! dense, double numco = 1 ! one value per cell / entity tagname = trim(seq_flds_i2x_fields)//C_NULL_CHAR @@ -1626,11 +1650,13 @@ subroutine cplcomp_moab_Init(infodata,comp) #endif endif if (MPSIID .ge. 0) then ! we are on component sea ice pes - context_id = id_join - ierr = iMOAB_FreeSenderBuffers(MPSIID, context_id) - if (ierr .ne. 0) then - write(logunit,*) subname,' error in freeing buffers ' - call shr_sys_abort(subname//' ERROR in freeing buffers ') + if ( trim(ice_domain) == 'none' ) then + context_id = id_join + ierr = iMOAB_FreeSenderBuffers(MPSIID, context_id) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in freeing buffers ' + call shr_sys_abort(subname//' ERROR in freeing buffers ') + endif endif endif diff --git a/driver-moab/shr/seq_infodata_mod.F90 b/driver-moab/shr/seq_infodata_mod.F90 index 2e9838bc69c5..512adb853b63 100644 --- a/driver-moab/shr/seq_infodata_mod.F90 +++ b/driver-moab/shr/seq_infodata_mod.F90 @@ -234,6 +234,7 @@ MODULE seq_infodata_mod character(SHR_KIND_CL) :: rof_mesh ! path to river mesh file character(SHR_KIND_CL) :: rof_domain ! path to river domain file; only for data rof for now character(SHR_KIND_CL) :: ocn_domain ! path to ocean domain file, used by data ocean models only + character(SHR_KIND_CL) :: ice_domain ! path to ice domain file, used by data ice models only character(SHR_KIND_CL) :: atm_mesh ! path to atmosphere domain/mesh file, used by data atm models only !--- set via components and may be time varying --- @@ -795,6 +796,7 @@ SUBROUTINE seq_infodata_Init( infodata, nmlfile, ID, pioid, cpl_tag) infodata%rof_mesh = 'none' infodata%rof_domain = 'none' infodata%ocn_domain = 'none' ! will be used for ocean data models only; will be used as a signal + infodata%ice_domain = 'none' ! will be used for ice data models only; will be used as a signal infodata%atm_mesh = 'none' ! will be used for atmosphere data models only; will be used as a signal ! not sure if it exists always actually @@ -1040,7 +1042,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ wav_phase, iac_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & lnd_nx, lnd_ny, rof_nx, rof_ny, ice_nx, ice_ny, ocn_nx, ocn_ny, & iac_nx, iac_ny, glc_nx, glc_ny, lnd_domain, rof_mesh, rof_domain, & - ocn_domain, atm_mesh, eps_frac, & + ocn_domain, ice_domain, atm_mesh, eps_frac, & eps_amask, eps_agrid, eps_aarea, eps_omask, eps_ogrid, eps_oarea, & reprosum_use_ddpdd, reprosum_allow_infnan, & reprosum_diffmax, reprosum_recompute, & @@ -1216,6 +1218,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ character(SHR_KIND_CL), optional, intent(OUT) :: rof_mesh character(SHR_KIND_CL), optional, intent(OUT) :: rof_domain character(SHR_KIND_CL), optional, intent(OUT) :: ocn_domain + character(SHR_KIND_CL), optional, intent(OUT) :: ice_domain character(SHR_KIND_CL), optional, intent(OUT) :: atm_mesh real(SHR_KIND_R8), optional, intent(OUT) :: nextsw_cday ! calendar of next atm shortwave @@ -1406,6 +1409,7 @@ SUBROUTINE seq_infodata_GetData_explicit( infodata, cime_model, case_name, case_ if ( present(rof_mesh) ) rof_mesh = infodata%rof_mesh if ( present(rof_domain) ) rof_domain = infodata%rof_domain if ( present(ocn_domain) ) ocn_domain = infodata%ocn_domain + if ( present(ice_domain) ) ice_domain = infodata%ice_domain if ( present(atm_mesh) ) atm_mesh = infodata%atm_mesh if ( present(nextsw_cday) ) nextsw_cday = infodata%nextsw_cday @@ -1602,8 +1606,8 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ wav_phase, iac_phase, esp_phase, wav_nx, wav_ny, atm_nx, atm_ny, & lnd_nx, lnd_ny, rof_nx, rof_ny, ice_nx, ice_ny, ocn_nx, ocn_ny, & iac_nx, iac_ny, glc_nx, glc_ny, eps_frac, eps_amask, lnd_domain, & - rof_mesh, rof_domain, ocn_domain, atm_mesh, eps_agrid, eps_aarea, & - eps_omask, eps_ogrid, eps_oarea, & + rof_mesh, rof_domain, ocn_domain, ice_domain, atm_mesh, eps_agrid, & + eps_aarea, eps_omask, eps_ogrid, eps_oarea, & reprosum_use_ddpdd, reprosum_allow_infnan, & reprosum_diffmax, reprosum_recompute, & mct_usealltoall, mct_usevector, glc_valid_input, nlmaps_verbosity) @@ -1777,6 +1781,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ character(SHR_KIND_CL), optional, intent(IN) :: rof_mesh character(SHR_KIND_CL), optional, intent(IN) :: rof_domain character(SHR_KIND_CL), optional, intent(IN) :: ocn_domain + character(SHR_KIND_CL), optional, intent(IN) :: ice_domain character(SHR_KIND_CL), optional, intent(IN) :: atm_mesh real(SHR_KIND_R8), optional, intent(IN) :: nextsw_cday ! calendar of next atm shortwave @@ -1966,6 +1971,7 @@ SUBROUTINE seq_infodata_PutData_explicit( infodata, cime_model, case_name, case_ if ( present(rof_mesh) ) infodata%rof_mesh = rof_mesh if ( present(rof_domain) ) infodata%rof_domain = rof_domain if ( present(ocn_domain) ) infodata%ocn_domain = ocn_domain + if ( present(ice_domain) ) infodata%ice_domain = ice_domain if ( present(atm_mesh) ) infodata%atm_mesh = atm_mesh if ( present(nextsw_cday) ) infodata%nextsw_cday = nextsw_cday @@ -2279,6 +2285,7 @@ subroutine seq_infodata_bcast(infodata,mpicom) call shr_mpi_bcast(infodata%rof_mesh, mpicom) call shr_mpi_bcast(infodata%rof_domain, mpicom) call shr_mpi_bcast(infodata%ocn_domain, mpicom) + call shr_mpi_bcast(infodata%ice_domain, mpicom) call shr_mpi_bcast(infodata%atm_mesh, mpicom) call shr_mpi_bcast(infodata%nextsw_cday, mpicom) call shr_mpi_bcast(infodata%precip_fact, mpicom) @@ -2552,6 +2559,7 @@ subroutine seq_infodata_Exchange(infodata,ID,type) call shr_mpi_bcast(infodata%iceberg_prognostic, mpicom, pebcast=cmppe) call shr_mpi_bcast(infodata%ice_nx, mpicom, pebcast=cmppe) call shr_mpi_bcast(infodata%ice_ny, mpicom, pebcast=cmppe) + call shr_mpi_bcast(infodata%ice_domain, mpicom, pebcast=cmppe) ! dead_comps is true if it's ever set to true deads = infodata%dead_comps call shr_mpi_bcast(deads, mpicom, pebcast=cmppe) @@ -3000,6 +3008,7 @@ SUBROUTINE seq_infodata_print( infodata ) write(logunit,F0I) subname,'rof_mesh = ', infodata%rof_mesh write(logunit,F0I) subname,'rof_domain = ', infodata%rof_domain write(logunit,F0I) subname,'ocn_domain = ', infodata%ocn_domain + write(logunit,F0I) subname,'ice_domain = ', infodata%ice_domain write(logunit,F0I) subname,'atm_mesh = ', infodata%atm_mesh write(logunit,F0R) subname,'nextsw_cday = ', infodata%nextsw_cday From ec58e8216ad976371235f6844bcf065eac452baf Mon Sep 17 00:00:00 2001 From: Iulian Grindeanu Date: Sun, 16 Jun 2024 10:31:15 -0500 Subject: [PATCH 05/10] define data ice imoab app before init --- components/data_comps/dice/src/ice_comp_mct.F90 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/data_comps/dice/src/ice_comp_mct.F90 b/components/data_comps/dice/src/ice_comp_mct.F90 index b38445ad2dc4..f8c48c89240a 100644 --- a/components/data_comps/dice/src/ice_comp_mct.F90 +++ b/components/data_comps/dice/src/ice_comp_mct.F90 @@ -155,7 +155,13 @@ subroutine ice_init_mct( EClock, cdata, x2i, i2x, NLFilename ) !---------------------------------------------------------------------------- ! Initialize dice !---------------------------------------------------------------------------- - +#ifdef HAVE_MOAB + ierr = iMOAB_RegisterApplication(trim("DICE")//C_NULL_CHAR, mpicom, compid, MPSIID) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in registering data ice comp' + call shr_sys_abort(subname//' ERROR in registering data ice comp') + endif +#endif call dice_comp_init(Eclock, x2i, i2x, & seq_flds_x2i_fields, seq_flds_i2x_fields, seq_flds_i2o_per_cat, & SDICE, gsmap, ggrid, mpicom, compid, my_task, master_task, & @@ -164,11 +170,6 @@ subroutine ice_init_mct( EClock, cdata, x2i, i2x, NLFilename ) #ifdef HAVE_MOAB - ierr = iMOAB_RegisterApplication(trim("DICE")//C_NULL_CHAR, mpicom, compid, MPSIID) - if (ierr .ne. 0) then - write(logunit,*) subname,' error in registering data ice comp' - call shr_sys_abort(subname//' ERROR in registering data ice comp') - endif if (my_task == master_task) then call shr_stream_getDomainInfo(SDICE%stream(1), filePath,fileName,timeName,lonName, & latName,hgtName,maskName,areaName) From ef39f1f892ff61e73f6110bf2c8adb10476138eb Mon Sep 17 00:00:00 2001 From: Iulian Grindeanu Date: Sun, 16 Jun 2024 15:19:31 -0500 Subject: [PATCH 06/10] need to compute comm graph between data ice and coupler ice --- driver-moab/main/cplcomp_exchange_mod.F90 | 35 +++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/driver-moab/main/cplcomp_exchange_mod.F90 b/driver-moab/main/cplcomp_exchange_mod.F90 index e21d3f4554a2..a677153d4e67 100644 --- a/driver-moab/main/cplcomp_exchange_mod.F90 +++ b/driver-moab/main/cplcomp_exchange_mod.F90 @@ -1359,7 +1359,7 @@ subroutine cplcomp_moab_Init(infodata,comp) endif endif ! in case of domain read, we need to compute the comm graph - if ( trim(ocn_domain) /= 'none' ) then + if ( trim(ocn_domain) /= 'none' ) then ! we are now on joint pes, compute comm graph between data ocn and coupler model ocn typeA = 2 ! point cloud on component PEs typeB = 3 ! full mesh on coupler pes, we just read it @@ -1596,7 +1596,17 @@ subroutine cplcomp_moab_Init(infodata,comp) if (seq_comm_iamroot(CPLID)) then write(logunit,'(A)') subname//' load ice domain mesh from file '//trim(ice_domain) endif - +#ifdef MOABDEBUG + ! debug test + outfile = 'recSeaIceInit.h5m'//C_NULL_CHAR + wopts = ';PARALLEL=WRITE_PART'//C_NULL_CHAR ! + ! write out the mesh file to disk + ierr = iMOAB_WriteMesh(mbixid, trim(outfile), trim(wopts)) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in writing sea ice mesh on coupler ' + call shr_sys_abort(subname//' ERROR in writing sea ice mesh on coupler ') + endif +#endif endif tagtype = 1 ! dense, double numco = 1 ! one value per cell / entity @@ -1618,7 +1628,6 @@ subroutine cplcomp_moab_Init(infodata,comp) write(logunit,*) subname,' error in defining tags seq_flds_dom_fields on ice on coupler ' call shr_sys_abort(subname//' ERROR in defining tags ') endif - tagname = trim(seq_flds_a2x_fields)//C_NULL_CHAR tagtype = 1 ! dense numco = 1 ! @@ -1659,6 +1668,22 @@ subroutine cplcomp_moab_Init(infodata,comp) endif endif endif + ! in case of ice domain read, we need to compute the comm graph + if ( trim(ice_domain) /= 'none' ) then + ! we are now on joint pes, compute comm graph between data ice and coupler model ice + typeA = 2 ! point cloud on component PEs + typeB = 3 ! full mesh on coupler pes, we just read it + ierr = iMOAB_ComputeCommGraph( MPSIID, mbixid, mpicom_join, mpigrp_old, mpigrp_cplid, & + typeA, typeB, id_old, id_join) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in computing comm graph for data ice model ' + call shr_sys_abort(subname//' ERROR in computing comm graph for data ice model ') + endif + ! also, frac, area, aream, masks has to come from ice MPSIID , not from domain file reader + ! this is hard to digest :( + tagname = 'area:aream:frac:mask'//C_NULL_CHAR + call component_exch_moab(comp, MPSIID, mbixid, 0, tagname) + endif endif ! rof @@ -1810,14 +1835,14 @@ subroutine component_exch_moab(comp, mbAPPid1, mbAppid2, direction, fields ) ! basically, use the initial partitioning ierr = iMOAB_SendElementTag(mbAPPid1, tagName, mpicom_join, target_id) if (ierr .ne. 0) then - call shr_sys_abort(subname//' cannot send element tag') + call shr_sys_abort(subname//' cannot send element tag: '//trim(tagName)) endif endif if ( mbAPPid2 .ge. 0 ) then ! we are on receiving end ierr = iMOAB_ReceiveElementTag(mbAPPid2, tagName, mpicom_join, source_id) if (ierr .ne. 0) then - call shr_sys_abort(subname//' cannot receive element tag') + call shr_sys_abort(subname//' cannot receive element tag: '//trim(tagName)) endif endif From 53be196af1ccfff3e2a3b7c71e3c17bb1d2bb92a Mon Sep 17 00:00:00 2001 From: Iulian Grindeanu Date: Tue, 18 Jun 2024 08:42:40 -0500 Subject: [PATCH 07/10] add GLOBAL_ID to tags for ice needed for restart, for all models that read a domain/mesh file this happens in cplcomp_exchange_mod this is for data ice, in which we read a domain file --- driver-moab/main/cplcomp_exchange_mod.F90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/driver-moab/main/cplcomp_exchange_mod.F90 b/driver-moab/main/cplcomp_exchange_mod.F90 index a677153d4e67..76737ad31419 100644 --- a/driver-moab/main/cplcomp_exchange_mod.F90 +++ b/driver-moab/main/cplcomp_exchange_mod.F90 @@ -1596,6 +1596,15 @@ subroutine cplcomp_moab_Init(infodata,comp) if (seq_comm_iamroot(CPLID)) then write(logunit,'(A)') subname//' load ice domain mesh from file '//trim(ice_domain) endif + ! need to add global id tag to the app, it will be used in restart + tagtype = 0 ! dense, integer + numco = 1 + tagname='GLOBAL_ID'//C_NULL_CHAR + ierr = iMOAB_DefineTagStorage(mbixid, tagname, tagtype, numco, tagindex ) + if (ierr .ne. 0) then + write(logunit,*) subname,' error in adding global id tag to icex' + call shr_sys_abort(subname//' ERROR in adding global id tag to icex ') + endif #ifdef MOABDEBUG ! debug test outfile = 'recSeaIceInit.h5m'//C_NULL_CHAR From 6e04be8cd2398fb80595efdcdf862df6dacc431a Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 23 Jun 2024 20:38:21 +0200 Subject: [PATCH 08/10] Remove totalRemoved*RunoffFlux variables The totals are computed incorrectly (they are missing areaCell) and are not currently used for anything within MPAS-Ocean or any diagnostics. --- components/mpas-ocean/driver/ocn_comp_mct.F | 165 ++++++++------------ components/mpas-ocean/src/Registry.xml | 8 - 2 files changed, 64 insertions(+), 109 deletions(-) diff --git a/components/mpas-ocean/driver/ocn_comp_mct.F b/components/mpas-ocean/driver/ocn_comp_mct.F index be40de0622a9..b23d54770735 100644 --- a/components/mpas-ocean/driver/ocn_comp_mct.F +++ b/components/mpas-ocean/driver/ocn_comp_mct.F @@ -96,9 +96,9 @@ module ocn_comp_mct private :: ocn_export_moab private :: ocn_import_moab integer , private :: mblsize, totalmbls, totalmbls_r - real (kind=RKIND) , allocatable, private :: o2x_om(:,:) + real (kind=RKIND) , allocatable, private :: o2x_om(:,:) - real (kind=RKIND) , allocatable, private :: x2o_om(:,:) + real (kind=RKIND) , allocatable, private :: x2o_om(:,:) integer :: mpicom_moab #endif @@ -238,7 +238,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )!{{{ integer :: size_list, index_list type(mct_string) :: mctOStr ! character(CXX) :: mct_field, modelStr -#endif +#endif #endif interface @@ -652,7 +652,7 @@ end subroutine xml_stream_get_attributes totalmbls = mblsize * nsend ! size of the double array for exporting to coupler allocate (o2x_om(lsize, nsend) ) o2x_om = 0._r8 - ! define tags according to the seq_flds_o2x_fields + ! define tags according to the seq_flds_o2x_fields tagtype = 1 ! dense, double numco = 1 ! one value per cell / entity tagname = trim(seq_flds_o2x_fields)//C_NULL_CHAR @@ -667,7 +667,7 @@ end subroutine xml_stream_get_attributes write(ocnLogUnit,*) 'Fail to set MOAB fields ' endif - totalmbls_r = mblsize * nrecv ! size of the double array for importing + totalmbls_r = mblsize * nrecv ! size of the double array for importing allocate (x2o_om(lsize, nrecv) ) x2o_om = 0._r8 @@ -681,7 +681,7 @@ end subroutine xml_stream_get_attributes if ( ierr /= 0 ) then write(ocnLogUnit,*) 'Fail to set MOAB fields ' endif - + ! add domain tags tagname=trim(seq_flds_dom_fields)//C_NULL_CHAR tagtype = 1 @@ -690,7 +690,7 @@ end subroutine xml_stream_get_attributes write(ocnLogUnit,*) 'Fail to set define dom fields ' endif ent_type = 1 ! cells - + #endif !----------------------------------------------------------------------- @@ -897,7 +897,7 @@ end subroutine xml_stream_get_attributes size_list=mct_list_nitem (temp_list) ent_type = 1 ! entity type is cell for ocn modelStr='ocn init' - mpicom_moab = mpicom_o ! save it for run method + mpicom_moab = mpicom_o ! save it for run method do index_list = 1, size_list call mct_list_get(mctOStr,index_list,temp_list) mct_field = mct_string_toChar(mctOStr) @@ -912,7 +912,7 @@ end subroutine xml_stream_get_attributes call mpas_log_write('Error in ocn_import_moab', MPAS_LOG_CRIT) endif #endif - + itimestep = 0 @@ -1001,7 +1001,7 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)!{{{ integer :: size_list, index_list, ent_type type(mct_string) :: mctOStr ! character(CXX) :: mct_field, modelStr, tagname -#endif +#endif #endif iam = domain % dminfo % my_proc_id @@ -1055,7 +1055,7 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)!{{{ call mpas_log_write('Error in ocn_import_moab', MPAS_LOG_CRIT) endif #endif - + ! Ensures MPAS AM write/compute startup steps are performed call ocn_analysis_compute_startup(domain_ptr, ierr) @@ -1739,8 +1739,6 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ real (kind=RKIND), pointer :: config_density0 - real (kind=RKIND), pointer :: totalRemovedRiverRunoffFlux, totalRemovedIceRunoffFlux - type (block_type), pointer :: block_ptr type (mpas_pool_type), pointer :: meshPool, & @@ -2613,23 +2611,6 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ end if endif - ! global sum of removed runoff - if (config_remove_AIS_coupler_runoff) then - call MPAS_dmpar_sum_real(domain % dminfo, removedRiverRunoffFluxThisProc, removedRiverRunoffFluxReduced) - call MPAS_dmpar_sum_real(domain % dminfo, removedIceRunoffFluxThisProc, removedIceRunoffFluxReduced) - block_ptr => domain % blocklist - do while(associated(block_ptr)) - call mpas_pool_get_subpool(block_ptr % structs, 'forcing', forcingPool) - - call mpas_pool_get_array(forcingPool, 'totalRemovedRiverRunoffFlux', totalRemovedRiverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'totalRemovedIceRunoffFlux', totalRemovedIceRunoffFlux) - totalRemovedRiverRunoffFlux = removedRiverRunoffFluxReduced - totalRemovedIceRunoffFlux = removedIceRunoffFluxReduced - - block_ptr => block_ptr % next - end do - endif - !----------------------------------------------------------------------- !EOC @@ -3160,7 +3141,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ ! This routine receives message from cpl7 driver ! ! The following fields are always received from the coupler: -! +! ! o taux -- zonal wind stress (taux) (W/m2 ) ! o tauy -- meridonal wind stress (tauy) (W/m2 ) ! o snow -- water flux due to snow (kg/m2/s) @@ -3176,15 +3157,15 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ ! o ifrac -- ice fraction (%) ! o rofl -- river runoff flux (kg/m2/s) ! o rofi -- ice runoff flux (kg/m2/s) -! +! ! The following fields are sometimes received from the coupler, ! depending on model options: -! +! ! o pbot -- bottom atm pressure (Pa) ! o duu10n -- 10m wind speed squared (m^2/s^2) ! o co2prog-- bottom atm level prognostic co2 ! o co2diag-- bottom atm level diagnostic co2 -! +! !----------------------------------------------------------------------- ! ! !REVISION HISTORY: @@ -3193,7 +3174,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ ! !INPUT/OUTPUT PARAMETERS: ! type(mct_aVect) , intent(inout) :: x2o_o - ! instead, we will get x2o_om from MPOID + ! instead, we will get x2o_om from MPOID ! !OUTPUT PARAMETERS: @@ -3247,8 +3228,6 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ real (kind=RKIND), pointer :: config_density0 - real (kind=RKIND), pointer :: totalRemovedRiverRunoffFlux, totalRemovedIceRunoffFlux - type (block_type), pointer :: block_ptr type (mpas_pool_type), pointer :: meshPool, & @@ -3337,7 +3316,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ !----------------------------------------------------------------------- ! -! zero out padded cells +! zero out padded cells ! !----------------------------------------------------------------------- integer :: cur_ocn_stepno @@ -3354,7 +3333,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ if (ierr > 0 ) then write(ocnLogUnit,*) 'Fail to write ocean state ' endif -#endif +#endif errorCode = 0 ! get moab tags from MPOID @@ -3726,7 +3705,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ iceFluxDMS(i) = x2o_om(n, index_x2o_Fioi_dms) endif if ( iceFluxDMSPField % isActive ) then - !JW TODO: dmspp? dmspd? the sum? + !JW TODO: dmspp? dmspd? the sum? iceFluxDMSP(i) = x2o_om(n, index_x2o_Fioi_dmspp) endif endif @@ -3939,22 +3918,6 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ call mpas_dmpar_exch_halo_field(iceFluxDMSPField) endif endif - - ! global sum of removed runoff - if (config_remove_AIS_coupler_runoff) then - call MPAS_dmpar_sum_real(domain % dminfo, removedRiverRunoffFluxThisProc, removedRiverRunoffFluxReduced) - call MPAS_dmpar_sum_real(domain % dminfo, removedIceRunoffFluxThisProc, removedIceRunoffFluxReduced) - block_ptr => domain % blocklist - do while(associated(block_ptr)) - call mpas_pool_get_subpool(block_ptr % structs, 'forcing', forcingPool) - - call mpas_pool_get_array(forcingPool, 'totalRemovedRiverRunoffFlux', totalRemovedRiverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'totalRemovedIceRunoffFlux', totalRemovedIceRunoffFlux) - totalRemovedRiverRunoffFlux = removedRiverRunoffFluxReduced - totalRemovedIceRunoffFlux = removedIceRunoffFluxReduced - - block_ptr => block_ptr % next - end do endif !----------------------------------------------------------------------- @@ -3983,9 +3946,9 @@ subroutine ocn_export_moab(EClock) !{{{ integer, pointer :: nCellsSolve, index_temperatureSurfaceValue, index_salinitySurfaceValue, & index_avgZonalSurfaceVelocity, index_avgMeridionalSurfaceVelocity, & index_avgZonalSSHGradient, index_avgMeridionalSSHGradient - + type (block_type), pointer :: block_ptr - + type (mpas_pool_type), pointer :: meshPool, & forcingPool, & statePool, & @@ -3994,9 +3957,9 @@ subroutine ocn_export_moab(EClock) !{{{ ecosysSeaIceCoupling, & DMSSeaIceCoupling, & MacroMoleculesSeaIceCoupling - + integer, dimension(:), pointer :: landIceMask - + real (kind=RKIND), dimension(:), pointer :: seaIceEnergy, accumulatedFrazilIceMass, frazilSurfacePressure, & avgTotalFreshWaterTemperatureFlux, & avgCO2_gas_flux, DMSFlux, surfaceUpwardCO2Flux, & @@ -4017,13 +3980,13 @@ subroutine ocn_export_moab(EClock) !{{{ avgRemovedIceRunoffFlux, & avgLandIceHeatFlux, & avgRemovedIceRunoffHeatFlux - + real (kind=RKIND), dimension(:,:), pointer :: avgTracersSurfaceValue, avgSurfaceVelocity, & avgSSHGradient, avgOceanSurfacePhytoC, & avgOceanSurfaceDOC, layerThickness - + real (kind=RKIND) :: surfaceFreezingTemp - + logical, pointer :: frazilIceActive, & config_remove_AIS_coupler_runoff, & config_use_ecosysTracers, & @@ -4032,12 +3995,12 @@ subroutine ocn_export_moab(EClock) !{{{ config_use_ecosysTracers_sea_ice_coupling, & config_use_DMSTracers_sea_ice_coupling, & config_use_MacroMoleculesTracers_sea_ice_coupling - + character (len=StrKIND), pointer :: config_land_ice_flux_mode - + logical :: keepFrazil - + ! get configure options call mpas_pool_get_package(domain % packages, 'frazilIceActive', frazilIceActive) call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers', config_use_ecosysTracers) @@ -4051,18 +4014,18 @@ subroutine ocn_export_moab(EClock) !{{{ config_use_DMSTracers_sea_ice_coupling) call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers_sea_ice_coupling', & config_use_MacroMoleculesTracers_sea_ice_coupling) - + n = 0 block_ptr => domain % blocklist do while(associated(block_ptr)) call mpas_pool_get_subpool(block_ptr % structs, 'mesh', meshPool) call mpas_pool_get_subpool(block_ptr % structs, 'forcing', forcingPool) call mpas_pool_get_subpool(block_ptr % structs, 'state', statePool) - + call mpas_pool_get_subpool(statePool, 'tracers', tracersPool) - + call mpas_pool_get_dimension(meshPool, 'nCellsSolve', nCellsSolve) - + call mpas_pool_get_dimension(forcingPool, 'index_avgTemperatureSurfaceValue', index_temperatureSurfaceValue) call mpas_pool_get_dimension(forcingPool, 'index_avgSalinitySurfaceValue', index_salinitySurfaceValue) call mpas_pool_get_dimension(forcingPool, 'index_avgSurfaceVelocityZonal', index_avgZonalSurfaceVelocity) @@ -4070,10 +4033,10 @@ subroutine ocn_export_moab(EClock) !{{{ call mpas_pool_get_dimension(forcingPool, 'index_avgSSHGradientZonal', index_avgZonalSSHGradient) call mpas_pool_get_dimension(forcingPool, 'index_avgSSHGradientMeridional', index_avgMeridionalSSHGradient) - + call mpas_pool_get_array(statePool, 'ssh', ssh, 1) call mpas_pool_get_array(statePool, 'layerThickness', layerThickness, 1) - + call mpas_pool_get_array(forcingPool, 'landIceMask', landIceMask) call mpas_pool_get_array(forcingPool, 'avgTracersSurfaceValue', avgTracersSurfaceValue) call mpas_pool_get_array(forcingPool, 'avgSurfaceVelocity', avgSurfaceVelocity) @@ -4094,18 +4057,18 @@ subroutine ocn_export_moab(EClock) !{{{ call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffFlux', avgRemovedIceRunoffFlux) call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffHeatFlux', avgRemovedIceRunoffHeatFlux) endif - + ! BGC fields if (config_use_ecosysTracers) then - + call mpas_pool_get_subpool(forcingPool, 'ecosysAuxiliary', ecosysAuxiliary) call mpas_pool_get_array(ecosysAuxiliary, 'avgCO2_gas_flux', avgCO2_gas_flux) - + end if - + if (config_use_ecosysTracers .and. config_use_ecosysTracers_sea_ice_coupling) then call mpas_pool_get_subpool(forcingPool, 'ecosysSeaIceCoupling', ecosysSeaIceCoupling) - + call mpas_pool_get_array(ecosysSeaIceCoupling, 'avgOceanSurfacePhytoC', avgOceanSurfacePhytoC) call mpas_pool_get_array(ecosysSeaIceCoupling, 'avgOceanSurfaceDIC', avgOceanSurfaceDIC) call mpas_pool_get_array(ecosysSeaIceCoupling, 'avgOceanSurfaceNO3', avgOceanSurfaceNO3) @@ -4118,32 +4081,32 @@ subroutine ocn_export_moab(EClock) !{{{ endif if (config_use_DMSTracers .and. config_use_DMSTracers_sea_ice_coupling) then call mpas_pool_get_subpool(forcingPool, 'DMSSeaIceCoupling', DMSSeaIceCoupling) - + call mpas_pool_get_array(DMSSeaIceCoupling, 'avgOceanSurfaceDMS', avgOceanSurfaceDMS) call mpas_pool_get_array(DMSSeaIceCoupling, 'avgOceanSurfaceDMSP', avgOceanSurfaceDMSP) endif if (config_use_MacroMoleculesTracers .and. config_use_MacroMoleculesTracers_sea_ice_coupling) then call mpas_pool_get_subpool(forcingPool, 'MacroMoleculesSeaIceCoupling', MacroMoleculesSeaIceCoupling) - + call mpas_pool_get_array(MacroMoleculesSeaIceCoupling, 'avgOceanSurfaceDOC', avgOceanSurfaceDOC) call mpas_pool_get_array(MacroMoleculesSeaIceCoupling, 'avgOceanSurfaceDON', avgOceanSurfaceDON) endif ! call mpas_pool_get_array(forcingPool, 'CO2Flux', CO2Flux) ! call mpas_pool_get_array(forcingPool, 'DMSFlux', DMSFlux) ! call mpas_pool_get_array(forcingPool, 'surfaceUpwardCO2Flux', surfaceUpwardCO2Flux) - + do i = 1, nCellsSolve n = n + 1 - + o2x_om(n, index_o2x_So_t) = avgTracersSurfaceValue(index_temperatureSurfaceValue, i) o2x_om(n, index_o2x_So_s) = avgTracersSurfaceValue(index_salinitySurfaceValue, i) o2x_om(n, index_o2x_So_u) = avgSurfaceVelocity(index_avgZonalSurfaceVelocity, i) o2x_om(n, index_o2x_So_v) = avgSurfaceVelocity(index_avgMeridionalSurfaceVelocity, i) - + o2x_om(n, index_o2x_So_ssh) = ssh(i) o2x_om(n, index_o2x_So_dhdx) = avgSSHGradient(index_avgZonalSSHGradient, i) o2x_om(n, index_o2x_So_dhdy) = avgSSHGradient(index_avgMeridionalSSHGradient, i) - + o2x_om(n, index_o2x_Faoo_h2otemp) = avgTotalFreshWaterTemperatureFlux(i) * rho_sw * cp_sw if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then @@ -4164,31 +4127,31 @@ subroutine ocn_export_moab(EClock) !{{{ keepFrazil = .false. end if end if - + if ( keepFrazil ) then - + ! Calculate energy associated with frazil mass transfer to sea ice if frazil has accumulated if ( accumulatedFrazilIceMass(i) > 0.0_RKIND ) then - - seaIceEnergy(i) = accumulatedFrazilIceMass(i) * config_frazil_heat_of_fusion - + + seaIceEnergy(i) = accumulatedFrazilIceMass(i) * config_frazil_heat_of_fusion + ! Otherwise calculate the melt potential where avgTracersSurfaceValue represents only the ! top layer of the ocean else - + surfaceFreezingTemp = ocn_freezing_temperature(salinity=avgTracersSurfaceValue(index_salinitySurfaceValue, i), & - pressure=0.0_RKIND, inLandIceCavity=.false.) - + pressure=0.0_RKIND, inLandIceCavity=.false.) + seaIceEnergy(i) = min(rho_sw*cp_sw*layerThickness(1, i)*( surfaceFreezingTemp + T0_Kelvin & - avgTracersSurfaceValue(index_temperatureSurfaceValue, i) ), 0.0_RKIND ) - + end if - + o2x_om(n, index_o2x_Fioo_q) = seaIceEnergy(i) / ocn_cpl_dt o2x_om(n, index_o2x_Fioo_frazil) = accumulatedFrazilIceMass(i) / ocn_cpl_dt - + else - + o2x_om(n, index_o2x_Fioo_q) = 0.0_RKIND o2x_om(n, index_o2x_Fioo_frazil) = 0.0_RKIND if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then @@ -4196,13 +4159,13 @@ subroutine ocn_export_moab(EClock) !{{{ o2x_om(n, index_o2x_Foxo_frazil_li) = accumulatedFrazilIceMass(i) / ocn_cpl_dt endif end if - + ! Reset SeaIce Energy and Accumulated Frazil Ice seaIceEnergy(i) = 0.0_RKIND accumulatedFrazilIceMass(i) = 0.0_RKIND frazilSurfacePressure(i) = 0.0_RKIND end if - + ! BGC fields if (config_use_ecosysTracers) then ! convert from mmolC/m2/s to kg CO2/m2/s @@ -4233,7 +4196,7 @@ subroutine ocn_export_moab(EClock) !{{{ o2x_om(n, index_o2x_So_doc2) = max(0.0_RKIND,avgOceanSurfaceDOC(2,i)) o2x_om(n, index_o2x_So_don1) = max(0.0_RKIND,avgOceanSurfaceDON(i)) endif - + if ( trim(config_land_ice_flux_mode) .eq. 'standalone' .or. & trim(config_land_ice_flux_mode) .eq. 'coupled' ) then o2x_om(n, index_o2x_So_blt) = landIceBoundaryLayerTracers(indexBLT,i) @@ -4241,9 +4204,9 @@ subroutine ocn_export_moab(EClock) !{{{ o2x_om(n, index_o2x_So_htv) = landIceTracerTransferVelocities(indexHeatTrans,i) o2x_om(n, index_o2x_So_stv) = landIceTracerTransferVelocities(indexSaltTrans,i) o2x_om(n, index_o2x_So_rhoeff) = 0.0_RKIND - endif + endif end do - + block_ptr => block_ptr % next end do @@ -4264,7 +4227,7 @@ subroutine ocn_export_moab(EClock) !{{{ ierr = iMOAB_WriteMesh(MPOID, outfile, wopts) #endif end subroutine ocn_export_moab!}}} -#endif +#endif end module ocn_comp_mct diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 825fe607a5b4..3bacd20f1543 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3764,10 +3764,6 @@ description="Fresh water flux from river runoff from the coupler that was removed due to config_remove_AIS_coupler_runoff option. Positive into the ocean." packages="thicknessBulkPKG" /> - - From d1d0f0aafa11add726983aa4b026c89d07ecfdc0 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 23 Jun 2024 20:59:33 +0200 Subject: [PATCH 09/10] Separate removal of Antarctic river and ice runoff This is needed so so we can remove ice (solid) runoff but not river (liquid) runoff. --- components/mpas-ocean/bld/build-namelist | 5 +- .../mpas-ocean/bld/build-namelist-section | 3 +- .../namelist_defaults_mpaso.xml | 3 +- .../namelist_definition_mpaso.xml | 12 +++- components/mpas-ocean/driver/ocn_comp_mct.F | 68 +++++++++++++------ components/mpas-ocean/src/Registry.xml | 12 ++-- .../Registry_conservation_check.xml | 4 +- .../shared/mpas_ocn_time_average_coupled.F | 33 +++++++-- 8 files changed, 100 insertions(+), 40 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 1c55bcb7be1d..6e63d8f9c11c 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -707,10 +707,11 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); # Namelist group: coupling # ############################ +add_default($nl, 'config_remove_ais_river_runoff'); if (($OCN_ICEBERG eq 'true') && ($OCN_FORCING eq 'active_atm')) { - add_default($nl, 'config_remove_AIS_coupler_runoff', 'val'=>".true."); + add_default($nl, 'config_remove_ais_ice_runoff', 'val'=>".true."); } else { - add_default($nl, 'config_remove_AIS_coupler_runoff', 'val'=>".false."); + add_default($nl, 'config_remove_ais_ice_runoff', 'val'=>".false."); } ###################################### diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index cc1695243faa..cae11d395c9f 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -229,7 +229,8 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); # Namelist group: coupling # ############################ -add_default($nl, 'config_remove_AIS_coupler_runoff'); +add_default($nl, 'config_remove_ais_river_runoff'); +add_default($nl, 'config_remove_ais_ice_runoff'); ###################################### # Namelist group: shortwaveRadiation # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index c7441c6b2214..d4a1487ba161 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,8 @@ 10.0 -.false. +.false. +.false. 'jerlov' diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index f6c2f9c5b765..6ebd149d17ac 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1191,9 +1191,17 @@ Default: Defined in namelist_defaults.xml - -If true, solid and liquid runoff from the Antarctic Ice Sheet (below 60S latitude) coming from the coupled is zeroed in the coupler import routines. To be used with data iceberg fluxes coming from the sea ice model. +If true, liquid runoff from the Antarctic Ice Sheet (below 60S latitude) coming from the coupled is zeroed in the coupler import routines. To be used with data iceberg fluxes coming from the sea ice model. + +Valid values: .true. or .false. +Default: Defined in namelist_defaults.xml + + + +If true, solid runoff from the Antarctic Ice Sheet (below 60S latitude) coming from the coupled is zeroed in the coupler import routines. To be used with data iceberg fluxes coming from the sea ice model. Valid values: .true. or .false. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/driver/ocn_comp_mct.F b/components/mpas-ocean/driver/ocn_comp_mct.F index b23d54770735..bd425e7e806a 100644 --- a/components/mpas-ocean/driver/ocn_comp_mct.F +++ b/components/mpas-ocean/driver/ocn_comp_mct.F @@ -1729,7 +1729,8 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ config_use_MacroMoleculesTracers, & config_use_MacroMoleculesTracers_sea_ice_coupling, & config_use_CFCTracers, & - config_remove_AIS_coupler_runoff, & + config_remove_ais_river_runoff, & + config_remove_ais_ice_runoff, & config_cvmix_kpp_use_theory_wave character(len=StrKIND), pointer :: config_ecosys_atm_co2_option, & @@ -1886,7 +1887,8 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers_sea_ice_coupling', & config_use_MacroMoleculesTracers_sea_ice_coupling) call mpas_pool_get_config(domain % configs, 'config_use_CFCTracers', config_use_CFCTracers) - call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_river_runoff', config_remove_ais_river_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_ice_runoff', config_remove_ais_ice_runoff) call mpas_pool_get_config(domain % configs, 'config_cvmix_kpp_use_theory_wave', config_cvmix_kpp_use_theory_wave) n = 0 @@ -2063,14 +2065,18 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ windSpeedSquared10mCFC => windSpeedSquared10mField % array endif - if (config_remove_AIS_coupler_runoff) then - ! Initialize these fields + if (config_remove_ais_river_runoff) then + ! Initialize this field removedRiverRunoffFlux(:) = 0.0_RKIND + endif + + if (config_remove_ais_ice_runoff) then + ! Initialize this field removedIceRunoffFlux(:) = 0.0_RKIND endif if (config_cvmix_kpp_use_theory_wave) then - ! Initialize these fields + ! Initialize this field windSpeed10m(:) = 0.0_RKIND endif @@ -2118,7 +2124,7 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ end if if ( riverRunoffFluxField % isActive ) then riverRunoffFlux(i) = x2o_o % rAttr(index_x2o_Foxx_rofl, n) - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then if (latCell(i) < -1.04719666667_RKIND) then ! 60S in radians removedRiverRunoffFlux(i) = riverRunoffFlux(i) riverRunoffFlux(i) = 0.0_RKIND @@ -2131,7 +2137,7 @@ subroutine ocn_import_mct(x2o_o, errorCode)!{{{ if(iceRunoffFlux(n) < 0.0_RKIND) then call shr_sys_abort ('Error: incoming rofi_F is negative') end if - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_ice_runoff) then if (latCell(i) < -1.04719666667_RKIND) then ! 60S in radians removedIceRunoffFlux(i) = iceRunoffFlux(i) iceRunoffFlux(i) = 0.0_RKIND @@ -2692,7 +2698,8 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{ real (kind=RKIND) :: surfaceFreezingTemp logical, pointer :: frazilIceActive, & - config_remove_AIS_coupler_runoff, & + config_remove_ais_river_runoff, & + config_remove_ais_ice_runoff, & config_use_ecosysTracers, & config_use_DMSTracers, & config_use_MacroMoleculesTracers, & @@ -2709,7 +2716,8 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{ call mpas_pool_get_package(domain % packages, 'frazilIceActive', frazilIceActive) call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers', config_use_ecosysTracers) call mpas_pool_get_config(domain % configs, 'config_land_ice_flux_mode', config_land_ice_flux_mode) - call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_river_runoff', config_remove_ais_river_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_ice_runoff', config_remove_ais_ice_runoff) call mpas_pool_get_config(domain % configs, 'config_use_DMSTracers', config_use_DMSTracers) call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers', config_use_MacroMoleculesTracers) call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers_sea_ice_coupling', & @@ -2757,8 +2765,10 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{ call mpas_pool_get_array(forcingPool, 'avgLandIceFreshwaterFlux', avgLandIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'avgLandIceHeatFlux', avgLandIceHeatFlux) endif - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then call mpas_pool_get_array(forcingPool, 'avgRemovedRiverRunoffFlux', avgRemovedRiverRunoffFlux) + endif + if (config_remove_ais_ice_runoff) then call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffFlux', avgRemovedIceRunoffFlux) call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffHeatFlux', avgRemovedIceRunoffHeatFlux) endif @@ -2819,8 +2829,10 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{ o2x_o % rAttr(index_o2x_Foxo_ismw, n) = avgLandIceFreshwaterFlux(i) o2x_o % rAttr(index_o2x_Foxo_ismh, n) = avgLandIceHeatFlux(i) endif - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then o2x_o % rAttr(index_o2x_Foxo_rrofl, n) = avgRemovedRiverRunoffFlux(i) + endif + if (config_remove_ais_ice_runoff) then o2x_o % rAttr(index_o2x_Foxo_rrofi, n) = avgRemovedIceRunoffFlux(i) o2x_o % rAttr(index_o2x_Foxo_rrofih, n) = avgRemovedIceRunoffHeatFlux(i) endif @@ -3218,7 +3230,8 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ config_use_DMSTracers_sea_ice_coupling, & config_use_MacroMoleculesTracers, & config_use_MacroMoleculesTracers_sea_ice_coupling, & - config_remove_AIS_coupler_runoff, & + config_remove_ais_river_runoff, & + config_remove_ais_ice_runoff, & config_cvmix_kpp_use_theory_wave character(len=StrKIND), pointer :: config_ecosys_atm_co2_option, & @@ -3365,7 +3378,8 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ config_use_DMSTracers_sea_ice_coupling) call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers_sea_ice_coupling', & config_use_MacroMoleculesTracers_sea_ice_coupling) - call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_river_runoff', config_remove_ais_river_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_ice_runoff', config_remove_ais_ice_runoff) call mpas_pool_get_config(domain % configs, 'config_cvmix_kpp_use_theory_wave', config_cvmix_kpp_use_theory_wave) n = 0 @@ -3503,14 +3517,18 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ iceFluxDMSP => iceFluxDMSPField % array endif - if (config_remove_AIS_coupler_runoff) then - ! Initialize these fields + if (config_remove_ais_river_runoff) then + ! Initialize this field removedRiverRunoffFlux(:) = 0.0_RKIND + endif + + if (config_remove_ais_ice_runoff) then + ! Initialize this field removedIceRunoffFlux(:) = 0.0_RKIND endif if (config_cvmix_kpp_use_theory_wave) then - ! Initialize these fields + ! Initialize this field windSpeed10m(:) = 0.0_RKIND endif @@ -3559,7 +3577,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ end if if ( riverRunoffFluxField % isActive ) then riverRunoffFlux(i) = x2o_om(n, index_x2o_Foxx_rofl) - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then if (latCell(i) < -1.04719666667_RKIND) then ! 60S in radians removedRiverRunoffFlux(i) = riverRunoffFlux(i) riverRunoffFlux(i) = 0.0_RKIND @@ -3572,7 +3590,7 @@ subroutine ocn_import_moab( Eclock, errorCode)!{{{ if(iceRunoffFlux(n) < 0.0_RKIND) then call shr_sys_abort ('Error: incoming rofi_F is negative') end if - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_ice_runoff) then if (latCell(i) < -1.04719666667_RKIND) then ! 60S in radians removedIceRunoffFlux(i) = iceRunoffFlux(i) iceRunoffFlux(i) = 0.0_RKIND @@ -3988,7 +4006,8 @@ subroutine ocn_export_moab(EClock) !{{{ real (kind=RKIND) :: surfaceFreezingTemp logical, pointer :: frazilIceActive, & - config_remove_AIS_coupler_runoff, & + config_remove_ais_river_runoff, & + config_remove_ais_ice_runoff, & config_use_ecosysTracers, & config_use_DMSTracers, & config_use_MacroMoleculesTracers, & @@ -4005,7 +4024,8 @@ subroutine ocn_export_moab(EClock) !{{{ call mpas_pool_get_package(domain % packages, 'frazilIceActive', frazilIceActive) call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers', config_use_ecosysTracers) call mpas_pool_get_config(domain % configs, 'config_land_ice_flux_mode', config_land_ice_flux_mode) - call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_river_runoff', config_remove_ais_river_runoff) + call mpas_pool_get_config(domain % configs, 'config_remove_ais_ice_runoff', config_remove_ais_ice_runoff) call mpas_pool_get_config(domain % configs, 'config_use_DMSTracers', config_use_DMSTracers) call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers', config_use_MacroMoleculesTracers) call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers_sea_ice_coupling', & @@ -4052,8 +4072,10 @@ subroutine ocn_export_moab(EClock) !{{{ call mpas_pool_get_array(forcingPool, 'avgLandIceFreshwaterFlux', avgLandIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'avgLandIceHeatFlux', avgLandIceHeatFlux) endif - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then call mpas_pool_get_array(forcingPool, 'avgRemovedRiverRunoffFlux', avgRemovedRiverRunoffFlux) + endif + if (config_remove_ais_ice_runoff) then call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffFlux', avgRemovedIceRunoffFlux) call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffHeatFlux', avgRemovedIceRunoffHeatFlux) endif @@ -4113,8 +4135,10 @@ subroutine ocn_export_moab(EClock) !{{{ o2x_om(n, index_o2x_Foxo_ismw) = avgLandIceFreshwaterFlux(i) o2x_om(n, index_o2x_Foxo_ismh) = avgLandIceHeatFlux(i) endif - if (config_remove_AIS_coupler_runoff) then + if (config_remove_ais_river_runoff) then o2x_om(n, index_o2x_Foxo_rrofl) = avgRemovedRiverRunoffFlux(i) + endif + if (config_remove_ais_ice_runoff) then o2x_om(n, index_o2x_Foxo_rrofi) = avgRemovedIceRunoffFlux(i) o2x_om(n, index_o2x_Foxo_rrofih) = avgRemovedIceRunoffHeatFlux(i) endif diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3bacd20f1543..be50e9ccd9ee 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -766,8 +766,12 @@ /> - + @@ -3761,7 +3765,7 @@ packages="thicknessBulkPKG" /> Date: Mon, 8 Jul 2024 12:17:48 -0500 Subject: [PATCH 10/10] Change fully-coupled HR test to WCYCL1850NS, due to missing ocn/ice ICs --- cime_config/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/tests.py b/cime_config/tests.py index 012f362e22fb..98b2b1f3495e 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -351,7 +351,7 @@ "e3sm_hi_res" : { "inherit" : "e3sm_atm_hi_res", "tests" : ( - "SMS_Ld3.ne120pg2_r025_RRSwISC6to18E3r5.WCYCL1850.eam-cosplite", + "SMS_Ld3.ne120pg2_r025_RRSwISC6to18E3r5.WCYCL1850NS.eam-cosplite", "SMS.T62_SOwISC12to60E2r4.GMPAS-IAF", ) },