39 implicit none ;
private
41 #include <MOM_memory.h>
43 character(len=40) ::
mod =
"RGC_initialization"
59 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
60 target,
intent(in) :: u
61 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
62 target,
intent(in) :: v
66 logical,
intent(in) :: use_ale
71 real :: t(szi_(g),szj_(g),szk_(g))
72 real :: s(szi_(g),szj_(g),szk_(g))
73 real :: u1(szib_(g),szj_(g),szk_(g))
74 real :: v1(szi_(g),szjb_(g),szk_(g))
75 real :: rho(szi_(g),szj_(g),szk_(g))
76 real :: tmp(szi_(g),szj_(g))
77 real :: h(szi_(g),szj_(g),szk_(g))
78 real :: idamp(szi_(g),szj_(g))
83 real :: eta(szi_(g),szj_(g),szk_(g)+1)
86 real :: min_depth, dummy1, z, delta_h
87 real :: damp, rho_dummy, min_thickness, rho_tmp, xi0
88 real :: lenlat, lenlon, lensponge
89 character(len=40) :: filename, state_file
90 character(len=40) :: temp_var, salt_var, eta_var, inputdir, h_var
92 character(len=40) ::
mod =
"RGC_initialize_sponges"
93 integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz, iscb, iecb, jscb, jecb
95 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
96 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
97 iscb = g%iscB ; iecb = g%iecB; jscb = g%jscB ; jecb = g%jecB
99 call get_param(pf,
mod,
"MIN_THICKNESS",min_thickness,
'Minimum layer thickness',units=
'm',default=1.e-3)
101 call get_param(pf,
mod,
"RGC_TNUDG", tnudg,
'Nudging time scale for sponge layers (days)', default=0.0)
104 "The latitudinal or y-direction length of the domain", &
105 fail_if_missing=.true., do_not_log=.true.)
108 "The longitudinal or x-direction length of the domain", &
109 fail_if_missing=.true., do_not_log=.true.)
112 "The length of the sponge layer (km).", &
116 "Nudge velocities (u and v) towards zero in the sponge layer.", &
117 default=.false., do_not_log=.true.)
119 t(:,:,:) = 0.0 ; s(:,:,:) = 0.0 ; idamp(:,:) = 0.0; rho(:,:,:) = 0.0
122 "The minimum depth of the ocean.", units=
"m", default=0.0)
124 if (
associated(csp))
call mom_error(fatal, &
125 "RGC_initialize_sponges called with an associated control structure.")
126 if (
associated(acsp))
call mom_error(fatal, &
127 "RGC_initialize_sponges called with an associated ALE-sponge control structure.")
134 do i=is,ie ;
do j=js,je
135 if (g%geoLonT(i,j) <= lensponge)
then
136 dummy1 = -(g%geoLonT(i,j))/lensponge + 1.0
141 elseif (g%geoLonT(i,j) >= (lenlon - lensponge) .AND. g%geoLonT(i,j) <= lenlon)
then
144 dummy1=(g%geoLonT(i,j)-(lenlon - lensponge))/(lensponge)
145 damp = (1.0/tnudg) * max(0.0,dummy1)
151 if (g%bathyT(i,j) > min_depth)
then
152 idamp(i,j) = damp/86400.0
153 else ; idamp(i,j) = 0.0 ;
endif
158 call get_param(pf,
mod,
"INPUTDIR", inputdir, default=
".")
159 inputdir = slasher(inputdir)
165 call get_param(pf,
mod,
"RGC_SPONGE_FILE", state_file, &
166 "The name of the file with temps., salts. and interfaces to \n"// &
167 " damp toward.", fail_if_missing=.true.)
169 "The name of the potential temperature variable in \n"//&
170 "SPONGE_STATE_FILE.", default=
"Temp")
172 "The name of the salinity variable in \n"//&
173 "SPONGE_STATE_FILE.", default=
"Salt")
175 "The name of the interface height variable in \n"//&
176 "SPONGE_STATE_FILE.", default=
"eta")
178 "The name of the layer thickness variable in \n"//&
179 "SPONGE_STATE_FILE.", default=
"h")
182 filename = trim(inputdir)//trim(state_file)
184 call mom_error(fatal,
" RGC_initialize_sponges: Unable to open "//trim(filename))
185 call read_data(filename,temp_var,t(:,:,:), domain=g%Domain%mpp_domain)
186 call read_data(filename,salt_var,s(:,:,:), domain=g%Domain%mpp_domain)
190 call read_data(filename,h_var,h(:,:,:), domain=g%Domain%mpp_domain)
197 if (
associated(tv%T) )
then
200 if (
associated(tv%S) )
then
205 u1(:,:,:) = 0.0; v1(:,:,:) = 0.0
213 call read_data(filename,eta_var,eta(:,:,:), domain=g%Domain%mpp_domain)
217 call initialize_sponge(idamp, eta, g, pf, csp, gv)
219 if ( gv%nkml>0 )
then
223 do i=is-1,ie ; pres(i) = tv%P_Ref ;
enddo
227 is, ie-is+1, tv%eqn_of_state, scale=us%kg_m3_to_R)
234 call set_up_sponge_field(t, tv%T, g, nz, csp)
235 call set_up_sponge_field(s, tv%S, g, nz, csp)