\hypertarget{namespaceidealized__hurricane}{}\section{idealized\+\_\+hurricane Module Reference}
\label{namespaceidealized__hurricane}\index{idealized\+\_\+hurricane@{idealized\+\_\+hurricane}}


\subsection{Detailed Description}
Forcing for the idealized hurricane and S\+C\+M\+\_\+idealized\+\_\+hurricane examples. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structidealized__hurricane_1_1idealized__hurricane__cs}{idealized\+\_\+hurricane\+\_\+cs}
\begin{DoxyCompactList}\small\item\em Container for parameters describing idealized wind structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespaceidealized__hurricane_ac4f888915491b3415da1fa457e5a2996}{idealized\+\_\+hurricane\+\_\+wind\+\_\+init} (Time, G, US, param\+\_\+file, CS)
\begin{DoxyCompactList}\small\item\em Initializes wind profile for the S\+CM idealized hurricane example. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespaceidealized__hurricane_a4474412268bd5b8b4d419d7f5d2ad621}{idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing} (sfc\+\_\+state, forces, day, G, US, CS)
\begin{DoxyCompactList}\small\item\em Computes the surface wind for the idealized hurricane test cases. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespaceidealized__hurricane_a9f7ebac8b7768ca2bd577179c596a93e}{idealized\+\_\+hurricane\+\_\+wind\+\_\+profile} (CS, US, absf, YY, XX, U\+O\+CN, V\+O\+CN, Tx, Ty)
\begin{DoxyCompactList}\small\item\em Calculate the wind speed at a location as a function of time. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespaceidealized__hurricane_ab2c6ed6b1c15a8c0c860157cb3de1efd}{scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing} (sfc\+\_\+state, forces, day, G, US, CS)
\begin{DoxyCompactList}\small\item\em This subroutine is primarily needed as a legacy for reproducing answers. It is included as an additional subroutine rather than padded into the previous routine with flags to ease its eventual removal. Its functionality is replaced with the new routines and it can be deleted when answer changes are acceptable. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}\label{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}} 
character(len=40) \hyperlink{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}{mdl} = \char`\"{}idealized\+\_\+hurricane\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespaceidealized__hurricane_a4474412268bd5b8b4d419d7f5d2ad621}\label{namespaceidealized__hurricane_a4474412268bd5b8b4d419d7f5d2ad621}} 
\index{idealized\+\_\+hurricane@{idealized\+\_\+hurricane}!idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing@{idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing}}
\index{idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing@{idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing}!idealized\+\_\+hurricane@{idealized\+\_\+hurricane}}
\subsubsection{\texorpdfstring{idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing()}{idealized\_hurricane\_wind\_forcing()}}
{\footnotesize\ttfamily subroutine, public idealized\+\_\+hurricane\+::idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(surface), intent(in)}]{sfc\+\_\+state,  }\item[{type(mech\+\_\+forcing), intent(inout)}]{forces,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structidealized__hurricane_1_1idealized__hurricane__cs}{idealized\+\_\+hurricane\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Computes the surface wind for the idealized hurricane test cases. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em sfc\+\_\+state} & Surface state structure\\
\hline
\mbox{\tt in,out}  & {\em forces} & A structure with the driving mechanical forces\\
\hline
\mbox{\tt in}  & {\em day} & Time in days\\
\hline
\mbox{\tt in,out}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & Container for idealized hurricane parameters \\
\hline
\end{DoxyParams}
Compute storm center location

Computes taux

Computes tauy

Get Ustar 

Definition at line 209 of file Idealized\+\_\+\+Hurricane.\+F90.


\begin{DoxyCode}
209   \textcolor{keywordtype}{type}(surface),                \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{  !< Surface state structure}
210   \textcolor{keywordtype}{type}(mech\_forcing),           \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
211   \textcolor{keywordtype}{type}(time\_type),              \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Time in days}
212   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{intent(inout)} :: g\textcolor{comment}{      !< Grid structure}
213   \textcolor{keywordtype}{type}(unit\_scale\_type),        \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
214   \textcolor{keywordtype}{type}(idealized\_hurricane\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{     !< Container for idealized hurricane parameters}
215 
216   \textcolor{comment}{! Local variables}
217   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isq, ieq, jsq, jeq
218   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, isdb, iedb, jsdb, jedb
219 
220   \textcolor{keywordtype}{real} :: tx, ty\textcolor{comment}{      !< wind stress components [R L Z T-2 ~> Pa]}
221   \textcolor{keywordtype}{real} :: uocn, vocn\textcolor{comment}{  !< Surface ocean velocity components [L T-1 ~> m s-1]}
222   \textcolor{keywordtype}{real} :: yy, xx\textcolor{comment}{      !< storm relative position [L ~> m]}
223   \textcolor{keywordtype}{real} :: xc, yc\textcolor{comment}{      !< Storm center location [L ~> m]}
224   \textcolor{keywordtype}{real} :: f\_local\textcolor{comment}{     !< Local Coriolis parameter [T-1 ~> s-1]}
225   \textcolor{keywordtype}{real} :: fbench\textcolor{comment}{      !< The benchmark 'f' value [T-1 ~> s-1]}
226   \textcolor{keywordtype}{real} :: fbench\_fac\textcolor{comment}{  !< A factor that is set to 0 to use the}
227 \textcolor{comment}{                      !!  benchmark 'f' value [nondim]}
228   \textcolor{keywordtype}{real} :: rel\_tau\_fac\textcolor{comment}{ !< A factor that is set to 0 to disable}
229 \textcolor{comment}{                      !!  current relative stress calculation [nondim]}
230 
231   \textcolor{comment}{! Bounds for loops and memory allocation}
232   is = g%isc    ; ie = g%iec    ; js = g%jsc    ; je = g%jec
233   isq = g%IscB  ; ieq = g%IecB  ; jsq = g%JscB  ; jeq = g%JecB
234   isd = g%isd   ; ied = g%ied   ; jsd = g%jsd   ; jed = g%jed
235   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
236 
237   \textcolor{comment}{! Allocate the forcing arrays, if necessary.}
238   \textcolor{keyword}{call }allocate\_mech\_forcing(g, forces, stress=.true., ustar=.true.)
239 
240   \textcolor{keywordflow}{if} (cs%relative\_tau) \textcolor{keywordflow}{then}
241      rel\_tau\_fac = 1.
242   \textcolor{keywordflow}{else}
243      rel\_tau\_fac = 0. \textcolor{comment}{!Multiplied to 0 surface current}
244 \textcolor{keywordflow}{  endif}
245 \textcolor{comment}{}
246 \textcolor{comment}{  !> Compute storm center location}
247   xc = cs%Hurr\_cen\_X0 + (time\_type\_to\_real(day)*us%s\_to\_T * cs%hurr\_translation\_spd * &
248        cos(cs%hurr\_translation\_dir))
249   yc = cs%Hurr\_cen\_Y0 + (time\_type\_to\_real(day)*us%s\_to\_T * cs%hurr\_translation\_spd * &
250        sin(cs%hurr\_translation\_dir))
251 
252 
253   \textcolor{keywordflow}{if} (cs%BR\_Bench) \textcolor{keywordflow}{then}
254     \textcolor{comment}{! f reset to value used in generated wind for benchmark test}
255     fbench = 5.5659e-05 * us%T\_to\_s
256     fbench\_fac = 0.0
257   \textcolor{keywordflow}{else}
258     fbench = 0.0
259     fbench\_fac = 1.0
260 \textcolor{keywordflow}{  endif}
261 \textcolor{comment}{}
262 \textcolor{comment}{  !> Computes taux}
263   \textcolor{keywordflow}{do} j=js,je
264     \textcolor{keywordflow}{do} i=is-1,ieq
265       uocn = sfc\_state%u(i,j) * rel\_tau\_fac
266       \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
267         vocn = 0.25*(sfc\_state%v(i,j)+sfc\_state%v(i+1,j-1)&
268                     +sfc\_state%v(i+1,j)+sfc\_state%v(i,j-1))*rel\_tau\_fac
269       \textcolor{keywordflow}{else}
270         vocn =0.25*((sfc\_state%v(i,j)+sfc\_state%v(i+1,j-1)) +&
271                     (sfc\_state%v(i+1,j)+sfc\_state%v(i,j-1))) * rel\_tau\_fac
272 \textcolor{keywordflow}{      endif}
273       f\_local = abs(0.5*(g%CoriolisBu(i,j)+g%CoriolisBu(i,j-1)))*fbench\_fac + fbench
274       \textcolor{comment}{! Calculate position as a function of time.}
275       \textcolor{keywordflow}{if} (cs%SCM\_mode) \textcolor{keywordflow}{then}
276         yy = yc + cs%dy\_from\_center
277         xx = xc
278       \textcolor{keywordflow}{else}
279         yy = g%geoLatCu(i,j)*1000.*us%m\_to\_L - yc
280         xx = g%geoLonCu(i,j)*1000.*us%m\_to\_L - xc
281 \textcolor{keywordflow}{      endif}
282       \textcolor{keyword}{call }idealized\_hurricane\_wind\_profile(cs, us, f\_local, yy, xx, uocn, vocn, tx, ty)
283       forces%taux(i,j) = g%mask2dCu(i,j) * tx
284 \textcolor{keywordflow}{    enddo}
285 \textcolor{keywordflow}{  enddo}\textcolor{comment}{}
286 \textcolor{comment}{  !> Computes tauy}
287   \textcolor{keywordflow}{do} j=js-1,jeq
288     \textcolor{keywordflow}{do} i=is,ie
289       \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
290         uocn = 0.25*(sfc\_state%u(i,j)+sfc\_state%u(i-1,j+1) + &
291                      sfc\_state%u(i-1,j)+sfc\_state%u(i,j+1))*rel\_tau\_fac
292       \textcolor{keywordflow}{else}
293         uocn = 0.25*((sfc\_state%u(i,j)+sfc\_state%u(i-1,j+1)) + &
294                      (sfc\_state%u(i-1,j)+sfc\_state%u(i,j+1))) * rel\_tau\_fac
295 \textcolor{keywordflow}{      endif}
296       vocn = sfc\_state%v(i,j) * rel\_tau\_fac
297       f\_local = abs(0.5*(g%CoriolisBu(i-1,j)+g%CoriolisBu(i,j)))*fbench\_fac + fbench
298       \textcolor{comment}{! Calculate position as a function of time.}
299       \textcolor{keywordflow}{if} (cs%SCM\_mode) \textcolor{keywordflow}{then}
300         yy = yc + cs%dy\_from\_center
301         xx = xc
302       \textcolor{keywordflow}{else}
303         yy = g%geoLatCv(i,j)*1000.*us%m\_to\_L - yc
304         xx = g%geoLonCv(i,j)*1000.*us%m\_to\_L - xc
305 \textcolor{keywordflow}{      endif}
306       \textcolor{keyword}{call }idealized\_hurricane\_wind\_profile(cs, us, f\_local, yy, xx, uocn, vocn, tx, ty)
307       forces%tauy(i,j) = g%mask2dCv(i,j) * ty
308 \textcolor{keywordflow}{    enddo}
309 \textcolor{keywordflow}{  enddo}
310 \textcolor{comment}{}
311 \textcolor{comment}{  !> Get Ustar}
312   \textcolor{keywordflow}{do} j=js,je
313     \textcolor{keywordflow}{do} i=is,ie
314       \textcolor{comment}{!  This expression can be changed if desired, but need not be.}
315       forces%ustar(i,j) = g%mask2dT(i,j) * sqrt(us%L\_to\_Z * (cs%gustiness/cs%Rho0 + &
316               sqrt(0.5*(forces%taux(i-1,j)**2 + forces%taux(i,j)**2) + &
317                    0.5*(forces%tauy(i,j-1)**2 + forces%tauy(i,j)**2))/cs%Rho0))
318 \textcolor{keywordflow}{    enddo}
319 \textcolor{keywordflow}{  enddo}
320 
321   \textcolor{keywordflow}{return}
\end{DoxyCode}
\mbox{\Hypertarget{namespaceidealized__hurricane_ac4f888915491b3415da1fa457e5a2996}\label{namespaceidealized__hurricane_ac4f888915491b3415da1fa457e5a2996}} 
\index{idealized\+\_\+hurricane@{idealized\+\_\+hurricane}!idealized\+\_\+hurricane\+\_\+wind\+\_\+init@{idealized\+\_\+hurricane\+\_\+wind\+\_\+init}}
\index{idealized\+\_\+hurricane\+\_\+wind\+\_\+init@{idealized\+\_\+hurricane\+\_\+wind\+\_\+init}!idealized\+\_\+hurricane@{idealized\+\_\+hurricane}}
\subsubsection{\texorpdfstring{idealized\+\_\+hurricane\+\_\+wind\+\_\+init()}{idealized\_hurricane\_wind\_init()}}
{\footnotesize\ttfamily subroutine, public idealized\+\_\+hurricane\+::idealized\+\_\+hurricane\+\_\+wind\+\_\+init (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\hyperlink{structidealized__hurricane_1_1idealized__hurricane__cs}{idealized\+\_\+hurricane\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Initializes wind profile for the S\+CM idealized hurricane example. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & Model time\\
\hline
\mbox{\tt in}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Input parameter structure\\
\hline
 & {\em cs} & Parameter container for this module \\
\hline
\end{DoxyParams}


Definition at line 96 of file Idealized\+\_\+\+Hurricane.\+F90.


\begin{DoxyCode}
96   \textcolor{keywordtype}{type}(time\_type),               \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{   !< Model time}
97   \textcolor{keywordtype}{type}(ocean\_grid\_type),         \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{      !< Grid structure}
98   \textcolor{keywordtype}{type}(unit\_scale\_type),         \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{     !< A dimensional unit scaling type}
99   \textcolor{keywordtype}{type}(param\_file\_type),         \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Input parameter structure}
100   \textcolor{keywordtype}{type}(idealized\_hurricane\_cs),  \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{     !< Parameter container for this module}
101 
102   \textcolor{comment}{! Local variables}
103   \textcolor{keywordtype}{real} :: dp  \textcolor{comment}{! The pressure difference across the hurricane [R L2 T-2 ~> Pa]}
104   \textcolor{keywordtype}{real} :: c
105   \textcolor{keywordtype}{logical} :: default\_2018\_answers \textcolor{comment}{! The default setting for the various 2018\_ANSWERS flags.}
106 
107   \textcolor{comment}{! This include declares and sets the variable "version".}
108 \textcolor{preprocessor}{# include "version\_variable.h"}
109 \textcolor{preprocessor}{}
110   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
111     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"idealized\_hurricane\_wind\_init called "}// &
112                           \textcolor{stringliteral}{"with an associated control structure."})
113     \textcolor{keywordflow}{return}
114 \textcolor{keywordflow}{  endif}
115 
116   \textcolor{keyword}{allocate}(cs)
117 
118   cs%pi = 4.0*atan(1.0)
119   cs%Deg2Rad = cs%pi/180.
120 
121   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
122   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
123 
124   \textcolor{comment}{! Parameters for computing a wind profile}
125   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_RHO\_AIR"}, cs%rho\_a, &
126                  \textcolor{stringliteral}{"Air density used to compute the idealized hurricane wind profile."}, &
127                  units=\textcolor{stringliteral}{'kg/m3'}, default=1.2, scale=us%kg\_m3\_to\_R)
128   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_AMBIENT\_PRESSURE"}, cs%pressure\_ambient, &
129                  \textcolor{stringliteral}{"Ambient pressure used in the idealized hurricane wind profile."}, &
130                  units=\textcolor{stringliteral}{'Pa'}, default=101200., scale=us%m\_s\_to\_L\_T**2*us%kg\_m3\_to\_R)
131   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_CENTRAL\_PRESSURE"}, cs%pressure\_central, &
132                  \textcolor{stringliteral}{"Central pressure used in the idealized hurricane wind profile."}, &
133                  units=\textcolor{stringliteral}{'Pa'}, default=96800., scale=us%m\_s\_to\_L\_T**2*us%kg\_m3\_to\_R)
134   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_RAD\_MAX\_WIND"}, &
135                  cs%rad\_max\_wind, \textcolor{stringliteral}{"Radius of maximum winds used in the "}//&
136                  \textcolor{stringliteral}{"idealized hurricane wind profile."}, units=\textcolor{stringliteral}{'m'}, &
137                  default=50.e3, scale=us%m\_to\_L)
138   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_MAX\_WIND"}, cs%max\_windspeed, &
139                  \textcolor{stringliteral}{"Maximum wind speed used in the idealized hurricane"}// &
140                  \textcolor{stringliteral}{"wind profile."}, units=\textcolor{stringliteral}{'m/s'}, default=65., scale=us%m\_s\_to\_L\_T)
141   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_TRAN\_SPEED"}, cs%hurr\_translation\_spd, &
142                  \textcolor{stringliteral}{"Translation speed of hurricane used in the idealized "}//&
143                  \textcolor{stringliteral}{"hurricane wind profile."}, units=\textcolor{stringliteral}{'m/s'}, default=5.0, scale=us%m\_s\_to\_L\_T)
144   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_TRAN\_DIR"}, cs%hurr\_translation\_dir, &
145                  \textcolor{stringliteral}{"Translation direction (towards) of hurricane used in the "}//&
146                  \textcolor{stringliteral}{"idealized hurricane wind profile."}, units=\textcolor{stringliteral}{'degrees'}, &
147                  default=180.0, scale=cs%Deg2Rad)
148   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_X0"}, cs%Hurr\_cen\_X0, &
149                  \textcolor{stringliteral}{"Idealized Hurricane initial X position"}, &
150                  units=\textcolor{stringliteral}{'m'}, default=0., scale=us%m\_to\_L)
151   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_Y0"}, cs%Hurr\_cen\_Y0, &
152                  \textcolor{stringliteral}{"Idealized Hurricane initial Y position"}, &
153                  units=\textcolor{stringliteral}{'m'}, default=0., scale=us%m\_to\_L)
154   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_TAU\_CURR\_REL"}, cs%relative\_tau, &
155                  \textcolor{stringliteral}{"Current relative stress switch "}//&
156                  \textcolor{stringliteral}{"used in the idealized hurricane wind profile."}, &
157                  units=\textcolor{stringliteral}{''}, default=.false.)
158 
159   \textcolor{comment}{! Parameters for SCM mode}
160   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_SCM\_BR\_BENCH"}, cs%BR\_BENCH, &
161                  \textcolor{stringliteral}{"Single column mode benchmark case switch, which is "}// &
162                  \textcolor{stringliteral}{"invoking a modification (bug) in the wind profile meant to "}//&
163                  \textcolor{stringliteral}{"reproduce a previous implementation."}, units=\textcolor{stringliteral}{''}, default=.false.)
164   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_SCM"}, cs%SCM\_MODE, &
165                  \textcolor{stringliteral}{"Single Column mode switch "}//&
166                  \textcolor{stringliteral}{"used in the SCM idealized hurricane wind profile."}, &
167                  units=\textcolor{stringliteral}{''}, default=.false.)
168   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_SCM\_LOCY"}, cs%dy\_from\_center, &
169                  \textcolor{stringliteral}{"Y distance of station used in the SCM idealized hurricane "}//&
170                  \textcolor{stringliteral}{"wind profile."}, units=\textcolor{stringliteral}{'m'}, default=50.e3, scale=us%m\_to\_L)
171   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEFAULT\_2018\_ANSWERS"}, default\_2018\_answers, &
172                  \textcolor{stringliteral}{"This sets the default value for the various \_2018\_ANSWERS parameters."}, &
173                  default=.false.)
174   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"IDL\_HURR\_2018\_ANSWERS"}, cs%answers\_2018, &
175                  \textcolor{stringliteral}{"If true, use expressions driving the idealized hurricane test case that recover "}//&
176                  \textcolor{stringliteral}{"the answers from the end of 2018.  Otherwise use expressions that are rescalable "}//&
177                  \textcolor{stringliteral}{"and respect rotational symmetry."}, default=default\_2018\_answers)
178 
179   \textcolor{comment}{! The following parameters are model run-time parameters which are used}
180   \textcolor{comment}{! and logged elsewhere and so should not be logged here. The default}
181   \textcolor{comment}{! value should be consistent with the rest of the model.}
182   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, cs%Rho0, &
183                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//&
184                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//&
185                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//&
186                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-2."}, &
187                  units=\textcolor{stringliteral}{"kg m-3"}, default=1035.0, scale=us%kg\_m3\_to\_R, do\_not\_log=.true.)
188   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GUST\_CONST"}, cs%gustiness, &
189                  \textcolor{stringliteral}{"The background gustiness in the winds."}, units=\textcolor{stringliteral}{"Pa"}, &
190                  default=0.0, scale=us%kg\_m3\_to\_R*us%m\_s\_to\_L\_T**2*us%L\_to\_Z, do\_not\_log=.true.)
191 
192   \textcolor{keywordflow}{if} (cs%BR\_BENCH) \textcolor{keywordflow}{then}
193     cs%rho\_a = 1.2*us%kg\_m3\_to\_R
194 \textcolor{keywordflow}{  endif}
195   dp = cs%pressure\_ambient - cs%pressure\_central
196   \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
197     c = cs%max\_windspeed / sqrt( us%R\_to\_kg\_m3 * dp )
198     cs%Holland\_B = c**2 * us%R\_to\_kg\_m3*cs%rho\_a * exp(1.0)
199   \textcolor{keywordflow}{else}
200     cs%Holland\_B = cs%max\_windspeed**2 * cs%rho\_a * exp(1.0) / dp
201 \textcolor{keywordflow}{  endif}
202   cs%Holland\_A = (us%L\_to\_m*cs%rad\_max\_wind)**cs%Holland\_B
203   cs%Holland\_AxBxDP = cs%Holland\_A*cs%Holland\_B*dp
204 
\end{DoxyCode}
\mbox{\Hypertarget{namespaceidealized__hurricane_a9f7ebac8b7768ca2bd577179c596a93e}\label{namespaceidealized__hurricane_a9f7ebac8b7768ca2bd577179c596a93e}} 
\index{idealized\+\_\+hurricane@{idealized\+\_\+hurricane}!idealized\+\_\+hurricane\+\_\+wind\+\_\+profile@{idealized\+\_\+hurricane\+\_\+wind\+\_\+profile}}
\index{idealized\+\_\+hurricane\+\_\+wind\+\_\+profile@{idealized\+\_\+hurricane\+\_\+wind\+\_\+profile}!idealized\+\_\+hurricane@{idealized\+\_\+hurricane}}
\subsubsection{\texorpdfstring{idealized\+\_\+hurricane\+\_\+wind\+\_\+profile()}{idealized\_hurricane\_wind\_profile()}}
{\footnotesize\ttfamily subroutine idealized\+\_\+hurricane\+::idealized\+\_\+hurricane\+\_\+wind\+\_\+profile (\begin{DoxyParamCaption}\item[{type(\hyperlink{structidealized__hurricane_1_1idealized__hurricane__cs}{idealized\+\_\+hurricane\+\_\+cs}), pointer}]{CS,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, intent(in)}]{absf,  }\item[{real, intent(in)}]{YY,  }\item[{real, intent(in)}]{XX,  }\item[{real, intent(in)}]{U\+O\+CN,  }\item[{real, intent(in)}]{V\+O\+CN,  }\item[{real, intent(out)}]{Tx,  }\item[{real, intent(out)}]{Ty }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calculate the wind speed at a location as a function of time. 


\begin{DoxyParams}[1]{Parameters}
 & {\em cs} & Container for idealized hurricane parameters\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em absf} & Input Coriolis magnitude \mbox{[}T-\/1 $\sim$$>$ s-\/1\mbox{]}\\
\hline
\mbox{\tt in}  & {\em yy} & Location in m relative to center y \mbox{[}L $\sim$$>$ m\mbox{]}\\
\hline
\mbox{\tt in}  & {\em xx} & Location in m relative to center x \mbox{[}L $\sim$$>$ m\mbox{]}\\
\hline
\mbox{\tt in}  & {\em uocn} & X surface current \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}\\
\hline
\mbox{\tt in}  & {\em vocn} & Y surface current \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}\\
\hline
\mbox{\tt out}  & {\em tx} & X stress \mbox{[}R L Z T-\/2 $\sim$$>$ Pa\mbox{]}\\
\hline
\mbox{\tt out}  & {\em ty} & Y stress \mbox{[}R L Z T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 326 of file Idealized\+\_\+\+Hurricane.\+F90.


\begin{DoxyCode}
326   \textcolor{comment}{! Author: Brandon Reichl}
327   \textcolor{comment}{! Date: Nov-20-2014}
328   \textcolor{comment}{!       Aug-14-2018 Generalized for non-SCM configuration}
329 
330   \textcolor{comment}{! Input parameters}
331   \textcolor{keywordtype}{type}(idealized\_hurricane\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{   !< Container for idealized hurricane parameters}
332   \textcolor{keywordtype}{type}(unit\_scale\_type),        \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
333   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: absf\textcolor{comment}{ !< Input Coriolis magnitude [T-1 ~> s-1]}
334   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: yy\textcolor{comment}{   !< Location in m relative to center y [L ~> m]}
335   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: xx\textcolor{comment}{   !< Location in m relative to center x [L ~> m]}
336   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: uocn\textcolor{comment}{ !< X surface current [L T-1 ~> m s-1]}
337   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: vocn\textcolor{comment}{ !< Y surface current [L T-1 ~> m s-1]}
338   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: tx\textcolor{comment}{   !< X stress [R L Z T-2 ~> Pa]}
339   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: ty\textcolor{comment}{   !< Y stress [R L Z T-2 ~> Pa]}
340 
341   \textcolor{comment}{! Local variables}
342 
343   \textcolor{comment}{! Wind profile terms}
344   \textcolor{keywordtype}{real} :: u10  \textcolor{comment}{! The 10 m wind speed [L T-1 ~> m s-1]}
345   \textcolor{keywordtype}{real} :: radius    \textcolor{comment}{! The distance from the hurricane center [L ~> m]}
346   \textcolor{keywordtype}{real} :: radius10  \textcolor{comment}{! 10 times the distance from the hurricane center [L ~> m]}
347   \textcolor{keywordtype}{real} :: radius\_km \textcolor{comment}{! The distance from the hurricane center, perhaps in km [L ~> m] or [1000 L ~> km]}
348   \textcolor{keywordtype}{real} :: radiusb
349   \textcolor{keywordtype}{real} :: tmp  \textcolor{comment}{! A temporary variable [R L T-1 ~> kg m-2 s-1]}
350   \textcolor{keywordtype}{real} :: du10 \textcolor{comment}{! The magnitude of the difference between the 10 m wind and the ocean flow [L T-1 ~> m s-1]}
351   \textcolor{keywordtype}{real} :: du   \textcolor{comment}{! The difference between the zonal 10 m wind and the zonal ocean flow [L T-1 ~> m s-1]}
352   \textcolor{keywordtype}{real} :: dv   \textcolor{comment}{! The difference between the meridional 10 m wind and the zonal ocean flow [L T-1 ~> m s-1]}
353   \textcolor{keywordtype}{real} :: cd
354 
355   \textcolor{comment}{!Wind angle variables}
356   \textcolor{keywordtype}{real} :: alph\textcolor{comment}{ !< The resulting inflow angle (positive outward)}
357   \textcolor{keywordtype}{real} :: rstr
358   \textcolor{keywordtype}{real} :: a0
359   \textcolor{keywordtype}{real} :: a1
360   \textcolor{keywordtype}{real} :: p1
361   \textcolor{keywordtype}{real} :: adir
362   \textcolor{keywordtype}{real} :: v\_ts \textcolor{comment}{! Meridional hurricane translation speed [L T-1 ~> m s-1]}
363   \textcolor{keywordtype}{real} :: u\_ts \textcolor{comment}{! Zonal hurricane translation speed [L T-1 ~> m s-1]}
364 
365   \textcolor{comment}{! Implementing Holland (1980) parameteric wind profile}
366 
367   radius = sqrt(xx**2 + yy**2)
368 
369   \textcolor{comment}{!/ BGR}
370   \textcolor{comment}{! rkm - r converted to km for Holland prof.}
371   \textcolor{comment}{!       used in km due to error, correct implementation should}
372   \textcolor{comment}{!       not need rkm, but to match winds w/ experiment this must}
373   \textcolor{comment}{!       be maintained.  Causes winds far from storm center to be a}
374   \textcolor{comment}{!       couple of m/s higher than the correct Holland prof.}
375   \textcolor{keywordflow}{if} (cs%BR\_Bench) \textcolor{keywordflow}{then}
376     radius\_km = radius/1000.
377   \textcolor{keywordflow}{else}
378     \textcolor{comment}{! if not comparing to benchmark, then use correct Holland prof.}
379     radius\_km = radius
380 \textcolor{keywordflow}{  endif}
381   radiusb = (us%L\_to\_m*radius)**cs%Holland\_B
382 
383   \textcolor{comment}{!/}
384   \textcolor{comment}{! Calculate U10 in the interior (inside of 10x radius of maximum wind),}
385   \textcolor{comment}{! while adjusting U10 to 0 outside of 12x radius of maximum wind.}
386   \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
387     \textcolor{keywordflow}{if} ( (radius > 0.001*cs%rad\_max\_wind) .and. (radius < 10.*cs%rad\_max\_wind) ) \textcolor{keywordflow}{then}
388       u10 = sqrt(cs%Holland\_AxBxDP*exp(-cs%Holland\_A/radiusb) / (cs%rho\_a*radiusb) + &
389                  0.25*(radius\_km*absf)**2) - 0.5*radius\_km*absf
390     \textcolor{keywordflow}{elseif} ( (radius > 10.*cs%rad\_max\_wind) .and. (radius < 15.*cs%rad\_max\_wind) ) \textcolor{keywordflow}{then}
391       radius10 = cs%rad\_max\_wind*10.
392       \textcolor{keywordflow}{if} (cs%BR\_Bench) \textcolor{keywordflow}{then}
393         radius\_km = radius10/1000.
394       \textcolor{keywordflow}{else}
395         radius\_km = radius10
396 \textcolor{keywordflow}{      endif}
397       radiusb = (us%L\_to\_m*radius10)**cs%Holland\_B
398 
399       u10 = (sqrt(cs%Holland\_AxBxDp*exp(-cs%Holland\_A/radiusb) / (cs%rho\_a*radiusb) + &
400                   0.25*(radius\_km*absf)**2) - 0.5*radius\_km*absf) &
401              * (15. - radius/cs%rad\_max\_wind)/5.
402     \textcolor{keywordflow}{else}
403       u10 = 0.
404 \textcolor{keywordflow}{    endif}
405   \textcolor{keywordflow}{else}  \textcolor{comment}{! This is mathematically equivalent to that is above but more accurate.}
406     \textcolor{keywordflow}{if} ( (radius > 0.001*cs%rad\_max\_wind) .and. (radius < 10.*cs%rad\_max\_wind) ) \textcolor{keywordflow}{then}
407       tmp = ( 0.5*radius\_km*absf) * (cs%rho\_a*radiusb)
408       u10 = (cs%Holland\_AxBxDP * exp(-cs%Holland\_A/radiusb)) / &
409             ( tmp + sqrt(cs%Holland\_AxBxDP*exp(-cs%Holland\_A/radiusb) * (cs%rho\_a*radiusb) + tmp**2) )
410     \textcolor{keywordflow}{elseif} ( (radius > 10.*cs%rad\_max\_wind) .and. (radius < 15.*cs%rad\_max\_wind) ) \textcolor{keywordflow}{then}
411       radius\_km = 10.0 * cs%rad\_max\_wind
412       \textcolor{keywordflow}{if} (cs%BR\_Bench) radius\_km = radius\_km/1000.
413       radiusb = (10.0*us%L\_to\_m*cs%rad\_max\_wind)**cs%Holland\_B
414       tmp = ( 0.5*radius\_km*absf) * (cs%rho\_a*radiusb)
415       u10 = (3.0 - radius/(5.0*cs%rad\_max\_wind)) * (cs%Holland\_AxBxDp*exp(-cs%Holland\_A/radiusb) ) / &
416             ( tmp + sqrt(cs%Holland\_AxBxDp*exp(-cs%Holland\_A/radiusb) * (cs%rho\_a*radiusb) + tmp**2) )
417     \textcolor{keywordflow}{else}
418       u10 = 0.0
419 \textcolor{keywordflow}{    endif}
420 \textcolor{keywordflow}{  endif}
421 
422   adir = atan2(yy,xx)
423 
424   \textcolor{comment}{!\(\backslash\)}
425 
426   \textcolor{comment}{! Wind angle model following Zhang and Ulhorn (2012)}
427   \textcolor{comment}{! ALPH is inflow angle positive outward.}
428   rstr = min(10., radius / cs%rad\_max\_wind)
429   a0 = -0.9*rstr - 0.09*us%L\_T\_to\_m\_s*cs%max\_windspeed - 14.33
430   a1 = -a0*(0.04*rstr + 0.05*us%L\_T\_to\_m\_s*cs%hurr\_translation\_spd + 0.14)
431   p1 = (6.88*rstr - 9.60*us%L\_T\_to\_m\_s*cs%hurr\_translation\_spd + 85.31) * cs%Deg2Rad
432   alph = a0 - a1*cos(cs%hurr\_translation\_dir-adir-p1)
433   \textcolor{keywordflow}{if} ( (radius > 10.*cs%rad\_max\_wind) .and.&
434        (radius < 15.*cs%rad\_max\_wind) ) \textcolor{keywordflow}{then}
435      alph = alph*(15.0 - radius/cs%rad\_max\_wind)/5.
436   \textcolor{keywordflow}{elseif} (radius > 15.*cs%rad\_max\_wind) \textcolor{keywordflow}{then}
437      alph = 0.0
438 \textcolor{keywordflow}{  endif}
439   alph = alph * cs%Deg2Rad
440 
441   \textcolor{comment}{! Calculate translation speed components}
442   u\_ts = cs%hurr\_translation\_spd * 0.5*cos(cs%hurr\_translation\_dir)
443   v\_ts = cs%hurr\_translation\_spd * 0.5*sin(cs%hurr\_translation\_dir)
444 
445   \textcolor{comment}{! Set output (relative) winds}
446   du = u10*sin(adir-cs%Pi-alph) - uocn + u\_ts
447   dv = u10*cos(adir-alph) - vocn + v\_ts
448 
449   \textcolor{comment}{!  Use a simple drag coefficient as a function of U10 (from Sullivan et al., 2010)}
450   du10 = sqrt(du**2+dv**2)
451   \textcolor{keywordflow}{if} (du10 < 11.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
452     cd = 1.2e-3
453   \textcolor{keywordflow}{elseif} (du10 < 20.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
454     \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
455       cd = (0.49 + 0.065*us%L\_T\_to\_m\_s*u10)*1.e-3
456     \textcolor{keywordflow}{else}
457       cd = (0.49 + 0.065*us%L\_T\_to\_m\_s*du10)*1.e-3
458 \textcolor{keywordflow}{    endif}
459   \textcolor{keywordflow}{else}
460     cd = 1.8e-3
461 \textcolor{keywordflow}{  endif}
462 
463   \textcolor{comment}{! Compute stress vector}
464   tx = us%L\_to\_Z * cs%rho\_a * cd * sqrt(du**2 + dv**2) * du
465   ty = us%L\_to\_Z * cs%rho\_a * cd * sqrt(du**2 + dv**2) * dv
466 
\end{DoxyCode}
\mbox{\Hypertarget{namespaceidealized__hurricane_ab2c6ed6b1c15a8c0c860157cb3de1efd}\label{namespaceidealized__hurricane_ab2c6ed6b1c15a8c0c860157cb3de1efd}} 
\index{idealized\+\_\+hurricane@{idealized\+\_\+hurricane}!scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing@{scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing}}
\index{scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing@{scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing}!idealized\+\_\+hurricane@{idealized\+\_\+hurricane}}
\subsubsection{\texorpdfstring{scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing()}{scm\_idealized\_hurricane\_wind\_forcing()}}
{\footnotesize\ttfamily subroutine, public idealized\+\_\+hurricane\+::scm\+\_\+idealized\+\_\+hurricane\+\_\+wind\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(surface), intent(in)}]{sfc\+\_\+state,  }\item[{type(mech\+\_\+forcing), intent(inout)}]{forces,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structidealized__hurricane_1_1idealized__hurricane__cs}{idealized\+\_\+hurricane\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine is primarily needed as a legacy for reproducing answers. It is included as an additional subroutine rather than padded into the previous routine with flags to ease its eventual removal. Its functionality is replaced with the new routines and it can be deleted when answer changes are acceptable. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em sfc\+\_\+state} & Surface state structure\\
\hline
\mbox{\tt in,out}  & {\em forces} & A structure with the driving mechanical forces\\
\hline
\mbox{\tt in}  & {\em day} & Time in days\\
\hline
\mbox{\tt in,out}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & Container for S\+CM parameters \\
\hline
\end{DoxyParams}


Definition at line 474 of file Idealized\+\_\+\+Hurricane.\+F90.


\begin{DoxyCode}
474   \textcolor{keywordtype}{type}(surface),                \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{  !< Surface state structure}
475   \textcolor{keywordtype}{type}(mech\_forcing),           \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
476   \textcolor{keywordtype}{type}(time\_type),              \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Time in days}
477   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{intent(inout)} :: g\textcolor{comment}{      !< Grid structure}
478   \textcolor{keywordtype}{type}(unit\_scale\_type),        \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
479   \textcolor{keywordtype}{type}(idealized\_hurricane\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{     !< Container for SCM parameters}
480   \textcolor{comment}{! Local variables}
481   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isq, ieq, jsq, jeq
482   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, isdb, iedb, jsdb, jedb
483   \textcolor{keywordtype}{real} :: pie, deg2rad
484   \textcolor{keywordtype}{real} :: du10 \textcolor{comment}{! The magnitude of the difference between the 10 m wind and the ocean flow [L T-1 ~> m s-1]}
485   \textcolor{keywordtype}{real} :: u10  \textcolor{comment}{! The 10 m wind speed [L T-1 ~> m s-1]}
486   \textcolor{keywordtype}{real} :: a, b, c \textcolor{comment}{! For wind profile expression}
487   \textcolor{keywordtype}{real} :: rad  \textcolor{comment}{! The distance from the hurricane center [L ~> m]}
488   \textcolor{keywordtype}{real} :: rkm  \textcolor{comment}{! The distance from the hurricane center, sometimes scaled to km [L ~> m] or [1000 L ~> km]}
489   \textcolor{keywordtype}{real} :: f\_local  \textcolor{comment}{! The local Coriolis parameter [T-1 ~> s-1]}
490   \textcolor{keywordtype}{real} :: xx  \textcolor{comment}{! x-position [L ~> m]}
491   \textcolor{keywordtype}{real} :: t0 \textcolor{comment}{!for location}
492   \textcolor{keywordtype}{real} :: dp  \textcolor{comment}{! The pressure difference across the hurricane [R L2 T-2 ~> Pa]}
493   \textcolor{keywordtype}{real} :: rb
494   \textcolor{keywordtype}{real} :: cd \textcolor{comment}{! Air-sea drag coefficient}
495   \textcolor{keywordtype}{real} :: uocn, vocn \textcolor{comment}{! Surface ocean velocity components [L T-1 ~> m s-1]}
496   \textcolor{keywordtype}{real} :: du, dv \textcolor{comment}{! Air-sea differential motion [L T-1 ~> m s-1]}
497   \textcolor{comment}{!Wind angle variables}
498   \textcolor{keywordtype}{real} :: alph,rstr, a0, a1, p1, adir, transdir
499   \textcolor{keywordtype}{real} :: v\_ts, u\_ts \textcolor{comment}{! Components of the translation speed [L T-1 ~> m s-1]}
500   \textcolor{keywordtype}{logical} :: br\_bench
501   \textcolor{comment}{! Bounds for loops and memory allocation}
502   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
503   isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
504   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
505   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
506 
507   \textcolor{comment}{! Allocate the forcing arrays, if necessary.}
508 
509   \textcolor{keyword}{call }allocate\_mech\_forcing(g, forces, stress=.true., ustar=.true.)
510   pie = 4.0*atan(1.0) ; deg2rad = pie/180.
511   \textcolor{comment}{!/ BR}
512   \textcolor{comment}{! Implementing Holland (1980) parameteric wind profile}
513   \textcolor{comment}{!------------------------------------------------------|}
514   br\_bench = .true.   \textcolor{comment}{!true if comparing to LES runs     |}
515   t0 = 129600.        \textcolor{comment}{!TC 'eye' crosses (0,0) at 36 hours|}
516   transdir = pie      \textcolor{comment}{!translation direction (-x)        |}
517   \textcolor{comment}{!------------------------------------------------------|}
518   dp = cs%pressure\_ambient - cs%pressure\_central
519   \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
520     c = cs%max\_windspeed / sqrt( us%R\_to\_kg\_m3*dp )
521     b = c**2 * us%R\_to\_kg\_m3*cs%rho\_a * exp(1.0)
522     \textcolor{keywordflow}{if} (br\_bench) \textcolor{keywordflow}{then} \textcolor{comment}{! rho\_a reset to value used in generated wind for benchmark test}
523        b = c**2 * 1.2 * exp(1.0)
524 \textcolor{keywordflow}{    endif}
525   \textcolor{keywordflow}{elseif} (br\_bench) \textcolor{keywordflow}{then} \textcolor{comment}{! rho\_a reset to value used in generated wind for benchmark test}
526     b = (cs%max\_windspeed**2 / dp ) * 1.2*us%kg\_m3\_to\_R * exp(1.0)
527   \textcolor{keywordflow}{else}
528     b = (cs%max\_windspeed**2 /dp ) * cs%rho\_a * exp(1.0)
529 \textcolor{keywordflow}{  endif}
530 
531   a = (us%L\_to\_m*cs%rad\_max\_wind / 1000.)**b
532   f\_local = g%CoriolisBu(is,js) \textcolor{comment}{! f=f(x,y) but in the SCM is constant}
533   \textcolor{keywordflow}{if} (br\_bench) \textcolor{keywordflow}{then}
534     \textcolor{comment}{! f reset to value used in generated wind for benchmark test}
535     f\_local = 5.5659e-05*us%T\_to\_s
536 \textcolor{keywordflow}{  endif}
537   \textcolor{comment}{!/ BR}
538   \textcolor{comment}{! Calculate x position as a function of time.}
539   xx = us%s\_to\_T*( t0 - time\_type\_to\_real(day)) * cs%hurr\_translation\_spd * cos(transdir)
540   rad = sqrt(xx**2 + cs%dy\_from\_center**2)
541   \textcolor{comment}{!/ BR}
542   \textcolor{comment}{! rkm - rad converted to km for Holland prof.}
543   \textcolor{comment}{!       used in km due to error, correct implementation should}
544   \textcolor{comment}{!       not need rkm, but to match winds w/ experiment this must}
545   \textcolor{comment}{!       be maintained.  Causes winds far from storm center to be a}
546   \textcolor{comment}{!       couple of m/s higher than the correct Holland prof.}
547   \textcolor{keywordflow}{if} (br\_bench) \textcolor{keywordflow}{then}
548      rkm = rad/1000.
549      rb = (us%L\_to\_m*rkm)**b
550   \textcolor{keywordflow}{else}
551      \textcolor{comment}{! if not comparing to benchmark, then use correct Holland prof.}
552      rkm = rad
553      rb = (us%L\_to\_m*rad)**b
554 \textcolor{keywordflow}{  endif}
555   \textcolor{comment}{!/ BR}
556   \textcolor{comment}{! Calculate U10 in the interior (inside of 10x radius of maximum wind),}
557   \textcolor{comment}{! while adjusting U10 to 0 outside of 12x radius of maximum wind.}
558   \textcolor{comment}{! Note that rho\_a is set to 1.2 following generated wind for experiment}
559   \textcolor{keywordflow}{if} (rad > 0.001*cs%rad\_max\_wind .AND. rad < 10.*cs%rad\_max\_wind) \textcolor{keywordflow}{then}
560     u10 = sqrt( a*b*dp*exp(-a/rb)/(1.2*us%kg\_m3\_to\_R*rb) + 0.25*(rkm*f\_local)**2 ) - 0.5*rkm*f\_local
561   \textcolor{keywordflow}{elseif} (rad > 10.*cs%rad\_max\_wind .AND. rad < 12.*cs%rad\_max\_wind) \textcolor{keywordflow}{then}
562     rad=(cs%rad\_max\_wind)*10.
563     \textcolor{keywordflow}{if} (br\_bench) \textcolor{keywordflow}{then}
564        rkm = rad/1000.
565        rb = (us%L\_to\_m*rkm)**b
566     \textcolor{keywordflow}{else}
567        rkm = rad
568        rb = (us%L\_to\_m*rad)**b
569 \textcolor{keywordflow}{    endif}
570     u10 = ( sqrt( a*b*dp*exp(-a/rb)/(1.2*us%kg\_m3\_to\_R*rb) + 0.25*(rkm*f\_local)**2 ) - 0.5*rkm*f\_local) &
571           * (12. - rad/cs%rad\_max\_wind)/2.
572   \textcolor{keywordflow}{else}
573     u10 = 0.
574 \textcolor{keywordflow}{  endif}
575   adir = atan2(cs%dy\_from\_center,xx)
576 
577   \textcolor{comment}{!/ BR}
578   \textcolor{comment}{! Wind angle model following Zhang and Ulhorn (2012)}
579   \textcolor{comment}{! ALPH is inflow angle positive outward.}
580   rstr = min(10., rad / cs%rad\_max\_wind)
581   a0 = -0.9*rstr - 0.09*us%L\_T\_to\_m\_s*cs%max\_windspeed - 14.33
582   a1 = -a0 *(0.04*rstr + 0.05*us%L\_T\_to\_m\_s*cs%hurr\_translation\_spd + 0.14)
583   p1 = (6.88*rstr - 9.60*us%L\_T\_to\_m\_s*cs%hurr\_translation\_spd + 85.31)*pie/180.
584   alph = a0 - a1*cos( (transdir - adir ) - p1)
585   \textcolor{keywordflow}{if} (rad > 10.*cs%rad\_max\_wind .AND. rad < 12.*cs%rad\_max\_wind) \textcolor{keywordflow}{then}
586     alph = alph* (12. - rad/cs%rad\_max\_wind)/2.
587   \textcolor{keywordflow}{elseif} (rad > 12.*cs%rad\_max\_wind) \textcolor{keywordflow}{then}
588     alph = 0.0
589 \textcolor{keywordflow}{  endif}
590   alph = alph * deg2rad
591  \textcolor{comment}{!/BR}
592   \textcolor{comment}{! Prepare for wind calculation}
593   \textcolor{comment}{! X\_TS is component of translation speed added to wind vector}
594   \textcolor{comment}{! due to background steering wind.}
595   u\_ts = cs%hurr\_translation\_spd*0.5*cos(transdir)
596   v\_ts = cs%hurr\_translation\_spd*0.5*sin(transdir)
597 
598   \textcolor{comment}{! Set the surface wind stresses, in [Pa]. A positive taux}
599   \textcolor{comment}{! accelerates the ocean to the (pseudo-)east.}
600   \textcolor{comment}{!   The i-loop extends to is-1 so that taux can be used later in the}
601   \textcolor{comment}{! calculation of ustar - otherwise the lower bound would be Isq.}
602   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is-1,ieq
603     \textcolor{comment}{!/BR}
604     \textcolor{comment}{! Turn off surface current for stress calculation to be}
605     \textcolor{comment}{! consistent with test case.}
606     uocn = 0. \textcolor{comment}{! sfc\_state%u(I,j)}
607     vocn = 0. \textcolor{comment}{! 0.25*( (sfc\_state%v(i,J) + sfc\_state%v(i+1,J-1)) + &}
608               \textcolor{comment}{!        (sfc\_state%v(i+1,J) + sfc\_state%v(i,J-1)) )}
609     \textcolor{comment}{!/BR}
610     \textcolor{comment}{! Wind vector calculated from location/direction (sin/cos flipped b/c}
611     \textcolor{comment}{! cyclonic wind is 90 deg. phase shifted from position angle).}
612     du = u10*sin(adir-pie-alph) - uocn + u\_ts
613     dv = u10*cos(adir-alph) - vocn + v\_ts
614     \textcolor{comment}{!/----------------------------------------------------|}
615     \textcolor{comment}{!BR}
616     \textcolor{comment}{!  Add a simple drag coefficient as a function of U10 |}
617     \textcolor{comment}{!/----------------------------------------------------|}
618     du10 = sqrt(du**2+dv**2)
619     \textcolor{keywordflow}{if} (du10 < 11.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
620       cd = 1.2e-3
621     \textcolor{keywordflow}{elseif} (du10 < 20.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
622       \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
623         cd = (0.49 + 0.065 * us%L\_T\_to\_m\_s*u10 )*0.001
624       \textcolor{keywordflow}{else}
625         cd = (0.49 + 0.065 * us%L\_T\_to\_m\_s*du10 )*0.001
626 \textcolor{keywordflow}{      endif}
627     \textcolor{keywordflow}{else}
628       cd = 0.0018
629 \textcolor{keywordflow}{    endif}
630     forces%taux(i,j) = cs%rho\_a * us%L\_to\_Z * g%mask2dCu(i,j) * cd*du10*du
631 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
632   \textcolor{comment}{!/BR}
633   \textcolor{comment}{! See notes above}
634   \textcolor{keywordflow}{do} j=js-1,jeq ; \textcolor{keywordflow}{do} i=is,ie
635     uocn = 0. \textcolor{comment}{! 0.25*( (sfc\_state%u(I,j) + sfc\_state%u(I-1,j+1)) + &}
636               \textcolor{comment}{!        (sfc\_state%u(I-1,j) + sfc\_state%u(I,j+1)) )}
637     vocn = 0. \textcolor{comment}{! sfc\_state%v(i,J)}
638     du = u10*sin(adir-pie-alph) - uocn + u\_ts
639     dv = u10*cos(adir-alph) - vocn + v\_ts
640     du10=sqrt(du**2+dv**2)
641     \textcolor{keywordflow}{if} (du10 < 11.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
642       cd = 1.2e-3
643     \textcolor{keywordflow}{elseif} (du10 < 20.0*us%m\_s\_to\_L\_T) \textcolor{keywordflow}{then}
644       \textcolor{keywordflow}{if} (cs%answers\_2018) \textcolor{keywordflow}{then}
645         cd = (0.49 + 0.065 * us%L\_T\_to\_m\_s*u10 )*0.001
646       \textcolor{keywordflow}{else}
647         cd = (0.49 + 0.065 * us%L\_T\_to\_m\_s*du10 )*0.001
648 \textcolor{keywordflow}{      endif}
649     \textcolor{keywordflow}{else}
650       cd = 0.0018
651 \textcolor{keywordflow}{    endif}
652     forces%tauy(i,j) = cs%rho\_a * us%L\_to\_Z * g%mask2dCv(i,j) * cd*du10*dv
653 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
654   \textcolor{comment}{! Set the surface friction velocity [Z T-1 ~> m s-1]. ustar is always positive.}
655   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
656     \textcolor{comment}{!  This expression can be changed if desired, but need not be.}
657     forces%ustar(i,j) = g%mask2dT(i,j) * sqrt(us%L\_to\_Z * (cs%gustiness/cs%Rho0 + &
658             sqrt(0.5*(forces%taux(i-1,j)**2 + forces%taux(i,j)**2) + &
659                  0.5*(forces%tauy(i,j-1)**2 + forces%tauy(i,j)**2))/cs%Rho0))
660 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
661 
\end{DoxyCode}
