New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in AngleCS and AngleSN in curvilinear grid #828
Comments
Thanks for submitting this bug report. |
Hello! Here are compressed files with CPP options and 'data' parameters needed to run the model in a simple configuration. I tried to attach other files together with the initial conditions for T and S, and also bathymetry but the file-size limitations here on Github did not allow this. Still, the initial conditions are not really necessary for this issue, and default MITgcm settings can be used for a simple run. To run it you only need to turn off all the unnecessary packages in the data.pkg and packages.conf (actually, almost all of them). The model will abort shortly because it lacks the boundary files, forcings, etc, but it will (I hope) generate the output grid files. I forgot to mention that the MITgcm versions I used were 65z (this config: a very old and currently obsolete configuration) and recently 67x. The above-mentioned problem with angles persists in both configurations so I believe that it is not a matter of a version. Regards, Files: |
Thanks, I can reproduce the problem: The last row (
I agree, it's a bug, but not a severe one. We could issue a warning at runtime, if a non-period domain is used. Or we could try to fix the values of |
suggestion: after l129 in
insert
to extrapolate @stanislav-martyanov maybe you would like to try that. |
With cartesian or SphericalPolarGrid, the grid setting is simple, only few user option and it's easy to set the grid correctly regarding the connectivity (doublely periodid by default). But with curvilinear-grid, the user need to provide all the grid metrics and it's less easy to get a consistent grid-setting regarding the connectivity. And the code does not check for any inconsistency (that depends on the use of OBC and also land barriers). @stanislav-martyanov in your case, as I understand, the grid-metrics are not supposed to be periodic in X and Y, and what you found is that the grid-angles are not right at the last row/column but likely other quantities are not right neither and the last row and column should not be part of the domain (either land or outside Open-Boundary). |
Also some discussion relevant to similar questions in issue #362 |
Yes, AngleCS/SN are not used anywhere in the model (these are just the output names used in WRITE_GRID), but, as I understand, the real fields they represent (angleCosC and angleSinC) are (sometimes). As the search tells, these 2D fields can be used in:
Though I must admit I did not deeply dig all these subroutines. It looks like the most important is EXF_SET_UV because it interpolates and rotates the input wind field on-the-fly and is used almost always in realistic configurations. But I did not investigate yet if these interpolated wind values at the edges are actually used in calculations.
I believe it does not but I'm not absolutely sure because of the aforementioned routines I'm not fully familiar with. Anyway, I agree with mjlosch that the issue is not severe. To solve this issue we've just slightly modified our post-processing tools without any modifications to the MITgcm code itself, so now it is not a problem. -- So, if anybody decides to do anything similar in the future, it would be useful for him/her to know about this issue to avoid a surprise and a headache :-) Anyway, it is up to the team to decide if any correction/warning/doc-info should be added. Regards, |
@stanislav-martyanov you are right, the angles are indeed used (sorry about my previous, wrong statement) and they have to be correct on the computational domain. I have the impression that in your configuration this is not a problem because the row/column in question are an open boundary where velocity and tracer values are prescribed and nothing is computed, so that the problem only appears in post processing if you are trying access values near the boundary. Most likely most configurations will be like this (either open boundary conditions or wall), but I can imagine configurations, either with a curvilinear grid, or an idealized sector model with walls, etc., where the last row/columns are not open boundaries and the wall has been put at So I think some sort of check is in place if the domain is periodic. I am not sure if it is worth thinking about an extrapolation scheme for |
Regarding this comment (from @mjlosch):
I think I answered this point on Apr 22:
I suggest to close this issue, because (1) it has not been active for few weeks ; (2) not clear it the reported problem is when using OBC (which makes this issue less useful to keep it open) ; (3) if the set-up does not use OBC then this discussion could continue in issue #362. |
Hello!
I think there is a bug in AngleCS and AngleSN in MITgcm. Actually, it concerns the underlying 2D fields angleCosC and angleSinC calculated in s/r CALC_GRID_ANGLES. This s/r is called from ini_curvilinear_grid while the 2D arrays angleCosC and angleSinC are assigned to 1 and 0 in ini_grid, respectively (it corresponds to a non-rotated grid). At this point everything is OK.
But somewhere in CALC_GRID_ANGLES there is a problem, because for grids I used for MITgcm, the angleCosC and angleSinC values of the easternmost and northernmost edges of the grid are not correct. There should not be an abrupt change in corresponding values because the grid is rather smooth everywhere.
By the way, the erroneous edge values of angleCosC also appear when a simple geographical grid is used (with the curvilinear option enabled).
According to model's code, this problem mainly affects the wind field interpolation at those edge points and some other less frequently-used features.
I've saved the output files with AngleCS and AngleSN values so anyone can verify the problem. The matlab script to read them is:
Files:
angles.zip
Kind regards,
Stanislav Martyanov
The text was updated successfully, but these errors were encountered: