ESCOMP / ESCOMP/CMEPS

med_methods_FB_init creates fields with mismatched ungridded dimensions

Open
#427 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Fortran
Stars
35
Forks
106
Avg merge
6d 5h
Merged PRs (30d)
4

Description

Hi there,

I'm currently using CMEPs to couple CICE6, MOM6, and the UM and I noticed some unexpected behaviour while using CMEPS.

When ungridded dimensions are present, behaviour of `med_methods_FB_init` seems to depend on the internal field ordering of the input state. `med_methods_FB_init` removes `cpl_scalars` from the field name list `lfieldNameList`, but then accesses the fields from the input state by index when determining the ungridded dimensions. Unless `cpl_scalars` is the last field in the input state, this causes the wrong fields to be used when determining the ungridded dimensions of the output fields.

The following small change fixed this for my use case. Changing

https://github.com/ESCOMP/CMEPS/blob/d2a08f0edc84b30b91891d96d3dd0040a595db5e/mediator/med_methods_mod.F90#L451-L457

to

```
elseif (present(STflds)) then
call ESMF_StateGet(STflds, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
```

Happy to submit a PR from my fork https://github.com/kieranricardo/CMEPS/tree/bugfix-FB-init-dim-mismatch if appropriate :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.