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

append_to_bundle in GOCART and checkpoint states in MAPL #258

Open
bena-nasa opened this issue Dec 8, 2023 · 3 comments
Open

append_to_bundle in GOCART and checkpoint states in MAPL #258

bena-nasa opened this issue Dec 8, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@bena-nasa
Copy link
Contributor

bena-nasa commented Dec 8, 2023

User @mfmehari was doing some OBIO work and found that the AERO_DP bundle imported into surface from gocart was causing the surface import checkpoint writing to fail when he tried running the OBIO code branch. When OBIO is turned on surface import some sort AERO_DP bundle, so of course when say checkpoint my import state, this tries to get written. I looked into it and this issue is in this append_to_bundle routine in GOCART is what is used to construct the bundle via calls in various gocart components. Ultimately this produces a bundle that gets sent over to the surface component. append_from_bundle can be found here
https://github.com/GEOS-ESM/GOCART/blob/main/ESMF/Shared/Chem_AeroGeneric.F90#L129
Basically this routine pulls a field from an ESMF state and creates a new field that shares the same pointer and puts it in the bundle via this code like this:

         ptr2d => orig_ptr(:,:,3)
          field2D = ESMF_FieldCreate(grid=grid, datacopyflag=ESMF_DATACOPY_REFERENCE, farrayPtr=ptr2d,&
                                     name=trim(varName)//'003' , __RC__)
          call MAPL_AllocateCoupling (field2D, __RC__)
          call MAPL_FieldBundleAdd (bundle, field2D, __RC__)

a few issues and weird things with this, first that call to MAPL_AllocateCouping is a NO-OP, if the field has been created, it does nothing so I have no idea why it was even called. The bigger problem is that this field is created without any of the "extra" attributes that fields need if they are to be checkpointed by the MAPL checkpointing system.

Well it turns out that when you run OBIO, the bundle with the fields do need to be checkpoint, but it fails as the required attributes are not there. The issue is that they basically want to create a 2D field by pointer to a level of a 3D field and there's not MAPL interface for that, so someone said, ok, I'll point a pointer to a level of a 3D field, and make an ESMF Field from that. Fine, but then that call AllocateCoupling is no-op. I think some work in MAPL needs to be done.

@bena-nasa
Copy link
Contributor Author

bena-nasa commented Dec 8, 2023

as @mfmehari pointed out, if surface would not just not checkpoint that bundle (add restartskip to the spec) well that would fix is crash, assuming that does not break start/stop regression. But if it does and it needs checkpoint then as I told him, for now I told him how to add the attributes to the field in append_to_bundle that I think should fix the checkpoint problem in surface.

@mfmehari
Copy link

mfmehari commented Dec 8, 2023

Add restartskip to the spec of AERO_DP bundle fixes the crash, but since Surf GC runs before Chem GC (in this order Surf Run1, Chem Run1, Surf Run2, Chem Run2), and the dust deposition looks to occur in Chem Run2 (Gocart Run2), the add restartskip won’t pass the start/stop regression test.
And adding the attributes to the field in subroutine append_to_bundle seems not to work either.

@mfmehari
Copy link

After @bena-nasa suggestion adding all the compulsory attributes to the fields in append_to_bundle has solved the surf_import_checkpoint problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants