\hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__field}{}\doxysection{mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field Interface Reference}
\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__field}\index{mom\_ale\_sponge::set\_up\_ale\_sponge\_field@{mom\_ale\_sponge::set\_up\_ale\_sponge\_field}}


\doxysubsection{Detailed Description}
Store the reference profile at h points for a variable. 

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

\doxysubsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_ac13ca73c932cc3ea73a84ff6850f95c7}{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+\_\+fixed}} (sp\+\_\+val, G, f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em This subroutine stores the reference profile at h points for the variable whose address is given by f\+\_\+ptr. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_a81f7ebe56416697ed6015bb062e05dd6}{set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+\_\+varying}} (filename, fieldname, Time, G, GV, US, f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em This subroutine stores the reference profile at h points for the variable whose address is given by filename and fieldname. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Store the reference profile at h points for a variable. 

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



\doxysubsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_ac13ca73c932cc3ea73a84ff6850f95c7}\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_ac13ca73c932cc3ea73a84ff6850f95c7}} 
\index{mom\_ale\_sponge::set\_up\_ale\_sponge\_field@{mom\_ale\_sponge::set\_up\_ale\_sponge\_field}!set\_up\_ale\_sponge\_field\_fixed@{set\_up\_ale\_sponge\_field\_fixed}}
\index{set\_up\_ale\_sponge\_field\_fixed@{set\_up\_ale\_sponge\_field\_fixed}!mom\_ale\_sponge::set\_up\_ale\_sponge\_field@{mom\_ale\_sponge::set\_up\_ale\_sponge\_field}}
\doxysubsubsection{\texorpdfstring{set\_up\_ale\_sponge\_field\_fixed()}{set\_up\_ale\_sponge\_field\_fixed()}}
{\footnotesize\ttfamily subroutine mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+\_\+fixed (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed,cs\%nz\+\_\+data), intent(in)}]{sp\+\_\+val,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\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 h points for the variable whose address is given by f\+\_\+ptr. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Grid structure \\
\hline
 & {\em cs} & A\+LE sponge control structure (in/out). \\
\hline
\mbox{\texttt{ in}}  & {\em sp\+\_\+val} & Field to be used in the sponge, it has arbitrary number of layers. \\
\hline
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & Pointer to the field to be damped \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{564   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{  !< Grid structure}}
\DoxyCodeLine{565   \textcolor{keywordtype}{type}(ALE\_sponge\_CS),   \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< ALE sponge control structure (in/out).}}
\DoxyCodeLine{566 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),CS\%nz\_data)}, \&}
\DoxyCodeLine{567                          \textcolor{keywordtype}{intent(in)} :: sp\_val\textcolor{comment}{ !< Field to be used in the sponge, it has arbitrary number of layers.}}
\DoxyCodeLine{568 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{569                  \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< Pointer to the field to be damped}}
\DoxyCodeLine{570 }
\DoxyCodeLine{571   \textcolor{keywordtype}{integer} :: j, k, col}
\DoxyCodeLine{572   \textcolor{keywordtype}{character(len=256)} :: mesg \textcolor{comment}{! String for error messages}}
\DoxyCodeLine{573 }
\DoxyCodeLine{574   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{575 }
\DoxyCodeLine{576   cs\%fldno = cs\%fldno + 1}
\DoxyCodeLine{577 }
\DoxyCodeLine{578   \textcolor{keywordflow}{if} (cs\%fldno > max\_fields\_) \textcolor{keywordflow}{then}}
\DoxyCodeLine{579     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Increase MAX\_FIELDS\_ to at least ",I3," in MOM\_memory.h or decrease \&}}
\DoxyCodeLine{580 \textcolor{stringliteral}{}\textcolor{stringliteral}{           \&the number of fields to be damped in the call to \&}}
\DoxyCodeLine{581 \textcolor{stringliteral}{}\textcolor{stringliteral}{           \&initialize\_ALE\_sponge." )'}) cs\%fldno}
\DoxyCodeLine{582     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"set\_up\_ALE\_sponge\_field: "}//mesg)}
\DoxyCodeLine{583 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{584 }
\DoxyCodeLine{585   \textcolor{comment}{! stores the reference profile}}
\DoxyCodeLine{586   \textcolor{keyword}{allocate}(cs\%Ref\_val(cs\%fldno)\%p(cs\%nz\_data,cs\%num\_col))}
\DoxyCodeLine{587   cs\%Ref\_val(cs\%fldno)\%p(:,:) = 0.0}
\DoxyCodeLine{588   \textcolor{keywordflow}{do} col=1,cs\%num\_col}
\DoxyCodeLine{589     \textcolor{keywordflow}{do} k=1,cs\%nz\_data}
\DoxyCodeLine{590       cs\%Ref\_val(cs\%fldno)\%p(k,col) = sp\_val(cs\%col\_i(col),cs\%col\_j(col),k)}
\DoxyCodeLine{591 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{592 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{593 }
\DoxyCodeLine{594   cs\%var(cs\%fldno)\%p => f\_ptr}
\DoxyCodeLine{595 }

\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_a81f7ebe56416697ed6015bb062e05dd6}\label{interfacemom__ale__sponge_1_1set__up__ale__sponge__field_a81f7ebe56416697ed6015bb062e05dd6}} 
\index{mom\_ale\_sponge::set\_up\_ale\_sponge\_field@{mom\_ale\_sponge::set\_up\_ale\_sponge\_field}!set\_up\_ale\_sponge\_field\_varying@{set\_up\_ale\_sponge\_field\_varying}}
\index{set\_up\_ale\_sponge\_field\_varying@{set\_up\_ale\_sponge\_field\_varying}!mom\_ale\_sponge::set\_up\_ale\_sponge\_field@{mom\_ale\_sponge::set\_up\_ale\_sponge\_field}}
\doxysubsubsection{\texorpdfstring{set\_up\_ale\_sponge\_field\_varying()}{set\_up\_ale\_sponge\_field\_varying()}}
{\footnotesize\ttfamily subroutine mom\+\_\+ale\+\_\+sponge\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+::set\+\_\+up\+\_\+ale\+\_\+sponge\+\_\+field\+\_\+varying (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{character(len=$\ast$), intent(in)}]{fieldname,  }\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, gv \%ke), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\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 h points for the variable whose address is given by filename and fieldname. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em filename} & The name of the file with the time varying field data \\
\hline
\mbox{\texttt{ in}}  & {\em fieldname} & The name of the field in the file with the time varying field data \\
\hline
\mbox{\texttt{ in}}  & {\em time} & The current model time \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid structure (in). \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & Pointer to the field to be damped (in). \\
\hline
 & {\em cs} & Sponge control structure (in/out). \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{601   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)} :: filename\textcolor{comment}{ !< The name of the file with the}}
\DoxyCodeLine{602 \textcolor{comment}{                                                  !! time varying field data}}
\DoxyCodeLine{603   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)} :: fieldname\textcolor{comment}{ !< The name of the field in the file}}
\DoxyCodeLine{604 \textcolor{comment}{                                                  !! with the time varying field data}}
\DoxyCodeLine{605   \textcolor{keywordtype}{type}(time\_type),         \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{  !< The current model time}}
\DoxyCodeLine{606   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{     !< Grid structure (in).}}
\DoxyCodeLine{607   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{608   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{    !< A dimensional unit scaling type}}
\DoxyCodeLine{609 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{610                    \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< Pointer to the field to be damped (in).}}
\DoxyCodeLine{611   \textcolor{keywordtype}{type}(ALE\_sponge\_CS),     \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{    !< Sponge control structure (in/out).}}
\DoxyCodeLine{612 }
\DoxyCodeLine{613   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{614 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: sp\_val\textcolor{comment}{ !< Field to be used in the sponge}}
\DoxyCodeLine{615 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:,:)} :: mask\_z\textcolor{comment}{ !< Field mask for the sponge data}}
\DoxyCodeLine{616 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{target} :: z\_in, z\_edges\_in \textcolor{comment}{! Heights [Z \string~> m].}}
\DoxyCodeLine{617 \textcolor{keywordtype}{  real} :: missing\_value}
\DoxyCodeLine{618   \textcolor{keywordtype}{integer} :: j, k, col}
\DoxyCodeLine{619   \textcolor{keywordtype}{integer} :: isd,ied,jsd,jed}
\DoxyCodeLine{620   \textcolor{keywordtype}{integer} :: nPoints}
\DoxyCodeLine{621   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(4)} :: fld\_sz}
\DoxyCodeLine{622   \textcolor{keywordtype}{integer} :: nz\_data\textcolor{comment}{ !< the number of vertical levels in this input field}}
\DoxyCodeLine{623   \textcolor{keywordtype}{character(len=256)} :: mesg \textcolor{comment}{! String for error messages}}
\DoxyCodeLine{624   \textcolor{comment}{! Local variables for ALE remapping}}
\DoxyCodeLine{625 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{allocatable} :: tmpT1d}
\DoxyCodeLine{626 \textcolor{keywordtype}{  real} :: zTopOfCell, zBottomOfCell \textcolor{comment}{! Heights [Z \string~> m].}}
\DoxyCodeLine{627   \textcolor{keywordtype}{type}(remapping\_CS) :: remapCS \textcolor{comment}{! Remapping parameters and work arrays}}
\DoxyCodeLine{628 }
\DoxyCodeLine{629   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{630   \textcolor{comment}{! initialize time interpolator module}}
\DoxyCodeLine{631   \textcolor{keyword}{call }time\_interp\_external\_init()}
\DoxyCodeLine{632   isd = g\%isd; ied = g\%ied; jsd = g\%jsd; jed = g\%jed}
\DoxyCodeLine{633   cs\%fldno = cs\%fldno + 1}
\DoxyCodeLine{634   \textcolor{keywordflow}{if} (cs\%fldno > max\_fields\_) \textcolor{keywordflow}{then}}
\DoxyCodeLine{635     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Increase MAX\_FIELDS\_ to at least ",I3," in MOM\_memory.h or decrease \&}}
\DoxyCodeLine{636 \textcolor{stringliteral}{}\textcolor{stringliteral}{           \&the number of fields to be damped in the call to \&}}
\DoxyCodeLine{637 \textcolor{stringliteral}{}\textcolor{stringliteral}{           \&initialize\_ALE\_sponge." )'}) cs\%fldno}
\DoxyCodeLine{638     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"set\_up\_ALE\_sponge\_field: "}//mesg)}
\DoxyCodeLine{639 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{640   \textcolor{comment}{! get a unique time interp id for this field. If sponge data is ongrid, then setup}}
\DoxyCodeLine{641   \textcolor{comment}{! to only read on the computational domain}}
\DoxyCodeLine{642   \textcolor{keywordflow}{if} (cs\%spongeDataOngrid) \textcolor{keywordflow}{then}}
\DoxyCodeLine{643     cs\%Ref\_val(cs\%fldno)\%id = init\_external\_field(filename, fieldname,domain=g\%Domain\%mpp\_domain)}
\DoxyCodeLine{644   \textcolor{keywordflow}{else}}
\DoxyCodeLine{645     cs\%Ref\_val(cs\%fldno)\%id = init\_external\_field(filename, fieldname)}
\DoxyCodeLine{646 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{647   fld\_sz(1:4)=-\/1}
\DoxyCodeLine{648   fld\_sz = get\_external\_field\_size(cs\%Ref\_val(cs\%fldno)\%id)}
\DoxyCodeLine{649   nz\_data = fld\_sz(3)}
\DoxyCodeLine{650   cs\%Ref\_val(cs\%fldno)\%nz\_data = nz\_data \textcolor{comment}{!< individual sponge fields may reside on a different vertical grid}}
\DoxyCodeLine{651   cs\%Ref\_val(cs\%fldno)\%num\_tlevs = fld\_sz(4)}
\DoxyCodeLine{652   \textcolor{comment}{! initializes the target profile array for this field}}
\DoxyCodeLine{653   \textcolor{comment}{! for all columns which will be masked}}
\DoxyCodeLine{654   \textcolor{keyword}{allocate}(cs\%Ref\_val(cs\%fldno)\%p(nz\_data,cs\%num\_col))}
\DoxyCodeLine{655   cs\%Ref\_val(cs\%fldno)\%p(:,:) = 0.0}
\DoxyCodeLine{656   \textcolor{keyword}{allocate}( cs\%Ref\_val(cs\%fldno)\%h(nz\_data,cs\%num\_col) )}
\DoxyCodeLine{657   cs\%Ref\_val(cs\%fldno)\%h(:,:) = 0.0}
\DoxyCodeLine{658   cs\%var(cs\%fldno)\%p => f\_ptr}
\DoxyCodeLine{659 }
\DoxyCodeLine{660 }

\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}
