\hypertarget{namespacemom__int__tide__input}{}\section{mom\+\_\+int\+\_\+tide\+\_\+input Module Reference}
\label{namespacemom__int__tide__input}\index{mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}}


\subsection{Detailed Description}
Calculates energy input to the internal tides. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structmom__int__tide__input_1_1int__tide__input__cs}{int\+\_\+tide\+\_\+input\+\_\+cs}
\begin{DoxyCompactList}\small\item\em This control structure holds parameters that regulate internal tide energy inputs. \end{DoxyCompactList}\item 
type \hyperlink{structmom__int__tide__input_1_1int__tide__input__type}{int\+\_\+tide\+\_\+input\+\_\+type}
\begin{DoxyCompactList}\small\item\em This type is used to exchange fields related to the internal tides. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacemom__int__tide__input_a33db0008342a1b2af532fa9501296d81}{set\+\_\+int\+\_\+tide\+\_\+input} (u, v, h, tv, fluxes, itide, dt, G, GV, US, CS)
\begin{DoxyCompactList}\small\item\em Sets the model-\/state dependent internal tide energy sources. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__int__tide__input_aac35fcf23f86c82c43dc27445743de04}{find\+\_\+n2\+\_\+bottom} (h, tv, T\+\_\+f, S\+\_\+f, h2, fluxes, G, GV, US, N2\+\_\+bot)
\begin{DoxyCompactList}\small\item\em Estimates the near-\/bottom buoyancy frequency (N$^\wedge$2). \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__int__tide__input_a134b589adde1907265c096afdb9a23b8}{int\+\_\+tide\+\_\+input\+\_\+init} (Time, G, GV, US, param\+\_\+file, diag, CS, itide)
\begin{DoxyCompactList}\small\item\em Initializes the data related to the internal tide input module. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__int__tide__input_a5d3501718d33ac915cb9595f9d51b089}{int\+\_\+tide\+\_\+input\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Deallocates any memory related to the internal tide input module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__int__tide__input_aac35fcf23f86c82c43dc27445743de04}\label{namespacemom__int__tide__input_aac35fcf23f86c82c43dc27445743de04}} 
\index{mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}!find\+\_\+n2\+\_\+bottom@{find\+\_\+n2\+\_\+bottom}}
\index{find\+\_\+n2\+\_\+bottom@{find\+\_\+n2\+\_\+bottom}!mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}}
\subsubsection{\texorpdfstring{find\+\_\+n2\+\_\+bottom()}{find\_n2\_bottom()}}
{\footnotesize\ttfamily subroutine mom\+\_\+int\+\_\+tide\+\_\+input\+::find\+\_\+n2\+\_\+bottom (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{T\+\_\+f,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{S\+\_\+f,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g)), intent(in)}]{h2,  }\item[{type(forcing), intent(in)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{N2\+\_\+bot }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Estimates the near-\/bottom buoyancy frequency (N$^\wedge$2). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em tv} & A structure containing pointers to the thermodynamic fields\\
\hline
\mbox{\tt in}  & {\em t\+\_\+f} & Temperature after vertical filtering to smooth out the values in thin layers \mbox{[}degC\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em s\+\_\+f} & Salinity after vertical filtering to smooth out the values in thin layers \mbox{[}ppt\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em h2} & Bottom topographic roughness \mbox{[}Z2 $\sim$$>$ m2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em fluxes} & A structure of thermodynamic surface fluxes\\
\hline
\mbox{\tt out}  & {\em n2\+\_\+bot} & The squared buoyancy freqency at the ocean bottom \mbox{[}T-\/2 $\sim$$>$ s-\/2\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 151 of file M\+O\+M\+\_\+internal\+\_\+tide\+\_\+input.\+F90.


\begin{DoxyCode}
151   \textcolor{keywordtype}{type}(ocean\_grid\_type),                    \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{    !< The ocean's grid structure}
152   \textcolor{keywordtype}{type}(verticalgrid\_type),                  \textcolor{keywordtype}{intent(in)}  :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
153   \textcolor{keywordtype}{type}(unit\_scale\_type),                    \textcolor{keywordtype}{intent(in)}  :: us\textcolor{comment}{   !< A dimensional unit scaling type}
154   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2]}
155   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                    \textcolor{keywordtype}{intent(in)}  :: tv\textcolor{comment}{   !< A structure containing pointers to the}
156 \textcolor{comment}{                                                                !! thermodynamic fields}
157   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: t\_f\textcolor{comment}{  !< Temperature after vertical filtering to}
158 \textcolor{comment}{                                                                !! smooth out the values in thin layers
       [degC].}
159   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: s\_f\textcolor{comment}{  !< Salinity after vertical filtering to}
160 \textcolor{comment}{                                                                !! smooth out the values in thin layers
       [ppt].}
161   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))},         \textcolor{keywordtype}{intent(in)}  :: h2\textcolor{comment}{   !< Bottom topographic roughness [Z2 ~> m2].}
162   \textcolor{keywordtype}{type}(forcing),                            \textcolor{keywordtype}{intent(in)}  :: fluxes\textcolor{comment}{ !< A structure of thermodynamic surface
       fluxes}
163   \textcolor{keywordtype}{type}(int\_tide\_input\_cs),                  \textcolor{keywordtype}{pointer}     :: cs\textcolor{comment}{    !<  This module's control structure.}
164   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))},         \textcolor{keywordtype}{intent(out)} :: n2\_bot\textcolor{comment}{ !< The squared buoyancy freqency at the}
165 \textcolor{comment}{                                                                 !! ocean bottom [T-2 ~> s-2].}
166   \textcolor{comment}{! Local variables}
167   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G)+1)} :: &
168     drho\_int      \textcolor{comment}{! The unfiltered density differences across interfaces [R ~> kg m-3].}
169   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G))} :: &
170     pres, &       \textcolor{comment}{! The pressure at each interface [R L2 T-2 ~> Pa].}
171     temp\_int, &   \textcolor{comment}{! The temperature at each interface [degC].}
172     salin\_int, &  \textcolor{comment}{! The salinity at each interface [ppt].}
173     drho\_bot, &   \textcolor{comment}{! The density difference at the bottom of a layer [R ~> kg m-3]}
174     h\_amp, &      \textcolor{comment}{! The amplitude of topographic roughness [Z ~> m].}
175     hb, &         \textcolor{comment}{! The depth below a layer [Z ~> m].}
176     z\_from\_bot, & \textcolor{comment}{! The height of a layer center above the bottom [Z ~> m].}
177     drho\_dt, &    \textcolor{comment}{! The partial derivative of density with temperature [R degC-1 ~> kg m-3 degC-1]}
178     drho\_ds       \textcolor{comment}{! The partial derivative of density with salinity [R ppt-1 ~> kg m-3 ppt-1].}
179 
180   \textcolor{keywordtype}{real} :: dz\_int  \textcolor{comment}{! The thickness associated with an interface [Z ~> m].}
181   \textcolor{keywordtype}{real} :: g\_rho0  \textcolor{comment}{! The gravitation acceleration divided by the Boussinesq}
182                   \textcolor{comment}{! density [Z T-2 R-1 ~> m4 s-2 kg-1].}
183   \textcolor{keywordtype}{logical} :: do\_i(szi\_(g)), do\_any
184   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)} :: eosdom \textcolor{comment}{! The i-computational domain for the equation of state}
185   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz
186 
187   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
188   g\_rho0 = (us%L\_to\_Z**2*gv%g\_Earth) / gv%Rho0
189   eosdom(:) = eos\_domain(g%HI)
190 
191   \textcolor{comment}{! Find the (limited) density jump across each interface.}
192   \textcolor{keywordflow}{do} i=is,ie
193     drho\_int(i,1) = 0.0 ; drho\_int(i,nz+1) = 0.0
194 \textcolor{keywordflow}{  enddo}
195 \textcolor{comment}{!$OMP parallel do default(none) shared(is,ie,js,je,nz,tv,fluxes,G,GV,US,h,T\_f,S\_f, &}
196 \textcolor{comment}{!$OMP                                  h2,N2\_bot,G\_Rho0,EOSdom) &}
197 \textcolor{comment}{!$OMP                          private(pres,Temp\_Int,Salin\_Int,dRho\_dT,dRho\_dS, &}
198 \textcolor{comment}{!$OMP                                  hb,dRho\_bot,z\_from\_bot,do\_i,h\_amp,       &}
199 \textcolor{comment}{!$OMP                                  do\_any,dz\_int) &}
200 \textcolor{comment}{!$OMP                     firstprivate(dRho\_int)}
201   \textcolor{keywordflow}{do} j=js,je
202     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%eqn\_of\_state)) \textcolor{keywordflow}{then}
203       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%p\_surf)) \textcolor{keywordflow}{then}
204         \textcolor{keywordflow}{do} i=is,ie ; pres(i) = fluxes%p\_surf(i,j) ;\textcolor{keywordflow}{ enddo}
205       \textcolor{keywordflow}{else}
206         \textcolor{keywordflow}{do} i=is,ie ; pres(i) = 0.0 ;\textcolor{keywordflow}{ enddo}
207 \textcolor{keywordflow}{      endif}
208       \textcolor{keywordflow}{do} k=2,nz
209         \textcolor{keywordflow}{do} i=is,ie
210           pres(i) = pres(i) + (gv%g\_Earth*gv%H\_to\_RZ)*h(i,j,k-1)
211           temp\_int(i) = 0.5 * (t\_f(i,j,k) + t\_f(i,j,k-1))
212           salin\_int(i) = 0.5 * (s\_f(i,j,k) + s\_f(i,j,k-1))
213 \textcolor{keywordflow}{        enddo}
214         \textcolor{keyword}{call }calculate\_density\_derivs(temp\_int, salin\_int, pres, drho\_dt(:), drho\_ds(:), &
215                                       tv%eqn\_of\_state, eosdom)
216         \textcolor{keywordflow}{do} i=is,ie
217           drho\_int(i,k) = max(drho\_dt(i)*(t\_f(i,j,k) - t\_f(i,j,k-1)) + &
218                               drho\_ds(i)*(s\_f(i,j,k) - s\_f(i,j,k-1)), 0.0)
219 \textcolor{keywordflow}{        enddo}
220 \textcolor{keywordflow}{      enddo}
221     \textcolor{keywordflow}{else}
222       \textcolor{keywordflow}{do} k=2,nz ; \textcolor{keywordflow}{do} i=is,ie
223         drho\_int(i,k) = (gv%Rlay(k) - gv%Rlay(k-1))
224 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
225 \textcolor{keywordflow}{    endif}
226 
227     \textcolor{comment}{! Find the bottom boundary layer stratification.}
228     \textcolor{keywordflow}{do} i=is,ie
229       hb(i) = 0.0 ; drho\_bot(i) = 0.0
230       z\_from\_bot(i) = 0.5*gv%H\_to\_Z*h(i,j,nz)
231       do\_i(i) = (g%mask2dT(i,j) > 0.5)
232       h\_amp(i) = sqrt(h2(i,j))
233 \textcolor{keywordflow}{    enddo}
234 
235     \textcolor{keywordflow}{do} k=nz,2,-1
236       do\_any = .false.
237       \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{if} (do\_i(i)) \textcolor{keywordflow}{then}
238         dz\_int = 0.5*gv%H\_to\_Z*(h(i,j,k) + h(i,j,k-1))
239         z\_from\_bot(i) = z\_from\_bot(i) + dz\_int \textcolor{comment}{! middle of the layer above}
240 
241         hb(i) = hb(i) + dz\_int
242         drho\_bot(i) = drho\_bot(i) + drho\_int(i,k)
243 
244         \textcolor{keywordflow}{if} (z\_from\_bot(i) > h\_amp(i)) \textcolor{keywordflow}{then}
245           \textcolor{keywordflow}{if} (k>2) \textcolor{keywordflow}{then}
246             \textcolor{comment}{! Always include at least one full layer.}
247             hb(i) = hb(i) + 0.5*gv%H\_to\_Z*(h(i,j,k-1) + h(i,j,k-2))
248             drho\_bot(i) = drho\_bot(i) + drho\_int(i,k-1)
249 \textcolor{keywordflow}{          endif}
250           do\_i(i) = .false.
251         \textcolor{keywordflow}{else}
252           do\_any = .true.
253 \textcolor{keywordflow}{        endif}
254 \textcolor{keywordflow}{      endif} ;\textcolor{keywordflow}{ enddo}
255       \textcolor{keywordflow}{if} (.not.do\_any) \textcolor{keywordflow}{exit}
256 \textcolor{keywordflow}{    enddo}
257 
258     \textcolor{keywordflow}{do} i=is,ie
259       \textcolor{keywordflow}{if} (hb(i) > 0.0) \textcolor{keywordflow}{then}
260         n2\_bot(i,j) = (g\_rho0 * drho\_bot(i)) / hb(i)
261       \textcolor{keywordflow}{else} ;  n2\_bot(i,j) = 0.0 ;\textcolor{keywordflow}{ endif}
262 \textcolor{keywordflow}{    enddo}
263 \textcolor{keywordflow}{  enddo}
264 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__int__tide__input_a5d3501718d33ac915cb9595f9d51b089}\label{namespacemom__int__tide__input_a5d3501718d33ac915cb9595f9d51b089}} 
\index{mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}!int\+\_\+tide\+\_\+input\+\_\+end@{int\+\_\+tide\+\_\+input\+\_\+end}}
\index{int\+\_\+tide\+\_\+input\+\_\+end@{int\+\_\+tide\+\_\+input\+\_\+end}!mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}}
\subsubsection{\texorpdfstring{int\+\_\+tide\+\_\+input\+\_\+end()}{int\_tide\_input\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+int\+\_\+tide\+\_\+input\+::int\+\_\+tide\+\_\+input\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__int__tide__input_1_1int__tide__input__cs}{int\+\_\+tide\+\_\+input\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Deallocates any memory related to the internal tide input module. 


\begin{DoxyParams}{Parameters}
{\em cs} & This module\textquotesingle{}s control structure, which is deallocated here. \\
\hline
\end{DoxyParams}


Definition at line 426 of file M\+O\+M\+\_\+internal\+\_\+tide\+\_\+input.\+F90.


\begin{DoxyCode}
426   \textcolor{keywordtype}{type}(int\_tide\_input\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< This module's control structure, which is deallocated here.}
427 
428   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{deallocate}(cs)
429 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__int__tide__input_a134b589adde1907265c096afdb9a23b8}\label{namespacemom__int__tide__input_a134b589adde1907265c096afdb9a23b8}} 
\index{mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}!int\+\_\+tide\+\_\+input\+\_\+init@{int\+\_\+tide\+\_\+input\+\_\+init}}
\index{int\+\_\+tide\+\_\+input\+\_\+init@{int\+\_\+tide\+\_\+input\+\_\+init}!mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}}
\subsubsection{\texorpdfstring{int\+\_\+tide\+\_\+input\+\_\+init()}{int\_tide\_input\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+int\+\_\+tide\+\_\+input\+::int\+\_\+tide\+\_\+input\+\_\+init (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(diag\+\_\+ctrl), intent(inout), target}]{diag,  }\item[{type(\hyperlink{structmom__int__tide__input_1_1int__tide__input__cs}{int\+\_\+tide\+\_\+input\+\_\+cs}), pointer}]{CS,  }\item[{type(\hyperlink{structmom__int__tide__input_1_1int__tide__input__type}{int\+\_\+tide\+\_\+input\+\_\+type}), pointer}]{itide }\end{DoxyParamCaption})}



Initializes the data related to the internal tide input module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & The current model time\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
\mbox{\tt in,out}  & {\em diag} & structure used to regulate diagnostic output.\\
\hline
 & {\em cs} & This module\textquotesingle{}s control structure, which is initialized here.\\
\hline
 & {\em itide} & A structure containing fields related to the internal tide sources. \\
\hline
\end{DoxyParams}


Definition at line 269 of file M\+O\+M\+\_\+internal\+\_\+tide\+\_\+input.\+F90.


\begin{DoxyCode}
269   \textcolor{keywordtype}{type}(time\_type),           \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{ !< The current model time}
270   \textcolor{keywordtype}{type}(ocean\_grid\_type),     \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{    !< The ocean's grid structure}
271   \textcolor{keywordtype}{type}(verticalgrid\_type),   \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
272   \textcolor{keywordtype}{type}(unit\_scale\_type),     \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{   !< A dimensional unit scaling type}
273   \textcolor{keywordtype}{type}(param\_file\_type),     \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
274   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< structure used to regulate diagnostic output.}
275   \textcolor{keywordtype}{type}(int\_tide\_input\_cs),   \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{   !< This module's control structure, which is initialized
       here.}
276   \textcolor{keywordtype}{type}(int\_tide\_input\_type), \textcolor{keywordtype}{pointer}       :: itide\textcolor{comment}{ !< A structure containing fields related}
277 \textcolor{comment}{                                                   !! to the internal tide sources.}
278   \textcolor{comment}{! Local variables}
279   \textcolor{keywordtype}{type}(vardesc) :: vd
280   \textcolor{keywordtype}{logical} :: read\_tideamp
281   \textcolor{comment}{! This include declares and sets the variable "version".}
282 \textcolor{preprocessor}{# include "version\_variable.h"}
283 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_int\_tide\_input"}  \textcolor{comment}{! This module's name.}
284   \textcolor{keywordtype}{character(len=20)}  :: tmpstr
285   \textcolor{keywordtype}{character(len=200)} :: filename, tideamp\_file, h2\_file
286 
287   \textcolor{keywordtype}{real} :: mask\_itidal        \textcolor{comment}{! A multiplicative land mask, 0 or 1 [nondim]}
288   \textcolor{keywordtype}{real} :: max\_frac\_rough     \textcolor{comment}{! The fraction relating the maximum topographic roughness}
289                              \textcolor{comment}{! to the mean depth [nondim]}
290   \textcolor{keywordtype}{real} :: utide              \textcolor{comment}{! constant tidal amplitude [L T-1 ~> m s-1] to be used if}
291                              \textcolor{comment}{! tidal amplitude file is not present.}
292   \textcolor{keywordtype}{real} :: kappa\_h2\_factor    \textcolor{comment}{! factor for the product of wavenumber * rms sgs height [nondim].}
293   \textcolor{keywordtype}{real} :: kappa\_itides       \textcolor{comment}{! topographic wavenumber and non-dimensional scaling [L-1 ~> m-1]}
294   \textcolor{keywordtype}{real} :: min\_zbot\_itides    \textcolor{comment}{! Minimum ocean depth for internal tide conversion [Z ~> m].}
295   \textcolor{keywordtype}{integer} :: tlen\_days\textcolor{comment}{       !< Time interval from start for adding wave source}
296 \textcolor{comment}{                             !! for testing internal tides (BDM)}
297   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed
298 
299   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
300     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"int\_tide\_input\_init called with an associated "}// &
301                             \textcolor{stringliteral}{"control structure."})
302     \textcolor{keywordflow}{return}
303 \textcolor{keywordflow}{  endif}
304   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(itide)) \textcolor{keywordflow}{then}
305     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"int\_tide\_input\_init called with an associated "}// &
306                             \textcolor{stringliteral}{"internal tide input type."})
307     \textcolor{keywordflow}{return}
308 \textcolor{keywordflow}{  endif}
309   \textcolor{keyword}{allocate}(cs)
310   \textcolor{keyword}{allocate}(itide)
311 
312   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
313   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
314 
315   cs%diag => diag
316 
317   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
318   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
319 
320   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, cs%inputdir, default=\textcolor{stringliteral}{"."})
321   cs%inputdir = slasher(cs%inputdir)
322 
323   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEBUG"}, cs%debug, default=.false., do\_not\_log=.true.)
324 
325   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MIN\_ZBOT\_ITIDES"}, min\_zbot\_itides, &
326                \textcolor{stringliteral}{"Turn off internal tidal dissipation when the total "}//&
327                \textcolor{stringliteral}{"ocean depth is less than this value."}, units=\textcolor{stringliteral}{"m"}, default=0.0, scale=us%m\_to\_Z)
328   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KD\_SMOOTH"}, cs%kappa\_fill, &
329                  \textcolor{stringliteral}{"A diapycnal diffusivity that is used to interpolate "}//&
330                  \textcolor{stringliteral}{"more sensible values of T & S into thin layers."}, &
331                  units=\textcolor{stringliteral}{"m2 s-1"}, default=1.0e-6, scale=us%m2\_s\_to\_Z2\_T)
332 
333   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"UTIDE"}, utide, &
334                \textcolor{stringliteral}{"The constant tidal amplitude used with INT\_TIDE\_DISSIPATION."}, &
335                units=\textcolor{stringliteral}{"m s-1"}, default=0.0, scale=us%m\_s\_to\_L\_T)
336 
337   \textcolor{keyword}{allocate}(itide%Nb(isd:ied,jsd:jed))  ; itide%Nb(:,:) = 0.0
338   \textcolor{keyword}{allocate}(itide%h2(isd:ied,jsd:jed))  ; itide%h2(:,:) = 0.0
339   \textcolor{keyword}{allocate}(itide%TKE\_itidal\_input(isd:ied,jsd:jed)) ; itide%TKE\_itidal\_input(:,:) = 0.0
340   \textcolor{keyword}{allocate}(itide%tideamp(isd:ied,jsd:jed)) ; itide%tideamp(:,:) = utide
341   \textcolor{keyword}{allocate}(cs%TKE\_itidal\_coef(isd:ied,jsd:jed)) ; cs%TKE\_itidal\_coef(:,:) = 0.0
342 
343   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KAPPA\_ITIDES"}, kappa\_itides, &
344                \textcolor{stringliteral}{"A topographic wavenumber used with INT\_TIDE\_DISSIPATION. "}//&
345                \textcolor{stringliteral}{"The default is 2pi/10 km, as in St.Laurent et al. 2002."}, &
346                units=\textcolor{stringliteral}{"m-1"}, default=8.e-4*atan(1.0), scale=us%L\_to\_m)
347 
348   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KAPPA\_H2\_FACTOR"}, kappa\_h2\_factor, &
349                \textcolor{stringliteral}{"A scaling factor for the roughness amplitude with n"}//&
350                \textcolor{stringliteral}{"INT\_TIDE\_DISSIPATION."},  units=\textcolor{stringliteral}{"nondim"}, default=1.0)
351   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TKE\_ITIDE\_MAX"}, cs%TKE\_itide\_max, &
352                \textcolor{stringliteral}{"The maximum internal tide energy source available to mix "}//&
353                \textcolor{stringliteral}{"above the bottom boundary layer with INT\_TIDE\_DISSIPATION."}, &
354                units=\textcolor{stringliteral}{"W m-2"}, default=1.0e3, scale=us%W\_m2\_to\_RZ3\_T3)
355 
356   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"READ\_TIDEAMP"}, read\_tideamp, &
357                \textcolor{stringliteral}{"If true, read a file (given by TIDEAMP\_FILE) containing "}//&
358                \textcolor{stringliteral}{"the tidal amplitude with INT\_TIDE\_DISSIPATION."}, default=.false.)
359   \textcolor{keywordflow}{if} (read\_tideamp) \textcolor{keywordflow}{then}
360     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TIDEAMP\_FILE"}, tideamp\_file, &
361                \textcolor{stringliteral}{"The path to the file containing the spatially varying "}//&
362                \textcolor{stringliteral}{"tidal amplitudes with INT\_TIDE\_DISSIPATION."}, default=\textcolor{stringliteral}{"tideamp.nc"})
363     filename = trim(cs%inputdir) // trim(tideamp\_file)
364     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/TIDEAMP\_FILE"}, filename)
365     \textcolor{keyword}{call }mom\_read\_data(filename, \textcolor{stringliteral}{'tideamp'}, itide%tideamp, g%domain, timelevel=1, scale=us%m\_s\_to\_L\_T)
366 \textcolor{keywordflow}{  endif}
367 
368   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"H2\_FILE"}, h2\_file, &
369                \textcolor{stringliteral}{"The path to the file containing the sub-grid-scale "}//&
370                \textcolor{stringliteral}{"topographic roughness amplitude with INT\_TIDE\_DISSIPATION."}, &
371                fail\_if\_missing=.true.)
372   filename = trim(cs%inputdir) // trim(h2\_file)
373   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/H2\_FILE"}, filename)
374   \textcolor{keyword}{call }mom\_read\_data(filename, \textcolor{stringliteral}{'h2'}, itide%h2, g%domain, timelevel=1, scale=us%m\_to\_Z**2)
375 
376   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"FRACTIONAL\_ROUGHNESS\_MAX"}, max\_frac\_rough, &
377                  \textcolor{stringliteral}{"The maximum topographic roughness amplitude as a fraction of the mean depth, "}//&
378                  \textcolor{stringliteral}{"or a negative value for no limitations on roughness."}, &
379                  units=\textcolor{stringliteral}{"nondim"}, default=0.1)
380 
381   \textcolor{comment}{! The following parameters are used in testing the internal tide code.}
382   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INTERNAL\_TIDE\_SOURCE\_TEST"}, cs%int\_tide\_source\_test, &
383                  \textcolor{stringliteral}{"If true, apply an arbitrary generation site for internal tide testing"}, &
384                  default=.false.)
385   \textcolor{keywordflow}{if} (cs%int\_tide\_source\_test)\textcolor{keywordflow}{then}
386     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INTERNAL\_TIDE\_SOURCE\_X"}, cs%int\_tide\_source\_x, &
387                  \textcolor{stringliteral}{"X Location of generation site for internal tide"}, default=1.)
388     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INTERNAL\_TIDE\_SOURCE\_Y"}, cs%int\_tide\_source\_y, &
389                  \textcolor{stringliteral}{"Y Location of generation site for internal tide"}, default=1.)
390     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INTERNAL\_TIDE\_SOURCE\_TLEN\_DAYS"}, tlen\_days, &
391                  \textcolor{stringliteral}{"Time interval from start of experiment for adding wave source"}, &
392                  units=\textcolor{stringliteral}{"days"}, default=0)
393     cs%time\_max\_source = time + set\_time(0, days=tlen\_days)
394 \textcolor{keywordflow}{  endif}
395 
396   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
397     mask\_itidal = 1.0
398     \textcolor{keywordflow}{if} (g%bathyT(i,j) < min\_zbot\_itides) mask\_itidal = 0.0
399 
400     itide%tideamp(i,j) = itide%tideamp(i,j) * mask\_itidal * g%mask2dT(i,j)
401 
402     \textcolor{comment}{! Restrict rms topo to a fraction (often 10 percent) of the column depth.}
403     \textcolor{keywordflow}{if} (max\_frac\_rough >= 0.0) &
404       itide%h2(i,j) = min((max\_frac\_rough*g%bathyT(i,j))**2, itide%h2(i,j))
405 
406     \textcolor{comment}{! Compute the fixed part of internal tidal forcing; units are [R Z3 T-2 ~> J m-2] here.}
407     cs%TKE\_itidal\_coef(i,j) = 0.5*us%L\_to\_Z*kappa\_h2\_factor*gv%Rho0*&
408          kappa\_itides * itide%h2(i,j) * itide%tideamp(i,j)**2
409 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
410 
411 
412   cs%id\_TKE\_itidal = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'},\textcolor{stringliteral}{'TKE\_itidal\_itide'},diag%axesT1,time, &
413       \textcolor{stringliteral}{'Internal Tide Driven Turbulent Kinetic Energy'}, &
414       \textcolor{stringliteral}{'W m-2'}, conversion=us%RZ3\_T3\_to\_W\_m2)
415 
416   cs%id\_Nb = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'},\textcolor{stringliteral}{'Nb\_itide'},diag%axesT1,time, &
417        \textcolor{stringliteral}{'Bottom Buoyancy Frequency'}, \textcolor{stringliteral}{'s-1'}, conversion=us%s\_to\_T)
418 
419   cs%id\_N2\_bot = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'},\textcolor{stringliteral}{'N2\_b\_itide'},diag%axesT1,time, &
420        \textcolor{stringliteral}{'Bottom Buoyancy frequency squared'}, \textcolor{stringliteral}{'s-2'}, conversion=us%s\_to\_T**2)
421 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__int__tide__input_a33db0008342a1b2af532fa9501296d81}\label{namespacemom__int__tide__input_a33db0008342a1b2af532fa9501296d81}} 
\index{mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}!set\+\_\+int\+\_\+tide\+\_\+input@{set\+\_\+int\+\_\+tide\+\_\+input}}
\index{set\+\_\+int\+\_\+tide\+\_\+input@{set\+\_\+int\+\_\+tide\+\_\+input}!mom\+\_\+int\+\_\+tide\+\_\+input@{mom\+\_\+int\+\_\+tide\+\_\+input}}
\subsubsection{\texorpdfstring{set\+\_\+int\+\_\+tide\+\_\+input()}{set\_int\_tide\_input()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+int\+\_\+tide\+\_\+input\+::set\+\_\+int\+\_\+tide\+\_\+input (\begin{DoxyParamCaption}\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{u,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{v,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{type(forcing), intent(in)}]{fluxes,  }\item[{type(\hyperlink{structmom__int__tide__input_1_1int__tide__input__type}{int\+\_\+tide\+\_\+input\+\_\+type}), intent(inout)}]{itide,  }\item[{real, intent(in)}]{dt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structmom__int__tide__input_1_1int__tide__input__cs}{int\+\_\+tide\+\_\+input\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Sets the model-\/state dependent internal tide energy sources. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}\\
\hline
\mbox{\tt in}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em tv} & A structure containing pointers to the thermodynamic fields\\
\hline
\mbox{\tt in}  & {\em fluxes} & A structure of thermodynamic surface fluxes\\
\hline
\mbox{\tt in,out}  & {\em itide} & A structure containing fields related to the internal tide sources.\\
\hline
\mbox{\tt in}  & {\em dt} & The time increment \mbox{[}T $\sim$$>$ s\mbox{]}.\\
\hline
 & {\em cs} & This module\textquotesingle{}s control structure. \\
\hline
\end{DoxyParams}


Definition at line 75 of file M\+O\+M\+\_\+internal\+\_\+tide\+\_\+input.\+F90.


\begin{DoxyCode}
75   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{  !< The ocean's grid structure}
76   \textcolor{keywordtype}{type}(verticalgrid\_type),                   \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{ !< The ocean's vertical grid structure}
77   \textcolor{keywordtype}{type}(unit\_scale\_type),                     \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{ !< A dimensional unit scaling type}
78   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}    :: u\textcolor{comment}{  !< The zonal velocity [L T-1 ~> m s-1]}
79   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}    :: v\textcolor{comment}{  !< The meridional velocity [L T-1 ~> m
       s-1]}
80   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thicknesses [H ~> m or kg m-2]}
81   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                     \textcolor{keywordtype}{intent(in)}    :: tv\textcolor{comment}{ !< A structure containing pointers to the}
82 \textcolor{comment}{                                                                 !! thermodynamic fields}
83   \textcolor{keywordtype}{type}(forcing),                             \textcolor{keywordtype}{intent(in)}    :: fluxes\textcolor{comment}{ !< A structure of thermodynamic
       surface fluxes}
84   \textcolor{keywordtype}{type}(int\_tide\_input\_type),                 \textcolor{keywordtype}{intent(inout)} :: itide\textcolor{comment}{ !< A structure containing fields
       related}
85 \textcolor{comment}{                                                                 !! to the internal tide sources.}
86   \textcolor{keywordtype}{real},                                      \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{ !< The time increment [T ~> s].}
87   \textcolor{keywordtype}{type}(int\_tide\_input\_cs),                   \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{ !< This module's control structure.}
88   \textcolor{comment}{! Local variables}
89   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))} :: &
90     n2\_bot        \textcolor{comment}{! The bottom squared buoyancy frequency [T-2 ~> s-2].}
91 
92   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: &
93     t\_f, s\_f      \textcolor{comment}{! The temperature and salinity in [degC] and [ppt] with the values in}
94                   \textcolor{comment}{! the massless layers filled vertically by diffusion.}
95   \textcolor{keywordtype}{logical} :: use\_eos    \textcolor{comment}{! If true, density is calculated from T & S using an}
96                         \textcolor{comment}{! equation of state.}
97   \textcolor{keywordtype}{logical} :: avg\_enabled  \textcolor{comment}{! for testing internal tides (BDM)}
98   \textcolor{keywordtype}{type}(time\_type) :: time\_end\textcolor{comment}{        !< For use in testing internal tides (BDM)}
99 
100   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, isd, ied, jsd, jed
101 
102   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
103   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
104 
105   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"set\_diffusivity: "}//&
106          \textcolor{stringliteral}{"Module must be initialized before it is used."})
107 
108   use\_eos = \textcolor{keyword}{associated}(tv%eqn\_of\_state)
109 
110   \textcolor{comment}{! Smooth the properties through massless layers.}
111   \textcolor{keywordflow}{if} (use\_eos) \textcolor{keywordflow}{then}
112     \textcolor{keyword}{call }vert\_fill\_ts(h, tv%T, tv%S, cs%kappa\_fill*dt, t\_f, s\_f, g, gv, larger\_h\_denom=.true.)
113 \textcolor{keywordflow}{  endif}
114 
115   \textcolor{keyword}{call }find\_n2\_bottom(h, tv, t\_f, s\_f, itide%h2, fluxes, g, gv, us, n2\_bot)
116 
117   \textcolor{comment}{!$OMP parallel do default(shared)}
118   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
119     itide%Nb(i,j) = g%mask2dT(i,j) * sqrt(n2\_bot(i,j))
120     itide%TKE\_itidal\_input(i,j) = min(cs%TKE\_itidal\_coef(i,j)*itide%Nb(i,j), cs%TKE\_itide\_max)
121 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
122 
123   \textcolor{keywordflow}{if} (cs%int\_tide\_source\_test) \textcolor{keywordflow}{then}
124     itide%TKE\_itidal\_input(:,:) = 0.0
125     avg\_enabled = query\_averaging\_enabled(cs%diag, time\_end=time\_end)
126     \textcolor{keywordflow}{if} (time\_end <= cs%time\_max\_source) \textcolor{keywordflow}{then}
127       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
128         \textcolor{comment}{! Input  an arbitrary energy point source.id\_}
129         \textcolor{keywordflow}{if} (((g%geoLonCu(i-1,j)-cs%int\_tide\_source\_x) * (g%geoLonBu(i,j)-cs%int\_tide\_source\_x) <= 0.0) 
      .and. &
130             ((g%geoLatCv(i,j-1)-cs%int\_tide\_source\_y) * (g%geoLatCv(i,j)-cs%int\_tide\_source\_y) <= 0.0)) \textcolor{keywordflow}{
      then}
131           itide%TKE\_itidal\_input(i,j) = 1.0*us%kg\_m3\_to\_R*us%m\_to\_Z**3*us%T\_to\_s**3
132 \textcolor{keywordflow}{        endif}
133 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
134 \textcolor{keywordflow}{    endif}
135 \textcolor{keywordflow}{  endif}
136 
137   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
138     \textcolor{keyword}{call }hchksum(n2\_bot,\textcolor{stringliteral}{"N2\_bot"},g%HI,haloshift=0, scale=us%s\_to\_T**2)
139     \textcolor{keyword}{call }hchksum(itide%TKE\_itidal\_input,\textcolor{stringliteral}{"TKE\_itidal\_input"},g%HI,haloshift=0, &
140                  scale=us%RZ3\_T3\_to\_W\_m2)
141 \textcolor{keywordflow}{  endif}
142 
143   \textcolor{keywordflow}{if} (cs%id\_TKE\_itidal > 0) \textcolor{keyword}{call }post\_data(cs%id\_TKE\_itidal, itide%TKE\_itidal\_input, cs%diag)
144   \textcolor{keywordflow}{if} (cs%id\_Nb > 0) \textcolor{keyword}{call }post\_data(cs%id\_Nb, itide%Nb, cs%diag)
145   \textcolor{keywordflow}{if} (cs%id\_N2\_bot > 0 ) \textcolor{keyword}{call }post\_data(cs%id\_N2\_bot, n2\_bot, cs%diag)
146 
\end{DoxyCode}
