Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Wed Jul 17, 2019 4:40 am




Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Author Message
 Post subject: Issue on check_refine.m
PostPosted: Tue Jun 04, 2019 8:26 am 
Offline

Joined: Thu Jan 24, 2019 7:16 pm
Posts: 2
Location: CNR-IBIMET - LaMMA
Dear all,

I write to ask for a problem arose using the check_refine function to control the consistency between parent and child grid. It is not so crucial since it is a tool to check, instead of produce necessary files to run the model, but I am not sure a similar problem may arise somewhere else in the functions provided in the matlab toolbox. However, it is a rounding problem related to the indexing.

Here you have the modified code of the check_refine.m function to resolve the issue (of course something better is possible):

Code:
YrF = [YpF(1)-half YpF+half];                    % RHO-points 
% Start modification
% Idg = fix(XrF(Imid) - 0.5) + 1;
% Jdg = fix(YrF(Jmid) - 0.5) + 1;
Idg = ceil(XrF(Imid));
Jdg = ceil(YrF(Jmid));
% End modification         
[Yrg,Xrg] = meshgrid(Jdg,Idg);


and this is the matlab output for the variables XrF and Idg the case of Hurrican Sandy with the grids from the COAWST/Project/Sandy folder (Sandy_roms_grid.nc, Sandy_roms_grid_ref3.nc) both for the previous (Idg_old) and the modified indexing (rows 10-11 have the same index for the old version):

[XrF(Imid(1:15))' Idg_old(1:15)' Idg(1:15)']

ans =

22.5 23 23
23.5 24 24
24.5 25 25
25.5 26 26
26.5 27 27
27.5 28 28
28.5 29 29
29.5 30 30
30.5 31 31
31.5 32 32
32.5 32 33
33.5 33 34
34.5 34 35
35.5 35 36
36.5 36 37

If format long is activated in matlab it is possible to check that 32 is instead 31.99999 and the function fix() rounds it to 31 instead of 32 (during the call 'fix(XrF(Imid) - 0.5)').

I noticed such an issue because with the check_refine function I got really high differences between the variables S(dg).h(dg_index) and S(rg).h_avg and it was due to the wrong indexing instead of real differences in the bathymetries.

Hope it helps.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group