Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Bug in mpas_io_streams.F: real3dField is queried for a real4dField #1365

Merged

Conversation

climbfuji
Copy link
Contributor

In mpas_io_streams.F, field_cursor % real3dField % isVarArray is queried in one place for a 4d real field. The correct behaviour would be to query field_cursor % real4dField % isVarArray.

Apparently, we do not meet the section of the code at present, hence this error never came up. The code should probably crash if we did.

… is queried.

This would crash probably, but until now this section of the code is not executed.
@@ -3074,7 +3074,7 @@ subroutine MPAS_readStream(stream, frame, ierr)

else

if (field_cursor % real3dField % isVarArray) then
if (field_cursor % real4dField % isVarArray) then
call mpas_dmpar_bcast_reals( mpas_io_handle_dminfo(stream % fileHandle), size(real3d_temp), real3d_temp(:,1,1))
field_4dreal_ptr => field_cursor % real4dField
do while (associated(field_4dreal_ptr))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgduda Not knowing this code, I just wanted to check that a 3D temp field indexed to first index j in the 4d field is what is intended on the next line. A few more lines down, there is a 4D temporary array, which is what I would have expected. Could you review that line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-petersen Hey Mark, thanks for looking at this. I believe real3d_temp is correct in line 3078, since we are testing real4dField being a varArray or not. If you scroll up or down a few lines, you will find that the remainder of the code is using/deallocating real3d_temp inside "if field_cursor % real4dField % isVarArray)".

Also, if you look at line 2990 (similar piece of code for field_cursor % real3dField % isVarArray, you will see that it uses real2d_temp inside those if blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks. That makes sense.

Copy link
Contributor

@mark-petersen mark-petersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged into ocean/develop, compiled with gnu, ran through ocean regression suite. Results are b-f-b with previous. Please merge.

@mgduda mgduda merged commit 6ef493f into MPAS-Dev:develop Aug 7, 2017
@mgduda mgduda deleted the framework/iostreams-real4dfield-bug branch August 7, 2017 20:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants