\hypertarget{interfacemom__ale__sponge_1_1set__up__ale__sponge__field}{}\section{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}}


\subsection{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.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \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 \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}


\subsection{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.



\subsection{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}}
\subsubsection{\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(\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{\tt in}  & {\em g} & Grid structure\\
\hline
 & {\em cs} & A\+LE sponge control structure (in/out).\\
\hline
\mbox{\tt in}  & {\em sp\+\_\+val} & Field to be used in the sponge, it has arbitrary number of layers.\\
\hline
\mbox{\tt in}  & {\em f\+\_\+ptr} & Pointer to the field to be damped \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
564   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{  !< Grid structure}
565   \textcolor{keywordtype}{type}(ale\_sponge\_cs),   \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< ALE sponge control structure (in/out).}
566   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),CS%nz\_data)}, &
567                          \textcolor{keywordtype}{intent(in)} :: sp\_val\textcolor{comment}{ !< Field to be used in the sponge, it has arbitrary number of
       layers.}
568   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
569                  \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< Pointer to the field to be damped}
570 
571   \textcolor{keywordtype}{integer} :: j, k, col
572   \textcolor{keywordtype}{character(len=256)} :: mesg \textcolor{comment}{! String for error messages}
573 
574   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
575 
576   cs%fldno = cs%fldno + 1
577 
578   \textcolor{keywordflow}{if} (cs%fldno > max\_fields\_) \textcolor{keywordflow}{then}
579     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Increase MAX\_FIELDS\_ to at least ",I3," in MOM\_memory.h or decrease &}
580 \textcolor{stringliteral}{}\textcolor{stringliteral}{           &the number of fields to be damped in the call to &}
581 \textcolor{stringliteral}{}\textcolor{stringliteral}{           &initialize\_ALE\_sponge." )'}) cs%fldno
582     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"set\_up\_ALE\_sponge\_field: "}//mesg)
583 \textcolor{keywordflow}{  endif}
584 
585   \textcolor{comment}{! stores the reference profile}
586   \textcolor{keyword}{allocate}(cs%Ref\_val(cs%fldno)%p(cs%nz\_data,cs%num\_col))
587   cs%Ref\_val(cs%fldno)%p(:,:) = 0.0
588   \textcolor{keywordflow}{do} col=1,cs%num\_col
589     \textcolor{keywordflow}{do} k=1,cs%nz\_data
590       cs%Ref\_val(cs%fldno)%p(k,col) = sp\_val(cs%col\_i(col),cs%col\_j(col),k)
591 \textcolor{keywordflow}{    enddo}
592 \textcolor{keywordflow}{  enddo}
593 
594   cs%var(cs%fldno)%p => f\_ptr
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}}
\subsubsection{\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(\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{\tt in}  & {\em filename} & The name of the file with the time varying field data\\
\hline
\mbox{\tt in}  & {\em fieldname} & The name of the field in the file with the time varying field data\\
\hline
\mbox{\tt in}  & {\em time} & The current model time\\
\hline
\mbox{\tt in}  & {\em g} & Grid structure (in).\\
\hline
\mbox{\tt in}  & {\em gv} & ocean vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt 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 601 of file M\+O\+M\+\_\+\+A\+L\+E\+\_\+sponge.\+F90.


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