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

update halo and allow sponge_uv to not be on grid #1432

Merged
merged 3 commits into from
Jun 24, 2021
Merged
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
20 changes: 16 additions & 4 deletions src/parameterizations/vertical/MOM_ALE_sponge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ subroutine initialize_ALE_sponge_fixed(Iresttime, G, GV, param_file, CS, data_h,
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< ocean vertical grid structure
integer, intent(in) :: nz_data !< The total number of sponge input layers.
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: Iresttime !< The inverse of the restoring time [T-1 ~> s-1].
real, dimension(SZI_(G),SZJ_(G)), intent(inout) :: Iresttime !< The inverse of the restoring time [T-1 ~> s-1].
type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
!! to parse for model parameter values.
type(ALE_sponge_CS), pointer :: CS !< A pointer that is set to point to the control
!! structure for this module (in/out).
real, dimension(SZI_(G),SZJ_(G),nz_data), intent(in) :: data_h !< The thicknesses of the sponge
real, dimension(SZI_(G),SZJ_(G),nz_data), intent(inout) :: data_h !< The thicknesses of the sponge
!! input layers [H ~> m or kg m-2].
real, dimension(SZIB_(G),SZJ_(G)), intent(in), optional :: Iresttime_u_in !< The inverse of the restoring
!! time at U-points [T-1 ~> s-1].
Expand Down Expand Up @@ -287,6 +287,9 @@ subroutine initialize_ALE_sponge_fixed(Iresttime, G, GV, param_file, CS, data_h,
allocate(Iresttime_u(G%isdB:G%iedB,G%jsd:G%jed)) ; Iresttime_u(:,:) = 0.0
allocate(Iresttime_v(G%isd:G%ied,G%jsdB:G%jedB)) ; Iresttime_v(:,:) = 0.0

call pass_var(Iresttime,G%Domain)
call pass_var(data_h,G%Domain)

! u points
CS%num_col_u = 0 ;
if (present(Iresttime_u_in)) then
Expand Down Expand Up @@ -823,13 +826,21 @@ subroutine set_up_ALE_sponge_vel_field_varying(filename_u, fieldname_u, filename
! get a unique id for this field which will allow us to return an array
! containing time-interpolated values from an external file corresponding
! to the current model date.
CS%Ref_val_u%id = init_external_field(filename_u, fieldname_u, domain=G%Domain%mpp_domain)
if (CS%spongeDataOngrid) then
CS%Ref_val_u%id = init_external_field(filename_u, fieldname_u, domain=G%Domain%mpp_domain)
else
CS%Ref_val_u%id = init_external_field(filename_u, fieldname_u)
endif
fld_sz(1:4)=-1
call get_external_field_info(CS%Ref_val_u%id, size=fld_sz)
CS%Ref_val_u%nz_data = fld_sz(3)
CS%Ref_val_u%num_tlevs = fld_sz(4)

CS%Ref_val_v%id = init_external_field(filename_v, fieldname_v, domain=G%Domain%mpp_domain)
if (CS%spongeDataOngrid) then
CS%Ref_val_v%id = init_external_field(filename_v, fieldname_v, domain=G%Domain%mpp_domain)
else
CS%Ref_val_v%id = init_external_field(filename_v, fieldname_v)
endif
fld_sz(1:4)=-1
call get_external_field_info(CS%Ref_val_v%id, size=fld_sz)
CS%Ref_val_v%nz_data = fld_sz(3)
Expand Down Expand Up @@ -1091,6 +1102,7 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time)
deallocate(sp_val, sp_val_v, mask_v, mask_z, hsrc, tmpT1d)
endif

call pass_var(h,G%Domain)
nz_data = CS%Ref_val_u%nz_data
allocate(tmp_val2(nz_data))
if (CS%id_sp_u_tendency > 0) then
Expand Down