Skip to content
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

Are field_in area arrays using sufficient memory? #266

Open
ngs333 opened this issue Dec 21, 2023 · 0 comments
Open

Are field_in area arrays using sufficient memory? #266

ngs333 opened this issue Dec 21, 2023 · 0 comments
Labels

Comments

@ngs333
Copy link
Contributor

ngs333 commented Dec 21, 2023

@mlee03 has noticed a very interesting and suspicious code relationship. In function
do_scalar_conserve_interp, for second order conservative regridding, for cell_methods SUM or cell_measure true, field_in.area and grid_in.cell_area are indexed by a 3D index, with the horizontal component by itself being NX*NY:

...
n1 = k * nx1 * ny1 + j1 * nx1 + i1;
      else if (cell_measures)
             area *= (field_in[tile].area[n1]  / grid_in[tile].cell_area[n1]);
...

However, the arrays seem to be to small , of size NX * NY as determined by code inspection. For example, in function get_input_data , for the cell measure case:

field[n].area = (double *)malloc(nx * ny * sizeof(double));

Without some side effect programming or hidden correction of the array sizes, the code may be incorrect and
it merits further investigation. If somehow the code is correct it should be documented. If its not correct, a clean code / non-mysterious software should be created.

This mystery can be seen in the baseline code, circa 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant