MetOffice / MetOffice/lfric_apps

Unable to write out W2H fields with XIOS

Open
#164 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Fortran
Stars
31
Forks
118
Avg merge
2d 4h
Merged PRs (30d)
8

Description

### Version

main

### Are there any linked Issues or Pull Requests?

#77

### What happened?

For a long time (possibly ever) it has not been possible to consistently write out W2H fields. This may depend on compiler / machine, and application (for instance it seems possible to write out fields in `gungho_model` but not `lfric_atm`).

This is important for writing out wind fields, as the workaround is to average the wind fields to the W3 function space, which can remove import grid-scale artifacts from the output.

The solution is likely to be in LFRic-Core, but is impacting LFRic-Apps.

### Relevant log output

```shell
Backtrace for this error:
terminate called after throwing an instance of 'xios::CException'

Program received signal SIGABRT: Process abort signal.

#1 0x14c207251d2b in ???
#2 0x14c2072533e4 in ???
#3 0x14c2104a5608 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv
at ../../../../cpe-gcc-12.1.0-202208101649.1dfb26392197c/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x152a0a6a5608 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv
at ../../../../cpe-gcc-12.1.0-202208101649.1dfb26392197c/libstdc++-v3/libsupc++/vterminate.cc:95
#4 0x152a0a6b0c89 in _ZN10__cxxabiv111__terminateEPFvvE
at ../../../../cpe-gcc-12.1.0-202208101649.1dfb26392197c/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5 0x152a0a6b0cf4 in _ZSt9terminatev
at ../../../../cpe-gcc-12.1.0-202208101649.1dfb26392197c/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6 0x152a0a6b0f46 in __cxa_throw
at ../../../../cpe-gcc-12.1.0-202208101649.1dfb26392197c/libstdc++-v3/libsupc++/eh_throw.cc:98
#7 0x41b4fc in _ZN4xios6CField18solveGridReferenceEv
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/node/field.cpp:1604
#8 0x1b37c21 in _ZN4xios6CField30solveOnlyReferenceEnabledFieldEb
#9 0x1b49986 in _ZN4xios5CFile27solveOnlyRefOfEnabledFieldsEb
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/node/file.cpp:839
#10 0x1ac7583 in _ZN4xios8CContext27solveOnlyRefOfEnabledFieldsEb
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/node/context.cpp:870
#11 0x1acea86 in _ZN4xios8CContext14postProcessingEv
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/node/context.cpp:1654
#12 0x1ad4a63 in _ZN4xios8CContext30postProcessingGlobalAttributesEv
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/node/context.cpp:639
#13 0x1ad4f3e in _ZN4xios8CContext15closeDefinitionEv
#14 0x1c62c92 in cxios_context_close_definition
at /tmp/spackadmin/tmp.11pYYoa69N.2025-08-28/spack-stage/spack-stage-xios-2701-lcybbxh4mmgiuroe2kvojdcdtelxuipf/spack-src/src/interface/c/icdata.cpp:124
#15 0x4aceba in __lfric_xios_context_mod_MOD_initialise_xios_context
at /var/tmp/pbs.4673331.ehz100/vn2.2_orog_project/run25/lfric_atm/gnu_fast-debug-64bit-rbl32/lfric_xios_context_mod.f90:140
#16 0x47345b in init_xios_io_context
at /var/tmp/pbs.4673331.ehz100/vn2.2_orog_project/run25/lfric_atm/gnu_fast-debug-64bit-rbl32/driver_io_mod.F90:243
#17 0x4736e9 in __driver_io_mod_MOD_init_io
at /var/tmp/pbs.4673331.ehz100/vn2.2_orog_project/run25/lfric_atm/gnu_fast-debug-64bit-rbl32/driver_io_mod.F90:106
#18 0x45c947 in __gungho_model_mod_MOD_initialise_infrastructure
at driver/gungho_model_mod.F90:782
#19 0x450ab4 in __gungho_driver_mod_MOD_initialise
at driver/gungho_driver_mod.F90:154
#20 0x44b69d in lfric_atm
#21 0x44b7b0 in main
at /var/tmp/pbs.4673331.ehz100/vn2.2_orog_project/run25/lfric_atm/gnu_fast-debug-64bit-rbl32/lfric_atm.f90:19
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked issue #77 and the XIOS failure at src/node/field.cpp:1604, then trace the LFRic call from lfric_xios_context_mod.f90:140 through driver_io_mod.F90:243. Reproduce the behavior in gungho_model and lfric_atm, and treat the issue as done when W2H wind fields can be written consistently without the XIOS abort.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.