\hypertarget{namespacemom__transcribe__grid}{}\section{mom\+\_\+transcribe\+\_\+grid Module Reference}
\label{namespacemom__transcribe__grid}\index{mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}}


\subsection{Detailed Description}
Module with routines for copying information from a shared dynamic horizontal grid to an ocean-\/specific horizontal grid and the reverse. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__transcribe__grid_abe8bd4f6f75bf431d0b53ef702a91d8d}{copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid}} (dG, oG, US)
\begin{DoxyCompactList}\small\item\em Copies information from a dynamic (shared) horizontal grid type into an ocean\+\_\+grid\+\_\+type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__transcribe__grid_afe3cc701e19603d664699db7fe8d72a8}{copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid}} (oG, dG, US)
\begin{DoxyCompactList}\small\item\em Copies information from an ocean\+\_\+grid\+\_\+type into a dynamic (shared) horizontal grid type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__transcribe__grid_a6eb8778abd0e6800af90271536b19796}{rotate\+\_\+dyngrid}} (G\+\_\+in, G, US, turns)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__transcribe__grid_abe8bd4f6f75bf431d0b53ef702a91d8d}\label{namespacemom__transcribe__grid_abe8bd4f6f75bf431d0b53ef702a91d8d}} 
\index{mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}!copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid@{copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid}}
\index{copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid@{copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid}!mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}}
\subsubsection{\texorpdfstring{copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid()}{copy\_dyngrid\_to\_mom\_grid()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+transcribe\+\_\+grid\+::copy\+\_\+dyngrid\+\_\+to\+\_\+mom\+\_\+grid (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{dG,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{oG,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US }\end{DoxyParamCaption})}



Copies information from a dynamic (shared) horizontal grid type into an ocean\+\_\+grid\+\_\+type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em dg} & Common horizontal grid type\\
\hline
\mbox{\tt in,out}  & {\em og} & Ocean grid type\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 25 of file M\+O\+M\+\_\+transcribe\+\_\+grid.\+F90.


\begin{DoxyCode}
25   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(in)}    :: dG\textcolor{comment}{  !< Common horizontal grid type}
26   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(inout)} :: oG\textcolor{comment}{  !< Ocean grid type}
27   \textcolor{keywordtype}{type}(unit\_scale\_type),  \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{  !< A dimensional unit scaling type}
28 
29   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed      \textcolor{comment}{! Common data domains.}
30   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB  \textcolor{comment}{! Common data domains.}
31   \textcolor{keywordtype}{integer} :: ido, jdo, Ido2, Jdo2    \textcolor{comment}{! Indexing offsets between the grids.}
32   \textcolor{keywordtype}{integer} :: Igst, Jgst              \textcolor{comment}{! Global starting indices.}
33   \textcolor{keywordtype}{integer} :: i, j
34 
35   \textcolor{comment}{! MOM\_grid\_init and create\_dyn\_horgrid are called outside of this routine.}
36   \textcolor{comment}{! This routine copies over the fields that were set by MOM\_initialized\_fixed.}
37 
38   \textcolor{comment}{! Determine the indexing offsets between the grids.}
39   ido = dg%idg\_offset - og%idg\_offset
40   jdo = dg%jdg\_offset - og%jdg\_offset
41 
42   isd = max(og%isd, dg%isd+ido) ; jsd = max(og%jsd, dg%jsd+jdo)
43   ied = min(og%ied, dg%ied+ido) ; jed = min(og%jed, dg%jed+jdo)
44   isdb = max(og%IsdB, dg%IsdB+ido) ; jsdb = max(og%JsdB, dg%JsdB+jdo)
45   iedb = min(og%IedB, dg%IedB+ido) ; jedb = min(og%JedB, dg%JedB+jdo)
46 
47   \textcolor{comment}{! Check that the grids conform.}
48   \textcolor{keywordflow}{if} ((isd > og%isc) .or. (ied < og%ied) .or. (jsd > og%jsc) .or. (jed > og%jed)) &
49     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"copy\_dyngrid\_to\_MOM\_grid called with incompatible grids."})
50 
51   \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsd,jed
52     og%geoLonT(i,j) = dg%geoLonT(i+ido,j+jdo)
53     og%geoLatT(i,j) = dg%geoLatT(i+ido,j+jdo)
54     og%dxT(i,j) = dg%dxT(i+ido,j+jdo)
55     og%dyT(i,j) = dg%dyT(i+ido,j+jdo)
56     og%areaT(i,j) = dg%areaT(i+ido,j+jdo)
57     og%bathyT(i,j) = dg%bathyT(i+ido,j+jdo)
58 
59     og%dF\_dx(i,j) = dg%dF\_dx(i+ido,j+jdo)
60     og%dF\_dy(i,j) = dg%dF\_dy(i+ido,j+jdo)
61     og%sin\_rot(i,j) = dg%sin\_rot(i+ido,j+jdo)
62     og%cos\_rot(i,j) = dg%cos\_rot(i+ido,j+jdo)
63     og%mask2dT(i,j) = dg%mask2dT(i+ido,j+jdo)
64 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
65 
66   \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsd,jed
67     og%geoLonCu(i,j) = dg%geoLonCu(i+ido,j+jdo)
68     og%geoLatCu(i,j) = dg%geoLatCu(i+ido,j+jdo)
69     og%dxCu(i,j) = dg%dxCu(i+ido,j+jdo)
70     og%dyCu(i,j) = dg%dyCu(i+ido,j+jdo)
71     og%dy\_Cu(i,j) = dg%dy\_Cu(i+ido,j+jdo)
72 
73     og%mask2dCu(i,j) = dg%mask2dCu(i+ido,j+jdo)
74     og%areaCu(i,j) = dg%areaCu(i+ido,j+jdo)
75     og%IareaCu(i,j) = dg%IareaCu(i+ido,j+jdo)
76 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
77 
78   \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsdb,jedb
79     og%geoLonCv(i,j) = dg%geoLonCv(i+ido,j+jdo)
80     og%geoLatCv(i,j) = dg%geoLatCv(i+ido,j+jdo)
81     og%dxCv(i,j) = dg%dxCv(i+ido,j+jdo)
82     og%dyCv(i,j) = dg%dyCv(i+ido,j+jdo)
83     og%dx\_Cv(i,j) = dg%dx\_Cv(i+ido,j+jdo)
84 
85     og%mask2dCv(i,j) = dg%mask2dCv(i+ido,j+jdo)
86     og%areaCv(i,j) = dg%areaCv(i+ido,j+jdo)
87     og%IareaCv(i,j) = dg%IareaCv(i+ido,j+jdo)
88 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
89 
90   \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsdb,jedb
91     og%geoLonBu(i,j) = dg%geoLonBu(i+ido,j+jdo)
92     og%geoLatBu(i,j) = dg%geoLatBu(i+ido,j+jdo)
93     og%dxBu(i,j) = dg%dxBu(i+ido,j+jdo)
94     og%dyBu(i,j) = dg%dyBu(i+ido,j+jdo)
95     og%areaBu(i,j) = dg%areaBu(i+ido,j+jdo)
96     og%CoriolisBu(i,j) = dg%CoriolisBu(i+ido,j+jdo)
97     og%mask2dBu(i,j) = dg%mask2dBu(i+ido,j+jdo)
98 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
99 
100   og%bathymetry\_at\_vel = dg%bathymetry\_at\_vel
101   \textcolor{keywordflow}{if} (og%bathymetry\_at\_vel) \textcolor{keywordflow}{then}
102     \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsd,jed
103       og%Dblock\_u(i,j) = dg%Dblock\_u(i+ido,j+jdo)
104       og%Dopen\_u(i,j) = dg%Dopen\_u(i+ido,j+jdo)
105 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
106     \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsdb,jedb
107       og%Dblock\_v(i,j) = dg%Dblock\_v(i+ido,j+jdo)
108       og%Dopen\_v(i,j) = dg%Dopen\_v(i+ido,j+jdo)
109 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
110 \textcolor{keywordflow}{  endif}
111 
112   og%gridLonT(og%isg:og%ieg) = dg%gridLonT(dg%isg:dg%ieg)
113   og%gridLatT(og%jsg:og%jeg) = dg%gridLatT(dg%jsg:dg%jeg)
114   \textcolor{comment}{! The more complicated logic here avoids segmentation faults if one grid uses}
115   \textcolor{comment}{! global symmetric memory while the other does not.  Because a northeast grid}
116   \textcolor{comment}{! convention is being used, the upper bounds for each array correspond.}
117   \textcolor{comment}{!   Note that the dynamic grid always uses symmetric memory.}
118   ido2 = dg%IegB-og%IegB ; igst = max(og%IsgB, (dg%isg-1)-ido2)
119   jdo2 = dg%JegB-og%JegB ; jgst = max(og%JsgB, (dg%jsg-1)-jdo2)
120   \textcolor{keywordflow}{do} i=igst,og%IegB ; og%gridLonB(i) = dg%gridLonB(i+ido2) ;\textcolor{keywordflow}{ enddo}
121   \textcolor{keywordflow}{do} j=jgst,og%JegB ; og%gridLatB(j) = dg%gridLatB(j+jdo2) ;\textcolor{keywordflow}{ enddo}
122 
123   \textcolor{comment}{! Copy various scalar variables and strings.}
124   og%x\_axis\_units = dg%x\_axis\_units ; og%y\_axis\_units = dg%y\_axis\_units
125   og%areaT\_global = dg%areaT\_global ; og%IareaT\_global = dg%IareaT\_global
126   og%south\_lat = dg%south\_lat ; og%west\_lon  = dg%west\_lon
127   og%len\_lat = dg%len\_lat ; og%len\_lon = dg%len\_lon
128   og%Rad\_Earth = dg%Rad\_Earth ; og%max\_depth = dg%max\_depth
129 
130 \textcolor{comment}{! Update the halos in case the dynamic grid has smaller halos than the ocean grid.}
131   \textcolor{keyword}{call }pass\_var(og%areaT, og%Domain)
132   \textcolor{keyword}{call }pass\_var(og%bathyT, og%Domain)
133   \textcolor{keyword}{call }pass\_var(og%geoLonT, og%Domain)
134   \textcolor{keyword}{call }pass\_var(og%geoLatT, og%Domain)
135   \textcolor{keyword}{call }pass\_vector(og%dxT, og%dyT, og%Domain, to\_all+scalar\_pair, agrid)
136   \textcolor{keyword}{call }pass\_vector(og%dF\_dx, og%dF\_dy, og%Domain, to\_all, agrid)
137   \textcolor{keyword}{call }pass\_vector(og%cos\_rot, og%sin\_rot, og%Domain, to\_all, agrid)
138   \textcolor{keyword}{call }pass\_var(og%mask2dT, og%Domain)
139 
140   \textcolor{keyword}{call }pass\_vector(og%areaCu, og%areaCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
141   \textcolor{keyword}{call }pass\_vector(og%dyCu, og%dxCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
142   \textcolor{keyword}{call }pass\_vector(og%dxCu, og%dyCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
143   \textcolor{keyword}{call }pass\_vector(og%dy\_Cu, og%dx\_Cv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
144   \textcolor{keyword}{call }pass\_vector(og%mask2dCu, og%mask2dCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
145   \textcolor{keyword}{call }pass\_vector(og%IareaCu, og%IareaCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
146   \textcolor{keyword}{call }pass\_vector(og%IareaCu, og%IareaCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
147   \textcolor{keyword}{call }pass\_vector(og%geoLatCu, og%geoLatCv, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
148 
149   \textcolor{keyword}{call }pass\_var(og%areaBu, og%Domain, position=corner)
150   \textcolor{keyword}{call }pass\_var(og%geoLonBu, og%Domain, position=corner, inner\_halo=og%isc-isd)
151   \textcolor{keyword}{call }pass\_var(og%geoLatBu, og%Domain, position=corner)
152   \textcolor{keyword}{call }pass\_vector(og%dxBu, og%dyBu, og%Domain, to\_all+scalar\_pair, bgrid\_ne)
153   \textcolor{keyword}{call }pass\_var(og%CoriolisBu, og%Domain, position=corner)
154   \textcolor{keyword}{call }pass\_var(og%mask2dBu, og%Domain, position=corner)
155 
156   \textcolor{keywordflow}{if} (og%bathymetry\_at\_vel) \textcolor{keywordflow}{then}
157     \textcolor{keyword}{call }pass\_vector(og%Dblock\_u, og%Dblock\_v, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
158     \textcolor{keyword}{call }pass\_vector(og%Dopen\_u, og%Dopen\_v, og%Domain, to\_all+scalar\_pair, cgrid\_ne)
159 \textcolor{keywordflow}{  endif}
160 
161   \textcolor{keyword}{call }set\_derived\_metrics(og, us)
162 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__transcribe__grid_afe3cc701e19603d664699db7fe8d72a8}\label{namespacemom__transcribe__grid_afe3cc701e19603d664699db7fe8d72a8}} 
\index{mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}!copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid@{copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid}}
\index{copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid@{copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid}!mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}}
\subsubsection{\texorpdfstring{copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid()}{copy\_mom\_grid\_to\_dyngrid()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+transcribe\+\_\+grid\+::copy\+\_\+mom\+\_\+grid\+\_\+to\+\_\+dyngrid (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{oG,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{dG,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Copies information from an ocean\+\_\+grid\+\_\+type into a dynamic (shared) horizontal grid type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em og} & Ocean grid type\\
\hline
\mbox{\tt in,out}  & {\em dg} & Common horizontal grid type\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 169 of file M\+O\+M\+\_\+transcribe\+\_\+grid.\+F90.


\begin{DoxyCode}
169   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: oG\textcolor{comment}{  !< Ocean grid type}
170   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: dG\textcolor{comment}{  !< Common horizontal grid type}
171   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}
172 
173   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed      \textcolor{comment}{! Common data domains.}
174   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB  \textcolor{comment}{! Common data domains.}
175   \textcolor{keywordtype}{integer} :: ido, jdo, Ido2, Jdo2    \textcolor{comment}{! Indexing offsets between the grids.}
176   \textcolor{keywordtype}{integer} :: Igst, Jgst              \textcolor{comment}{! Global starting indices.}
177   \textcolor{keywordtype}{integer} :: i, j
178 
179   \textcolor{comment}{! MOM\_grid\_init and create\_dyn\_horgrid are called outside of this routine.}
180   \textcolor{comment}{! This routine copies over the fields that were set by MOM\_initialized\_fixed.}
181 
182   \textcolor{comment}{! Determine the indexing offsets between the grids.}
183   ido = og%idG\_offset - dg%idG\_offset
184   jdo = og%jdG\_offset - dg%jdG\_offset
185 
186   isd = max(dg%isd, og%isd+ido) ; jsd = max(dg%jsd, og%jsd+jdo)
187   ied = min(dg%ied, og%ied+ido) ; jed = min(dg%jed, og%jed+jdo)
188   isdb = max(dg%IsdB, og%IsdB+ido) ; jsdb = max(dg%JsdB, og%JsdB+jdo)
189   iedb = min(dg%IedB, og%IedB+ido) ; jedb = min(dg%JedB, og%JedB+jdo)
190 
191   \textcolor{comment}{! Check that the grids conform.}
192   \textcolor{keywordflow}{if} ((isd > dg%isc) .or. (ied < dg%ied) .or. (jsd > dg%jsc) .or. (jed > dg%jed)) &
193     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"copy\_dyngrid\_to\_MOM\_grid called with incompatible grids."})
194 
195   \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsd,jed
196     dg%geoLonT(i,j) = og%geoLonT(i+ido,j+jdo)
197     dg%geoLatT(i,j) = og%geoLatT(i+ido,j+jdo)
198     dg%dxT(i,j) = og%dxT(i+ido,j+jdo)
199     dg%dyT(i,j) = og%dyT(i+ido,j+jdo)
200     dg%areaT(i,j) = og%areaT(i+ido,j+jdo)
201     dg%bathyT(i,j) = og%bathyT(i+ido,j+jdo)
202 
203     dg%dF\_dx(i,j) = og%dF\_dx(i+ido,j+jdo)
204     dg%dF\_dy(i,j) = og%dF\_dy(i+ido,j+jdo)
205     dg%sin\_rot(i,j) = og%sin\_rot(i+ido,j+jdo)
206     dg%cos\_rot(i,j) = og%cos\_rot(i+ido,j+jdo)
207     dg%mask2dT(i,j) = og%mask2dT(i+ido,j+jdo)
208 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
209 
210   \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsd,jed
211     dg%geoLonCu(i,j) = og%geoLonCu(i+ido,j+jdo)
212     dg%geoLatCu(i,j) = og%geoLatCu(i+ido,j+jdo)
213     dg%dxCu(i,j) = og%dxCu(i+ido,j+jdo)
214     dg%dyCu(i,j) = og%dyCu(i+ido,j+jdo)
215     dg%dy\_Cu(i,j) = og%dy\_Cu(i+ido,j+jdo)
216 
217     dg%mask2dCu(i,j) = og%mask2dCu(i+ido,j+jdo)
218     dg%areaCu(i,j) = og%areaCu(i+ido,j+jdo)
219     dg%IareaCu(i,j) = og%IareaCu(i+ido,j+jdo)
220 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
221 
222   \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsdb,jedb
223     dg%geoLonCv(i,j) = og%geoLonCv(i+ido,j+jdo)
224     dg%geoLatCv(i,j) = og%geoLatCv(i+ido,j+jdo)
225     dg%dxCv(i,j) = og%dxCv(i+ido,j+jdo)
226     dg%dyCv(i,j) = og%dyCv(i+ido,j+jdo)
227     dg%dx\_Cv(i,j) = og%dx\_Cv(i+ido,j+jdo)
228 
229     dg%mask2dCv(i,j) = og%mask2dCv(i+ido,j+jdo)
230     dg%areaCv(i,j) = og%areaCv(i+ido,j+jdo)
231     dg%IareaCv(i,j) = og%IareaCv(i+ido,j+jdo)
232 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
233 
234   \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsdb,jedb
235     dg%geoLonBu(i,j) = og%geoLonBu(i+ido,j+jdo)
236     dg%geoLatBu(i,j) = og%geoLatBu(i+ido,j+jdo)
237     dg%dxBu(i,j) = og%dxBu(i+ido,j+jdo)
238     dg%dyBu(i,j) = og%dyBu(i+ido,j+jdo)
239     dg%areaBu(i,j) = og%areaBu(i+ido,j+jdo)
240     dg%CoriolisBu(i,j) = og%CoriolisBu(i+ido,j+jdo)
241     dg%mask2dBu(i,j) = og%mask2dBu(i+ido,j+jdo)
242 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
243 
244   dg%bathymetry\_at\_vel = og%bathymetry\_at\_vel
245   \textcolor{keywordflow}{if} (dg%bathymetry\_at\_vel) \textcolor{keywordflow}{then}
246     \textcolor{keywordflow}{do} i=isdb,iedb ; \textcolor{keywordflow}{do} j=jsd,jed
247       dg%Dblock\_u(i,j) = og%Dblock\_u(i+ido,j+jdo)
248       dg%Dopen\_u(i,j) = og%Dopen\_u(i+ido,j+jdo)
249 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
250     \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsdb,jedb
251       dg%Dblock\_v(i,j) = og%Dblock\_v(i+ido,j+jdo)
252       dg%Dopen\_v(i,j) = og%Dopen\_v(i+ido,j+jdo)
253 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
254 \textcolor{keywordflow}{  endif}
255 
256   dg%gridLonT(dg%isg:dg%ieg) = og%gridLonT(og%isg:og%ieg)
257   dg%gridLatT(dg%jsg:dg%jeg) = og%gridLatT(og%jsg:og%jeg)
258 
259   \textcolor{comment}{! The more complicated logic here avoids segmentation faults if one grid uses}
260   \textcolor{comment}{! global symmetric memory while the other does not.  Because a northeast grid}
261   \textcolor{comment}{! convention is being used, the upper bounds for each array correspond.}
262   \textcolor{comment}{!   Note that the dynamic grid always uses symmetric memory.}
263   ido2 = og%IegB-dg%IegB ; igst = max(dg%isg-1, og%IsgB-ido2)
264   jdo2 = og%JegB-dg%JegB ; jgst = max(dg%jsg-1, og%JsgB-jdo2)
265   \textcolor{keywordflow}{do} i=igst,dg%IegB ; dg%gridLonB(i) = og%gridLonB(i+ido2) ;\textcolor{keywordflow}{ enddo}
266   \textcolor{keywordflow}{do} j=jgst,dg%JegB ; dg%gridLatB(j) = og%gridLatB(j+jdo2) ;\textcolor{keywordflow}{ enddo}
267 
268   \textcolor{comment}{! Copy various scalar variables and strings.}
269   dg%x\_axis\_units = og%x\_axis\_units ; dg%y\_axis\_units = og%y\_axis\_units
270   dg%areaT\_global = og%areaT\_global ; dg%IareaT\_global = og%IareaT\_global
271   dg%south\_lat = og%south\_lat ; dg%west\_lon  = og%west\_lon
272   dg%len\_lat = og%len\_lat ; dg%len\_lon = og%len\_lon
273   dg%Rad\_Earth = og%Rad\_Earth ; dg%max\_depth = og%max\_depth
274 
275 \textcolor{comment}{! Update the halos in case the dynamic grid has smaller halos than the ocean grid.}
276   \textcolor{keyword}{call }pass\_var(dg%areaT, dg%Domain)
277   \textcolor{keyword}{call }pass\_var(dg%bathyT, dg%Domain)
278   \textcolor{keyword}{call }pass\_var(dg%geoLonT, dg%Domain)
279   \textcolor{keyword}{call }pass\_var(dg%geoLatT, dg%Domain)
280   \textcolor{keyword}{call }pass\_vector(dg%dxT, dg%dyT, dg%Domain, to\_all+scalar\_pair, agrid)
281   \textcolor{keyword}{call }pass\_vector(dg%dF\_dx, dg%dF\_dy, dg%Domain, to\_all, agrid)
282   \textcolor{keyword}{call }pass\_vector(dg%cos\_rot, dg%sin\_rot, dg%Domain, to\_all, agrid)
283   \textcolor{keyword}{call }pass\_var(dg%mask2dT, dg%Domain)
284 
285   \textcolor{keyword}{call }pass\_vector(dg%areaCu, dg%areaCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
286   \textcolor{keyword}{call }pass\_vector(dg%dyCu, dg%dxCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
287   \textcolor{keyword}{call }pass\_vector(dg%dxCu, dg%dyCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
288   \textcolor{keyword}{call }pass\_vector(dg%dy\_Cu, dg%dx\_Cv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
289   \textcolor{keyword}{call }pass\_vector(dg%mask2dCu, dg%mask2dCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
290   \textcolor{keyword}{call }pass\_vector(dg%IareaCu, dg%IareaCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
291   \textcolor{keyword}{call }pass\_vector(dg%IareaCu, dg%IareaCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
292   \textcolor{keyword}{call }pass\_vector(dg%geoLatCu, dg%geoLatCv, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
293 
294   \textcolor{keyword}{call }pass\_var(dg%areaBu, dg%Domain, position=corner)
295   \textcolor{keyword}{call }pass\_var(dg%geoLonBu, dg%Domain, position=corner, inner\_halo=dg%isc-isd)
296   \textcolor{keyword}{call }pass\_var(dg%geoLatBu, dg%Domain, position=corner)
297   \textcolor{keyword}{call }pass\_vector(dg%dxBu, dg%dyBu, dg%Domain, to\_all+scalar\_pair, bgrid\_ne)
298   \textcolor{keyword}{call }pass\_var(dg%CoriolisBu, dg%Domain, position=corner)
299   \textcolor{keyword}{call }pass\_var(dg%mask2dBu, dg%Domain, position=corner)
300 
301   \textcolor{keywordflow}{if} (dg%bathymetry\_at\_vel) \textcolor{keywordflow}{then}
302     \textcolor{keyword}{call }pass\_vector(dg%Dblock\_u, dg%Dblock\_v, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
303     \textcolor{keyword}{call }pass\_vector(dg%Dopen\_u, dg%Dopen\_v, dg%Domain, to\_all+scalar\_pair, cgrid\_ne)
304 \textcolor{keywordflow}{  endif}
305 
306   \textcolor{keyword}{call  }set\_derived\_dyn\_horgrid(dg, us)
307 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__transcribe__grid_a6eb8778abd0e6800af90271536b19796}\label{namespacemom__transcribe__grid_a6eb8778abd0e6800af90271536b19796}} 
\index{mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}!rotate\+\_\+dyngrid@{rotate\+\_\+dyngrid}}
\index{rotate\+\_\+dyngrid@{rotate\+\_\+dyngrid}!mom\+\_\+transcribe\+\_\+grid@{mom\+\_\+transcribe\+\_\+grid}}
\subsubsection{\texorpdfstring{rotate\+\_\+dyngrid()}{rotate\_dyngrid()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+transcribe\+\_\+grid\+::rotate\+\_\+dyngrid (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G\+\_\+in,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in)}]{turns }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g\+\_\+in} & Common horizontal grid type\\
\hline
\mbox{\tt in,out}  & {\em g} & Ocean grid type\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em turns} & Number of quarter turns \\
\hline
\end{DoxyParams}


Definition at line 311 of file M\+O\+M\+\_\+transcribe\+\_\+grid.\+F90.


\begin{DoxyCode}
311   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(in)}    :: G\_in\textcolor{comment}{   !< Common horizontal grid type}
312   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{      !< Ocean grid type}
313   \textcolor{keywordtype}{type}(unit\_scale\_type),  \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{     !< A dimensional unit scaling type}
314   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: turns\textcolor{comment}{                    !< Number of quarter turns}
315 
316   \textcolor{keywordtype}{integer} :: jsc, jec, jscB, jecB
317   \textcolor{keywordtype}{integer} :: qturn
318 
319   \textcolor{comment}{! Center point}
320   \textcolor{keyword}{call }rotate\_array(g\_in%geoLonT, turns, g%geoLonT)
321   \textcolor{keyword}{call }rotate\_array(g\_in%geoLatT, turns, g%geoLatT)
322   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%dxT, g\_in%dyT, turns, g%dxT, g%dyT)
323   \textcolor{keyword}{call }rotate\_array(g\_in%areaT, turns, g%areaT)
324   \textcolor{keyword}{call }rotate\_array(g\_in%bathyT, turns, g%bathyT)
325 
326   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%df\_dx, g\_in%df\_dy, turns, g%df\_dx, g%df\_dy)
327   \textcolor{keyword}{call }rotate\_array(g\_in%sin\_rot, turns, g%sin\_rot)
328   \textcolor{keyword}{call }rotate\_array(g\_in%cos\_rot, turns, g%cos\_rot)
329   \textcolor{keyword}{call }rotate\_array(g\_in%mask2dT, turns, g%mask2dT)
330 
331   \textcolor{comment}{! Face point}
332   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%geoLonCu, g\_in%geoLonCv, turns, &
333       g%geoLonCu, g%geoLonCv)
334   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%geoLatCu, g\_in%geoLatCv, turns, &
335       g%geoLatCu, g%geoLatCv)
336   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%dxCu, g\_in%dyCv, turns, g%dxCu, g%dyCv)
337   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%dxCv, g\_in%dyCu, turns, g%dxCv, g%dyCu)
338   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%dx\_Cv, g\_in%dy\_Cu, turns, g%dx\_Cv, g%dy\_Cu)
339 
340   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%mask2dCu, g\_in%mask2dCv, turns, &
341       g%mask2dCu, g%mask2dCv)
342   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%areaCu, g\_in%areaCv, turns, &
343       g%areaCu, g%areaCv)
344   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%IareaCu, g\_in%IareaCv, turns, &
345       g%IareaCu, g%IareaCv)
346 
347   \textcolor{comment}{! Vertex point}
348   \textcolor{keyword}{call }rotate\_array(g\_in%geoLonBu, turns, g%geoLonBu)
349   \textcolor{keyword}{call }rotate\_array(g\_in%geoLatBu, turns, g%geoLatBu)
350   \textcolor{keyword}{call }rotate\_array\_pair(g\_in%dxBu, g\_in%dyBu, turns, g%dxBu, g%dyBu)
351   \textcolor{keyword}{call }rotate\_array(g\_in%areaBu, turns, g%areaBu)
352   \textcolor{keyword}{call }rotate\_array(g\_in%CoriolisBu, turns, g%CoriolisBu)
353   \textcolor{keyword}{call }rotate\_array(g\_in%mask2dBu, turns, g%mask2dBu)
354 
355   \textcolor{comment}{! Topographic}
356   g%bathymetry\_at\_vel = g\_in%bathymetry\_at\_vel
357   \textcolor{keywordflow}{if} (g%bathymetry\_at\_vel) \textcolor{keywordflow}{then}
358     \textcolor{keyword}{call }rotate\_array\_pair(g\_in%Dblock\_u, g\_in%Dblock\_v, turns, &
359         g%Dblock\_u, g%Dblock\_v)
360     \textcolor{keyword}{call }rotate\_array\_pair(g\_in%Dopen\_u, g\_in%Dopen\_v, turns, &
361         g%Dopen\_u, g%Dopen\_v)
362 \textcolor{keywordflow}{  endif}
363 
364   \textcolor{comment}{! Nominal grid axes}
365   \textcolor{comment}{! TODO: We should not assign lat values to the lon axis, and vice versa.}
366   \textcolor{comment}{!   We temporarily copy lat <-> lon since several components still expect}
367   \textcolor{comment}{!   lat and lon sizes to match the first and second dimension sizes.}
368   \textcolor{comment}{!   But we ought to instead leave them unchanged and adjust the references to}
369   \textcolor{comment}{!   these axes.}
370   \textcolor{keywordflow}{if} (modulo(turns, 2) /= 0) \textcolor{keywordflow}{then}
371     g%gridLonT(:) = g\_in%gridLatT(g\_in%jeg:g\_in%jsg:-1)
372     g%gridLatT(:) = g\_in%gridLonT(:)
373     g%gridLonB(:) = g\_in%gridLatB(g\_in%jeg:(g\_in%jsg-1):-1)
374     g%gridLatB(:) = g\_in%gridLonB(:)
375   \textcolor{keywordflow}{else}
376     g%gridLonT(:) = g\_in%gridLonT(:)
377     g%gridLatT(:) = g\_in%gridLatT(:)
378     g%gridLonB(:) = g\_in%gridLonB(:)
379     g%gridLatB(:) = g\_in%gridLatB(:)
380 \textcolor{keywordflow}{  endif}
381 
382   g%x\_axis\_units = g\_in%y\_axis\_units
383   g%y\_axis\_units = g\_in%x\_axis\_units
384   g%south\_lat = g\_in%south\_lat
385   g%west\_lon = g\_in%west\_lon
386   g%len\_lat = g\_in%len\_lat
387   g%len\_lon = g\_in%len\_lon
388 
389   \textcolor{comment}{! Rotation-invariant fields}
390   g%areaT\_global = g\_in%areaT\_global
391   g%IareaT\_global = g\_in%IareaT\_global
392   g%Rad\_Earth = g\_in%Rad\_Earth
393   g%max\_depth = g\_in%max\_depth
394 
395   \textcolor{keyword}{call }set\_derived\_dyn\_horgrid(g, us)
\end{DoxyCode}
