@@ -165,8 +165,9 @@ module MOM_ALE
165165! ! before the main time integration loop to initialize the regridding stuff.
166166! ! We read the MOM_input file to register the values of different
167167! ! regridding/remapping parameters.
168- subroutine ALE_init ( param_file , GV , US , max_depth , CS )
168+ subroutine ALE_init ( param_file , G , GV , US , max_depth , CS )
169169 type (param_file_type), intent (in ) :: param_file ! < Parameter file
170+ type (ocean_grid_type), intent (in ) :: G ! < Grid structure
170171 type (verticalGrid_type), intent (in ) :: GV ! < Ocean vertical grid structure
171172 type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
172173 real , intent (in ) :: max_depth ! < The maximum depth of the ocean [Z ~> m].
@@ -205,8 +206,9 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
205206 default= .false. )
206207
207208 ! Initialize and configure regridding
208- call ALE_initRegridding(GV, US, max_depth, param_file, mdl, CS% regridCS)
209- call regridding_preadjust_reqs(CS% regridCS, CS% do_conv_adj, CS% use_hybgen_unmix, hybgen_CS= hybgen_regridCS)
209+ call ALE_initRegridding(G, GV, US, max_depth, param_file, mdl, CS% regridCS)
210+ call regridding_preadjust_reqs(CS% regridCS, CS% do_conv_adj, CS% use_hybgen_unmix, &
211+ hybgen_CS= hybgen_regridCS)
210212
211213 ! Initialize and configure remapping that is orchestrated by ALE.
212214 call get_param(param_file, mdl, " REMAPPING_SCHEME" , string, &
@@ -321,12 +323,12 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
321323 default=- 0.001 , units= " m" , scale= GV% m_to_H)
322324 call get_param(param_file, mdl, " REMAP_VEL_MASK_H_THIN" , CS% h_vel_mask, &
323325 " A thickness at velocity points below which near-bottom layers are zeroed out " // &
324- " after remapping, following practice with Hybgen remapping, or a negative value " // &
325- " to avoid such filtering altogether." , &
326+ " after remapping, following practice with Hybgen remapping, " // &
327+ " or a negative value to avoid such filtering altogether." , &
326328 default= 1.0e-6 , units= " m" , scale= GV% m_to_H, do_not_log= (CS% BBL_h_vel_mask<= 0.0 ))
327329
328330 if (CS% use_hybgen_unmix) &
329- call init_hybgen_unmix(CS% hybgen_unmixCS, GV, US, param_file, hybgen_regridCS)
331+ call init_hybgen_unmix(CS% hybgen_unmixCS, GV, US, param_file, hybgen_regridCS)
330332
331333 call get_param(param_file, mdl, " REMAP_VEL_CONSERVE_KE" , CS% conserve_ke, &
332334 " If true, a correction is applied to the baroclinic component of velocity " // &
@@ -640,7 +642,8 @@ end subroutine ALE_offline_inputs
640642
641643! > For a state-based coordinate, accelerate the process of regridding by
642644! ! repeatedly applying the grid calculation algorithm
643- subroutine ALE_regrid_accelerated (CS , G , GV , US , h , tv , n_itt , u , v , OBC , Reg , dt , dzRegrid , initial )
645+ subroutine ALE_regrid_accelerated (CS , G , GV , US , h , tv , n_itt , u , v , OBC , Reg , dt , &
646+ dzRegrid , initial )
644647 type (ALE_CS), pointer :: CS ! < ALE control structure
645648 type (ocean_grid_type), intent (inout ) :: G ! < Ocean grid
646649 type (verticalGrid_type), intent (in ) :: GV ! < Vertical grid
@@ -689,7 +692,7 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d
689692
690693 ! initial total interface displacement due to successive regridding
691694 if (CS% remap_uv_using_old_alg) &
692- dzIntTotal(:,:,:) = 0 .
695+ dzIntTotal(:,:,:) = 0 .
693696
694697 call create_group_pass(pass_T_S_h, T, G% domain)
695698 call create_group_pass(pass_T_S_h, S, G% domain)
@@ -708,7 +711,7 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d
708711
709712 ! Apply timescale to regridding (for e.g. filtered_grid_motion)
710713 if (present (dt)) &
711- call ALE_update_regrid_weights(dt, CS)
714+ call ALE_update_regrid_weights(dt, CS)
712715
713716 do itt = 1 , n_itt
714717
@@ -722,12 +725,14 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d
722725
723726 call regridding_main(CS% remapCS, CS% regridCS, G, GV, US, h_loc, tv_local, h, dzInterface)
724727 if (CS% remap_uv_using_old_alg) &
725- dzIntTotal(:,:,:) = dzIntTotal(:,:,:) + dzInterface(:,:,:)
728+ dzIntTotal(:,:,:) = dzIntTotal(:,:,:) + dzInterface(:,:,:)
726729
727730 ! remap from original grid onto new grid
728731 do j = G% jsc-1 ,G% jec+1 ; do i = G% isc-1 ,G% iec+1
729- call remapping_core_h(CS% remapCS, nz, h_orig(i,j,:), tv% S(i,j,:), nz, h(i,j,:), tv_local% S(i,j,:))
730- call remapping_core_h(CS% remapCS, nz, h_orig(i,j,:), tv% T(i,j,:), nz, h(i,j,:), tv_local% T(i,j,:))
732+ call remapping_core_h(CS% remapCS, nz, h_orig(i,j,:), tv% S(i,j,:), nz, h(i,j,:), &
733+ tv_local% S(i,j,:))
734+ call remapping_core_h(CS% remapCS, nz, h_orig(i,j,:), tv% T(i,j,:), nz, h(i,j,:), &
735+ tv_local% T(i,j,:))
731736 enddo ; enddo
732737
733738 ! starting grid for next iteration
@@ -1146,7 +1151,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u
11461151 if (CS% id_remap_delta_integ_v2> 0 ) dv2h_tot(:,:) = 0 .
11471152
11481153 if (((CS% id_remap_delta_integ_u2> 0 ) .or. (CS% id_remap_delta_integ_v2> 0 )) .and. .not. present (dt))&
1149- call MOM_error(FATAL, " ALE KE diagnostics requires passing dt into ALE_remap_velocities" )
1154+ call MOM_error(FATAL, " ALE KE diagnostics requires passing dt into ALE_remap_velocities" )
11501155
11511156 nz = GV% ke
11521157
@@ -1212,7 +1217,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u
12121217 endif
12131218
12141219 if ((CS% BBL_h_vel_mask > 0.0 ) .and. (CS% h_vel_mask > 0.0 )) &
1215- call mask_near_bottom_vel(u_tgt, h2, CS% BBL_h_vel_mask, CS% h_vel_mask, nz)
1220+ call mask_near_bottom_vel(u_tgt, h2, CS% BBL_h_vel_mask, CS% h_vel_mask, nz)
12161221
12171222 ! Copy the column of new velocities back to the 3-d array
12181223 do k= 1 ,nz
@@ -1361,13 +1366,14 @@ subroutine ALE_remap_vertex_vals(CS, G, GV, h_old, h_new, vert_val)
13611366
13621367 do J= G% JscB,G% JecB ; do I= G% IscB,G% IecB
13631368 if ((G% mask2dT(i,j) + G% mask2dT(i+1 ,j+1 )) + (G% mask2dT(i+1 ,j) + G% mask2dT(i,j+1 )) > 0.0 ) then
1364- I_mask_sum = 1.0 / ((G% mask2dT(i,j) + G% mask2dT(i+1 ,j+1 )) + (G% mask2dT(i+1 ,j) + G% mask2dT(i,j+1 )))
1369+ I_mask_sum = 1.0 / ((G% mask2dT(i,j) + G% mask2dT(i+1 ,j+1 )) + &
1370+ (G% mask2dT(i+1 ,j) + G% mask2dT(i,j+1 )))
13651371
13661372 do k= 1 ,nz
13671373 h_src(k) = ((G% mask2dT(i,j) * h_old(i,j,k) + G% mask2dT(i+1 ,j+1 ) * h_old(i+1 ,j+1 ,k)) + &
1368- (G% mask2dT(i+1 ,j) * h_old(i+1 ,j,k) + G% mask2dT(i,j+1 ) * h_old(i,j+1 ,k)) ) * I_mask_sum
1374+ (G% mask2dT(i+1 ,j) * h_old(i+1 ,j,k) + G% mask2dT(i,j+1 ) * h_old(i,j+1 ,k)) ) * I_mask_sum
13691375 h_tgt(k) = ((G% mask2dT(i,j) * h_new(i,j,k) + G% mask2dT(i+1 ,j+1 ) * h_new(i+1 ,j+1 ,k)) + &
1370- (G% mask2dT(i+1 ,j) * h_new(i+1 ,j,k) + G% mask2dT(i,j+1 ) * h_new(i,j+1 ,k)) ) * I_mask_sum
1376+ (G% mask2dT(i+1 ,j) * h_new(i+1 ,j,k) + G% mask2dT(i,j+1 ) * h_new(i,j+1 ,k)) ) * I_mask_sum
13711377 enddo
13721378
13731379 do K= 1 ,nz+1
@@ -1549,7 +1555,8 @@ subroutine ALE_PLM_edge_values( CS, G, GV, h, Q, bdry_extrap, Q_t, Q_b )
15491555 do j = G% jsc-1 ,G% jec+1 ; do i = G% isc-1 ,G% iec+1
15501556 slp(1 ) = 0 .
15511557 do k = 2 , GV% ke-1
1552- slp(k) = PLM_slope_wa(h(i,j,k-1 ), h(i,j,k), h(i,j,k+1 ), h_neglect, Q(i,j,k-1 ), Q(i,j,k), Q(i,j,k+1 ))
1558+ slp(k) = PLM_slope_wa(h(i,j,k-1 ), h(i,j,k), h(i,j,k+1 ), h_neglect, &
1559+ Q(i,j,k-1 ), Q(i,j,k), Q(i,j,k+1 ))
15531560 enddo
15541561 slp(GV% ke) = 0 .
15551562
@@ -1562,7 +1569,8 @@ subroutine ALE_PLM_edge_values( CS, G, GV, h, Q, bdry_extrap, Q_t, Q_b )
15621569 mslp = - PLM_extrapolate_slope(h(i,j,2 ), h(i,j,1 ), h_neglect, Q(i,j,2 ), Q(i,j,1 ))
15631570 Q_t(i,j,1 ) = Q(i,j,1 ) - 0.5 * mslp
15641571 Q_b(i,j,1 ) = Q(i,j,1 ) + 0.5 * mslp
1565- mslp = PLM_extrapolate_slope(h(i,j,GV% ke-1 ), h(i,j,GV% ke), h_neglect, Q(i,j,GV% ke-1 ), Q(i,j,GV% ke))
1572+ mslp = PLM_extrapolate_slope(h(i,j,GV% ke-1 ), h(i,j,GV% ke), h_neglect, &
1573+ Q(i,j,GV% ke-1 ), Q(i,j,GV% ke))
15661574 Q_t(i,j,GV% ke) = Q(i,j,GV% ke) - 0.5 * mslp
15671575 Q_b(i,j,GV% ke) = Q(i,j,GV% ke) + 0.5 * mslp
15681576 else
@@ -1630,7 +1638,7 @@ subroutine TS_PPM_edge_values( CS, S_t, S_b, T_t, T_b, G, GV, tv, h, bdry_extrap
16301638 call PPM_reconstruction( GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect, &
16311639 answer_date= CS% answer_date )
16321640 if (bdry_extrap) &
1633- call PPM_boundary_extrapolation( GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
1641+ call PPM_boundary_extrapolation( GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
16341642
16351643 do k = 1 ,GV% ke
16361644 S_t(i,j,k) = ppol_E(k,1 )
@@ -1651,7 +1659,7 @@ subroutine TS_PPM_edge_values( CS, S_t, S_b, T_t, T_b, G, GV, tv, h, bdry_extrap
16511659 call PPM_reconstruction( GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect, &
16521660 answer_date= CS% answer_date )
16531661 if (bdry_extrap) &
1654- call PPM_boundary_extrapolation(GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
1662+ call PPM_boundary_extrapolation(GV% ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
16551663
16561664 do k = 1 ,GV% ke
16571665 T_t(i,j,k) = ppol_E(k,1 )
@@ -1664,7 +1672,8 @@ end subroutine TS_PPM_edge_values
16641672
16651673
16661674! > Initializes regridding for the main ALE algorithm
1667- subroutine ALE_initRegridding (GV , US , max_depth , param_file , mdl , regridCS )
1675+ subroutine ALE_initRegridding (G , GV , US , max_depth , param_file , mdl , regridCS )
1676+ type (ocean_grid_type), intent (in ) :: G ! < Grid structure
16681677 type (verticalGrid_type), intent (in ) :: GV ! < Ocean vertical grid structure
16691678 type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
16701679 real , intent (in ) :: max_depth ! < The maximum depth of the ocean [Z ~> m].
@@ -1680,7 +1689,7 @@ subroutine ALE_initRegridding(GV, US, max_depth, param_file, mdl, regridCS)
16801689 trim (regriddingCoordinateModeDoc), &
16811690 default= DEFAULT_COORDINATE_MODE, fail_if_missing= .true. )
16821691
1683- call initialize_regridding(regridCS, GV, US, max_depth, param_file, mdl, coord_mode, ' ' , ' ' )
1692+ call initialize_regridding(regridCS, G, GV, US, max_depth, param_file, mdl, coord_mode, ' ' , ' ' )
16841693
16851694end subroutine ALE_initRegridding
16861695
0 commit comments