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

Changes for the CalvingMIP submission #70

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 17 additions & 1 deletion libglide/glide_setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ subroutine handle_ho_options(section, model)
call GetValue(section, 'which_ho_assemble_bfric', model%options%which_ho_assemble_bfric)
call GetValue(section, 'which_ho_assemble_lateral', model%options%which_ho_assemble_lateral)
call GetValue(section, 'which_ho_calving_front', model%options%which_ho_calving_front)
call GetValue(section, 'which_ho_calvingmip_domain', model%options%which_ho_calvingmip_domain)
call GetValue(section, 'which_ho_ground', model%options%which_ho_ground)
call GetValue(section, 'which_ho_fground_no_glp', model%options%which_ho_fground_no_glp)
call GetValue(section, 'which_ho_ground_bmlt', model%options%which_ho_ground_bmlt)
Expand Down Expand Up @@ -1169,6 +1170,11 @@ subroutine print_options(model)
'no subgrid calving front parameterization ', &
'subgrid calving front parameterization ' /)

character(len=*), dimension(0:2), parameter :: ho_calvingmip_domain = (/ &
'none ', &
'circular ', &
'Thule' /)

character(len=*), dimension(0:2), parameter :: ho_whichground = (/ &
'f_ground = 0 or 1; no GLP (glissade dycore) ', &
'GLP for basal friction with 0 <= f_ground <= 1 for vertices', &
Expand Down Expand Up @@ -2026,7 +2032,17 @@ subroutine print_options(model)
call write_log('Error, calving front option out of range for glissade dycore', GM_FATAL)
end if

write(message,*) 'ho_whichground : ',model%options%which_ho_ground, &
if (model%options%which_ho_calvingmip_domain /= HO_CALVINGMIP_DOMAIN_NONE) then
write(message,*) 'ho_calvingmip_domain : ',model%options%which_ho_calvingmip_domain, &
ho_calvingmip_domain(model%options%which_ho_calvingmip_domain)
call write_log(message)
if (model%options%which_ho_calvingmip_domain < 0 .or. &
model%options%which_ho_calvingmip_domain >= size(ho_calvingmip_domain)) then
call write_log('Error, calvingMIP domain option out of range for glissade dycore', GM_FATAL)
end if
end if

write(message,*) 'ho_whichground : ', model%options%which_ho_ground, &
ho_whichground(model%options%which_ho_ground)
call write_log(message)
if (model%options%which_ho_ground < 0 .or. model%options%which_ho_ground >= size(ho_whichground)) then
Expand Down
12 changes: 12 additions & 0 deletions libglide/glide_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ module glide_types
integer, parameter :: HO_CALVING_FRONT_NO_SUBGRID = 0
integer, parameter :: HO_CALVING_FRONT_SUBGRID = 1

integer, parameter :: HO_CALVINGMIP_DOMAIN_NONE = 0
integer, parameter :: HO_CALVINGMIP_DOMAIN_CIRCULAR = 1
integer, parameter :: HO_CALVINGMIP_DOMAIN_THULE = 2

integer, parameter :: HO_GROUND_NO_GLP = 0
integer, parameter :: HO_GROUND_GLP_BASAL_FRICTION = 1
integer, parameter :: HO_GROUND_GLP_DELUXE = 2
Expand Down Expand Up @@ -1090,6 +1094,14 @@ module glide_types
!> \item[1] subgrid parameterization with partially filled cells at the calving front
!> \end{description}

integer :: which_ho_calvingmip_domain = 0
!> Flag that indicates the desired domain for CalvingMIP experiments
!> \begin{description}
!> \item[0] none
!> \item[1] circular (radially symmetric)
!> \item[1] Thule (complex topography)
!> \end{description}

integer :: which_ho_ground = 0
!> Flag that indicates how to compute the grounded fraction of each gridcell in the glissade dycore.
!> Not valid for other dycores
Expand Down
2 changes: 2 additions & 0 deletions libglide/glide_vars.def
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ long_name: Cartesian x-coordinate, velocity grid
axis: X
data: data%general%x0
dimlen: model%parallel%global_ewn-1
load: 1

[y0]
dimensions: y0
Expand All @@ -31,6 +32,7 @@ long_name: Cartesian y-coordinate, velocity grid
axis: Y
data: data%general%y0
dimlen: model%parallel%global_nsn-1
load: 1

[x1]
dimensions: x1
Expand Down
80 changes: 56 additions & 24 deletions libglimmer/parallel_mpi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ function distributed_get_var_real4_1d(ncid, varid, values, parallel, start)
real(sp),dimension(:) :: values
type(parallel_type) :: parallel

integer :: i,ierror,myn,status,x1id,y1id
integer :: i,ierror,myn,status,x0id,y0id,x1id,y1id
integer,dimension(2) :: mybounds
integer,dimension(:),allocatable :: displs,sendcounts
integer,dimension(:,:),allocatable :: bounds
Expand All @@ -1945,14 +1945,26 @@ function distributed_get_var_real4_1d(ncid, varid, values, parallel, start)

if (main_task) then
allocate(bounds(2,tasks))
status = nf90_inq_varid(ncid,"x0",x0id)
status = nf90_inq_varid(ncid,"y0",y0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y1",y1id)
else
allocate(bounds(1,1))
end if
call broadcast(x0id)
call broadcast(y0id)
call broadcast(x1id)
call broadcast(y1id)
if (varid==x1id) then
if (varid==x0id) then
mybounds(1) = ewlb
mybounds(2) = ewub-1
myn = global_ewn-1
else if (varid==y0id) then
mybounds(1) = nslb
mybounds(2) = nsub-1
myn = global_nsn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
Expand All @@ -1968,7 +1980,11 @@ function distributed_get_var_real4_1d(ncid, varid, values, parallel, start)
if (main_task) then
!WHL - See comments above on allocating the global_values array
!! allocate(global_values(minval(bounds(1,:)):maxval(bounds(2,:))))
if (varid==x1id) then
if (varid==x0id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub-1))
elseif (varid==y0id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y1id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub))
Expand Down Expand Up @@ -2105,7 +2121,7 @@ function distributed_get_var_real8_1d(ncid, varid, values, parallel, start)
real(dp),dimension(:) :: values
type(parallel_type) :: parallel

integer :: i,ierror,myn,status,x1id,y1id
integer :: i,ierror,myn,status,x0id,y0id,x1id,y1id
integer,dimension(2) :: mybounds
integer,dimension(:),allocatable :: displs,sendcounts
integer,dimension(:,:),allocatable :: bounds
Expand All @@ -2130,14 +2146,26 @@ function distributed_get_var_real8_1d(ncid, varid, values, parallel, start)

if (main_task) then
allocate(bounds(2,tasks))
status = nf90_inq_varid(ncid,"x0",x0id)
status = nf90_inq_varid(ncid,"y0",y0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y1",y1id)
else
allocate(bounds(1,1))
end if
call broadcast(x0id)
call broadcast(y0id)
call broadcast(x1id)
call broadcast(y1id)
if (varid==x1id) then
if (varid==x0id) then
mybounds(1) = ewlb
mybounds(2) = ewub-1
myn = global_ewn-1
else if (varid==y0id) then
mybounds(1) = nslb
mybounds(2) = nsub-1
myn = global_nsn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
Expand All @@ -2153,7 +2181,11 @@ function distributed_get_var_real8_1d(ncid, varid, values, parallel, start)
if (main_task) then
!WHL - See comments above on allocating the global_values array
!! allocate(global_values(minval(bounds(1,:)):maxval(bounds(2,:))))
if (varid==x1id) then
if (varid==x0id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub-1))
elseif (varid==y0id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y1id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub))
Expand Down Expand Up @@ -3753,7 +3785,7 @@ function distributed_put_var_real4_1d(ncid, varid, values, parallel, start)
type(parallel_type) :: parallel
integer,dimension(:),optional :: start

integer :: i,ierror,myn,status,x0id,x1id,y0id,y1id
integer :: i,ierror,myn,status,x0id,y0id,x1id,y1id
integer,dimension(2) :: mybounds
integer,dimension(:),allocatable :: displs,recvcounts
integer,dimension(:,:),allocatable :: bounds
Expand All @@ -3777,28 +3809,28 @@ function distributed_put_var_real4_1d(ncid, varid, values, parallel, start)
if (main_task) then
allocate(bounds(2,tasks))
status = nf90_inq_varid(ncid,"x0",x0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y0",y0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y1",y1id)
else
allocate(bounds(1,1))
end if
call broadcast(x0id)
call broadcast(x1id)
call broadcast(y0id)
call broadcast(x1id)
call broadcast(y1id)
if (varid==x0id) then
mybounds(1) = ewlb
mybounds(2) = ewub-1
myn = global_ewn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
else if (varid==y0id) then
mybounds(1) = nslb
mybounds(2) = nsub-1
myn = global_nsn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
else if (varid==y1id) then
mybounds(1) = nslb
mybounds(2) = nsub
Expand All @@ -3813,10 +3845,10 @@ function distributed_put_var_real4_1d(ncid, varid, values, parallel, start)
!! allocate(global_values(minval(bounds(1,:)):maxval(bounds(2,:))))
if (varid==x0id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y0id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y1id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub))
endif
Expand Down Expand Up @@ -3948,7 +3980,7 @@ function distributed_put_var_real8_1d(ncid, varid, values, parallel, start)
type(parallel_type) :: parallel
integer,dimension(:),optional :: start

integer :: i,ierror,myn,status,x0id,x1id,y0id,y1id
integer :: i,ierror,myn,status,x0id,y0id,x1id,y1id

integer,dimension(2) :: mybounds
integer,dimension(:),allocatable :: displs,recvcounts
Expand All @@ -3973,28 +4005,28 @@ function distributed_put_var_real8_1d(ncid, varid, values, parallel, start)
if (main_task) then
allocate(bounds(2,tasks))
status = nf90_inq_varid(ncid,"x0",x0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y0",y0id)
status = nf90_inq_varid(ncid,"x1",x1id)
status = nf90_inq_varid(ncid,"y1",y1id)
else
allocate(bounds(1,1))
end if
call broadcast(x0id)
call broadcast(x1id)
call broadcast(y0id)
call broadcast(x1id)
call broadcast(y1id)
if (varid==x0id) then
mybounds(1) = ewlb
mybounds(2) = ewub-1
myn = global_ewn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
else if (varid==y0id) then
mybounds(1) = nslb
mybounds(2) = nsub-1
myn = global_nsn-1
else if (varid==x1id) then
mybounds(1) = ewlb
mybounds(2) = ewub
myn = global_ewn
else if (varid==y1id) then
mybounds(1) = nslb
mybounds(2) = nsub
Expand All @@ -4009,10 +4041,10 @@ function distributed_put_var_real8_1d(ncid, varid, values, parallel, start)
!! allocate(global_values(minval(bounds(1,:)):maxval(bounds(2,:))))
if (varid==x0id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y0id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub-1))
elseif (varid==x1id) then
allocate(global_values(global_minval_ewlb:global_maxval_ewub))
elseif (varid==y1id) then
allocate(global_values(global_minval_nslb:global_maxval_nsub))
endif
Expand Down
13 changes: 8 additions & 5 deletions libglissade/glissade.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2419,11 +2419,10 @@ subroutine glissade_thickness_tracer_solve(model)
effective_areafrac = model%calving%effective_areafrac)

if (verbose_calving) then
call point_diag(calving_front_mask, 'Before transport, calving_front_mask', itest, jtest, rtest, 7, 7)
call point_diag(calving_front_mask, 'calving_front_mask', itest, jtest, rtest, 7, 7)
call point_diag(partial_cf_mask, 'partial_cf_mask', itest, jtest, rtest, 7, 7)
call point_diag(full_mask, 'full_mask', itest, jtest, rtest, 7, 7)
call point_diag(ocean_mask, 'ocean_mask', itest, jtest, rtest, 7, 7)
call point_diag(model%geometry%thck*thk0, 'thck', itest, jtest, rtest, 7, 7)
! call point_diag(ocean_mask, 'ocean_mask', itest, jtest, rtest, 7, 7)
call point_diag(model%calving%thck_effective, 'thck_effective', itest, jtest, rtest, 7, 7)
call point_diag(model%calving%effective_areafrac, &
'effective_areafrac', itest, jtest, rtest, 7, 7, '(f10.6)')
Expand Down Expand Up @@ -3525,14 +3524,17 @@ subroutine glissade_calving_solve(model, init_calving)
nx, ny, &
model%options%whichcalving, &
model%options%calving_domain, &
model%options%which_ho_calving_front, &
model%options%which_ho_calving_front, &
model%options%which_ho_calvingmip_domain, &
parallel, &
model%calving, & ! calving object; includes calving_thck (m)
itest, jtest, rtest, &
model%numerics%dt*tim0, & ! s
model%numerics%time*scyr, & ! s
model%numerics%dew*len0, & ! m
model%numerics%dns*len0, & ! m
model%general%x0, & ! m
model%general%y0, & ! m
model%general%x1, & ! m
model%general%y1, & ! m
model%numerics%sigma, &
Expand Down Expand Up @@ -4124,7 +4126,8 @@ subroutine glissade_diagnostic_variable_solve(model)
thck_effective = model%calving%thck_effective, &
thck_effective_min = model%calving%thck_effective_min, &
partial_cf_mask = partial_cf_mask, &
full_mask = full_mask)
full_mask = full_mask, &
effective_areafrac = model%calving%effective_areafrac)

! ------------------------------------------------------------------------
! Compute the fraction of grounded ice in each cell and at each vertex.
Expand Down
Loading