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

Cross-contour transport bug #265

Closed
claireyung opened this issue Aug 23, 2023 · 5 comments
Closed

Cross-contour transport bug #265

claireyung opened this issue Aug 23, 2023 · 5 comments
Assignees

Comments

@claireyung
Copy link
Collaborator

It has been raised that there is a problem with the cross-contour transport example, where in specific cases where the contour moves left, right, or down by only one cell (but not up - in that case it seems fine) compared to the adjacent cells, one component of the transport in two cells is missed. With a two or more cell deviation, it seems correct. This means that the circumpolar integral of volume transport does not close to zero. In the large scale or time mean, the two missing transports likely oppose since we take -u and +u in adjacent cells, but for accuracy this should be fixed by modifying the code to account for these cases.

As an example, see the below figure, where the orange arrows show where there should be transport in the x direction, but it is missing in the mask_x_transport field in the centre plot (note that the mask_x_transport and mask_y_transport show the cells where the zonal transport at the right edge and meridional transport at the top edge respectively are used in the cross-contour (i.e. towards the north) transport, with the values +/-1 indicating whether +/- uh or vh are used.).

contour_issue

Apologies for this oversight and a warning to those who have been using the code!!
@adele157 @wghuneke @willaguiar @mauricehuguenin @ongqingyee

@adele-morrison
Copy link
Collaborator

Thanks for reporting Claire.

Just to clarify that there’s no problem in the case that anyone is using the old version of the contour definition where there are no diagonal connections on the contour. It’s only a problem for the new (current) version of the contour creation code that has diagonal connections.

Let’s definitely add this to the list of tasks for the upcoming hackathon!

@claireyung
Copy link
Collaborator Author

claireyung commented Aug 25, 2023

Looking at this a little closer, it only appears to be an issue if the "divot" (one cell deviates from the adjacent cells in one direction) is towards Antarctica (light blue colours). If it is away from Antarctica, then the components of the transport to follow the divot are created from both the contour points adjacent to the divot (since they each have one cell towards and away from Antarctica) (e.g. second row of plots in the below figure). I've added some code to account for the cases where the divot is towards Antarctica i.e. both cells adjacent to divot in the perpendicular direction to the divot are towards Antarctica (=0), one for each the x and y directions.

Would someone be able to check if they agree with the masks in the below figure? Also, the arrows in the plot of my previous post are incorrect, they should be at the Antarctica-side of the contour as shown below.

Picture 1

Code added to cell [27] of https://github.com/COSIMA/cosima-recipes/blob/main/DocumentedExamples/Cross-contour_transport.ipynb:

  ... other existing cases for y transport ...
    # if point below and point above are BOTH towards Antarctica:
    # take transport grid point to south of t grid:
    elif (contour_masked_above[index_j-1, index_i]==0) and (contour_masked_above[index_j+1, index_i]==0):
        mask_y_transport[index_j-1, index_i] = 1
        mask_y_transport[index_j, index_i] = -1        
        mask_y_transport_numbered[index_j-1, index_i] = new_number_count
        new_number_count += 1
 ... other existing cases for x transport ...
    # if point to left and right BOTH toward Antarctica
    elif (contour_masked_above_halo[index_j, index_i]==0) and (contour_masked_above_halo[index_j, index_i+2]==0):
        mask_x_transport[index_j, index_i-1] = 1
        mask_x_transport[index_j, index_i] = -1        
        mask_x_transport_numbered[index_j, index_i-1] = new_number_count
        new_number_count += 1

@adele-morrison
Copy link
Collaborator

So speedy @claireyung! Maybe @schmidt-christina do you want to review? This will affect your current DSW transport calculations in the panan.

@access-hive-bot
Copy link

This issue has been mentioned on ACCESS Hive Community Forum. There might be relevant details there:

https://forum.access-hive.org.au/t/cosima-hackathon-v3-0-monday-september-4th-2023/1186/1

@schmidt-christina
Copy link
Collaborator

The additional option accounts for the case when the contour borders a grid cell on three sides. Now all possibilities are covered.

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

No branches or pull requests

4 participants