Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OMP setup and 'setmask' #806

Merged
merged 2 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2330,8 +2330,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