\hypertarget{namespacemeso__surface__forcing}{}\section{meso\+\_\+surface\+\_\+forcing Module Reference}
\label{namespacemeso__surface__forcing}\index{meso\+\_\+surface\+\_\+forcing@{meso\+\_\+surface\+\_\+forcing}}


\subsection{Detailed Description}
Sets forcing for the M\+E\+SO configuration. 

Rewritten by Robert Hallberg, June 2009.

This file contains the subroutines that a user should modify to to set the surface wind stresses and fluxes of buoyancy or temperature and fresh water. They are called when the run-\/time parameters W\+I\+N\+D\+\_\+\+C\+O\+N\+F\+IG or B\+U\+O\+Y\+\_\+\+C\+O\+N\+F\+IG are set to \char`\"{}\+U\+S\+E\+R\char`\"{}. The standard version has simple examples, along with run-\/time error messages that will cause the model to abort if this code has not been modified. This code is intended for use with relatively simple specifications of the forcing. For more complicated forms, it is probably a good idea to read the forcing from input files using \char`\"{}file\char`\"{} for W\+I\+N\+D\+\_\+\+C\+O\+N\+F\+IG and B\+U\+O\+Y\+\_\+\+C\+O\+N\+F\+IG.

M\+E\+S\+O\+\_\+buoyancy forcing is used to set the surface buoyancy forcing, which may include a number of fresh water flux fields (evap, liq\+\_\+precip, froz\+\_\+precip, liq\+\_\+runoff, froz\+\_\+runoff, and vprec) and the surface heat fluxes (sw, lw, latent and sens) if temperature and salinity are state variables, or it may simply be the buoyancy flux if it is not. This routine also has coded a restoring to surface values of temperature and salinity. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmeso__surface__forcing_1_1meso__surface__forcing__cs}{meso\+\_\+surface\+\_\+forcing\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em This control structure is used to store parameters associated with the M\+E\+SO forcing. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemeso__surface__forcing_a004a1769318285d7d7ab0c51de8b1d77}{meso\+\_\+buoyancy\+\_\+forcing}} (sfc\+\_\+state, fluxes, day, dt, G, US, CS)
\begin{DoxyCompactList}\small\item\em This subroutine sets up the M\+E\+SO buoyancy forcing, which uses control-\/theory style specification restorative buoyancy fluxes at large scales. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemeso__surface__forcing_aff6ab2bfc61d73084c623d1654f85046}{meso\+\_\+surface\+\_\+forcing\+\_\+init}} (Time, G, US, param\+\_\+file, diag, CS)
\begin{DoxyCompactList}\small\item\em Initialize the M\+E\+SO surface forcing module. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemeso__surface__forcing_a2fc3c5390054b3d245f409a1ad34cea1}\label{namespacemeso__surface__forcing_a2fc3c5390054b3d245f409a1ad34cea1}} 
logical \mbox{\hyperlink{namespacemeso__surface__forcing_a2fc3c5390054b3d245f409a1ad34cea1}{first\+\_\+call}} = .true.
\begin{DoxyCompactList}\small\item\em True until after the first call to the M\+E\+SO forcing routines. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemeso__surface__forcing_a004a1769318285d7d7ab0c51de8b1d77}\label{namespacemeso__surface__forcing_a004a1769318285d7d7ab0c51de8b1d77}} 
\index{meso\+\_\+surface\+\_\+forcing@{meso\+\_\+surface\+\_\+forcing}!meso\+\_\+buoyancy\+\_\+forcing@{meso\+\_\+buoyancy\+\_\+forcing}}
\index{meso\+\_\+buoyancy\+\_\+forcing@{meso\+\_\+buoyancy\+\_\+forcing}!meso\+\_\+surface\+\_\+forcing@{meso\+\_\+surface\+\_\+forcing}}
\subsubsection{\texorpdfstring{meso\+\_\+buoyancy\+\_\+forcing()}{meso\_buoyancy\_forcing()}}
{\footnotesize\ttfamily subroutine, public meso\+\_\+surface\+\_\+forcing\+::meso\+\_\+buoyancy\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(surface), intent(inout)}]{sfc\+\_\+state,  }\item[{type(forcing), intent(inout)}]{fluxes,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{real, intent(in)}]{dt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmeso__surface__forcing_1_1meso__surface__forcing__cs}{meso\+\_\+surface\+\_\+forcing\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine sets up the M\+E\+SO buoyancy forcing, which uses control-\/theory style specification restorative buoyancy fluxes at large scales. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean.\\
\hline
\mbox{\tt in,out}  & {\em fluxes} & A structure containing thermodynamic forcing fields\\
\hline
\mbox{\tt in}  & {\em day} & The time of the fluxes\\
\hline
\mbox{\tt in}  & {\em dt} & The amount of time over which the fluxes apply \mbox{[}s\mbox{]}\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & A pointer to the control structure returned by a previous call to M\+E\+S\+O\+\_\+surface\+\_\+forcing\+\_\+init \\
\hline
\end{DoxyParams}


Definition at line 59 of file M\+E\+S\+O\+\_\+surface\+\_\+forcing.\+F90.


\begin{DoxyCode}
59   \textcolor{keywordtype}{type}(surface),                 \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}
60 \textcolor{comment}{                                                    !! describe the surface state of the ocean.}
61   \textcolor{keywordtype}{type}(forcing),                 \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing thermodynamic forcing
       fields}
62   \textcolor{keywordtype}{type}(time\_type),               \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{  !< The time of the fluxes}
63   \textcolor{keywordtype}{real},                          \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{   !< The amount of time over which}
64 \textcolor{comment}{                                                       !! the fluxes apply [s]}
65   \textcolor{keywordtype}{type}(ocean\_grid\_type),         \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure}
66   \textcolor{keywordtype}{type}(unit\_scale\_type),         \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
67   \textcolor{keywordtype}{type}(MESO\_surface\_forcing\_CS), \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< A pointer to the control structure returned by}
68 \textcolor{comment}{                                                       !! a previous call to MESO\_surface\_forcing\_init}
69 
70 \textcolor{comment}{!    When temperature is used, there are long list of fluxes that need to be}
71 \textcolor{comment}{!  set - essentially the same as for a full coupled model, but most of these}
72 \textcolor{comment}{!  can be simply set to zero.  The net fresh water flux should probably be}
73 \textcolor{comment}{!  set in fluxes%evap and fluxes%lprec, with any salinity restoring}
74 \textcolor{comment}{!  appearing in fluxes%vprec, and the other water flux components}
75 \textcolor{comment}{!  (fprec, lrunoff and frunoff) left as arrays full of zeros.}
76 \textcolor{comment}{!  Evap is usually negative and precip is usually positive.  All heat fluxes}
77 \textcolor{comment}{!  are in W m-2 and positive for heat going into the ocean.  All fresh water}
78 \textcolor{comment}{!  fluxes are in kg m-2 s-1 and positive for water moving into the ocean.}
79 
80   \textcolor{keywordtype}{real} :: Temp\_restore   \textcolor{comment}{! The temperature that is being restored toward [degC].}
81   \textcolor{keywordtype}{real} :: Salin\_restore  \textcolor{comment}{! The salinity that is being restored toward [ppt]}
82   \textcolor{keywordtype}{real} :: density\_restore  \textcolor{comment}{! The potential density that is being restored toward [R ~> kg m-3].}
83   \textcolor{keywordtype}{real} :: rhoXcp \textcolor{comment}{! The mean density times the heat capacity [Q R degC-1 ~> J m-3 degC-1].}
84   \textcolor{keywordtype}{real} :: buoy\_rest\_const  \textcolor{comment}{! A constant relating density anomalies to the}
85                            \textcolor{comment}{! restoring buoyancy flux [L2 T-3 R-1 ~> m5 s-3 kg-1].}
86 
87   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je
88   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed
89 
90   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
91   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
92 
93   \textcolor{comment}{!   When modifying the code, comment out this error message.  It is here}
94   \textcolor{comment}{! so that the original (unmodified) version is not accidentally used.}
95 
96   \textcolor{comment}{! Allocate and zero out the forcing arrays, as necessary.  This portion is}
97   \textcolor{comment}{! usually not changed.}
98   \textcolor{keywordflow}{if} (cs%use\_temperature) \textcolor{keywordflow}{then}
99     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%evap, isd, ied, jsd, jed)
100     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%lprec, isd, ied, jsd, jed)
101     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%fprec, isd, ied, jsd, jed)
102     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%lrunoff, isd, ied, jsd, jed)
103     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%frunoff, isd, ied, jsd, jed)
104     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%vprec, isd, ied, jsd, jed)
105 
106     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%sw, isd, ied, jsd, jed)
107     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%lw, isd, ied, jsd, jed)
108     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%latent, isd, ied, jsd, jed)
109     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%sens, isd, ied, jsd, jed)
110     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%heat\_content\_lprec, isd, ied, jsd, jed)
111   \textcolor{keywordflow}{else} \textcolor{comment}{! This is the buoyancy only mode.}
112     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%buoy, isd, ied, jsd, jed)
113 \textcolor{keywordflow}{  endif}
114 
115 
116   \textcolor{comment}{! MODIFY THE CODE IN THE FOLLOWING LOOPS TO SET THE BUOYANCY FORCING TERMS.}
117   \textcolor{keywordflow}{if} (cs%restorebuoy .and. first\_call) \textcolor{keywordflow}{then} \textcolor{comment}{!#CTRL# .or. associated(CS%ctrl\_forcing\_CSp)) then}
118     \textcolor{keyword}{call }safe\_alloc\_ptr(cs%T\_Restore, isd, ied, jsd, jed)
119     \textcolor{keyword}{call }safe\_alloc\_ptr(cs%S\_Restore, isd, ied, jsd, jed)
120     \textcolor{keyword}{call }safe\_alloc\_ptr(cs%Heat, isd, ied, jsd, jed)
121     \textcolor{keyword}{call }safe\_alloc\_ptr(cs%PmE, isd, ied, jsd, jed)
122     \textcolor{keyword}{call }safe\_alloc\_ptr(cs%Solar, isd, ied, jsd, jed)
123 
124     \textcolor{keyword}{call }mom\_read\_data(trim(cs%inputdir)//trim(cs%SSTrestore\_file), \textcolor{stringliteral}{"SST"}, &
125              cs%T\_Restore(:,:), g%Domain)
126     \textcolor{keyword}{call }mom\_read\_data(trim(cs%inputdir)//trim(cs%salinityrestore\_file), \textcolor{stringliteral}{"SAL"}, &
127              cs%S\_Restore(:,:), g%Domain)
128     \textcolor{keyword}{call }mom\_read\_data(trim(cs%inputdir)//trim(cs%heating\_file), \textcolor{stringliteral}{"Heat"}, &
129              cs%Heat(:,:), g%Domain, scale=us%W\_m2\_to\_QRZ\_T)
130     \textcolor{keyword}{call }mom\_read\_data(trim(cs%inputdir)//trim(cs%PmE\_file), \textcolor{stringliteral}{"PmE"}, &
131              cs%PmE(:,:), g%Domain, scale=us%m\_to\_Z*us%T\_to\_s)
132     \textcolor{keyword}{call }mom\_read\_data(trim(cs%inputdir)//trim(cs%Solar\_file), \textcolor{stringliteral}{"NET\_SOL"}, &
133              cs%Solar(:,:), g%Domain, scale=us%W\_m2\_to\_QRZ\_T)
134     first\_call = .false.
135 \textcolor{keywordflow}{  endif}
136 
137   \textcolor{keywordflow}{if} ( cs%use\_temperature ) \textcolor{keywordflow}{then}
138     \textcolor{comment}{! Set whichever fluxes are to be used here.  Any fluxes that}
139     \textcolor{comment}{! are always zero do not need to be changed here.}
140     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
141       \textcolor{comment}{! Fluxes of fresh water through the surface are in units of [kg m-2 s-1]}
142       \textcolor{comment}{! and are positive downward - i.e. evaporation should be negative.}
143       fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
144       fluxes%lprec(i,j) =  cs%PmE(i,j) * cs%Rho0 * g%mask2dT(i,j)
145 
146       \textcolor{comment}{! vprec will be set later, if it is needed for salinity restoring.}
147       fluxes%vprec(i,j) = 0.0
148 
149       \textcolor{comment}{!   Heat fluxes are in units of [Q R Z T-1 ~> W m-2] and are positive into the ocean.}
150       fluxes%lw(i,j)     = 0.0 * g%mask2dT(i,j)
151       fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
152       fluxes%sens(i,j)   = cs%Heat(i,j) * g%mask2dT(i,j)
153       fluxes%sw(i,j)     = cs%Solar(i,j) * g%mask2dT(i,j)
154 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
155   \textcolor{keywordflow}{else} \textcolor{comment}{! This is the buoyancy only mode.}
156     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
157       \textcolor{comment}{!   fluxes%buoy is the buoyancy flux into the ocean [L2 T-3 ~> m2 s-3].  A positive}
158       \textcolor{comment}{! buoyancy flux is of the same sign as heating the ocean.}
159       fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
160 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
161 \textcolor{keywordflow}{  endif}
162 
163   \textcolor{keywordflow}{if} (cs%restorebuoy) \textcolor{keywordflow}{then}
164     \textcolor{keywordflow}{if} (cs%use\_temperature) \textcolor{keywordflow}{then}
165       \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes%heat\_added, isd, ied, jsd, jed)
166       \textcolor{comment}{!   When modifying the code, comment out this error message.  It is here}
167       \textcolor{comment}{! so that the original (unmodified) version is not accidentally used.}
168 \textcolor{comment}{!      call MOM\_error(FATAL, "MESO\_buoyancy\_surface\_forcing: " // &}
169 \textcolor{comment}{!        "Temperature and salinity restoring used without modification." )}
170 
171       rhoxcp = cs%Rho0 * fluxes%C\_p
172       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
173         \textcolor{comment}{!   Set Temp\_restore and Salin\_restore to the temperature (in degC) and}
174         \textcolor{comment}{! salinity (in ppt or PSU) that are being restored toward.}
175         \textcolor{keywordflow}{if} (g%mask2dT(i,j) > 0) \textcolor{keywordflow}{then}
176           fluxes%heat\_added(i,j) = g%mask2dT(i,j) * &
177               ((cs%T\_Restore(i,j) - sfc\_state%SST(i,j)) * rhoxcp * cs%Flux\_const)
178           fluxes%vprec(i,j) = - (cs%Rho0 * cs%Flux\_const) * &
179               (cs%S\_Restore(i,j) - sfc\_state%SSS(i,j)) / &
180               (0.5*(sfc\_state%SSS(i,j) + cs%S\_Restore(i,j)))
181         \textcolor{keywordflow}{else}
182           fluxes%heat\_added(i,j) = 0.0
183           fluxes%vprec(i,j) = 0.0
184 \textcolor{keywordflow}{        endif}
185 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
186     \textcolor{keywordflow}{else}
187       \textcolor{comment}{!   When modifying the code, comment out this error message.  It is here}
188       \textcolor{comment}{! so that the original (unmodified) version is not accidentally used.}
189       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MESO\_buoyancy\_surface\_forcing: "} // &
190         \textcolor{stringliteral}{"Buoyancy restoring used without modification."} )
191 
192       \textcolor{comment}{! The -1 is because density has the opposite sign to buoyancy.}
193       buoy\_rest\_const = -1.0 * (cs%G\_Earth * cs%Flux\_const) / cs%Rho0
194       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
195        \textcolor{comment}{!   Set density\_restore to an expression for the surface potential}
196        \textcolor{comment}{! density [R ~> kg m-3] that is being restored toward.}
197         density\_restore = 1030.0 * us%kg\_m3\_to\_R
198 
199         fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy\_rest\_const * &
200                            (density\_restore - sfc\_state%sfc\_density(i,j))
201 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
202 \textcolor{keywordflow}{    endif}
203 \textcolor{keywordflow}{  endif}                                             \textcolor{comment}{! end RESTOREBUOY}
204 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemeso__surface__forcing_aff6ab2bfc61d73084c623d1654f85046}\label{namespacemeso__surface__forcing_aff6ab2bfc61d73084c623d1654f85046}} 
\index{meso\+\_\+surface\+\_\+forcing@{meso\+\_\+surface\+\_\+forcing}!meso\+\_\+surface\+\_\+forcing\+\_\+init@{meso\+\_\+surface\+\_\+forcing\+\_\+init}}
\index{meso\+\_\+surface\+\_\+forcing\+\_\+init@{meso\+\_\+surface\+\_\+forcing\+\_\+init}!meso\+\_\+surface\+\_\+forcing@{meso\+\_\+surface\+\_\+forcing}}
\subsubsection{\texorpdfstring{meso\+\_\+surface\+\_\+forcing\+\_\+init()}{meso\_surface\_forcing\_init()}}
{\footnotesize\ttfamily subroutine, public meso\+\_\+surface\+\_\+forcing\+::meso\+\_\+surface\+\_\+forcing\+\_\+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(diag\+\_\+ctrl), intent(inout), target}]{diag,  }\item[{type(\mbox{\hyperlink{structmeso__surface__forcing_1_1meso__surface__forcing__cs}{meso\+\_\+surface\+\_\+forcing\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Initialize the M\+E\+SO surface forcing module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & The current model time\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
\mbox{\tt in,out}  & {\em diag} & structure used to regulate diagnostic output\\
\hline
 & {\em cs} & A pointer that is set to point to the control structure for this module \\
\hline
\end{DoxyParams}


Definition at line 209 of file M\+E\+S\+O\+\_\+surface\+\_\+forcing.\+F90.


\begin{DoxyCode}
209 
210   \textcolor{keywordtype}{type}(time\_type),               \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{ !< The current model time}
211   \textcolor{keywordtype}{type}(ocean\_grid\_type),         \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure}
212   \textcolor{keywordtype}{type}(unit\_scale\_type),         \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
213   \textcolor{keywordtype}{type}(param\_file\_type),         \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-time
       parameters}
214   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target},       \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< structure used to regulate diagnostic output}
215   \textcolor{keywordtype}{type}(MESO\_surface\_forcing\_CS), \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< A pointer that is set to point to the}
216 \textcolor{comment}{                                                       !! control structure for this module}
217 
218 \textcolor{comment}{! This include declares and sets the variable "version".}
219 \textcolor{preprocessor}{#include "version\_variable.h"}
220 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MESO\_surface\_forcing"} \textcolor{comment}{! This module's name.}
221 
222   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
223     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"MESO\_surface\_forcing\_init called with an associated "}// &
224                              \textcolor{stringliteral}{"control structure."})
225     \textcolor{keywordflow}{return}
226 \textcolor{keywordflow}{  endif}
227   \textcolor{keyword}{allocate}(cs)
228   cs%diag => diag
229 
230   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
231   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
232   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ENABLE\_THERMODYNAMICS"}, cs%use\_temperature, &
233                  \textcolor{stringliteral}{"If true, Temperature and salinity are used as state "}//&
234                  \textcolor{stringliteral}{"variables."}, default=.true.)
235 
236   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"G\_EARTH"}, cs%G\_Earth, &
237                  \textcolor{stringliteral}{"The gravitational acceleration of the Earth."}, &
238                  units=\textcolor{stringliteral}{"m s-2"}, default = 9.80, scale=us%m\_to\_L**2*us%Z\_to\_m*us%T\_to\_s**2)
239   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, cs%Rho0, &
240                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//&
241                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//&
242                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//&
243                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-2."}, &
244                  units=\textcolor{stringliteral}{"kg m-3"}, default=1035.0, scale=us%kg\_m3\_to\_R)
245   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GUST\_CONST"}, cs%gust\_const, &
246                  \textcolor{stringliteral}{"The background gustiness in the winds."}, units=\textcolor{stringliteral}{"Pa"}, default=0.0)
247 
248   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTOREBUOY"}, cs%restorebuoy, &
249                  \textcolor{stringliteral}{"If true, the buoyancy fluxes drive the model back "}//&
250                  \textcolor{stringliteral}{"toward some specified surface state with a rate "}//&
251                  \textcolor{stringliteral}{"given by FLUXCONST."}, default= .false.)
252 
253   \textcolor{keywordflow}{if} (cs%restorebuoy) \textcolor{keywordflow}{then}
254     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"FLUXCONST"}, cs%Flux\_const, &
255                  \textcolor{stringliteral}{"The constant that relates the restoring surface fluxes to the relative "}//&
256                  \textcolor{stringliteral}{"surface anomalies (akin to a piston velocity).  Note the non-MKS units."}, &
257                  default=0.0, units=\textcolor{stringliteral}{"m day-1"}, scale=us%m\_to\_Z/(86400.0*us%s\_to\_T))
258 
259     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SSTRESTORE\_FILE"}, cs%SSTrestore\_file, &
260                  \textcolor{stringliteral}{"The file with the SST toward which to restore in "}//&
261                  \textcolor{stringliteral}{"variable TEMP."}, fail\_if\_missing=.true.)
262     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SALINITYRESTORE\_FILE"}, cs%salinityrestore\_file, &
263                  \textcolor{stringliteral}{"The file with the surface salinity toward which to "}//&
264                  \textcolor{stringliteral}{"restore in variable SALT."}, fail\_if\_missing=.true.)
265     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SENSIBLEHEAT\_FILE"}, cs%heating\_file, &
266                  \textcolor{stringliteral}{"The file with the non-shortwave heat flux in "}//&
267                  \textcolor{stringliteral}{"variable Heat."}, fail\_if\_missing=.true.)
268     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PRECIP\_FILE"}, cs%PmE\_file, &
269                  \textcolor{stringliteral}{"The file with the net precipiation minus evaporation "}//&
270                  \textcolor{stringliteral}{"in variable PmE."}, fail\_if\_missing=.true.)
271     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHORTWAVE\_FILE"}, cs%Solar\_file, &
272                  \textcolor{stringliteral}{"The file with the shortwave heat flux in "}//&
273                  \textcolor{stringliteral}{"variable NET\_SOL."}, fail\_if\_missing=.true.)
274     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, cs%inputdir, default=\textcolor{stringliteral}{"."})
275     cs%inputdir = slasher(cs%inputdir)
276 
277 \textcolor{keywordflow}{   endif}
278 
\end{DoxyCode}
