I downloaded the latest ROMS matlab package and tried to create a contact points file for composite grids.
1. First, I used the dogbone grids:
Code: Select all
c_contact('contact.nc', 0, 2);
Gnames = {'dogbone_grd_left.nc','dogbone_grd_right.nc'};
G = grids_structure(Gnames);
S = grid_perimeter(G);
S = grid_connections(G, S);
The reason is X and G(rg).x_rho are not the same size. This is easy to debug, I changed it to: Xmin=min(X(:))-min(G(rg).x_rho(:));
Note that the dogbone_grd_left.nc and dogbone_grd_right.nc "totally overlap" at the boundary:
2. I use grid_extract.m to create two grids from my parent grid, and the overlap region is not only one column: This time I got an error when running grid_connections.m
Code: Select all
Summary of Contact Regions Processed:
Grid 01: left_new.nc
Grid 02: right.nc
Contact Donor Receiver
Region Grid Grid
Unrecognized field name "contact".
Error in grid_connections (line 635)
dg = S.contact(cr).donor_grid;
The way I set up my two sub-grids makes it unable to run some if-end syntax (in grid_connections.m) in which "connected" is defined as true.
So I created a new left sub-grid, and this time the two sub-grids only overlap one column like the dogbone case: Now grid_connections.m worked.
3. I ran the contact.m and got this error:
Code: Select all
Summary of Contact Regions Processed:
Grid 01: left.nc
Grid 02: right.nc
Contact Donor Receiver
Region Grid Grid
01 01 02
02 02 01
Dot indexing is not supported for variables of this type.
Error in contact (line 345)
Ndatum = Ndatum + length(S.contact(cr).point.Irg_rho)
Code: Select all
Updated global 'type' attribute to: "ROMS Hybrid Nesting Contact Regions Data".
Unable to perform assignment because the left and right
sides have a different number of elements.
Error in write_contact (line 235)
Idg(NstrR(cr):NendR(cr)) = S.contact(cr).point.Idg_rho;
Error in contact (line 376)
write_contact(Cname, S, G);
4. I wondered if my subgrids had some problems, so I set up a similar subgrids case using dogbone_grd_whole.nc. I used grid_extract.m to create a new left subgrid for the dogbone test case. The new two subgrids overlap more than one column, and their boundaries do not "totally overlap": Then I can produce the same error in grid_connections.m:
Code: Select all
Summary of Contact Regions Processed:
Grid 01: dogbone_grd_left_new.nc
Grid 02: dogbone_grd_right.nc
Contact Donor Receiver
Region Grid Grid
Unrecognized field name "contact".
Error in grid_connections (line 635)
dg = S.contact(cr).donor_grid;
Does anyone have a modified contact.m script that can work for my case? I hope that the ROMS developers could revise grid_connections.m and contact.m, thank you!