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

Add gigataj grid comp #954

Draft
wants to merge 37 commits into
base: develop
Choose a base branch
from
Draft

Conversation

weiyuan-jiang
Copy link
Contributor

No description provided.

@weiyuan-jiang weiyuan-jiang added enhancement New feature or request 0 diff The changes in this pull request have verified to be zero-diff with the target branch. labels Jun 18, 2024
@@ -8,6 +8,13 @@ set (alldirs
GEOSwgcm_GridComp
)

option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" ON)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want this to default to ON? Might be best to initially add it as an optional feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will make if OFF as default. The on is just for my own convenience.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely needs to be OFF as default.

Suggested change
option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" ON)
option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" OFF)

@@ -0,0 +1,9 @@
esma_set_this()

set (dependencies MAPL esmf geos_giga metsources filters gigatraj)
Copy link
Member

Choose a reason for hiding this comment

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

Might be best to use ESMF::ESMF or at least ESMF here. The all lowercase isn't really official (though we do support it).

option(BUILD_WITH_GIGATRAJ "Build GEOSgcm with Gigatraj" ON)

if (BUILD_WITH_GIGATRAJ)
add_definitions (-DHAS_GIGATRAJ)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit of an anti pattern for CMake. It should get attached to the target that needs the definition. Possibly ${this}

Comment on lines +23 to +25
#ifdef HAS_GIGATRAJ
use GEOS_GigatrajGridCompMod, only: GigaTraj_SetServices => SetServices
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any chance this can use DSO instead? Then we don't need the $ifdef and can instead just use information in the RC file to load the component.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively, the gridcomp itself is rather small. Why not always build it and just have runtime conditionals (defaulting to off) to control use.

Comment on lines +259 to +262
#ifdef HAS_GIGATRAJ
gigatraj = MAPL_AddChild(GC, NAME='GIGATRAJ', SS=GigaTraj_SetServices, RC=STATUS)
VERIFY_(STATUS)
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, if we use DSO this can be turned into a run-time if instead of a compile time #ifdef.

Comment on lines +2033 to +2039

#ifdef HAS_GIGATRAJ
! use agcm export as gigatraj's import to get the initial state.
! it only runs at the begining of the first time step
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=1, userRC=status )
VERIFY_(STATUS)
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be a runtime conditional.

Comment on lines +2044 to +2049
#ifdef HAS_GIGATRAJ
! use agcm export as gigatraj's import
call ESMF_GridCompRun ( GCS(gigatraj), importState=GEX(AGCM), exportState=GEX(gigatraj), clock=clock, phase=2, userRC=status )
VERIFY_(STATUS)
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

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

This appears to be a duplicate of the call above. Why is it run twice?

Comment on lines +793 to +810
#ifdef HAS_GIGATRAJ
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'OMEGA', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'PL', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'TH', &
CHILD_ID = SDYN, &
RC = STATUS)
VERIFY_(STATUS)
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

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

Run-time conditional.

@@ -0,0 +1,9 @@
esma_set_this()

set (dependencies MAPL esmf geos_giga metsources filters gigatraj)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
set (dependencies MAPL esmf geos_giga metsources filters gigatraj)
set (dependencies MAPL ESMF::ESMF geos_giga metsources filters gigatraj)

@@ -0,0 +1,187 @@
module GEOS_Giga_InterOpMod
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs documentation as to what it is for. Nothing big - just a few sentences at the top explaining.

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. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants