Skip to content

Conversation

@aoloso
Copy link
Contributor

@aoloso aoloso commented Jan 24, 2026

Types of change(s)

  • Bug fix (non-breaking change which fixes an issue)
  • [ X] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Trivial change (affects only documentation or cleanup)
  • Refactor (no functional changes, no api changes)

Checklist

  • Tested this change with a run of GEOSgcm
  • Ran the Unit Tests (make tests)

Description

Changed MAPL 2 to MAPL 3

Related Issue

4274

@aoloso aoloso requested a review from a team as a code owner January 24, 2026 00:36
@aoloso aoloso added the 📈 MAPL3 MAPL 3 Related label Jan 24, 2026
@tclune tclune added 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. Changelog Skip Skips the Changelog Enforcer labels Jan 25, 2026
@tclune
Copy link
Collaborator

tclune commented Jan 25, 2026

Note that I played around a bit with refactoring the develop branch of this component over the weekend. In the end, the main thing that I wanted to accomplish appears to be too risky. Namely, I wanted to make the logic "grid agnostic" rather than special cases for latlon and CS. (And then I was going to fix the haloing issue.)

Copy link
Collaborator

@tclune tclune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made several specific suggestions, but did not flag all of the commented lines that should be deleted.

@aoloso
Copy link
Contributor Author

aoloso commented Jan 31, 2026

@tclune All the changes have been made.


subroutine grid_get(grid, unusable, name, dimCount, coordDimCount, im, jm, rc)
subroutine grid_get(grid, unusable, name, dimCount, coordDimCount, &
im, jm, globalCellCountPerDim, rc)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to look into this. Our thinking is that we don't want user code to be getting global cell counts. Too much danger.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Near as I can tell this is only being used to determine whether this is latlon vs cubed sphere. We want a better way to do that.

However, that fix should not be part of this PR. So I may end up approving and require you to go back and clean all this up when the other feature is available.

Am thinking something like

call mapl_GridGet(grid, class=class, _RC)

Where class is either a string {"latlon", "cubedsphere", ...) or possibly a simple derived type for type safety. (akin to ESMF_TypeKind_Flag).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imsize depends on IM_World, so in addition to knowing what type of grid this is, it looks like we actually need to know the global cell counts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tclune We keep bumping into this. There are several places where IM_WORLD is queried for. In FV3, we get around that by reading it from the config file.

Copy link
Collaborator

@tclune tclune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few things to fix (for now). See inline comments for details.

  1. A few commented out lines to remove.
  2. Check whether comp_name is still needed - I think it was just fore use with "Iam"
  3. We need to redo some of this once GridGet can return the grid class.
    • please open a new issue for that. And make fixing here a sub-issue.

@aoloso
Copy link
Contributor Author

aoloso commented Feb 3, 2026 via email

Use MAPL_BaseMod
Use MAPL_GenericMod
Use MAPL_Constants
Use MAPL_BaseMod, only: MAPL_PI,MAPL_DEGREES_TO_RADIANS_R8, &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the constants, try

use MAPL_Constants, only: MAPL_PI, MAPL_DEGREES_TO_RADIANS_R8 etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - responded to this in main conversation. We certainly don't want to reference Base at all. As much as possible I think we just want use MAPL3 [, only: ...] Constants might be an important exception, but then it should be use MAPL_Constants [, only: ...]

Use MAPL_Constants
Use MAPL_BaseMod, only: MAPL_PI,MAPL_DEGREES_TO_RADIANS_R8, &
MAPL_RADIANS_TO_DEGREES, MAPL_UNDEF, MAPL_DimsHorzOnly, &
MAPL_R4, MAPL_VLocationCenter, MAPL_FieldCreateEmpty, &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAPL_VLocationCenter can be replaced with VERTICAL_STAGGER_CENTER from mapl3g_VerticalStaggerLoc`

Use MAPL_BaseMod, only: MAPL_PI,MAPL_DEGREES_TO_RADIANS_R8, &
MAPL_RADIANS_TO_DEGREES, MAPL_UNDEF, MAPL_DimsHorzOnly, &
MAPL_R4, MAPL_VLocationCenter, MAPL_FieldCreateEmpty, &
MAPL_GridGetCorners, MAPL_FieldAllocCommit, MAPL_FieldBundleAdd, &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new MAPL_FieldBundleAdd in module mapl3g_FieldBundle_API

@tclune geom/VectorBasis.F90 has a GridGetCorners routine, but it is not included in geom/API.F90. Should we add it to API.F90?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grr. For now I suppose. I really want to consolidate things in GridGet where possible.

MAPL_R4, MAPL_VLocationCenter, MAPL_FieldCreateEmpty, &
MAPL_GridGetCorners, MAPL_FieldAllocCommit, MAPL_FieldBundleAdd, &
MAPL_PackTime
Use MAPL_CommsMod, only: MAPL_AM_I_ROOT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try MAPL_Am_I_Root from module mapl3g_Utilities_Comms_API

@tclune
Copy link
Collaborator

tclune commented Feb 5, 2026

@pchakraborty Do we really want users to be so aware of internal module structure of MAPL?

I think we want to aim for use MAPL3, only: ...

But there may be exceptions for specific cases such as constants. (Indeed, we may yet move constants into a separate repo.)

@pchakraborty
Copy link
Contributor

@pchakraborty Do we really want users to be so aware of internal module structure of MAPL?

I think we want to aim for use MAPL3, only: ...

But there may be exceptions for specific cases such as constants. (Indeed, we may yet move constants into a separate repo.)

We’ll have to do another pass closer to release where we replace the use statements with use mapl3, only:…, but for now, I think it’s best to be as specific as possible.

@tclune
Copy link
Collaborator

tclune commented Feb 6, 2026

We’ll have to do another pass closer to release where we replace the use statements with use mapl3, only:…, but for now, I think it’s best to be as specific as possible.

Not sure I agree. It ties our hands if we want to move something into a different module. Won't be much of that, but I'm not seeing much advantage to naming the specific module.

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

Labels

0 Diff The changes in this pull request have verified to be zero-diff with the target branch. Changelog Skip Skips the Changelog Enforcer 📈 MAPL3 MAPL 3 Related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants