@@ -306,7 +306,7 @@ subroutine initialize_ALE_sponge_fixed(Iresttime, G, GV, param_file, CS, data_h,
306
306
call pass_var(data_dz, G% Domain, To_All+ Omit_Corners, halo= 1 )
307
307
308
308
! u points
309
- CS% num_col_u = 0 ;
309
+ CS% num_col_u = 0
310
310
if (present (Iresttime_u_in)) then
311
311
Iresttime_u(:,:) = Iresttime_u_in(:,:)
312
312
else
@@ -350,15 +350,15 @@ subroutine initialize_ALE_sponge_fixed(Iresttime, G, GV, param_file, CS, data_h,
350
350
" The total number of columns where sponges are applied at u points." , like_default= .true. )
351
351
352
352
! v points
353
- CS% num_col_v = 0 ;
353
+ CS% num_col_v = 0
354
354
if (present (Iresttime_v_in)) then
355
355
Iresttime_v(:,:) = Iresttime_v_in(:,:)
356
356
else
357
- do J= G% jscB,G% jecB; do i= G% isc,G% iec
357
+ do J= G% jscB,G% jecB ; do i= G% isc,G% iec
358
358
Iresttime_v(i,J) = 0.5 * (Iresttime(i,j) + Iresttime(i,j+1 ))
359
359
enddo ; enddo
360
360
endif
361
- do J= G% jscB,G% jecB; do i= G% isc,G% iec
361
+ do J= G% jscB,G% jecB ; do i= G% isc,G% iec
362
362
if ((Iresttime_v(i,J) > 0.0 ) .and. (G% mask2dCv(i,J) > 0.0 )) &
363
363
CS% num_col_v = CS% num_col_v + 1
364
364
enddo ; enddo
@@ -594,8 +594,8 @@ subroutine initialize_ALE_sponge_varying(Iresttime, G, GV, US, param_file, CS, I
594
594
Iresttime_u(I,j) = 0.5 * (Iresttime(i,j) + Iresttime(i+1 ,j))
595
595
enddo ; enddo
596
596
endif
597
- CS% num_col_u = 0 ;
598
- do j= G% jsc,G% jec; do I= G% iscB,G% iecB
597
+ CS% num_col_u = 0
598
+ do j= G% jsc,G% jec ; do I= G% iscB,G% iecB
599
599
if ((Iresttime_u(I,j) > 0.0 ) .and. (G% mask2dCu(I,j) > 0.0 )) &
600
600
CS% num_col_u = CS% num_col_u + 1
601
601
enddo ; enddo
@@ -622,12 +622,12 @@ subroutine initialize_ALE_sponge_varying(Iresttime, G, GV, US, param_file, CS, I
622
622
if (present (Iresttime_v_in)) then
623
623
Iresttime_v(:,:) = Iresttime_v_in(:,:)
624
624
else
625
- do J= G% jscB,G% jecB; do i= G% isc,G% iec
625
+ do J= G% jscB,G% jecB ; do i= G% isc,G% iec
626
626
Iresttime_v(i,J) = 0.5 * (Iresttime(i,j) + Iresttime(i,j+1 ))
627
627
enddo ; enddo
628
628
endif
629
- CS% num_col_v = 0 ;
630
- do J= G% jscB,G% jecB; do i= G% isc,G% iec
629
+ CS% num_col_v = 0
630
+ do J= G% jscB,G% jecB ; do i= G% isc,G% iec
631
631
if ((Iresttime_v(i,J) > 0.0 ) .and. (G% mask2dCv(i,J) > 0.0 )) &
632
632
CS% num_col_v = CS% num_col_v + 1
633
633
enddo ; enddo
@@ -663,16 +663,23 @@ subroutine init_ALE_sponge_diags(Time, G, diag, CS, US)
663
663
type (ALE_sponge_CS), intent (inout ) :: CS ! < ALE sponge control structure
664
664
type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
665
665
! Local Variables
666
+ character (len= :), allocatable :: tend_unit ! The units for a sponge tendency diagnostic.
667
+ real :: tend_conv ! The conversion factor use for the sponge tendency [A T-1 ~> a s-1]
666
668
integer :: m
667
669
668
670
CS% diag = > diag
669
671
670
672
do m= 1 ,CS% fldno
671
673
CS% id_sp_tendency(m) = - 1
672
- CS% id_sp_tendency(m) = register_diag_field(' ocean_model' , &
673
- ' sp_tendency_' // CS% Ref_val(m)% name, diag% axesTL, Time, &
674
- ' Time tendency due to restoring ' // CS% Ref_val(m)% long_name, &
675
- CS% Ref_val(m)% unit, conversion= US% s_to_T)
674
+ if ((trim (CS% Ref_val(m)% unit) == ' none' ) .or. (len_trim (CS% Ref_val(m)% unit) == 0 )) then
675
+ tend_unit = " s-1"
676
+ else
677
+ tend_unit = trim (CS% Ref_val(m)% unit)// " s-1"
678
+ endif
679
+ tend_conv = US% s_to_T ; if (CS% Ref_val(m)% scale /= 0.0 ) tend_conv = US% s_to_T / CS% Ref_val(m)% scale
680
+ CS% id_sp_tendency(m) = register_diag_field(' ocean_model' , ' sp_tendency_' // CS% Ref_val(m)% name, &
681
+ diag% axesTL, Time, long_name= ' Time tendency due to restoring ' // CS% Ref_val(m)% long_name, &
682
+ units= tend_unit, conversion= tend_conv)
676
683
enddo
677
684
678
685
CS% id_sp_u_tendency = - 1
@@ -716,8 +723,8 @@ subroutine set_up_ALE_sponge_field_fixed(sp_val, G, GV, f_ptr, CS, &
716
723
if (.not. associated (CS)) return
717
724
718
725
scale_fac = 1.0 ; if (present (scale)) scale_fac = scale
719
- long_name = sp_name; if (present (sp_long_name)) long_name = sp_long_name
720
- unit = ' none' ; if (present (sp_unit)) unit = sp_unit
726
+ long_name = sp_name ; if (present (sp_long_name)) long_name = sp_long_name
727
+ unit = ' none' ; if (present (sp_unit)) unit = sp_unit
721
728
722
729
CS% fldno = CS% fldno + 1
723
730
if (CS% fldno > MAX_FIELDS_) then
@@ -732,6 +739,7 @@ subroutine set_up_ALE_sponge_field_fixed(sp_val, G, GV, f_ptr, CS, &
732
739
CS% Ref_val(CS% fldno)% name = sp_name
733
740
CS% Ref_val(CS% fldno)% long_name = long_name
734
741
CS% Ref_val(CS% fldno)% unit = unit
742
+ CS% Ref_val(CS% fldno)% scale = scale_fac
735
743
allocate (CS% Ref_val(CS% fldno)% p(CS% nz_data,CS% num_col), source= 0.0 )
736
744
do col= 1 ,CS% num_col
737
745
do k= 1 ,CS% nz_data
@@ -775,15 +783,15 @@ subroutine set_up_ALE_sponge_field_varying(filename, fieldname, Time, G, GV, US,
775
783
character (len= 256 ) :: mesg ! String for error messages
776
784
character (len= 256 ) :: long_name ! The long name of the tracer field
777
785
character (len= 256 ) :: unit ! The unit of the tracer field
778
- long_name = sp_name; if (present (sp_long_name)) long_name = sp_long_name
779
- unit = ' none' ; if (present (sp_unit)) unit = sp_unit
786
+ long_name = sp_name ; if (present (sp_long_name)) long_name = sp_long_name
787
+ unit = ' none' ; if (present (sp_unit)) unit = sp_unit
780
788
781
789
! Local variables for ALE remapping
782
790
783
791
if (.not. associated (CS)) return
784
792
! initialize time interpolator module
785
793
call time_interp_external_init()
786
- isd = G% isd; ied = G% ied; jsd = G% jsd; jed = G% jed
794
+ isd = G% isd ; ied = G% ied ; jsd = G% jsd ; jed = G% jed
787
795
CS% fldno = CS% fldno + 1
788
796
if (CS% fldno > MAX_FIELDS_) then
789
797
write (mesg, ' ("Increase MAX_FIELDS_ to at least ",I3," in MOM_memory.h or decrease "//&
@@ -888,8 +896,8 @@ subroutine set_up_ALE_sponge_vel_field_varying(filename_u, fieldname_u, filename
888
896
889
897
override = .true.
890
898
891
- isd = G% isd; ied = G% ied; jsd = G% jsd; jed = G% jed
892
- isdB = G% isdB; iedB = G% iedB; jsdB = G% jsdB; jedB = G% jedB
899
+ isd = G% isd ; ied = G% ied ; jsd = G% jsd ; jed = G% jed
900
+ isdB = G% isdB ; iedB = G% iedB ; jsdB = G% jsdB ; jedB = G% jedB
893
901
! get a unique id for this field which will allow us to return an array
894
902
! containing time-interpolated values from an external file corresponding
895
903
! to the current model date.
@@ -1081,7 +1089,7 @@ subroutine apply_ALE_sponge(h, tv, dt, G, GV, US, CS, Time)
1081
1089
call pass_var(mask_z, G% Domain, To_All+ Omit_Corners, halo= 1 )
1082
1090
1083
1091
allocate (mask_u(G% isdB:G% iedB,G% jsd:G% jed,1 :nz_data))
1084
- do j= G% jsc,G% jec; do I= G% iscB,G% iecB
1092
+ do j= G% jsc,G% jec ; do I= G% iscB,G% iecB
1085
1093
mask_u(I,j,1 :nz_data) = min (mask_z(i,j,1 :nz_data),mask_z(i+1 ,j,1 :nz_data))
1086
1094
enddo ; enddo
1087
1095
@@ -1128,7 +1136,7 @@ subroutine apply_ALE_sponge(h, tv, dt, G, GV, US, CS, Time)
1128
1136
call pass_var(mask_z, G% Domain, To_All+ Omit_Corners, halo= 1 )
1129
1137
1130
1138
allocate (mask_v(G% isd:G% ied,G% jsdB:G% jedB,1 :nz_data))
1131
- do J= G% jscB,G% jecB; do i= G% isc,G% iec
1139
+ do J= G% jscB,G% jecB ; do i= G% isc,G% iec
1132
1140
mask_v(i,J,1 :nz_data) = min (mask_z(i,j,1 :nz_data),mask_z(i,j+1 ,1 :nz_data))
1133
1141
enddo ; enddo
1134
1142
0 commit comments