\hypertarget{namespacemom__oda__driver__mod}{}\section{mom\+\_\+oda\+\_\+driver\+\_\+mod Module Reference}
\label{namespacemom__oda__driver__mod}\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}


\subsection{Detailed Description}
Interfaces for M\+O\+M6 ensembles and data assimilation. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}
\begin{DoxyCompactList}\small\item\em Control structure that contains a transpose of the ocean state across ensemble members. \end{DoxyCompactList}\item 
type \hyperlink{structmom__oda__driver__mod_1_1ptr__mpp__domain}{ptr\+\_\+mpp\+\_\+domain}
\begin{DoxyCompactList}\small\item\em A structure with a pointer to a domain2d, to allow for the creation of arrays of pointers. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_aaaf67b8d0e0db3ba3dfe09e24d2b8b24}{init\+\_\+oda} (Time, G, GV, CS)
\begin{DoxyCompactList}\small\item\em initialize First\+\_\+guess (prior) and Analysis grid information for all ensemble members \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_a24806346258e5d9143e233999eef0e7f}{set\+\_\+prior\+\_\+tracer} (Time, G, GV, h, tv, CS)
\begin{DoxyCompactList}\small\item\em Copy ensemble member tracers to ensemble vector. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_aae4e3631b7c02cc28640de25af758b4a}{get\+\_\+posterior\+\_\+tracer} (Time, CS, h, tv, increment)
\begin{DoxyCompactList}\small\item\em Returns posterior adjustments or full state Note that only those P\+Es associated with an ensemble member receive data. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_ac7821f6ee4d3a59fc8bfe505730b0059}{oda} (Time, CS)
\begin{DoxyCompactList}\small\item\em Gather observations and sall O\+DA routines. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_a619ba9e78b8b43d33ed6210beacedd37}{oda\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Finalize DA module. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__oda__driver__mod_a8fd360e7b7af465caf37c4256be70458}{init\+\_\+ocean\+\_\+ensemble} (CS, Grid, GV, ens\+\_\+size)
\begin{DoxyCompactList}\small\item\em Initialize DA module. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_a6df570bae958c31d3aab1053484e1f5d}{set\+\_\+analysis\+\_\+time} (Time, CS)
\begin{DoxyCompactList}\small\item\em Set the next analysis time. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_acd36611ea11bbefa2e03a2101abb4810}{save\+\_\+obs\+\_\+diff} (filename, CS)
\begin{DoxyCompactList}\small\item\em Write observation differences to a file. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__oda__driver__mod_a1591229c657f196c97b87b77ca4378a6}{apply\+\_\+oda\+\_\+tracer\+\_\+increments} (dt, G, tv, h, CS)
\begin{DoxyCompactList}\small\item\em Apply increments to tracers. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\textbf{ }\par
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a7883f775c4038b0bcd2230dec648e537}\label{namespacemom__oda__driver__mod_a7883f775c4038b0bcd2230dec648e537}} 
integer, parameter \hyperlink{namespacemom__oda__driver__mod_a7883f775c4038b0bcd2230dec648e537}{no\+\_\+assim} = 0
\begin{DoxyCompactList}\small\item\em DA parameters. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a6f59a3ce11518c0db8e85de4963f987e}\label{namespacemom__oda__driver__mod_a6f59a3ce11518c0db8e85de4963f987e}} 
integer, parameter \hyperlink{namespacemom__oda__driver__mod_a6f59a3ce11518c0db8e85de4963f987e}{oi\+\_\+assim} =1
\begin{DoxyCompactList}\small\item\em DA parameters. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__oda__driver__mod_ac00bf4f8752ef7eba4ba0652ca1dcddf}\label{namespacemom__oda__driver__mod_ac00bf4f8752ef7eba4ba0652ca1dcddf}} 
integer, parameter \hyperlink{namespacemom__oda__driver__mod_ac00bf4f8752ef7eba4ba0652ca1dcddf}{eakf\+\_\+assim} =2
\begin{DoxyCompactList}\small\item\em DA parameters. \end{DoxyCompactList}\end{DoxyCompactItemize}



\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a1591229c657f196c97b87b77ca4378a6}\label{namespacemom__oda__driver__mod_a1591229c657f196c97b87b77ca4378a6}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!apply\+\_\+oda\+\_\+tracer\+\_\+increments@{apply\+\_\+oda\+\_\+tracer\+\_\+increments}}
\index{apply\+\_\+oda\+\_\+tracer\+\_\+increments@{apply\+\_\+oda\+\_\+tracer\+\_\+increments}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{apply\+\_\+oda\+\_\+tracer\+\_\+increments()}{apply\_oda\_tracer\_increments()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::apply\+\_\+oda\+\_\+tracer\+\_\+increments (\begin{DoxyParamCaption}\item[{real, intent(in)}]{dt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(inout)}]{CS }\end{DoxyParamCaption})}



Apply increments to tracers. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em dt} & The tracer timestep \mbox{[}s\mbox{]}\\
\hline
\mbox{\tt in}  & {\em g} & ocean grid structure\\
\hline
\mbox{\tt in,out}  & {\em tv} & A structure pointing to various thermodynamic variables\\
\hline
\mbox{\tt in}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in,out}  & {\em cs} & the data assimilation structure \\
\hline
\end{DoxyParams}


Definition at line 529 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
529   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{ !< The tracer timestep [s]}
530   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{  !< ocean grid structure}
531   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),    \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{ !< A structure pointing to various thermodynamic variables}
532   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  &
533                             \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< layer thickness [H ~> m or kg m-2]}
534   \textcolor{keywordtype}{type}(oda\_cs),             \textcolor{keywordtype}{intent(inout)} :: cs\textcolor{comment}{ !< the data assimilation structure}
535 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_aae4e3631b7c02cc28640de25af758b4a}\label{namespacemom__oda__driver__mod_aae4e3631b7c02cc28640de25af758b4a}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!get\+\_\+posterior\+\_\+tracer@{get\+\_\+posterior\+\_\+tracer}}
\index{get\+\_\+posterior\+\_\+tracer@{get\+\_\+posterior\+\_\+tracer}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{get\+\_\+posterior\+\_\+tracer()}{get\_posterior\_tracer()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::get\+\_\+posterior\+\_\+tracer (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), pointer}]{CS,  }\item[{real, dimension(\+:,\+:,\+:), pointer}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), pointer}]{tv,  }\item[{logical, intent(in), optional}]{increment }\end{DoxyParamCaption})}



Returns posterior adjustments or full state Note that only those P\+Es associated with an ensemble member receive data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & the current model time\\
\hline
 & {\em cs} & ocean DA control structure\\
\hline
 & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
 & {\em tv} & A structure pointing to various thermodynamic variables\\
\hline
\mbox{\tt in}  & {\em increment} & True if returning increment only \\
\hline
\end{DoxyParams}


Definition at line 365 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
365   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{ !< the current model time}
366   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< ocean DA control structure}
367   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2]}
368   \textcolor{keywordtype}{type}(thermo\_var\_ptrs), \textcolor{keywordtype}{pointer} :: tv\textcolor{comment}{   !< A structure pointing to various thermodynamic variables}
369   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: increment\textcolor{comment}{ !< True if returning increment only}
370 
371   \textcolor{keywordtype}{type}(ocean\_control\_struct), \textcolor{keywordtype}{pointer} :: ocean\_increment=>null()
372   \textcolor{keywordtype}{integer} :: i, j, m
373   \textcolor{keywordtype}{logical} :: used, get\_inc
374 
375   \textcolor{comment}{! return if not analysis time (retain pointers for h and tv)}
376   \textcolor{keywordflow}{if} (time < cs%Time) \textcolor{keywordflow}{return}
377 
378 
379   \textcolor{comment}{!! switch to global pelist}
380   \textcolor{keyword}{call }set\_current\_pelist(cs%filter\_pelist)
381   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{'Getting posterior'})
382 
383   get\_inc = .true.
384   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(increment)) get\_inc = increment
385 
386   \textcolor{keywordflow}{if} (get\_inc) \textcolor{keywordflow}{then}
387     \textcolor{keyword}{allocate}(ocean\_increment)
388     \textcolor{keyword}{call }init\_ocean\_ensemble(ocean\_increment,cs%Grid,cs%GV,cs%ensemble\_size)
389     ocean\_increment%T = cs%Ocean\_posterior%T - cs%Ocean\_prior%T
390     ocean\_increment%S = cs%Ocean\_posterior%S - cs%Ocean\_prior%S
391 \textcolor{keywordflow}{  endif}
392   \textcolor{keywordflow}{do} m=1,cs%ensemble\_size
393     \textcolor{keywordflow}{if} (get\_inc) \textcolor{keywordflow}{then}
394       \textcolor{keyword}{call }mpp\_redistribute(cs%mpp\_domain, ocean\_increment%T(:,:,:,m), &
395               cs%domains(m)%mpp\_domain, cs%tv%T, complete=.true.)
396       \textcolor{keyword}{call }mpp\_redistribute(cs%mpp\_domain, ocean\_increment%S(:,:,:,m), &
397               cs%domains(m)%mpp\_domain, cs%tv%S, complete=.true.)
398     \textcolor{keywordflow}{else}
399       \textcolor{keyword}{call }mpp\_redistribute(cs%mpp\_domain, cs%Ocean\_posterior%T(:,:,:,m), &
400               cs%domains(m)%mpp\_domain, cs%tv%T, complete=.true.)
401       \textcolor{keyword}{call }mpp\_redistribute(cs%mpp\_domain, cs%Ocean\_posterior%S(:,:,:,m), &
402               cs%domains(m)%mpp\_domain, cs%tv%S, complete=.true.)
403 \textcolor{keywordflow}{    endif}
404 \textcolor{keywordflow}{  enddo}
405 
406   tv => cs%tv
407   h => cs%h
408   \textcolor{comment}{!! switch back to ensemble member pelist}
409   \textcolor{keyword}{call }set\_current\_pelist(cs%ensemble\_pelist(cs%ensemble\_id,:))
410 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a8fd360e7b7af465caf37c4256be70458}\label{namespacemom__oda__driver__mod_a8fd360e7b7af465caf37c4256be70458}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!init\+\_\+ocean\+\_\+ensemble@{init\+\_\+ocean\+\_\+ensemble}}
\index{init\+\_\+ocean\+\_\+ensemble@{init\+\_\+ocean\+\_\+ensemble}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{init\+\_\+ocean\+\_\+ensemble()}{init\_ocean\_ensemble()}}
{\footnotesize\ttfamily subroutine mom\+\_\+oda\+\_\+driver\+\_\+mod\+::init\+\_\+ocean\+\_\+ensemble (\begin{DoxyParamCaption}\item[{type(\hyperlink{structocean__da__types__mod_1_1ocean__control__struct}{ocean\+\_\+control\+\_\+struct}), pointer}]{CS,  }\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{Grid,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{integer, intent(in)}]{ens\+\_\+size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Initialize DA module. 


\begin{DoxyParams}[1]{Parameters}
 & {\em cs} & Pointer to O\+DA control structure\\
\hline
 & {\em grid} & Pointer to ocean analysis grid\\
\hline
 & {\em gv} & Pointer to DA vertical grid\\
\hline
\mbox{\tt in}  & {\em ens\+\_\+size} & ensemble size \\
\hline
\end{DoxyParams}


Definition at line 448 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
448   \textcolor{keywordtype}{type}(ocean\_control\_struct), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< Pointer to ODA control structure}
449   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: grid\textcolor{comment}{ !< Pointer to ocean analysis grid}
450   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{pointer} :: gv\textcolor{comment}{ !< Pointer to DA vertical grid}
451   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ens\_size\textcolor{comment}{ !< ensemble size}
452 
453   \textcolor{keywordtype}{integer} :: n,is,ie,js,je,nk
454 
455   nk=gv%ke
456   is=grid%isd;ie=grid%ied
457   js=grid%jsd;je=grid%jed
458   cs%ensemble\_size=ens\_size
459   \textcolor{keyword}{allocate}(cs%T(is:ie,js:je,nk,ens\_size))
460   \textcolor{keyword}{allocate}(cs%S(is:ie,js:je,nk,ens\_size))
461   \textcolor{keyword}{allocate}(cs%SSH(is:ie,js:je,ens\_size))
462 \textcolor{comment}{!  allocate(CS%id\_t(ens\_size));CS%id\_t(:)=-1}
463 \textcolor{comment}{!  allocate(CS%id\_s(ens\_size));CS%id\_s(:)=-1}
464 \textcolor{comment}{!  allocate(CS%U(is:ie,js:je,nk,ens\_size))}
465 \textcolor{comment}{!  allocate(CS%V(is:ie,js:je,nk,ens\_size))}
466 \textcolor{comment}{!  allocate(CS%id\_u(ens\_size));CS%id\_u(:)=-1}
467 \textcolor{comment}{!  allocate(CS%id\_v(ens\_size));CS%id\_v(:)=-1}
468 \textcolor{comment}{!  allocate(CS%id\_ssh(ens\_size));CS%id\_ssh(:)=-1}
469 
470   \textcolor{keywordflow}{return}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_aaaf67b8d0e0db3ba3dfe09e24d2b8b24}\label{namespacemom__oda__driver__mod_aaaf67b8d0e0db3ba3dfe09e24d2b8b24}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!init\+\_\+oda@{init\+\_\+oda}}
\index{init\+\_\+oda@{init\+\_\+oda}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{init\+\_\+oda()}{init\_oda()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::init\+\_\+oda (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(inout), pointer}]{CS }\end{DoxyParamCaption})}



initialize First\+\_\+guess (prior) and Analysis grid information for all ensemble members 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & The current model time.\\
\hline
 & {\em g} & domain and grid information for ocean model\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in,out}  & {\em cs} & The DA control structure \\
\hline
\end{DoxyParams}


Definition at line 115 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
115 
116   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{ !< The current model time.}
117   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: g\textcolor{comment}{ !< domain and grid information for ocean model}
118   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
119   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{intent(inout)} :: cs\textcolor{comment}{  !< The DA control structure}
120 
121 \textcolor{comment}{! Local variables}
122   \textcolor{keywordtype}{type}(thermo\_var\_ptrs) :: tv\_dummy
123   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{pointer} :: dg=> null()
124   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{pointer} :: hi=> null()
125   \textcolor{keywordtype}{type}(directories) :: dirs
126 
127   \textcolor{keywordtype}{type}(grid\_type), \textcolor{keywordtype}{pointer} :: t\_grid\textcolor{comment}{ !< global tracer grid}
128   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable} :: global2d, global2d\_old
129   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{allocatable} :: lon1d, lat1d, glon1d, glat1d
130   \textcolor{keywordtype}{type}(param\_file\_type) :: pf
131   \textcolor{keywordtype}{integer} :: n, m, k, i, j, nk
132   \textcolor{keywordtype}{integer} :: is,ie,js,je,isd,ied,jsd,jed
133   \textcolor{keywordtype}{integer} :: stdout\_unit
134   \textcolor{keywordtype}{character(len=32)} :: assim\_method
135   \textcolor{keywordtype}{integer} :: npes\_pm, ens\_info(6), ni, nj
136   \textcolor{keywordtype}{character(len=128)} :: mesg
137   \textcolor{keywordtype}{character(len=32)} :: fldnam
138   \textcolor{keywordtype}{character(len=30)} :: coord\_mode
139   \textcolor{keywordtype}{character(len=200)} :: inputdir, basin\_file
140   \textcolor{keywordtype}{logical} :: reentrant\_x, reentrant\_y, tripolar\_n, symmetric
141 
142   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mpp\_error(fatal,\textcolor{stringliteral}{'Calling oda\_init with associated control structure'})
143   \textcolor{keyword}{allocate}(cs)
144 \textcolor{comment}{! Use ens1 parameters , this could be changed at a later time}
145 \textcolor{comment}{! if it were desirable to have alternate parameters, e.g. for the grid}
146 \textcolor{comment}{! for the analysis}
147   \textcolor{keyword}{call }get\_mom\_input(pf,dirs,ensemble\_num=0)
148 
149   \textcolor{keyword}{call }unit\_scaling\_init(pf, cs%US)
150 
151   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"ASSIM\_METHOD"}, assim\_method,  &
152        \textcolor{stringliteral}{"String which determines the data assimilation method "}//&
153        \textcolor{stringliteral}{"Valid methods are: \(\backslash\)'EAKF\(\backslash\)',\(\backslash\)'OI\(\backslash\)', and \(\backslash\)'NO\_ASSIM\(\backslash\)'"}, default=\textcolor{stringliteral}{'NO\_ASSIM'})
154   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"ASSIM\_FREQUENCY"}, cs%assim\_frequency,  &
155        \textcolor{stringliteral}{"data assimilation frequency in hours"})
156   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"USE\_REGRIDDING"}, cs%use\_ALE\_algorithm , &
157                 \textcolor{stringliteral}{"If True, use the ALE algorithm (regridding/remapping).\(\backslash\)n"}//&
158                 \textcolor{stringliteral}{"If False, use the layered isopycnal algorithm."}, default=.false. )
159   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"REENTRANT\_X"}, cs%reentrant\_x, &
160        \textcolor{stringliteral}{"If true, the domain is zonally reentrant."}, default=.true.)
161   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"REENTRANT\_Y"}, cs%reentrant\_y, &
162        \textcolor{stringliteral}{"If true, the domain is meridionally reentrant."}, &
163        default=.false.)
164   \textcolor{keyword}{call }get\_param(pf,\textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"TRIPOLAR\_N"}, cs%tripolar\_N, &
165        \textcolor{stringliteral}{"Use tripolar connectivity at the northern edge of the "}//&
166        \textcolor{stringliteral}{"domain.  With TRIPOLAR\_N, NIGLOBAL must be even."}, &
167        default=.false.)
168   \textcolor{keyword}{call }get\_param(pf,\textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"NIGLOBAL"}, cs%ni, &
169        \textcolor{stringliteral}{"The total number of thickness grid points in the "}//&
170        \textcolor{stringliteral}{"x-direction in the physical domain."})
171   \textcolor{keyword}{call }get\_param(pf,\textcolor{stringliteral}{"MOM"}, \textcolor{stringliteral}{"NJGLOBAL"}, cs%nj, &
172        \textcolor{stringliteral}{"The total number of thickness grid points in the "}//&
173        \textcolor{stringliteral}{"y-direction in the physical domain."})
174   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{'MOM'}, \textcolor{stringliteral}{"INPUTDIR"}, inputdir)
175   inputdir = slasher(inputdir)
176 
177   \textcolor{keywordflow}{select case}(lowercase(trim(assim\_method)))
178   \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'eakf'})
179       cs%assim\_method = eakf\_assim
180   \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'oi'})
181      cs%assim\_method = oi\_assim
182   \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'no\_assim'})
183       cs%assim\_method = no\_assim
184 \textcolor{keywordflow}{  case default}
185       \textcolor{keyword}{call }mpp\_error(fatal,\textcolor{stringliteral}{'Invalid assimilation method provided'})
186 \textcolor{keywordflow}{  end select}
187 
188   ens\_info = get\_ensemble\_size()
189   cs%ensemble\_size = ens\_info(1)
190   npes\_pm=ens\_info(3)
191   cs%ensemble\_id = get\_ensemble\_id()
192   \textcolor{comment}{!! Switch to global pelist}
193   \textcolor{keyword}{allocate}(cs%ensemble\_pelist(cs%ensemble\_size,npes\_pm))
194   \textcolor{keyword}{allocate}(cs%filter\_pelist(cs%ensemble\_size*npes\_pm))
195   \textcolor{keyword}{call }get\_ensemble\_pelist(cs%ensemble\_pelist,\textcolor{stringliteral}{'ocean'})
196   \textcolor{keyword}{call }get\_ensemble\_filter\_pelist(cs%filter\_pelist,\textcolor{stringliteral}{'ocean'})
197 
198   \textcolor{keyword}{call }set\_current\_pelist(cs%filter\_pelist)
199 
200   \textcolor{keyword}{allocate}(cs%domains(cs%ensemble\_size))
201   cs%domains(cs%ensemble\_id)%mpp\_domain => g%Domain%mpp\_domain
202   \textcolor{keywordflow}{do} n=1,cs%ensemble\_size
203     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs%domains(n)%mpp\_domain)) \textcolor{keyword}{allocate}(cs%domains(n)%mpp\_domain)
204     \textcolor{keyword}{call }set\_root\_pe(cs%ensemble\_pelist(n,1))
205     \textcolor{keyword}{call }mpp\_broadcast\_domain(cs%domains(n)%mpp\_domain)
206 \textcolor{keywordflow}{  enddo}
207   \textcolor{keyword}{call }set\_root\_pe(cs%filter\_pelist(1))
208   \textcolor{keyword}{allocate}(cs%Grid)
209   \textcolor{comment}{! params NIHALO\_ODA, NJHALO\_ODA set the DA halo size}
210   \textcolor{keyword}{call }mom\_domains\_init(cs%Grid%Domain,pf,param\_suffix=\textcolor{stringliteral}{'\_ODA'})
211   \textcolor{keyword}{allocate}(hi)
212   \textcolor{keyword}{call }hor\_index\_init(cs%Grid%Domain, hi, pf, &
213                       local\_indexing=.false.)  \textcolor{comment}{! Use global indexing for DA}
214   \textcolor{keyword}{call }verticalgridinit( pf, cs%GV, cs%US )
215   \textcolor{keyword}{allocate}(dg)
216   \textcolor{keyword}{call }create\_dyn\_horgrid(dg, hi)
217   \textcolor{keyword}{call }clone\_mom\_domain(cs%Grid%Domain, dg%Domain,symmetric=.false.)
218   \textcolor{keyword}{call }set\_grid\_metrics(dg,pf)
219   \textcolor{keyword}{call }mom\_initialize\_topography(dg%bathyT,dg%max\_depth,dg,pf)
220   \textcolor{keyword}{call }mom\_initialize\_coord(cs%GV, cs%US, pf, .false., &
221            dirs%output\_directory, tv\_dummy, dg%max\_depth)
222   \textcolor{keyword}{call }ale\_init(pf, cs%GV, cs%US, dg%max\_depth, cs%ALE\_CS)
223   \textcolor{keyword}{call }mom\_grid\_init(cs%Grid, pf, global\_indexing=.true.)
224   \textcolor{keyword}{call }ale\_updateverticalgridtype(cs%ALE\_CS, cs%GV)
225   \textcolor{keyword}{call }copy\_dyngrid\_to\_mom\_grid(dg, cs%Grid, cs%US)
226   cs%mpp\_domain => cs%Grid%Domain%mpp\_domain
227   cs%Grid%ke = cs%GV%ke
228   cs%nk = cs%GV%ke
229   \textcolor{comment}{! initialize storage for prior and posterior}
230   \textcolor{keyword}{allocate}(cs%Ocean\_prior)
231   \textcolor{keyword}{call }init\_ocean\_ensemble(cs%Ocean\_prior,cs%Grid,cs%GV,cs%ensemble\_size)
232   \textcolor{keyword}{allocate}(cs%Ocean\_posterior)
233   \textcolor{keyword}{call }init\_ocean\_ensemble(cs%Ocean\_posterior,cs%Grid,cs%GV,cs%ensemble\_size)
234   \textcolor{keyword}{allocate}(cs%tv)
235 
236   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{'oda\_driver'}, \textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, coord\_mode, &
237        \textcolor{stringliteral}{"Coordinate mode for vertical regridding."}, &
238        default=\textcolor{stringliteral}{"ZSTAR"}, fail\_if\_missing=.false.)
239   \textcolor{keyword}{call }initialize\_regridding(cs%regridCS, cs%GV, cs%US, dg%max\_depth,pf,\textcolor{stringliteral}{'oda\_driver'},coord\_mode,\textcolor{stringliteral}{''},\textcolor{stringliteral}{''})
240   \textcolor{keyword}{call }initialize\_remapping(cs%remapCS,\textcolor{stringliteral}{'PLM'})
241   \textcolor{keyword}{call }set\_regrid\_params(cs%regridCS, min\_thickness=0.)
242   \textcolor{keyword}{call }mpp\_get\_data\_domain(g%Domain%mpp\_domain,isd,ied,jsd,jed)
243   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs%h)) \textcolor{keywordflow}{then}
244     \textcolor{keyword}{allocate}(cs%h(isd:ied,jsd:jed,cs%GV%ke)); cs%h(:,:,:)=0.0
245     \textcolor{comment}{! assign thicknesses}
246     \textcolor{keyword}{call }ale\_initthicknesstocoord(cs%ALE\_CS,g,cs%GV,cs%h)
247 \textcolor{keywordflow}{  endif}
248   \textcolor{keyword}{allocate}(cs%tv%T(isd:ied,jsd:jed,cs%GV%ke)); cs%tv%T(:,:,:)=0.0
249   \textcolor{keyword}{allocate}(cs%tv%S(isd:ied,jsd:jed,cs%GV%ke)); cs%tv%S(:,:,:)=0.0
250 
251   \textcolor{keyword}{call }set\_axes\_info(cs%Grid, cs%GV, cs%US, pf, cs%diag\_cs, set\_vertical=.true.)
252 
253   \textcolor{keyword}{call }mpp\_get\_data\_domain(cs%mpp\_domain,isd,ied,jsd,jed)
254   \textcolor{keyword}{allocate}(cs%oda\_grid)
255   cs%oda\_grid%x => cs%Grid%geolonT
256   cs%oda\_grid%y => cs%Grid%geolatT
257 
258   \textcolor{keyword}{call }get\_param(pf, \textcolor{stringliteral}{'oda\_driver'}, \textcolor{stringliteral}{"BASIN\_FILE"}, basin\_file, &
259           \textcolor{stringliteral}{"A file in which to find the basin masks, in variable 'basin'."}, &
260           default=\textcolor{stringliteral}{"basin.nc"})
261   basin\_file = trim(inputdir) // trim(basin\_file)
262   \textcolor{keyword}{allocate}(cs%oda\_grid%basin\_mask(isd:ied,jsd:jed))
263   cs%oda\_grid%basin\_mask(:,:) = 0.0
264   \textcolor{keyword}{call }mom\_read\_data(basin\_file,\textcolor{stringliteral}{'basin'},cs%oda\_grid%basin\_mask,cs%Grid%domain, timelevel=1)
265 
266 \textcolor{comment}{!    get global grid information from ocean\_model}
267   \textcolor{keyword}{allocate}(t\_grid)
268   \textcolor{keyword}{allocate}(t\_grid%x(cs%ni,cs%nj))
269   \textcolor{keyword}{allocate}(t\_grid%y(cs%ni,cs%nj))
270   \textcolor{keyword}{allocate}(t\_grid%basin\_mask(cs%ni,cs%nj))
271   \textcolor{keyword}{call }mpp\_global\_field(cs%mpp\_domain, cs%Grid%geolonT, t\_grid%x)
272   \textcolor{keyword}{call }mpp\_global\_field(cs%mpp\_domain, cs%Grid%geolatT, t\_grid%y)
273   \textcolor{keyword}{call }mpp\_global\_field(cs%mpp\_domain, cs%oda\_grid%basin\_mask, t\_grid%basin\_mask)
274   t\_grid%ni = cs%ni
275   t\_grid%nj = cs%nj
276   t\_grid%nk = cs%nk
277   \textcolor{keyword}{allocate}(t\_grid%mask(cs%ni,cs%nj,cs%nk))
278   \textcolor{keyword}{allocate}(t\_grid%z(cs%ni,cs%nj,cs%nk))
279   \textcolor{keyword}{allocate}(global2d(cs%ni,cs%nj))
280   \textcolor{keyword}{allocate}(global2d\_old(cs%ni,cs%nj))
281   t\_grid%mask(:,:,:) = 0.0
282   t\_grid%z(:,:,:) = 0.0
283 
284   \textcolor{keywordflow}{do} k = 1, cs%nk
285     \textcolor{keyword}{call }mpp\_global\_field(g%Domain%mpp\_domain, cs%h(:,:,k), global2d)
286     \textcolor{keywordflow}{do} i=1, cs%ni; \textcolor{keywordflow}{do} j=1, cs%nj
287       \textcolor{keywordflow}{if} ( global2d(i,j) > 1 ) \textcolor{keywordflow}{then}
288         t\_grid%mask(i,j,k) = 1.0
289 \textcolor{keywordflow}{      endif}
290 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
291     \textcolor{keywordflow}{if} (k == 1) \textcolor{keywordflow}{then}
292       t\_grid%z(:,:,k) = global2d/2
293     \textcolor{keywordflow}{else}
294       t\_grid%z(:,:,k) = t\_grid%z(:,:,k-1) + (global2d + global2d\_old)/2
295 \textcolor{keywordflow}{    endif}
296     global2d\_old = global2d
297 \textcolor{keywordflow}{  enddo}
298 
299   \textcolor{keyword}{call }ocean\_da\_core\_init(cs%mpp\_domain, t\_grid, cs%Profiles, time)
300 
301   cs%Time=time
302   \textcolor{comment}{!! switch back to ensemble member pelist}
303   \textcolor{keyword}{call }set\_current\_pelist(cs%ensemble\_pelist(cs%ensemble\_id,:))
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_ac7821f6ee4d3a59fc8bfe505730b0059}\label{namespacemom__oda__driver__mod_ac7821f6ee4d3a59fc8bfe505730b0059}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!oda@{oda}}
\index{oda@{oda}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{oda()}{oda()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::oda (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(inout)}]{CS }\end{DoxyParamCaption})}



Gather observations and sall O\+DA routines. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & the current model time\\
\hline
\mbox{\tt in,out}  & {\em cs} & the ocean DA control structure \\
\hline
\end{DoxyParams}


Definition at line 415 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
415   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{ !< the current model time}
416   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{intent(inout)} :: cs\textcolor{comment}{ !< the ocean DA control structure}
417 
418   \textcolor{keywordtype}{integer} :: i, j
419   \textcolor{keywordtype}{integer} :: m
420   \textcolor{keywordtype}{integer} :: yr, mon, day, hr, min, sec
421 
422   \textcolor{keywordflow}{if} ( time >= cs%Time ) \textcolor{keywordflow}{then}
423 
424     \textcolor{comment}{!! switch to global pelist}
425     \textcolor{keyword}{call }set\_current\_pelist(cs%filter\_pelist)
426 
427     \textcolor{keyword}{call }get\_profiles(time, cs%Profiles, cs%CProfiles)
428 \textcolor{preprocessor}{#ifdef ENABLE\_ECDA}
429 \textcolor{preprocessor}{}    \textcolor{keyword}{call }ensemble\_filter(cs%Ocean\_prior, cs%Ocean\_posterior, cs%CProfiles, cs%kdroot, cs%mpp\_domain, cs
      %oda\_grid)
430 \textcolor{preprocessor}{#endif}
431 \textcolor{preprocessor}{}
432     \textcolor{comment}{!! switch back to ensemble member pelist}
433     \textcolor{keyword}{call }set\_current\_pelist(cs%ensemble\_pelist(cs%ensemble\_id,:))
434 
435 \textcolor{keywordflow}{  endif}
436 
437   \textcolor{keywordflow}{return}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a619ba9e78b8b43d33ed6210beacedd37}\label{namespacemom__oda__driver__mod_a619ba9e78b8b43d33ed6210beacedd37}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!oda\+\_\+end@{oda\+\_\+end}}
\index{oda\+\_\+end@{oda\+\_\+end}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{oda\+\_\+end()}{oda\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::oda\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(inout)}]{CS }\end{DoxyParamCaption})}



Finalize DA module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em cs} & the ocean DA control structure \\
\hline
\end{DoxyParams}


Definition at line 442 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
442   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{intent(inout)} :: cs\textcolor{comment}{ !< the ocean DA control structure}
443 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_acd36611ea11bbefa2e03a2101abb4810}\label{namespacemom__oda__driver__mod_acd36611ea11bbefa2e03a2101abb4810}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!save\+\_\+obs\+\_\+diff@{save\+\_\+obs\+\_\+diff}}
\index{save\+\_\+obs\+\_\+diff@{save\+\_\+obs\+\_\+diff}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{save\+\_\+obs\+\_\+diff()}{save\_obs\_diff()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::save\+\_\+obs\+\_\+diff (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(in), pointer}]{CS }\end{DoxyParamCaption})}



Write observation differences to a file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em filename} & name of output file\\
\hline
\mbox{\tt in}  & {\em cs} & pointer to DA control structure \\
\hline
\end{DoxyParams}


Definition at line 502 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
502   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: filename\textcolor{comment}{ !< name of output file}
503   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{intent(in)} :: cs\textcolor{comment}{  !< pointer to DA control structure}
504 
505   \textcolor{keywordtype}{integer} :: fid \textcolor{comment}{! profile file handle}
506   \textcolor{keywordtype}{type}(ocean\_profile\_type), \textcolor{keywordtype}{pointer} :: prof=>null()
507 
508   fid = open\_profile\_file(trim(filename), nvar=2, thread=mpp\_single, fset=mpp\_single)
509   prof=>cs%CProfiles
510 
511   \textcolor{comment}{!! switch to global pelist}
512   \textcolor{comment}{!call set\_current\_pelist(CS%filter\_pelist)}
513 
514   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(prof))
515     \textcolor{keyword}{call }write\_profile(fid,prof)
516     prof=>prof%cnext
517 \textcolor{keywordflow}{  enddo}
518   \textcolor{keyword}{call }close\_profile\_file(fid)
519 
520   \textcolor{comment}{!! switch back to ensemble member pelist}
521   \textcolor{comment}{!call set\_current\_pelist(CS%ensemble\_pelist(CS%ensemble\_id,:))}
522 
523   \textcolor{keywordflow}{return}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a6df570bae958c31d3aab1053484e1f5d}\label{namespacemom__oda__driver__mod_a6df570bae958c31d3aab1053484e1f5d}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!set\+\_\+analysis\+\_\+time@{set\+\_\+analysis\+\_\+time}}
\index{set\+\_\+analysis\+\_\+time@{set\+\_\+analysis\+\_\+time}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{set\+\_\+analysis\+\_\+time()}{set\_analysis\_time()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::set\+\_\+analysis\+\_\+time (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), intent(inout), pointer}]{CS }\end{DoxyParamCaption})}



Set the next analysis time. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & the current model time\\
\hline
\mbox{\tt in,out}  & {\em cs} & the DA control structure \\
\hline
\end{DoxyParams}


Definition at line 475 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
475   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{ !< the current model time}
476   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{intent(inout)} :: cs\textcolor{comment}{ !< the DA control structure}
477 
478   \textcolor{keywordtype}{character(len=160)} :: mesg  \textcolor{comment}{! The text of an error message}
479   \textcolor{keywordtype}{integer} :: yr, mon, day, hr, min, sec
480 
481   \textcolor{keywordflow}{if} (time >= cs%Time) \textcolor{keywordflow}{then}
482     cs%Time=increment\_time(cs%Time,cs%assim\_frequency*3600)
483 
484     \textcolor{keyword}{call }get\_date(time, yr, mon, day, hr, min, sec)
485     \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{'Model Time: '}, yr, mon, day, hr, min, sec
486     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"set\_analysis\_time: "}//trim(mesg))
487     \textcolor{keyword}{call }get\_date(cs%time, yr, mon, day, hr, min, sec)
488     \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{'Assimilation Time: '}, yr, mon, day, hr, min, sec
489     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"set\_analysis\_time: "}//trim(mesg))
490 \textcolor{keywordflow}{  endif}
491   \textcolor{keywordflow}{if} (cs%Time < time) \textcolor{keywordflow}{then}
492     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{" set\_analysis\_time: "} // &
493          \textcolor{stringliteral}{"assimilation interval appears to be shorter than "} // &
494          \textcolor{stringliteral}{"the model timestep"})
495 \textcolor{keywordflow}{  endif}
496   \textcolor{keywordflow}{return}
497 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__oda__driver__mod_a24806346258e5d9143e233999eef0e7f}\label{namespacemom__oda__driver__mod_a24806346258e5d9143e233999eef0e7f}} 
\index{mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}!set\+\_\+prior\+\_\+tracer@{set\+\_\+prior\+\_\+tracer}}
\index{set\+\_\+prior\+\_\+tracer@{set\+\_\+prior\+\_\+tracer}!mom\+\_\+oda\+\_\+driver\+\_\+mod@{mom\+\_\+oda\+\_\+driver\+\_\+mod}}
\subsubsection{\texorpdfstring{set\+\_\+prior\+\_\+tracer()}{set\_prior\_tracer()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+oda\+\_\+driver\+\_\+mod\+::set\+\_\+prior\+\_\+tracer (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{type(\hyperlink{structmom__oda__driver__mod_1_1oda__cs}{oda\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Copy ensemble member tracers to ensemble vector. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & The current model time\\
\hline
 & {\em g} & domain and grid information for ocean model\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em tv} & A structure pointing to various thermodynamic variables\\
\hline
 & {\em cs} & ocean DA control structure \\
\hline
\end{DoxyParams}


Definition at line 308 of file M\+O\+M\+\_\+oda\+\_\+driver.\+F90.


\begin{DoxyCode}
308   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{ !< The current model time}
309   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: g\textcolor{comment}{ !< domain and grid information for ocean model}
310   \textcolor{keywordtype}{type}(verticalgrid\_type),               \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
311   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2]}
312   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                 \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various
       thermodynamic variables}
313 
314   \textcolor{keywordtype}{type}(oda\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< ocean DA control structure}
315   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable} :: t, s
316   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: grid=>null()
317   \textcolor{keywordtype}{integer} :: i,j, m, n, ss
318   \textcolor{keywordtype}{integer} :: is, ie, js, je
319   \textcolor{keywordtype}{integer} :: isc, iec, jsc, jec
320   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed
321   \textcolor{keywordtype}{integer} :: id
322   \textcolor{keywordtype}{logical} :: used
323 
324   \textcolor{comment}{! return if not time for analysis}
325   \textcolor{keywordflow}{if} (time < cs%Time) \textcolor{keywordflow}{return}
326 
327   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs%Grid)) \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{'ODA\_CS ensemble horizontal grid not associated'})
328   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs%GV)) \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{'ODA\_CS ensemble vertical grid not associated'})
329 
330   \textcolor{comment}{!! switch to global pelist}
331   \textcolor{keyword}{call }set\_current\_pelist(cs%filter\_pelist)
332   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{'Setting prior'})
333 
334   isc=cs%Grid%isc;iec=cs%Grid%iec;jsc=cs%Grid%jsc;jec=cs%Grid%jec
335   \textcolor{keyword}{call }mpp\_get\_compute\_domain(cs%domains(cs%ensemble\_id)%mpp\_domain,is,ie,js,je)
336   \textcolor{keyword}{call }mpp\_get\_data\_domain(cs%domains(cs%ensemble\_id)%mpp\_domain,isd,ied,jsd,jed)
337   \textcolor{keyword}{allocate}(t(isd:ied,jsd:jed,cs%nk))
338   \textcolor{keyword}{allocate}(s(isd:ied,jsd:jed,cs%nk))
339 
340   \textcolor{keywordflow}{do} j=js,je; \textcolor{keywordflow}{do} i=is,ie
341     \textcolor{keyword}{call }remapping\_core\_h(cs%remapCS, gv%ke, h(i,j,:), tv%T(i,j,:), &
342          cs%nk, cs%h(i,j,:), t(i,j,:))
343     \textcolor{keyword}{call }remapping\_core\_h(cs%remapCS, gv%ke, h(i,j,:), tv%S(i,j,:), &
344          cs%nk, cs%h(i,j,:), s(i,j,:))
345 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
346 
347   \textcolor{keywordflow}{do} m=1,cs%ensemble\_size
348     \textcolor{keyword}{call }mpp\_redistribute(cs%domains(m)%mpp\_domain, t,&
349          cs%mpp\_domain, cs%Ocean\_prior%T(:,:,:,m), complete=.true.)
350     \textcolor{keyword}{call }mpp\_redistribute(cs%domains(m)%mpp\_domain, s,&
351          cs%mpp\_domain, cs%Ocean\_prior%S(:,:,:,m), complete=.true.)
352 \textcolor{keywordflow}{  enddo}
353   \textcolor{keyword}{deallocate}(t,s)
354 
355   \textcolor{comment}{!! switch back to ensemble member pelist}
356   \textcolor{keyword}{call }set\_current\_pelist(cs%ensemble\_pelist(cs%ensemble\_id,:))
357 
358   \textcolor{keywordflow}{return}
359 
\end{DoxyCode}
