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

med_methods_FB_init creates fields with mismatched ungridded dimensions #427

Open
kieranricardo opened this issue Jan 9, 2024 · 0 comments

Comments

@kieranricardo
Copy link

kieranricardo commented Jan 9, 2024

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

elseif (present(STgeom)) then
call med_methods_State_getNameN(STgeom, 1, lname, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_StateGet(STgeom, itemName=lname, field=lfield, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

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 :)

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

1 participant