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

mapping ATM state fields bilinearly #38

Open
DeniseWorthen opened this issue Mar 13, 2021 · 6 comments
Open

mapping ATM state fields bilinearly #38

DeniseWorthen opened this issue Mar 13, 2021 · 6 comments
Assignees

Comments

@DeniseWorthen
Copy link
Collaborator

DeniseWorthen commented Mar 13, 2021

Changes are required in esmFldsExchange_nems and med_map_mod to implement two changes: unity normalization and bilinear mapping of ATM state fields. These are changes from the current implementation in which the criteria used was validating the NEMS mediator functionality.

  1. CMEPS has the ability to apply a "unity" normalization when mapping from source to destination grid. This ensures that the mapping weights on the destination side add to one. The normalization is a static field which needs to be calculated only once (in med_map_mod) by mapping a field value 1.0 from each source component to each destination component for each defined mapping type between those two components. The reciprocal of the mapped value 1.0 is added to the mediator internal state and used when specifying that the normalization type for mapping is "one"; e.g.
call addmap(fldListFr(source_component)%flds, 'field_name', destination_component, mapconsf, "one", 'unset')

Note that an equivalent process happens when normalizing using a time-varying ice fraction. In that case, the the normalization in the above call would be set to ifrac. When normalizing by ifrac, the mapped destination field (= mapped source_field*ifrac) is normalized by the factor 1.0/(mapped ifrac).

The ability to apply unity normalization when not normalizing by ifrac was not available in NEMS and so was set to none in the mapping calls used by UFS. Since it is a static field that is calculated only once, there is no penalty to applying the unity normalization and it ensures that the mapping weights always add to one regardless of the mapping type.

  1. For CMEPS in UFS, ATM states (T,P,Q,U,V) are being mapped conservatively when mapped to the ICE (when coupled) or to the mediator (when using the mediator aoflux calculation). (The DATM application also maps the 2m and 10m state fields conservatively for use in the bulk flux option).

For the typical case in UFS, this means mapping from a coarse ATM to a fine OCN (relatively). This creates very un-smooth destination fields. For example, the following shows the mapped Tbot (from ATM) exported to the ICE in the C96-mx100 case in the Ross Sea (Antarctic) region. The left shows the conservatively mapped field and the right shows the bilinearly mapped field.

Screen Shot 2021-03-13 at 10 42 10 AM

The following shows the value at the x=130 line:

Screen Shot 2021-03-13 at 10 42 36 AM

Since ATM T,P,Q,U,V are global, unmasked states and not fluxes, the mapping should be switched to bilinear in order to provide smooth fields to the ICE model (coupled) and for the aoflux calculation (DATM). Changes are required to both esmFieldsExchange_nems (where the mapping is defined) as well as to the srcMaskValue used for a bilinear routehandle creation from ATM->OCN,ICE.

For the datm applications (either cdeps or nemsdatm), the ATM is much finer than the OCN. This results in smooth states being passed to the ICE and aofluxes even though they are being mapped conservatively.

@DeniseWorthen DeniseWorthen self-assigned this Mar 13, 2021
@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Mar 20, 2021

The bilinear mapping of ATM states when using the DATM component requires the addition of another mapping type.

For pure bilinear mapping, the dstStatus flag field returned from the RegridStore can have the value of 2 at points along the topmost row of the tripole grid. The value of 2 indicates that the destination location is outside the source grid, so no regridding has been performed on it.

The maximum latitude of the source grids are:

cfsr data source, max lat: 89.844
gefs data source, max lat: 89.821

The maximum latitude of the tripole destination grids are:

mx100 89.831 
mx050 89.881
mx025 89.939

Depending on source-destination pairs, destination locations can be unmapped because the source latitude range does not extend far enough north. So, for example, the cfsr data source can be mapped completely to the mx100 destination but the gefs data source cannot.

Introduction of a second bilinear mapping type which uses an extrapolation method of ESMF_EXTRAPMETHOD_NEAREST_STOD allows these points to be mapped. This method will fill any unmapped destination points with the closest source point

@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Mar 21, 2021

The following shows the bottom temperature (Tbot) mapped from the CFSR data source to the mx025 destination grid using mapbilin only. Values near the pole which are unmapped are given a value of 0.0 and appear here as being <= 250.0K.

mapbilin_iceExp_Sa_tbot


The following shows the same field using the current conservative mapping (left) and using bilinear mapping with NSTOD extrapolation to fill the umapped locations. This demonstrates both the unsmoothness of the conservative mapping fields and also that the bilinear NSTOD mapping fills the unmapped destination points with reasonable values.

Sa_tbot

mvertens added a commit to ESCOMP/CMEPS that referenced this issue Mar 28, 2021
Retrieval of dstStatusField and optionally writing to file; add mapbilnr_nstod mapping
### Description of changes
Adds ability to write dstStatusField from RegridStore. Adds bilinear mapping with NSTOD extrapolation.
### Specific notes
A flag is added (dststatus_print, default false) in med_map_mod.F90 to write the dstStatusField from the RegridStore operation. Since ESMF_FieldWrite does not order the written field correctly, a field containing the index order is also retrieved and written. This can be used off-line to re-order the data in the dststatus file. 
A bilinear mapping type with NSTOD extrapolation is added. This is currently unused but will be implemented in the ufs-model system for mapping the ATM states (bottom T,P,Q,U,V) using bilinear instead of conservative mapping.
A small change is added to abort if coupling_mode is not supported. 

Trailing white space cleanup, primarily in fd_nems.yaml

CMEPS Issues Fixed (include github issue #):
NOAA-EMC#38

Are changes expected to change answers?
 - [X] bit for bit
 - [ ] different at roundoff level
 - [ ] more substantial 

Any User Interface Changes (namelist or namelist defaults changes)?
 - [ ] Yes
 - [X] No

Testing performed if application target is CESM:(either UFS-S2S or CESM testing is required):
- [ ] (recommended) CIME_DRIVER=nuopc scripts_regression_tests.py
   - machines:
   - details (e.g. failed tests):
- [ ] (recommended) CESM testlist_drv.xml
   - machines and compilers:
   - details (e.g. failed tests):
- [ ] (optional) CESM prealpha test
   - machines and compilers
   - details (e.g. failed tests):
- [ ] (other) please described in detail
   - machines and compilers
   - details (e.g. failed tests):

Testing performed if application target is UFS-coupled:
- [X] (recommended) UFS-coupled testing
   - description: ufs-weather-model (3e46f5b) switched to this branch for CMEPS with shr_mod_pio.F90 from CMakeLists.txt in CMEPS-interface
   - details (e.g. failed tests): All ufs-coupled and ufs-datm tests pass current baselines
 CESM - verified that SMS_Vnuopc_Ld1.f09_g17.B1850.cheyenne_intel was bfb with these changes
@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Apr 12, 2021

The switch to unity normalization will create b4b differences at the first coupling timestep. To asses the impact of the switch to unity normalization, a butterfly comparison test was carried out using the cpld_controlfrac_c192 test (which runs for 48 hrs). Three tests were run:

  1. Current develop branch
  2. Current develop branch + adding butterfly_effect = .T. to the fv_core_nml
  3. Current develop branch but switched to a CMEPS branch using unity normalization for all fields: shown here. In this test case, nems.configure contained the setting norm_mode=one.

Difference fields were made for SST for the ocean and Tsfc for the ice after the 48 hour run. Visual comparisons indicate that the b4b differences associated with unity normalization are comparable to the butterfly effect.


SST_global


SST_tile1


Tsfc_h

@arunchawla-NOAA
Copy link

@DeniseWorthen the PRS related to this issue are already merged. Is this issue still need to be open ?

@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Mar 5, 2022

The bilinear mapping is still an outstanding issue. I believe we should be mapping states bilinearly and fluxes conservatively. The fact that we're mapping states conservatively is a hold-over from the NEMS mediator prior to the implementation of the fractional grid.

The issues is that when we map states conservatively, we get the imprint of the ATM resolution on the OCN and ICE as shown in the first few figures above. This is even more of an issue when I've tested a c96mx025 configuration for the validation of the XGrid. In that case, this "imprint" appears even in mid and low latitudes.

I have not moved forward on this because of an issue I saw when adding bilinear mapping. In ESMF, we can obtain the dstStatusField during RH creation which reports a flag for how each destination point was arrived at. The various possible values are shown here.

Using the dstStatusField, I had found that in UFS, when I made a single mapping change (mapping Sa_pslv from atm->ocn bilinearly instead of conservatively), I saw a strange effect on a completely different mapping, in this case the mapping of ocn->atm with conservative destination. A few points were showing up as now being mapped from ocn->atm, when previously they had not been.

This is the dstStatusField for ocn->atm conservative mapping:

Screen Shot 2022-01-25 at 11 46 47 AM

This is the same field if I change the sea level pressure to bilinear mapping atm->ocn. Note that the stripes actually all run the same direction, but because some FV3 tiles are laid out sideways, the direction appears to change. In any case, there are now a handful of points which are now being mapped from ocn->atm. I believe all these points are all land points on the atm side.

Screen Shot 2022-01-25 at 11 47 15 AM

Recently, I found that if map the sea level pressure from atm->ocn bilinearly and set the dstMaskValue = ispval_mask when mapping from ocn->atm, the issue does not arise:

Screen Shot 2022-01-25 at 1 10 31 PM

I've been in contact w/ Rocky and Bob regarding this issue, but so far we don't have an explanation for the odd behavior. For that reason, I've been reluctant to implement bilinear mapping even though I think it is the right thing to do.

@DeniseWorthen DeniseWorthen changed the title mapping ATM state fields bilinearly; add unity normalization mapping ATM state fields bilinearly Jun 30, 2023
@DeniseWorthen
Copy link
Collaborator Author

DeniseWorthen commented Jun 30, 2023

Changed title of issue since unity normalization was committed in UFS PR #522

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

No branches or pull requests

2 participants