\hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field}{}\section{mom\+\_\+ale\+\_\+sponge\+:\+:set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field Interface Reference}
\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field}\index{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field@{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field}}


\subsection{Detailed Description}
This subroutine stores the reference profile at u and v points for a vector. 

Definition at line 40 of file M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aa0daa07893ebcc910b5f5dcdae3eaf81}{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed} (u\+\_\+val, v\+\_\+val, G, u\+\_\+ptr, v\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em This subroutine stores the reference profile at u and v points for the variable whose address is given by u\+\_\+ptr and v\+\_\+ptr. \end{DoxyCompactList}\item 
subroutine \hyperlink{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aae74143786257b294a22b4e450bb6a67}{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying} (filename\+\_\+u, fieldname\+\_\+u, filename\+\_\+v, fieldname\+\_\+v, Time, G, US, CS, u\+\_\+ptr, v\+\_\+ptr)
\begin{DoxyCompactList}\small\item\em This subroutine stores the reference profile at uand v points for the variable whose address is given by u\+\_\+ptr and v\+\_\+ptr. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This subroutine stores the reference profile at u and v points for a vector. 

Definition at line 40 of file M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90.



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aa0daa07893ebcc910b5f5dcdae3eaf81}\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aa0daa07893ebcc910b5f5dcdae3eaf81}} 
\index{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field@{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field}!set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed@{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed}}
\index{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed@{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed}!mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field@{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field}}
\subsubsection{\texorpdfstring{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed()}{set\_up\_ale\_sponge\_vel\_field\_fixed()}}
{\footnotesize\ttfamily subroutine mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+fixed (\begin{DoxyParamCaption}\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed,cs\%nz\+\_\+data), intent(in)}]{u\+\_\+val,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb,cs\%nz\+\_\+data), intent(in)}]{v\+\_\+val,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in), target}]{u\+\_\+ptr,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in), target}]{v\+\_\+ptr,  }\item[{type(\hyperlink{structmom__ale__sponge_1_1ale__sponge__cs}{ale\+\_\+sponge\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine stores the reference profile at u and v points for the variable whose address is given by u\+\_\+ptr and v\+\_\+ptr. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Grid structure (in).\\
\hline
 & {\em cs} & Sponge structure (in/out).\\
\hline
\mbox{\tt in}  & {\em u\+\_\+val} & u field to be used in the sponge, it has arbritary number of layers.\\
\hline
\mbox{\tt in}  & {\em v\+\_\+val} & v field to be used in the sponge, it has arbritary number of layers.\\
\hline
\mbox{\tt in}  & {\em u\+\_\+ptr} & u pointer to the field to be damped\\
\hline
\mbox{\tt in}  & {\em v\+\_\+ptr} & v pointer to the field to be damped \\
\hline
\end{DoxyParams}


Definition at line 666 of file M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90.


\begin{DoxyCode}
666   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{  !< Grid structure (in).}
667   \textcolor{keywordtype}{type}(ale\_sponge\_cs),   \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< Sponge structure (in/out).}
668   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),CS%nz\_data)}, &
669                          \textcolor{keywordtype}{intent(in)} :: u\_val\textcolor{comment}{ !< u field to be used in the sponge, it has arbritary number
       of layers.}
670   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),CS%nz\_data)}, &
671                          \textcolor{keywordtype}{intent(in)} :: v\_val\textcolor{comment}{ !< v field to be used in the sponge, it has arbritary number
       of layers.}
672   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: u\_ptr\textcolor{comment}{ !< u pointer to the field to be
       damped}
673   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: v\_ptr\textcolor{comment}{ !< v pointer to the field to be
       damped}
674 
675   \textcolor{keywordtype}{integer} :: j, k, col
676   \textcolor{keywordtype}{character(len=256)} :: mesg \textcolor{comment}{! String for error messages}
677 
678   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
679 
680   \textcolor{comment}{! stores the reference profile}
681   \textcolor{keyword}{allocate}(cs%Ref\_val\_u%p(cs%nz\_data,cs%num\_col\_u))
682   cs%Ref\_val\_u%p(:,:) = 0.0
683   \textcolor{keywordflow}{do} col=1,cs%num\_col\_u
684     \textcolor{keywordflow}{do} k=1,cs%nz\_data
685       cs%Ref\_val\_u%p(k,col) = u\_val(cs%col\_i\_u(col),cs%col\_j\_u(col),k)
686 \textcolor{keywordflow}{    enddo}
687 \textcolor{keywordflow}{  enddo}
688   cs%var\_u%p => u\_ptr
689   \textcolor{keyword}{allocate}(cs%Ref\_val\_v%p(cs%nz\_data,cs%num\_col\_v))
690   cs%Ref\_val\_v%p(:,:) = 0.0
691   \textcolor{keywordflow}{do} col=1,cs%num\_col\_v
692     \textcolor{keywordflow}{do} k=1,cs%nz\_data
693       cs%Ref\_val\_v%p(k,col) = v\_val(cs%col\_i\_v(col),cs%col\_j\_v(col),k)
694 \textcolor{keywordflow}{    enddo}
695 \textcolor{keywordflow}{  enddo}
696   cs%var\_v%p => v\_ptr
697 
\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aae74143786257b294a22b4e450bb6a67}\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__vel__field_aae74143786257b294a22b4e450bb6a67}} 
\index{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field@{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field}!set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying@{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying}}
\index{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying@{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying}!mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field@{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field}}
\subsubsection{\texorpdfstring{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying()}{set\_up\_ale\_sponge\_vel\_field\_varying()}}
{\footnotesize\ttfamily subroutine mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+vel\+\_\+field\+\_\+varying (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename\+\_\+u,  }\item[{character(len=$\ast$), intent(in)}]{fieldname\+\_\+u,  }\item[{character(len=$\ast$), intent(in)}]{filename\+\_\+v,  }\item[{character(len=$\ast$), intent(in)}]{fieldname\+\_\+v,  }\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structmom__ale__sponge_1_1ale__sponge__cs}{ale\+\_\+sponge\+\_\+cs}), pointer}]{CS,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in), target}]{u\+\_\+ptr,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in), target}]{v\+\_\+ptr }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine stores the reference profile at uand v points for the variable whose address is given by u\+\_\+ptr and v\+\_\+ptr. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em filename\+\_\+u} & File name for u field\\
\hline
\mbox{\tt in}  & {\em fieldname\+\_\+u} & Name of u variable in file\\
\hline
\mbox{\tt in}  & {\em filename\+\_\+v} & File name for v field\\
\hline
\mbox{\tt in}  & {\em fieldname\+\_\+v} & Name of v variable in file\\
\hline
\mbox{\tt in}  & {\em time} & Model time\\
\hline
\mbox{\tt in,out}  & {\em g} & Ocean grid (in)\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & Sponge structure (in/out).\\
\hline
\mbox{\tt in}  & {\em u\+\_\+ptr} & u pointer to the field to be damped (in).\\
\hline
\mbox{\tt in}  & {\em v\+\_\+ptr} & v pointer to the field to be damped (in). \\
\hline
\end{DoxyParams}


Definition at line 704 of file M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90.


\begin{DoxyCode}
704   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)}    :: filename\_u\textcolor{comment}{  !< File name for u field}
705   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)}    :: fieldname\_u\textcolor{comment}{ !< Name of u variable in file}
706   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)}    :: filename\_v\textcolor{comment}{  !< File name for v field}
707   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)}    :: fieldname\_v\textcolor{comment}{ !< Name of v variable in file}
708   \textcolor{keywordtype}{type}(time\_type),  \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{        !< Model time}
709   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: g\textcolor{comment}{      !< Ocean grid (in)}
710   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
711   \textcolor{keywordtype}{type}(ale\_sponge\_cs), \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{          !< Sponge structure (in/out).}
712   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: u\_ptr\textcolor{comment}{ !< u pointer to the field to be
       damped (in).}
713   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: v\_ptr\textcolor{comment}{ !< v pointer to the field to be
       damped (in).}
714   \textcolor{comment}{! Local variables}
715   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: u\_val\textcolor{comment}{ !< U field to be used in the sponge.}
716   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: mask\_u\textcolor{comment}{ !< U field mask for the sponge data.}
717   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: v\_val\textcolor{comment}{ !< V field to be used in the sponge.}
718   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: mask\_v\textcolor{comment}{ !< V field mask for the sponge data.}
719 
720   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{target} :: z\_in, z\_edges\_in
721   \textcolor{keywordtype}{real} :: missing\_value
722 
723   \textcolor{keywordtype}{integer} :: j, k, col
724   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed
725   \textcolor{keywordtype}{integer} :: isdb, iedb, jsdb, jedb
726   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(4)} :: fld\_sz
727   \textcolor{keywordtype}{character(len=256)} :: mesg \textcolor{comment}{! String for error messages}
728 
729   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
730 
731   isd = g%isd; ied = g%ied; jsd = g%jsd; jed = g%jed
732   isdb = g%isdB; iedb = g%iedB; jsdb = g%jsdB; jedb = g%jedB
733   \textcolor{comment}{! get a unique id for this field which will allow us to return an array}
734   \textcolor{comment}{! containing time-interpolated values from an external file corresponding}
735   \textcolor{comment}{! to the current model date.}
736   cs%Ref\_val\_u%id = init\_external\_field(filename\_u, fieldname\_u)
737   fld\_sz(1:4)=-1
738   fld\_sz = get\_external\_field\_size(cs%Ref\_val\_u%id)
739   cs%Ref\_val\_u%nz\_data = fld\_sz(3)
740   cs%Ref\_val\_u%num\_tlevs = fld\_sz(4)
741   cs%Ref\_val\_v%id = init\_external\_field(filename\_v, fieldname\_v)
742   fld\_sz(1:4)=-1
743   fld\_sz = get\_external\_field\_size(cs%Ref\_val\_v%id)
744   cs%Ref\_val\_v%nz\_data = fld\_sz(3)
745   cs%Ref\_val\_v%num\_tlevs = fld\_sz(4)
746   \textcolor{keyword}{allocate}( u\_val(isdb:iedb,jsd:jed, fld\_sz(3)) )
747   \textcolor{keyword}{allocate}( mask\_u(isdb:iedb,jsd:jed, fld\_sz(3)) )
748   \textcolor{keyword}{allocate}( v\_val(isd:ied,jsdb:jedb, fld\_sz(3)) )
749   \textcolor{keyword}{allocate}( mask\_v(isd:ied,jsdb:jedb, fld\_sz(3)) )
750   \textcolor{comment}{! Interpolate external file data to the model grid}
751   \textcolor{comment}{! I am hard-wiring this call to assume that the input grid is zonally re-entrant}
752   \textcolor{comment}{! In the future, this should be generalized using an interface to return the}
753   \textcolor{comment}{! modulo attribute of the zonal axis (mjh).}
754   \textcolor{keyword}{call }horiz\_interp\_and\_extrap\_tracer(cs%Ref\_val\_u%id, time, 1.0, g, u\_val, mask\_u, z\_in, z\_edges\_in, &
755                                       missing\_value, .true., .false., .false., m\_to\_z=us%m\_to\_Z, &
756                                       answers\_2018=cs%hor\_regrid\_answers\_2018)
757   \textcolor{comment}{!!! TODO: add a velocity interface! (mjh)}
758   \textcolor{comment}{! Interpolate external file data to the model grid}
759   \textcolor{comment}{! I am hard-wiring this call to assume that the input grid is zonally re-entrant}
760   \textcolor{comment}{! In the future, this should be generalized using an interface to return the}
761   \textcolor{comment}{! modulo attribute of the zonal axis (mjh).}
762   \textcolor{keyword}{call }horiz\_interp\_and\_extrap\_tracer(cs%Ref\_val\_v%id, time, 1.0, g, v\_val, mask\_v, z\_in, z\_edges\_in, &
763                                       missing\_value, .true., .false., .false., m\_to\_z=us%m\_to\_Z, &
764                                       answers\_2018=cs%hor\_regrid\_answers\_2018)
765   \textcolor{comment}{! stores the reference profile}
766   \textcolor{keyword}{allocate}(cs%Ref\_val\_u%p(fld\_sz(3),cs%num\_col\_u))
767   cs%Ref\_val\_u%p(:,:) = 0.0
768   \textcolor{keywordflow}{do} col=1,cs%num\_col\_u
769     \textcolor{keywordflow}{do} k=1,fld\_sz(3)
770       cs%Ref\_val\_u%p(k,col) = u\_val(cs%col\_i\_u(col),cs%col\_j\_u(col),k)
771 \textcolor{keywordflow}{    enddo}
772 \textcolor{keywordflow}{  enddo}
773   cs%var\_u%p => u\_ptr
774   \textcolor{keyword}{allocate}(cs%Ref\_val\_v%p(fld\_sz(3),cs%num\_col\_v))
775   cs%Ref\_val\_v%p(:,:) = 0.0
776   \textcolor{keywordflow}{do} col=1,cs%num\_col\_v
777     \textcolor{keywordflow}{do} k=1,fld\_sz(3)
778       cs%Ref\_val\_v%p(k,col) = v\_val(cs%col\_i\_v(col),cs%col\_j\_v(col),k)
779 \textcolor{keywordflow}{    enddo}
780 \textcolor{keywordflow}{  enddo}
781   cs%var\_v%p => v\_ptr
782 
\end{DoxyCode}


The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/home/cermak/src/\+M\+O\+M6.\+devrob/src/parameterizations/vertical/M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90\end{DoxyCompactItemize}
