Closed nicholasbalasus closed 10 months ago
Tagging @yantosca @jimmielin. I am happy to write a fix for this but would like your thoughts on the last portion.
Also thanks to @toddmooring for flagging this!
Issue #208 deals with the same subroutine and may be related
Hi @eastjames @toddmooring @nicholasbalasus @jimmielin. I think you are correct, this seems to have been a bug in translation. We used to have the code in transfer_mod.F
(going waaaaayyy back) but then this was brought into HEMCO. I would proceed with your fix after confirming that mass is conserved.
Or it could have always been like that...
Thank you, @yantosca. My changes does conserve mass now (but I've only checked this for one methane file). I'm going to go through the code a little more closely and do some more tests first and then will get back to you.
Closing - addressed here https://github.com/geoschem/HEMCO/commit/daf54d07ed16d0948302070855468b6b27fdd9a5
Name and Institution (Required)
Name: Nick Balasus Institution: Harvard University
Confirm you have reviewed the following documentation
Description of your issue or question
We are currently using a 72-layer restart file as initial conditions for a 47-layer GEOS-Chem CH4 run. Using the BoundaryCondition collection, I am able to output how this restart file has been regridded with HEMCO at t = 0. This reveals that the mass has not been conserved.
I run GEOS-Chem using this bash script:
Then, using Python, we can see that the mass is not conserved (6.25 Tg have been created):
I find this to be related to the COLLAPSE subroutine in HEMCO. https://github.com/geoschem/HEMCO/blob/477c7e820c253c24e61d7c53df1911cd0e896abf/src/Core/hco_interp_mod.F90#L1220-L1311
I can make these simple changes that account for the fact that we are regridding layers, not levels. For example, if
InLev1
is equal to layer 37 (and should collapse 2 layers, 37 and 38), then theTOPLEV
should be the upper edge of grid box 38 (which is layer 39).Before this, when two layers were supposed to be being collapse, only the lower level was being taken into account (and the first three when four layers were collapse). The reason I create an issue for this instead of a PR is the fact that it seems like you would want a different subroutine depending on if you are regridding layers (n=72 or 47) or levels (n=73 or 48) which I get the impression that HEMCO is supposed to do based on the codes and comments.