contact.m works well for creating the nesting grid in the Cartesian coordinate system. However, when I made a nesting grid in the spherical coordinate system, I found there may be one bug in contact.m. Apologies if this is correct as it is.
lines 721-723
FSr.Values = G(dg).angle(:); R.angle = FCr(XrF, YrF);
FSr.Values = G(dg).f(:); R.f = FCr(XrF, YrF);
FSr.Values = G(dg).h(:); R.h = FCr(XrF, YrF);
should be
FSr.Values = G(dg).angle(:); R.angle = FSr(XrF, YrF);
FSr.Values = G(dg).f(:); R.f = FSr(XrF, YrF);
FSr.Values = G(dg).h(:); R.h = FSr(XrF, YrF);
However, one new problem occurs after I made these changes.
Subscripted assignment between dissimilar structures.
Error in contact (line 329)
S.refined(cr) = R;
Then I checked the function [S,G] = contact(Gnames, Cname, Lmask, MaskInterp, Lplot)
I found output S includs following two elements
S.refined(cr).xi_rho(:,:) - Receiver grid curvilinear
S.refined(cr).eta_rho(:,:) (XI,ETA) coordinates
However, R (R = refine_coordinates(cr, dg, rg, G, S, MaskInterp)) includes eight elements
R.xi_rho
R.eta_rho
R.xi_psi
R.eta_psi
R.xi_u
R.eta_u
R.xi_v
R.eta_v
Thanks a lot if you can look at them.
One possible nesting-related bug
-
- Posts: 5
- Joined: Mon Dec 31, 2018 8:42 pm
- Location: China Institute of Water Resources and Hydropower
Re: One possible nesting-related bug
Hello,
Did you solve the problem? I tried to this problem,
S.refined(cr) = R; -> S.refined = R;
delete (cr) in matlab line 329.
I'm not sure if this is the way to go, but the problem with the code has been solved.
The struct type 'R' consists of:
This problem occurs because struct type 'R' cannot be changed into the 3D layers structure through the for loop in the usual way.
I can't say that's the right way, but if it's wrong, you'll need a different solution.
Look forward to hearing from you and others.
Thanks.
Rintei
Did you solve the problem? I tried to this problem,
Code: Select all
for cr=1:Ncontact
dg = S.contact(cr).donor_grid;
rg = S.contact(cr).receiver_grid;
if (S.contact(cr).coincident)
P = coincident (cr, dg, rg, Lmask, G, S);
S.contact(cr).point = P;
elseif (S.contact(cr).refinement)
[P, R] = refinement (cr, dg, rg, Lmask, G, S, MaskInterp);
S.contact(cr).point = P;
S.refined = R; %S.refined(cr) = R;
end
Ndatum = Ndatum + length(S.contact(cr).point.Irg_rho) ...
+ length(S.contact(cr).point.Irg_u) ...
+ length(S.contact(cr).point.Irg_v);
end
delete (cr) in matlab line 329.
I'm not sure if this is the way to go, but the problem with the code has been solved.
The struct type 'R' consists of:
Code: Select all
37th field data
spherical 1
uniform 0
xi_rho eta_rho lon_rho lat_rho Irg_rho Jrg_rho
xi_psi eta_psi lon_psi lat_psi Irg_psi Jrg_psi
xi_u eta_u lon_u lat_u Irg_u Jrg_u
xi_v eta_v lon_v lat_v Irg_v Jrg_v
angle f h pm pn dndx dmde
mask_rho mask_psi mask_u mask_v
I can't say that's the right way, but if it's wrong, you'll need a different solution.
Look forward to hearing from you and others.
Thanks.
Rintei
Re: One possible nesting-related bug
Hello Rintei,
Thanks for this tip!
I got this exact same error trying to generate my contact grid points netcdf file and after sometime of debugging and web search, I found your answer.
After changing that line, it successfully generated the file but I don't know yet if it is correct, but I do think so.
Is this a bug or am I missing something?
Thanks,
Hatsue
Thanks for this tip!
I got this exact same error trying to generate my contact grid points netcdf file and after sometime of debugging and web search, I found your answer.
After changing that line, it successfully generated the file but I don't know yet if it is correct, but I do think so.
Is this a bug or am I missing something?
Thanks,
Hatsue