problem creating 'contact' file for 3-layer grid nesting!

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
youngstor
Posts: 29
Joined: Mon Mar 01, 2010 2:11 pm
Location: Georgia

problem creating 'contact' file for 3-layer grid nesting!

#1 Unread post by youngstor »

Hi ROMS community,

I just started to play with the newest version of ROMS, and one important update is the way it handles grid nesting. The new ROMS now requires users to provide a 'contact' file to specify the overlapping regions between nesting grids. However I ran into some difficulties while trying to use the 'contact.m' script to generate 'contact' files. Following are the details:

I plan to do a 3-layer nesting, and I already have the parent grid. The parent grid is already created with reasonable bathymetry and masking, and the parent grid is named 'roms_grid_lyr1.nc' (size(h)=300x120).

I used the following code to create child and grand-child grids and create the contact file:

Code: Select all

netcdf_load roms_grid_lyr1.nc

% child grid lyr 2 - ref5

% Select child indices
Istr=130; Iend=174; Jstr=40; Jend=104;    % 
%now make some plots and call the coarse-> fine
ref_ratio=5;
F=coarse2fine('roms_grid_lyr1.nc','roms_grid_lyr2_ref5.nc', ...
              ref_ratio,Istr,Iend,Jstr,Jend);
          
% grand-child grid lyr 3 - ref3
netcdf_load roms_grid_lyr2_ref5.nc
% Select child indices
Istr=75; Iend=171; Jstr=60; Jend=249;    % 
%now make some plots and call the coarse-> fine
ref_ratio=3;
F=coarse2fine('roms_grid_lyr2_ref5.nc','roms_grid_lyr3_ref3.nc', ...
              ref_ratio,Istr,Iend,Jstr,Jend);
Executing above code gave me all 3 grid files. When I ran the following code with only the parent and child grids, I was able to successfully create a contact file 'roms_contact.nc':

Code: Select all

Gnames={'roms_grid_lyr1.nc', 'roms_grid_lyr2_ref5.nc'};
[S,G]=contact(Gnames,'roms_contact.nc');
However, I wanted to nest all 3 grids, and when I ran the following code with all 3 grids, I got an error:

Code: Select all

Gnames={'roms_grid_lyr1.nc', 'roms_grid_lyr2_ref5.nc', 'roms_grid_lyr3_ref3.nc'};
[S,G]=contact(Gnames,'roms_contact.nc');

Code: Select all

Is =

   Empty matrix: 0-by-1

Error using  .* 
Matrix dimensions must agree.

Error in grid_connections (line 224)
          Iwest  = ones(size(Jwest )).*Is;

Error in contact (line 316)
S = grid_connections(G, S);
I also experimented and ran only with child and grand-child grids like the following, and I still got the same error:

Code: Select all

Gnames={'roms_grid_lyr2_ref5.nc', 'roms_grid_lyr3_ref3.nc'};
[S,G]=contact(Gnames,'roms_contact.nc');

Code: Select all

Error using  .* 
Matrix dimensions must agree.

Error in grid_connections (line 224)
          Iwest  = ones(size(Jwest )).*Is;

Error in contact (line 316)
S = grid_connections(G, S);
I tried to look into the code and figure out how the code works, but still couldn't find a solution. Can the ROMS developers give me some clues?

I've attached my parent grid file, so you can easily repeat the above problem.

I thank you for your kind help!
Xiufeng
Attachments
roms_grid_lyr1.nc
parent grid file
(7.66 MiB) Downloaded 212 times

User avatar
wilkin
Posts: 920
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: problem creating 'contact' file for 3-layer grid nesting

#2 Unread post by wilkin »

Yes, there are bugs in the 3-level nesting code for the contacts file.

We're working on it and will announce a solution when we have it corrected.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

youngstor
Posts: 29
Joined: Mon Mar 01, 2010 2:11 pm
Location: Georgia

Re: problem creating 'contact' file for 3-layer grid nesting

#3 Unread post by youngstor »

Hi John,

I appreciate your response. I am looking forward to seeing a solution to this problem soon!

Thanks,
Xiufeng
wilkin wrote:Yes, there are bugs in the 3-level nesting code for the contacts file.

We're working on it and will announce a solution when we have it corrected.

Post Reply