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


\doxysubsection{Detailed Description}
Forcing for the idealized hurricane and S\+C\+M\+\_\+idealized\+\_\+hurricane examples. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\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}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\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 \mbox{\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 \mbox{\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 \mbox{\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}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}\label{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}} 
character(len=40) \mbox{\hyperlink{namespaceidealized__hurricane_ab00b0e78aa89c5166eaddf09850bf04a}{mdl}} = \char`\"{}idealized\+\_\+hurricane\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{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}}
\doxysubsubsection{\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(\mbox{\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{\texttt{ in}}  & {\em sfc\+\_\+state} & Surface state structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in}}  & {\em day} & Time in days \\
\hline
\mbox{\texttt{ in,out}}  & {\em g} & Grid structure \\
\hline
\mbox{\texttt{ 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 208 of file Idealized\+\_\+\+Hurricane.\+F90.


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


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


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


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


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


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


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

\end{DoxyCode}
