Skip to content

Commit

Permalink
Fix OMP setup and 'setmask' (#806)
Browse files Browse the repository at this point in the history
* Fix OMP setup

* Update meshgrid
  • Loading branch information
dabail10 authored Dec 17, 2022
1 parent eebb350 commit 0bf0fdc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2422,8 +2422,7 @@ subroutine input_data
grid_type /= 'rectangular' .and. &
grid_type /= 'cpom_grid' .and. &
grid_type /= 'regional' .and. &
grid_type /= 'latlon' .and. &
grid_type /= 'setmask' ) then
grid_type /= 'latlon') then
if (my_task == master_task) write(nu_diag,*) subname//' ERROR: unknown grid_type=',trim(grid_type)
abort_list = trim(abort_list)//":20"
endif
Expand Down
4 changes: 1 addition & 3 deletions cicecore/cicedyn/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ subroutine init_grid2
!-----------------------------------------------------------------

! This code does not work in CESM. Needs to be investigated further.
#ifndef CESMCOUPLED
#if defined (_OPENMP)
!$OMP PARALLEL DO ORDERED PRIVATE(iblk) SCHEDULE(runtime)
do iblk = 1, nblocks
Expand All @@ -521,12 +520,11 @@ subroutine init_grid2
write(nu_diag,*) subname,' omp schedule = ',ompsk,ompcs
endif
write(nu_diag,*) subname,' block, thread = ',iblk,OMP_GET_THREAD_NUM()
call flush_fileunit(nu_diag)
!$OMP END ORDERED
endif
enddo
!$OMP END PARALLEL DO
#endif
call flush_fileunit(nu_diag)
#endif

!-----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module ice_comp_nuopc

use ice_import_export , only : ice_import, ice_export, ice_advertise_fields, ice_realize_fields
use ice_domain_size , only : nx_global, ny_global
use ice_grid , only : grid_type, init_grid2
use ice_grid , only : grid_format, init_grid2
use ice_communicate , only : init_communicate, my_task, master_task, mpi_comm_ice
use ice_calendar , only : force_restart_now, write_ic, init_calendar
use ice_calendar , only : idate, mday, mmonth, myear, year_init
Expand Down Expand Up @@ -684,7 +684,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize the cice mesh and the cice mask
if (trim(grid_type) == 'setmask') then
if (trim(grid_format) == 'meshnc') then
! In this case cap code determines the mask file
call ice_mesh_setmask_from_maskfile(ice_maskfile, ice_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down
4 changes: 2 additions & 2 deletions cicecore/drivers/nuopc/cmeps/ice_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module ice_import_export
use ice_arrays_column , only : floe_rad_c, wave_spectrum
use ice_state , only : vice, vsno, aice, aicen_init, trcr, trcrn
use ice_grid , only : tlon, tlat, tarea, tmask, anglet, hm
use ice_grid , only : grid_type
use ice_grid , only : grid_format
use ice_mesh_mod , only : ocn_gridcell_frac
use ice_boundary , only : ice_HaloUpdate
use ice_fileunits , only : nu_diag, flush_fileunit
Expand Down Expand Up @@ -1059,7 +1059,7 @@ subroutine ice_export( exportState, rc )
call state_setexport(exportState, 'ice_fraction', input=ailohi, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (trim(grid_type) == 'setmask') then
if (trim(grid_format) == 'meshnc') then
call state_setexport(exportState, 'ice_mask', input=ocn_gridcell_frac, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
Expand Down

0 comments on commit 0bf0fdc

Please sign in to comment.