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

Allow for read of tlat, tlon, anglet with popgrid #463

Merged
merged 22 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a10d718
Updated dmi drivers according to standalone
TillRasmussen Nov 30, 2019
eceee39
Update CICE_RunMod.F90
TillRasmussen Dec 4, 2019
6c1e6f0
Delete lal.dat
TillRasmussen Dec 4, 2019
39611f3
fix of icepack issues
TillRasmussen Dec 4, 2019
41d0362
Merge branch 'master' into master
apcraig Dec 7, 2019
f6b057e
Merge branch 'master' of https://github.com/CICE-Consortium/CICE
TillRasmussen Dec 8, 2019
1239007
Merge pull request #5 from CICE-Consortium/master
TillRasmussen Dec 25, 2019
9015d4c
cosmetic change to alin dmi/nuopc with standalone
TillRasmussen Dec 25, 2019
7be12ea
Allow for read in of tlon, tlat and anglet in order to avoid differen…
TillRasmussen Jan 22, 2020
8b10874
cice cap. DMI
TillRasmussen Feb 5, 2020
3b87bb5
Merge pull request #6 from CICE-Consortium/master
TillRasmussen Apr 10, 2020
e1b0126
Merge remote-tracking branch 'upstream/master'
TillRasmussen Apr 29, 2020
46ff9af
Merge pull request #7 from CICE-Consortium/master
TillRasmussen Jun 2, 2020
fddd22c
ice_grid
TillRasmussen Jun 2, 2020
901504d
old style ice_init
TillRasmussen Jun 2, 2020
903a8ef
bugfix. not in loop that uses iblk
TillRasmussen Jun 4, 2020
faad4ff
Merge pull request #8 from CICE-Consortium/master
TillRasmussen Jun 10, 2020
bd5df3c
Read angleT if it exist in grid file
TillRasmussen Jun 11, 2020
54a1365
bug fix missing declaration in ice_step_mod.F90. Only relevant if NEM…
TillRasmussen Jun 21, 2020
57e9346
remove icebarrier
TillRasmussen Jun 21, 2020
b1c5db3
Merge remote-tracking branch 'upstream/master'
TillRasmussen Jun 23, 2020
bf78110
update to latest
TillRasmussen Jun 23, 2020
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
8 changes: 4 additions & 4 deletions cicecore/cicedynB/dynamics/ice_transport_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ subroutine transport_remap (dt)
asum_init(0), asum_final(0))

if (l_stop) then
write (nu_diag,*) 'istep1, my_task, iblk =', &
istep1, my_task, iblk
write (nu_diag,*) 'istep1, my_task =', &
istep1, my_task
write (nu_diag,*) 'transport: conservation error, cat 0'
call abort_ice(subname//'ERROR: conservation error1')
endif
Expand All @@ -623,8 +623,8 @@ subroutine transport_remap (dt)
atsum_init(:,n), atsum_final(:,n))

if (l_stop) then
write (nu_diag,*) 'istep1, my_task, iblk, cat =', &
istep1, my_task, iblk, n
write (nu_diag,*) 'istep1, my_task, cat =', &
istep1, my_task, n
write (nu_diag,*) 'transport: conservation error, cat ',n
call abort_ice(subname//'ERROR: conservation error2')
endif
Expand Down
6 changes: 4 additions & 2 deletions cicecore/cicedynB/general/ice_step_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,17 @@ subroutine step_therm1 (dt, iblk)
logical (kind=log_kind) :: &
prescribed_ice ! if .true., use prescribed ice instead of computed
#endif

real (kind=dbl_kind), intent(in) :: &
dt ! time step

integer (kind=int_kind), intent(in) :: &
iblk ! block index

! local variables

#ifdef CICE_IN_NEMO
real (kind=dbl_kind) :: &
raice ! temporary reverse ice concentration
#endif
integer (kind=int_kind) :: &
ilo,ihi,jlo,jhi, & ! beginning and end of physical domain
i, j , & ! horizontal indices
Expand Down
61 changes: 46 additions & 15 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ module ice_grid
real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: &
rndex_global ! global index for local subdomain (dbl)

logical (kind=log_kind), private :: &
l_readCenter ! If anglet exist in grid file read it otherwise calculate it


!=======================================================================

contains
Expand Down Expand Up @@ -332,7 +336,6 @@ subroutine init_grid2
real (kind=dbl_kind) :: &
angle_0, angle_w, angle_s, angle_sw, &
pi, pi2, puny
! real (kind=dbl_kind) :: ANGLET_dum
logical (kind=log_kind), dimension(nx_block,ny_block,max_blocks):: &
out_of_range

Expand Down Expand Up @@ -470,11 +473,10 @@ subroutine init_grid2
!-----------------------------------------------------------------
! Compute ANGLE on T-grid
!-----------------------------------------------------------------
ANGLET = c0

if (trim(grid_type) == 'cpom_grid') then
ANGLET(:,:,:) = ANGLE(:,:,:)
else
else if (.not. (l_readCenter)) then
ANGLET = c0

!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, &
!$OMP angle_0,angle_w,angle_s,angle_sw)
Expand Down Expand Up @@ -504,7 +506,8 @@ subroutine init_grid2
enddo
!$OMP END PARALLEL DO
endif ! cpom_grid
if (trim(grid_type) == 'regional') then
if (trim(grid_type) == 'regional' .and. &
(.not. (l_readCenter))) then
! for W boundary extrapolate from interior
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
do iblk = 1, nblocks
Expand All @@ -531,9 +534,9 @@ subroutine init_grid2
call ice_timer_stop(timer_bound)

call makemask ! velocity mask, hemisphere masks

call Tlatlon ! get lat, lon on the T grid

if (.not. (l_readCenter)) then
call Tlatlon ! get lat, lon on the T grid
endif
!-----------------------------------------------------------------
! bathymetry
!-----------------------------------------------------------------
Expand Down Expand Up @@ -716,6 +719,7 @@ subroutine popgrid_nc
field_loc_center, field_loc_NEcorner, &
field_type_scalar, field_type_angle
use ice_domain_size, only: max_blocks
use netcdf

integer (kind=int_kind) :: &
i, j, iblk, &
Expand All @@ -739,6 +743,12 @@ subroutine popgrid_nc

type (block) :: &
this_block ! block information for current block

integer(kind=int_kind) :: &
varid
integer (kind=int_kind) :: &
status ! status flag


character(len=*), parameter :: subname = '(popgrid_nc)'

Expand All @@ -751,7 +761,7 @@ subroutine popgrid_nc
call ice_open_nc(kmt_file,fid_kmt)

diag = .true. ! write diagnostic info

l_readCenter = .false.
!-----------------------------------------------------------------
! topography
!-----------------------------------------------------------------
Expand Down Expand Up @@ -806,11 +816,37 @@ subroutine popgrid_nc
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! ANGLE
call scatter_global(ANGLE, work_g1, master_task, distrb_info, &
field_loc_NEcorner, field_type_angle)

! fix ANGLE: roundoff error due to single precision
where (ANGLE > pi) ANGLE = pi
where (ANGLE < -pi) ANGLE = -pi

! if grid file includes anglet then read instead
fieldname='anglet'
if (my_task == master_task) then
status = nf90_inq_varid(fid_grid, trim(fieldname) , varid)
if (status /= nf90_noerr) then
write(nu_diag,*) subname//' CICE will calculate angleT, TLON and TLAT'
else
write(nu_diag,*) subname//' angleT, TLON and TLAT is read from grid file'
l_readCenter = .true.
endif
endif
call broadcast_scalar(l_readCenter,master_task)
if (l_readCenter) then
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag)
call scatter_global(ANGLET, work_g1, master_task, distrb_info, &
field_loc_center, field_type_angle)
where (ANGLET > pi) ANGLET = pi
where (ANGLET < -pi) ANGLET = -pi
fieldname="tlon"
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag)
call scatter_global(TLON, work_g1, master_task, distrb_info, &
field_loc_center, field_type_scalar)
fieldname="tlat"
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag)
call scatter_global(TLAT, work_g1, master_task, distrb_info, &
field_loc_center, field_type_scalar)
endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looks like there might be a slight indentation problem in this if block. Can you check that there are no "tabs".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thnk that this has been solved

!-----------------------------------------------------------------
! cell dimensions
! calculate derived quantities from global arrays to preserve
Expand All @@ -820,7 +856,6 @@ subroutine popgrid_nc
fieldname='htn'
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! HTN
call primary_grid_lengths_HTN(work_g1) ! dxu, dxt

fieldname='hte'
call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! HTE
call primary_grid_lengths_HTE(work_g1) ! dyu, dyt
Expand All @@ -831,7 +866,6 @@ subroutine popgrid_nc
call ice_close_nc(fid_grid)
call ice_close_nc(fid_kmt)
endif

#endif
end subroutine popgrid_nc

Expand Down Expand Up @@ -1737,7 +1771,6 @@ subroutine Tlatlon
enddo ! j
enddo ! iblk
!$OMP END PARALLEL DO

if (trim(grid_type) == 'regional') then
! for W boundary extrapolate from interior
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
Expand Down Expand Up @@ -2463,7 +2496,6 @@ subroutine read_basalstress_bathy

! use module
use ice_read_write
use ice_communicate, only: my_task, master_task
use ice_constants, only: field_loc_center, field_type_scalar

! local variables
Expand Down Expand Up @@ -2491,7 +2523,6 @@ subroutine read_basalstress_bathy

if (my_task == master_task) then
write(nu_diag,*) 'reading ',TRIM(fieldname)
write(*,*) 'reading ',TRIM(fieldname)
call icepack_warnings_flush(nu_diag)
endif
call ice_read_nc(fid_init,1,fieldname,bathymetry,diag, &
Expand Down
Loading