geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
167 stars 163 forks source link

[FEATURE REQUEST] Remove HEMCO code from vdiff_mod.F90 #311

Closed yantosca closed 4 years ago

yantosca commented 4 years ago

Due to legacy coding, the non-local PBL mixing scheme (in vdiff_mod.F90) contains several calls to HEMCO embedded within the routine VDIFFDR. These HEMCO calls get pointers to HEMCO data, which are then passed down to routine VDIFF (which does the actual PBL mixing). But this poses a roadblock to the integration of GEOS-Chem within CESM, which must have a clean separation between HEMCO and GEOS-Chem code.

We therefore propose to remove all of the HEMCO-specific code from the non-local PBL mixing. This can be done in a wrapper and then the various fields can be passed via the State objects to the PBL module.

yantosca commented 4 years ago

I have moved most of the HEMCO code (and also where we obtain drydep velocities) out of VDIFFDR and into routine HCOI_Compute_Sflx_for_Vdiff (in hcoi_gc_main_mod.F90). This is currently in the feature/ComputePbl branch. Further testing and validation is needed but it looks like this will allow for a clean separation of the HEMCO code out of the PBL mixing code.. The HCOI_Compute_Sflux_for_Vdiff is called independently of the non-local PBL mixing code and the surface flux (which = emission - drydep) will be stored in State_Chm. Also, I need to test and implement this in GCHP as well.

@jimmielin: Do you have any other thoughts or concerns? Is hcoi_gc_main_mod.F90 the proper place for the computation of the surface flux?

lizziel commented 4 years ago

One concern of mine is this is touching HEMCO files that are changed in the dev 13.0 branch. Are you working off of 12.8 or dev/13.0? If you could switch to dev/13.0 that uses the new GEOS-Chem Classic wrapper that will make things easier later.

yantosca commented 4 years ago

I was working off 12.8 but can switch to the wrapper in dev/13.0.0.

lizziel commented 4 years ago

Yes, please do! A bunch of the HEMCO interface files have been either edited or renamed in that version. Thanks!

jimmielin commented 4 years ago

Hi Bob, thanks for the update! This should be right place to put it in 12.8 but in dev/13.0.0 it should go in the new HCO_Interface_GC_Mod file, which is a renamed version of HCOI_GC_Main_Mod. But this should be fairly easy to merge.

I think this will work for integrating emissions within CESM-GC but it would be best to have confirmation from Thibaud @fritzt on this. We can also discuss in MDS so we're sure everyone is aware of the changes. Thanks again!

yantosca commented 4 years ago

OK thanks. I can validate that it works in 12.8.0 and then try to merge up to dev/13.0.0. I can wait till after MDS to do the merge so we have a chance to discuss.

fritzt commented 4 years ago

Hi! Thanks for the update! This sounds great and is definitely what we need to integrate emissions and dry deposition in CESM-GC.

yantosca commented 4 years ago

I have merged the feature/cleanup.pbl branch up to 13.0.0 and am currently testing in feature/13.0.0+CleanupPbl. I had to make some minor code updates to call routines in HEMCO that were changed between 12.8.0 and 13.0.0. But the GEOS-Chem classic runs (using geos-chem-classic wrapper) in feature/CleanupPbl give identical results to those in the dev/13.0.0 branch.

I still need to make some modifications in e.g. gigc_chunk_mod for GCHPctm to work.

Furthermore, I had a discussion with Daniel today. The fix that I made pulls out the HEMCO code from the non-local PBL mixing but we are still computing the surface flux externally and then passing that into the non-local PBL mixing module. Daniel suggested that we should really be removing the surface flux from the non-local-PBL mixing module entirely. That might be a more complex task, as the surface flux expression goes deep into the non-local PBL mixing code, which is 3rd party code originally from Jintai Lin. I will try to scope out that problem more to see what we need to do to completely remove the surface flux from non-local PBL mixing. For now we just replicate the behavior of the prior code, which might be good enough for CESM development to continue. I'll keep you posted.

yantosca commented 4 years ago

Hi all -- As there are other pressing issues for the 13.0.0 release, I will leave further modifications along this line of development for later. Right now the HEMCO calls have been extracted from the non-local PBL mixing, but ideally we would like to add emissions into State_Chm%Species and subtract drydep from State_Chm%Species so as not to have to pass the net flux into the non-local PBL mixing routine. This is a more involved coding effort, so we will work on it later.

yantosca commented 4 years ago

I will close out this feature request and create a separate feature request for "add emissions and subtract drydep from State_Chm%Species before PBL mixing". This work would likely wait until after the 13.0.0 release.

msulprizio commented 4 years ago

See https://github.com/geoschem/geos-chem/issues/327