[MITgcm-support] How does MITgcm readin grid from tile001.mitgrid file

Martin Losch Martin.Losch at awi.de
Tue Apr 26 03:27:30 EDT 2016


Hi Peng and Chen,

the tile*.grid files are only necessary for a curvilinear grid, so you don’t even call ini_curvilinear_grid when you have usingCartesianGrid=.TRUE.,
You need to set 
 usingCurvilinearGrid=.TRUE.,
instead.

Comment about Peng’s anser: I am not sure, if I misunderstood your answer correctly, but I think 
#define OLD_GRID_IO
turns on code that reads individual grid files. Please check ini_curvilinear_grid.F
Once you have defined that option, you need 2D fields in ieee-be files with the following names:

DXC.bin
DXF.bin
DXG.bin
DXV.bin
DYC.bin
DYF.bin
DYG.bin
DYU.bin
LATC.bin
LATG.bin
LONC.bin
LONG.bin
RA.bin
RAS.bin
RAW.bin
RAZ.bin

Basically just rename the files that you generated from your "initial run0”. Excep for DXF/DYF/DYU/DXV, which you have to compute yourself (simple averages from the availble DX* DY*, see grid description in GRID.h or ini_spherical_polar_grid.F for a method). To my mind this is simpler than generating the tile*.mitgrid file. I usually do that for curvilinear grids as long as I don’t use cubed-sphere grids. (see also http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/arctic/)

Martin

> On 26 Apr 2016, at 08:39, Peng Zhan <peng.zhan at kaust.edu.sa> wrote:
> 
> Hi Chen,
> Make sure '#define OLD_GRID_IO' in the CPP_OPINTIONS.h if you want to use tile files.
> In my case I am using a series of .bin file for the grid info and therefore put '#undef OLD_GRID_IO'.
> Best, Peng
> 
> On Tue, Apr 26, 2016 at 4:06 AM, 陈忱 <chen636489 at gmail.com> wrote:
> Hi All:
> 
> I want the model to read grid from tiles file instead of specifying delX delY in input/data. However I did't find where to trigger this reading process. Here is what I have done so far:
> 
> Taking the experiment from verification/internal_wave:
> 
> (1) In compile time, I didn't change anything in code directory.
> 
> (2) generate tile001.mitgrid file and drop it into internal_wave/input/:
> 
> xc =rdmds('XC'); 
> yc =rdmds('YC'); 
> %dxf=rdmds('DXF');  
> %dyf=rdmds('DYF');  
> rac=rdmds('RAC');  
> xg =rdmds('XG'); 
> yg =rdmds('YG'); 
> %dxv=rdmds('DXV');  
> %dyu=rdmds('DYU');  
> raz=rdmds('RAZ');  
> dxc=rdmds('DXC');  
> dyc=rdmds('DYC');  
> raw=rdmds('RAW');  
> ras=rdmds('RAS');  
> dxg=rdmds('DXG');  
> dyg=rdmds('DYG'); 
> dxf=zeros(60,1);dyf=zeros(60,1);dxv=zeros(60,1);dyu=zeros(60,1);
> 
> n=1;
> fid=fopen( sprintf('tile%3.3i.mitgrid',n), 'w',ieee );
> fwrite(fid,xc(:,:,n),dtype);
> fwrite(fid,yc(:,:,n),dtype);
> fwrite(fid,dxf(:,:,n),dtype);
> fwrite(fid,dyf(:,:,n),dtype);
> fwrite(fid,rac(:,:,n),dtype);
> fwrite(fid,xg(:,:,n),dtype);
> fwrite(fid,yg(:,:,n),dtype);
> fwrite(fid,dxv(:,:,n),dtype);
> fwrite(fid,dyu(:,:,n),dtype);
> fwrite(fid,raz(:,:,n),dtype);
> fwrite(fid,dxc(:,:,n),dtype);
> fwrite(fid,dyc(:,:,n),dtype);
> fwrite(fid,raw(:,:,n),dtype);
> fwrite(fid,ras(:,:,n),dtype);
> fwrite(fid,dxg(:,:,n),dtype);
> fwrite(fid,dyg(:,:,n),dtype);
> fclose(fid);
> 
> Noting that, XC, YC ,RAW.etc which rdmds read, is from an initial run0. I did everything in README, and it will return me the grid info in internal_wave/run/ directory in the format of data/meta.
> 
> try(3a) internal_wave/input/data:
> 
> making changes in data:
> 
> # Gridding parameters
> 
>  &PARM04
>  usingCartesianGrid=.TRUE.,
>  horizGridFile='tile001.mitgrid',
>  delZ=20*10.,
>  &
> 
> === didn't work so far======
> 
> try(3b) internal_wave/input/data:
> 
> making changes in data:
> 
> # Gridding parameters
> #hoping that the model could detect mitgrid itself.
> 
>  &PARM04
>  usingCartesianGrid=.TRUE.,
>  delZ=20*10.,
>  &
> 
> === didn't work either======
> 
> (4) cd verfication/aim_51_cs/input:
> 
> It contains tile001~006.mitgrid files. But it's not specify in input/data &PARAM5.
> 
> (5) vim verfication/aim_51_cs/results/output.txt:
> 
> (PID.TID 0000.0001) SET_PARMS: done
> (PID.TID 0000.0001) Enter INI_VERTICAL_GRID: setInterFDr=    T ; setCenterDr=    F
> (PID.TID 0000.0001) tile:   1 ; Read from file tile001.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> (PID.TID 0000.0001) tile:   2 ; Read from file tile002.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> (PID.TID 0000.0001) tile:   3 ; Read from file tile003.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> (PID.TID 0000.0001) tile:   4 ; Read from file tile004.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> (PID.TID 0000.0001) tile:   5 ; Read from file tile005.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> (PID.TID 0000.0001) tile:   6 ; Read from file tile006.mitgrid
> (PID.TID 0000.0001)   => xC yC dxF dyF rA xG yG dxV dyU rAz dxC dyC rAw rAs dxG dyG
> 
> (PID.TID 0000.0001) %MON XC_max                       =   1.7854351589505E+02
> (PID.TID 0000.0001) %MON XC_min                       =  -1.7854351589505E+02
> (PID.TID 0000.0001) %MON XC_mean                      =  -4.6999441375798E-15
> (PID.TID 0000.0001) %MON XC_sd                        =   1.0355545336287E+02
> 
> 
> ===========================================================================================
> I attached the STDOUT.0000 STDERR.0000 for step(3)(4).
> 
> It seems mitgcm first of all didn't notice the grid should be imported from tile001.mitgrid.
> 
> I also have download tile001.mitgrid file online and replaced it with mine. The same error appear here again. 
> 
> I also dig into ini_cartesian_grid & load_grid_spacing, didn't find where to read mitgrid. 
> 
> In all, the main question here will be, where and how does mitgcm read .mitgrid file during run time.
> 
> 
> Thank you in advance for your attention!
> -- 
> Chen CHEN
> Graduate Student in ICES&EM
> The University of Texas at Austin
> 
> 
> 
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
> 
> 
> 
> 
> -- 
> Peng ZHAN
> 
>  
> ______________________________
> PhD Candidate 
> Earth Science & Engineering (ErSE)
> King Abdullah University of Science and Technology (KAUST)
> Bldg 1, Lv 4, 4700 KAUST, Thuwal 23955-6900, Jeddah, Saudi Arabia
> Mobile: +966 544701621
>  
> 
> This message and its contents, including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email._______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support




More information about the MITgcm-support mailing list