Hello,
We are trying to generate a realistic nesting configuration in ROMS for the simulation of some estuaries of our interest. Our aim is to study a case similar to what is shown for the 'US East Coast' example figures in the wiki: with a big domain, a nested grid just outside the estuary, and a composite grid for the estuary (in contact with the nested grid and with the same resolution):
https://www.myroms.org/wiki/index.php/Nested_Grids
1) But, unfortunately, I have not found any documented, or partially-documented example for a case like this. The only available source of information are the dogbone test example and the wiki page mentioned above, but this information is not enough for generating a complex ROMS case like this (or at least I have not been able to find the correct source of information).
Q.1.a) Does anyone knows a good source of information for generating this type of cases?
2) As a first step I decided generate my own replicas of the 'nesting' and 'composite' branches of the dogbone test example. After confirming that both original test examples branches ran properly, I REPLICATED SUCCESSFULLY THE NESTING CASE starting from the basic "whole" case files. In the replicating process I generated the refined nested grid with "coarse2fine.m", and generated the contact-point file with "c_contact.m" and "contact.m". The initial conditions were generated with a modified version of "d_roms2roms.m". The replicated case ran properly! So far so good, but ...
3) When trying to replicate the 'composite' branch of the dogbone test case, I'm having some errors while generating the contact-point file. First, I succeeded to generate proper replicas of the 'left' and 'right' grids from the original 'whole' grid. This was done using "grid_extract.m" twice dividing the original grid in two. But THE CONTACT-POINTS FILE GENERATION IS FAILING. It even fails when using the original grids.
Q.3.a) What is wrong with the generation of the contact-points file? My matlab-function usage is the following:
Code: Select all
c_contact('dogbone_ngc_AlexisComposite.nc',false,2); %AEG: creating the contact file
contact({'dogbone_grd_left.nc','dogbone_grd_right.nc'}, ...
'dogbone_ngc_AlexisComposite.nc', ...
false,false,true); %AEG: Filling the contact file
Code: Select all
Summary of Contact Regions Processed:
Grid 01: D:\AlexisEspinosa\dogbone_grd_left.nc
Grid 02: D:\AlexisEspinosa\dogbone_grd_right.nc
Contact Donor Receiver
Region Grid Grid
01 01 02
02 02 01
Error using sub2ind (line 52)
Out of range subscript.
Error in contact>Hweights (line 2453)
RindexB = sub2ind([Ir, Jr],
...
Error in contact (line 352)
S = Hweights(G, S, ImposeMask);
Error in refineMasterScript_RecreateComposite (line 163)
contact({'dogbone_grd_left.c','dogbone_grd_right.nc'}, ...
Code: Select all
[Ir,Jr] = size(S.grid(dg).I_rho);
RindexB = sub2ind([Ir, Jr], ...
S.contact(cr).point.Idg_rho+1, ...
min(Jr,S.contact(cr).point.Jdg_rho)); % (Idg, Jdg-1)
RindexO = sub2ind([Ir, Jr], ...
S.contact(cr).point.Idg_rho+1, ...
S.contact(cr).point.Jdg_rho+1); % (Idg, Jdg)
RindexT = sub2ind([Ir, Jr], ...
S.contact(cr).point.Idg_rho+1, ...
min(Jr,S.contact(cr).point.Jdg_rho+2));% (Idg, Jdg+1)
RindexR = sub2ind([Ir, Jr], ...
min(Ir, S.contact(cr).point.Idg_rho+2), ...
S.contact(cr).point.Jdg_rho+1); % (Idg+1, Jdg)
I tried a "blind" solution for the indexes problem by modifying the code with "max" functions to impede the appearance of zeros in the generation of RindexB and UindexB:
Code: Select all
[Ir,Jr] = size(S.grid(dg).I_rho);
% % RindexB = sub2ind([Ir, Jr], ...
% % S.contact(cr).point.Idg_rho+1, ...
% % min(Jr,S.contact(cr).point.Jdg_rho)); % (Idg, Jdg-1)
RindexB = sub2ind([Ir, Jr], ...
S.contact(cr).point.Idg_rho+1, ...
max(1,S.contact(cr).point.Jdg_rho)); % (Idg, Jdg-1)
.
.
.
.
[Iu,Ju] = size(S.grid(dg).I_u);
% % UindexB = sub2ind([Iu, Ju], ...
% % S.contact(cr).point.Idg_u , ...
% % min(Ju, S.contact(cr).point.Jdg_u)); % (Idg, Jdg-1)
UindexB = sub2ind([Iu, Ju], ...
S.contact(cr).point.Idg_u , ...
max(1, S.contact(cr).point.Jdg_u)); % (Idg, Jdg-1)
Q.3.b) I have tried different combinations for the logical, and numerical parameters of "c_contact" and "contact" (obligatory and optional) but have not succeeded yet to generate the contact-points file for the 'composite' dogbone test case. Maybe I'm still doing something wrong (read Q.3.a to see my settings). Am I doing something wrong? or Is there a bug in the "contact.m" function? I wonder how you generated the "dogbone_ngc_composite.nc" file for the dogbone composite test case in the first place?
Q.4.a) If someone has a solution for Q.3.a and Q.3.b above, can you go further and explain how can I create a new dogbone case: 'nesting+composite dogbone' (similar configuration to the realistic case): one with a nested refined grid just out of the "bone neck" together with a composite refined grid for the rest of the other side of the bone? (I'm wishing to generate a dogbone case with a grid-arrangement similar to the one for the realistic estuary case mentioned above.)
Q.5.a) If someone has an answer for the questions above, can you go further and explain what else should be done for generating a realistic case with nested-composite grids for estuary simulations? Will the process be exactly the same as for the new 'nesting+composite dogbone' case proposed in Q.4.a?
Thanks a lot for your patience and interest reading this post. Any kind of help is very welcome (Please do not forge Q.1.a very above!).
Alexis Espinosa
UWA