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

Run with DEBUG flag fails due to unallocated SHELFMASK #440

Closed
TomasTorsvik opened this issue Dec 2, 2024 · 4 comments · Fixed by #441
Closed

Run with DEBUG flag fails due to unallocated SHELFMASK #440

TomasTorsvik opened this issue Dec 2, 2024 · 4 comments · Fixed by #441
Assignees
Labels
bug Something isn't working iHAMOCC Issue mainly concerns the iHAMOCC code base

Comments

@TomasTorsvik
Copy link
Contributor

TomasTorsvik commented Dec 2, 2024

If the variable SHELFMASK is not allocated, hamocc_step fails at call hamocc4bcm(..., shelfmask) as it tries to pass SHELFMASK as an argument. This fails when running in DEBUG mode.

I suggest not to pass allocatable variables as arguments. Instead, I would opt for passing this directly from the mo_read_shelfmask.F90 module.

Actually, I would prefer to only have one module shelfsea.F90 containing both the ini_read_shelfmask and the shelfsea_residence_time subroutines, and make the SHELFMASK private to this module.

@jmaerz - If you agree, I can implement this.

@TomasTorsvik TomasTorsvik added bug Something isn't working iHAMOCC Issue mainly concerns the iHAMOCC code base labels Dec 2, 2024
@TomasTorsvik TomasTorsvik added this to the NorESM2.5 - BLOM/iHAMOCC milestone Dec 2, 2024
@JorgSchwinger
Copy link
Contributor

The reason to separate the two routines is, is to keep the "core HAMOCC" and and the interface between the ocean model and HAMOCC separated. Reading the shelf-mask depends on the ocean model grid and has therefore to happen outside core HAMOCC.

I would suggest to just make SHELFMASK a non allocatable variable as omask. From my perspective, one could also just calculate the shelf residence time as a default and remove the logical switch (it's just a 2d field and negligible cost to calculate the residence time).

@TomasTorsvik
Copy link
Contributor Author

TomasTorsvik commented Dec 2, 2024

Alternatively, if this is purely an age tracer, perhaps it doesn't need to be in iHAMOCC?

Unless at some stage someone wants to introduce, e.g. residence time for PO4 in shelf region, or something similar.

@JorgSchwinger
Copy link
Contributor

Yes, it could probably be in BLOM instead of HAMOCC, but now it is already where it is...

@TomasTorsvik TomasTorsvik linked a pull request Dec 3, 2024 that will close this issue
@TomasTorsvik
Copy link
Contributor Author

OK, I just re-arrange the ini_read_shelfmask so that the shelfmask array will be allocated before the first return statement.

@TomasTorsvik TomasTorsvik changed the title Run with DEBUG flag fails due to unalocated SHELFMASK Run with DEBUG flag fails due to unallocated SHELFMASK Dec 3, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in NorESM Development Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iHAMOCC Issue mainly concerns the iHAMOCC code base
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants