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

Trying to get mesh out of cpl_scalars field #398

Open
uturuncoglu opened this issue Aug 1, 2023 · 6 comments
Open

Trying to get mesh out of cpl_scalars field #398

uturuncoglu opened this issue Aug 1, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@uturuncoglu
Copy link
Collaborator

It seems that following if statement is not working properly and tries to get mesh out of cpl_scalars.

if (fieldcount > 0 .and. fieldcountgeom > 0) then

Just before the if statement the code tries to remove the cpl_scalars from the field list but it is still in the FB and if it is the first field then CMEPS fails with following error (I put couple of more print statement to be sure) because it uses cpl_scalars.

20230731 224553.040 INFO             PET00 (med_methods_FB_init):FB FBImpatm_wav fieldNameList from STflds
20230731 224553.040 INFO             PET00 (med_methods_FB_init):Sa_u10m
20230731 224553.040 INFO             PET00 (med_methods_FB_init):Sa_v10m
20230731 224553.040 INFO             PET00 (med_methods_FB_init):cpl_scalars
20230731 224553.040 INFO             PET00 (med_methods_FB_init):cpl_scalars removed ...
20230731 224553.040 INFO             PET00 (med_methods_FB_init):Sa_u10mloop again
20230731 224553.040 INFO             PET00 (med_methods_FB_init):Sa_v10mloop again
20230731 224553.040 INFO             PET00 (med_methods_FB_init):cpl_scalars mesh from STgeom
20230731 224553.040 ERROR            PET00 ESMF_GeomBase.F90:997 ESMF_GeomBaseGet Value unrecognized or out of range  -  Grid not geometry type
20230731 224553.040 ERROR            PET00 ESMF_FieldGet.F90:487 ESMF_FieldGetDefault Value unrecognized or out of range  - Internal subroutine call returned Error
20230731 224553.040 ERROR            PET00 med_methods_mod.F90:431 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 med.F90:1744 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 MED:src/addon/NUOPC/src/NUOPC_ModelBase.F90:1639 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 UFS Driver Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:2577 Value unrecognized or out of range  - Phase 'IPDv03p7' Initialize for modelComp 1: MED did not return ESMF_SUCCESS
20230731 224553.040 ERROR            PET00 UFS Driver Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:2408 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 UFS Driver Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:2192 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 UFS Driver Grid Comp:src/addon/NUOPC/src/NUOPC_Driver.F90:463 Value unrecognized or out of range  - Passing error in return code
20230731 224553.040 ERROR            PET00 UFS.F90:386 Value unrecognized or out of range  - Aborting UFS

Anyway, I think assuming first field is not cpl_scalars is not a generic solution and it could fail in some cases. Anyway, I'll try to fix it in CMEPS side as a part of the work in Coastal App side if you agree that this is an issue.

@uturuncoglu uturuncoglu added the bug Something isn't working label Aug 1, 2023
@uturuncoglu uturuncoglu self-assigned this Aug 1, 2023
@uturuncoglu
Copy link
Collaborator Author

I think, the main issue is in,

call State_GetNumFields(is_local%wrap%NStateImp(n2), fieldCount, rc=rc)

This returns field count but if the coupling is unidirectional such as datm->wav then wave export (NStateImp(n2) statement, which n2 is wave) will not have anything except scalar. But, fieldCount would be greater than zero since NStateImp(n2) have scalar field and this will not work. FB_init tries to use scalar field to extract mesh information (enters else statement). I think in this case State_GetNumFields needs to return total number of fields without including scalar field.

So, returning number of fields without scalar passes the point that code crash but then same thing also happens in following statement,

call State_GetNumFields(is_local%wrap%NStateImp(n1), fieldCount, rc=rc)

I am not sure by this is happening in my case. This is DATM+WAV configuration under ufs-coastal (it is a fork of ufs weather model) and CDEPS DATM only sends two wind component to WW3. As I know, there is no any wave configuration forced with DATM under UFS at this point. @DeniseWorthen do you have any information about it. Is it tested configuration under UFS? Anyway, I'll further investigate the issue.

@DeniseWorthen
Copy link
Collaborator

@uturuncoglu I just now found this mention. Sorry! Is this still an issue? We don't have a datm+wav configuration in UFS, but I've been thinking that we need one; this would allow UFS to test WW3 PRs using actively coupled ocean and ice (vs testing in the standalone system).

@uturuncoglu
Copy link
Collaborator Author

@DeniseWorthen No worries. We setup datm+wav case under UFS Coastal and it is working fine. I fixed CMEPS under our fork. You could see the diff in the following link,

NOAA-EMC/CMEPS@emc/develop...oceanmodeling:CMEPS:feature/coastalapp

This has also other changes related with the new coupling mode (we could get rid of it once we have stable ufs-coastal and merge with ufs one but at this point I am not sure if there is an intention to push those changes along with the new components to UFS Weather Model level). Please see the changes in mediator/med_methods_mod.F90 which is related with this issue. We could push this to NOAA-EMC if you want. We have also couple of fixed in WW3 side to enable coupling with Coastal ocean models, standalone build etc. (https://github.com/oceanmodeling/WW3/tree/dev/ufs-coastal)

@JessicaMeixner-NOAA
Copy link

@uturuncoglu It'd be great to get anything you need for coastal coupling in WW3 to be sync'd back to the noaa-emc fork. I know there were conversations about this years ago, but perhaps we can restart them. Let me know if there's anything I can help with in that respect.

@uturuncoglu
Copy link
Collaborator Author

@JessicaMeixner-NOAA Thanks. I could sync our fork with the NOAA-EMC and create draft PR. So, you could see the changes if you want. We also did minor modification in the cap to run WW3 standalone under UFS. Anyway, let me know what do you think.

@JessicaMeixner-NOAA
Copy link

@uturuncoglu that sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants