<div dir="ltr">Hello, Stephen!<div><br></div><div>When I create my EXF input data, I just write 2D XY fields of meteo forcing for each required variable sequentially for each time-step. Say, I have an array of 2m air temperature 't2m' prepared and stored in the matlab's current workspace and I want to write it into a binary file for use in MITgcm exf package. If I use daily-mean fields and 1deg horizontal resolution of the forcing data, I have the array of 360x180x366 elements for an ordinary year and 360x180x367 for a leap year. The additional record (366th or 367th) will be used for the internal time-interpolation implemented in the model when the model's time step in less than 24 hours. When such array is correctly prepared in matlab, I write it:</div><div><br></div><div>fout = fopen('exf_hourly_t2m.bin','wb','ieee-be');</div><div>fwrite(fout,t2m,'float32');</div><div>fclose(fout);<br></div><div><br></div><div>And so on for each variable..</div><div><br></div><div>Also, the corresponding parameters should be correctly set in data.exf and EXF_OPTIONS.h if you use spatial interpolation.</div><div><br></div><div>Regards, </div><div>Stanislav Martyanov</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 18 мая 2020 г. в 13:44, Stephen Hunter [EAR] <<a href="mailto:S.Hunter@leeds.ac.uk">S.Hunter@leeds.ac.uk</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
<div><br>
</div>
<div>Firstly my apologies for the long query (my 2 questions are summarised at the bottom)</div>
<div><br>
</div>
<div>I have set up a CS96 model for a deep-time palaeo experiment. I am using 20 years of monthly surface climatology in a cyclical manner to run the model for 1500 years. The surface climatology is from a global high-resolution atmosphere-only model.
 I am using Matlab to generate the MITgcm boundary conditions (bathymetry) and forcing files.  I believe that I have MITgcm correctly set-up as I can run the model from these boundary conditions and forcing files for 1500 years without problems. Globally integrated
 temperature on ocean levels comes into equilibrium and I see a drift in globally integrated salinity (as I expect as I haven’t implemented a river scheme yet).</div>
<div><br>
</div>
<div>I generate my bathymetry binary on a CS96 grid using the lat-lon specification within the grid definitions. I am satisfied that this works as I expect because I can use the reverse of my regridding process to unwrap the MITgcm climatological average
 back to a regular lat-lon grid and the imprinted land sea mask comes out as expected.</div>
<div><br>
</div>
<div>Whilst the model is happy to run for 1500 years, the processed climatology from the final 50 years appears incorrect. Whilst the surface ocean temperature appears visually OK (latitudinal distribution of temperatures appears fine). It is when
 I look closer, things appear to be wrong. For example when I look at the surface ocean currents I have a lot of diverging currents where I would expect zonal equatorial currents. I also don’t have flow through ocean gateways and channels. I do get some western
 boundary currents and some upwelling, but these are inconsistent in some regions.</div>
<div><b><br>
</b></div>
<div>I suspect that this mishmash is because I am creating the Forcing binaries incorrectly.  I would therefore like to check if I am creating them correctly. Here is a simplified account of what I am doing….</div>
<div><br>
</div>
<div>For each climatological field I generate a binary file for each year of monthly data. I do this in Matlab by building a vector of the data and then saving this as a float64 binary.  Consider a year of climatological data is an array of size (360,180,12),
 in which longitude runs from -179.5 to 179.5 in 1-degree cells, and latitude runs from 89.5 to -89.5 <span style="color:rgb(0,0,0)">in 1-degree cells. I then create a vector from this array with the following recipe
 (simplified pseudo code):</span></div>
<div><span style="color:rgb(0,0,0)"><br>
</span></div>
<div><span style="color:rgb(0,0,0)">vec=zeros(360*180*12,1);</span></div>
<div><span style="color:rgb(0,0,0)">counter=1;</span></div>
<div><span style="color:rgb(0,0,0)">for month=1:1:12</span></div>
<div><span style="color:rgb(0,0,0)">  for lat=180:-1:1 </span></div>
<div><span style="color:rgb(0,0,0)">   for lon=1:1:360</span></div>
<div><span style="color:rgb(0,0,0)">    </span><font color="#000000"><span>vec(counter,1)=data(lon,lat,month)</span></font></div>
<div><font color="#000000"><span>    counter=counter+1</span></font></div>
<div><font color="#000000"><span>  end</span></font></div>
<div><font color="#000000"><span>end</span></font></div>
<div><font color="#000000"><span>end</span></font></div>
<div><br>
</div>
<div><font color="#000000">I then write vec to a 64 bit binary. </font><span style="color:rgb(0,0,0)">With regards to CPP options for EXF I am using configuration A1,B3 but currently without runoff.
 In data.exf I define Ustress, Vstress, atemp, aqh, precip, wspeed, swdown and lwdown to be read in from yearly binary files with lon0 and lat0 as -179.5 and -89.5. My non scalar fields are on slightly different grid but these are specified accordingly.</span></div>
<div><font color="#000000"><br>
</font></div>
<div><font color="#000000">I cannot find a description of the ordering of cell data within binary forcing files for the EXF package. I have tried writing array data directly to binary file, transposing my input data, changing the ordering
 that I fill vec, but these appear wrong also. I have tried to write my forcing data to the CS96 grid (like I do for bathymetry) but I didn’t know how to order the data wrt to the time dimension. I would prefer to have EXF read and interpolate my lat-lon climatology.</font></div>
<div><font color="#000000"><span><br>
</span></font></div>
<div><font color="#000000"><span><br>
</span></font></div>
<div><font color="#000000"><span><b>My questions are therefore:</b></span></font></div>
<div><font color="#000000"><span><b><br>
</b></span></font></div>
<div><font color="#000000"><span><b>1) What is the ordering of the data within binary forcing files that EXF reads?</b></span></font></div>
<div><font color="#000000"><span><b>2) Currently I have MITgcm output monthly means of ocean variables but to help me understand my problem,  is it possible to have MITgcm write out the
 monthly averages of the Input Forcing Fields? (or at least the surface wind vectors)</b></span></font></div>
<div><span style="color:rgb(0,0,0)">     </span></div>
<div><span style="color:rgb(0,0,0)"><br>
</span></div>
<div><span style="color:rgb(0,0,0)">Kind regards</span></div>
<div><span style="color:rgb(0,0,0)">Stephen</span></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
</div>

_______________________________________________<br>
MITgcm-support mailing list<br>
<a href="mailto:MITgcm-support@mitgcm.org" target="_blank">MITgcm-support@mitgcm.org</a><br>
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" rel="noreferrer" target="_blank">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a><br>
</blockquote></div>