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

Sync w/ latest ESCOMP/main #129

Merged
merged 791 commits into from
Dec 16, 2024

Conversation

DeniseWorthen
Copy link
Collaborator

@DeniseWorthen DeniseWorthen commented Dec 10, 2024

Description of changes

This PR updates CMEPS to improve the usability of the RegridStatus field, which is returned during RH formation. When enabled with write_dststatus = true, a file named case_name.dststatus.nc will be produced. Each field in this file will report an integer flag indicating how a given point was mapped. These values are documented in the ESMF Ref manual here. Note that in order to "bin" the status among types a tolerance has been used, which can result in a speckled pattern for the conservative mapping types. These are generally not important (ie, the difference between a value=5,6,7).

The file produced will contain a set of fields in the form dstcomp_source_destination_maptype. For example, dstice_atm_ice_consf, which is the "conservative fraction mapping from atm to ice" and dstatm_ice_atm_consf, which is in the opposite direction (the atm fields are available decomposed onto the tiles).

This dststatus fields can be used to verify the correct mapping. For example, for the C96mx025 test case created to debug the grid imprint issue (ufs-community/ufs-weather-model#2466), mapping bilinear from atm->ice shows this mapping result around Bering Strait:

Screenshot 2024-12-11 at 9 20 28 AM

This clearly shows that coastal areas on the ice grid are unmapped (value=1, "The destination location is within a masked part of the source grid; no regridding"). This means to implement bilinear mapping from atm->ice, the srcMask value needs to be changed to map all atm points to the ice. With this change, the following dststatus is generated, showing that all ice points now being mapped to (value=4, "The destination location is within the unmasked source grid; regridded").

Screenshot 2024-12-11 at 9 20 51 AM

(Note that for the unstructured wave, the dststatus fields cannot be visualized w/o external information, namely the element and node coordinates. These can be retrieved from the SCRIP file used to generate the ESMF mesh.)

PR also updates to latest ESCOMP, which utilizes a centralized location (use nuopc_shr_methods in CDEPS share code) to initialize Alarms and provides updates to CESM-specific uses.

Specific notes

CMEPS Issues Fixed (include github issue #):

Are changes expected to change answers? (specify if bfb, different at roundoff, more substantial)

Any User Interface Changes (namelist or namelist defaults changes)?

This feature is enabled by adding write_dststatus = true to the MED attributes.

Testing performed

Please describe the tests along with the target model and machine(s)
If possible, please also added hashes that were used in the testing

jedwards4b and others added 30 commits January 30, 2024 13:56
CMEPS PR for CDEPS Inline implementation
* add new cpl_scalar for mediator history files for tiled
gridded domains, eg cube-sphere. Replaces existing use of
config variables which restricted the use to 6-tiles domain
* remove unnecessary trims, fix minor typos and indentation
Previously we hadn't been doing the mapping from MED -> GLC when CISM
was running in NOEVOLVE mode. This was a problem because this downscaled
SMB is one of the main benefits of running CISM in NOEVOLVE mode.

Resolves ESCOMP#426. See that issue for details.

One other change here is that I skip GLC -> MED in NOEVOLVE mode. I
*think* that's a safe thing to do, but I'm not 100% sure of it.
Add unstructured grid support for use with new Spectral Elements SCAM
* testing of this feature w/ UFS noahmp lnd component, which currently
runs on the CSG, found two issues. One to write the mediator fractions
and areas on the tiles when using the single history file. A second fix
is the mapping masking for lnd-atm coupling in UFS.
Copied POP2%ECO values to use as MOM6%MARBL values (want them for abio as well
as base bio runs)
Add index to cpl_scalars to allow CSG or regional (single tile) mediator history files for ATM component in UFS
When this was based on run_glc, NOEVOLVE cases were failing like this:

20240319 135112.648 ERROR            PET0000 ESMF_ArrayGet.F90:1949 ESMF_ArrayGetFPtr Object being used before creation  - Bad Object
20240319 135112.649 ERROR            PET0000 ESMF_FieldGet.F90:2634 ESMF_FieldGetDataPtr Object being used before creation  - Internal subroutine call returned Error
20240319 135112.649 ERROR            PET0000 nuopc_shr_methods.F90:304 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 glc_import_export.F90:475 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 glc_comp_nuopc.F90:481 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 ESM0001:src/addon/NUOPC/src/NUOPC_Driver.F90:2901 Object being used before creation  - Phase 'IPDv01p3' Initialize for modelComp 3: GLC did not return ESMF_SUCCESS
20240319 135112.649 ERROR            PET0000 ESM0001:src/addon/NUOPC/src/NUOPC_Driver.F90:1985 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:2901 Object being used before creation  - Phase 'IPDv02p3' Initialize for modelComp 1: ESM0001 did not return ESMF_SUCCESS
20240319 135112.649 ERROR            PET0000 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:1990 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 ensemble:src/addon/NUOPC/src/NUOPC_Driver.F90:489 Object being used before creation  - Passing error in return code
20240319 135112.649 ERROR            PET0000 esmApp.F90:134 Object being used before creation  - Passing error in return code
20240319 135112.649 INFO             PET0000 Finalizing ESMF

This fails in the InitializeRealize call to export_fields, and
specifically in this:

       ! Set scalars in export state
       call State_SetScalar(dble(get_nx_tot(instance_index=ns)), flds_scalar_index_nx, &
            NStateExp(ns), flds_scalar_name, flds_scalar_num, rc)

So it seems like we need to have GLC -> MED in the run sequence for
initialization to work correctly.
…teU10

Update U10 to be resolved wind; add variable for U10+gusts
billsacks and others added 17 commits October 22, 2024 12:54
Fix logic for adding psfc to aoflux_in

### Description of changes

Fix the logic for adding psfc to aoflux_in, particularly needed for cases using the exchange grid.

This is needed to avoid a segmentation fault in the call to flux_atmocn in SMS_Ld2.ne30pg3_t232.BMT1850.derecho_gnu.allactive-defaultio when running with aoflux_grid=xgrid. (This shows up when running with xgrid because the FB_fldchk can't be used in this situation - see details in my [comment below](ESCOMP#514 (comment)).)

### Specific notes

Contributors other than yourself, if any:

CMEPS Issues Fixed (include github issue #):

Are changes expected to change answers? No

Any User Interface Changes (namelist or namelist defaults changes)? No

### Testing performed

SMS_Ld2.ne30pg3_t232.BMT1850.derecho_gnu.allactive-defaultio with aoflux_grid="xgrid", from cesm3_0_beta03

Also ran many other tests from the CESM prealpha and prebeta test suite.
Make xgrid the default aoflux_grid when atm and ocn are running on different grids
add memory usage variables for use on derecho
do not write restart at end of erc test
* create a FB to hold the returned dststatus fields
* write all dststatus fields into one file via med_io_write_FB
in med.F90 if requested
* add mask to the FBdststatus
update retrieval and writing of dststatus fields
restart at end of run needs to be false for these tests
@DeniseWorthen DeniseWorthen marked this pull request as ready for review December 12, 2024 13:15
Copy link
Collaborator

@uturuncoglu uturuncoglu left a comment

Choose a reason for hiding this comment

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

It looks good to me.

@FernandoAndrade-NOAA
Copy link

Testing for #2469 has completed, please continue with the merge process, thank you.

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

Successfully merging this pull request may close these issues.

update NOAA-EMC from ESCOMP improve usability of dststatus fields