Skip to content

Provide default initialization for members of the met_data derived type#1453

Open
mgduda wants to merge 1 commit intoMPAS-Dev:developfrom
mgduda:init_atmosphere/met_data_default_init
Open

Provide default initialization for members of the met_data derived type#1453
mgduda wants to merge 1 commit intoMPAS-Dev:developfrom
mgduda:init_atmosphere/met_data_default_init

Conversation

@mgduda
Copy link
Copy Markdown
Contributor

@mgduda mgduda commented May 7, 2026

This PR adds default initialization for the members of the met_data derived type in the init_atm_read_met module. Without well-defined values for some members, unpredictable floating-point exceptions were possible, e.g.,

  Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

  Backtrace for this error:
  #0  0x15494ec288ff in ???
  #1  0x59ddc0 in __init_atm_read_met_MOD_read_next_met_field
        at src/core_init_atmosphere/mpas_init_atm_read_met.F:388
  #2  0x4ccb7a in __init_atm_cases_MOD_init_atm_case_lbc
        at src/core_init_atmosphere/mpas_init_atm_cases.F:6218
  #3  0x58a373 in __init_atm_cases_MOD_init_atm_setup_case
        at src/core_init_atmosphere/mpas_init_atm_cases.F:327
  #4  0x497807 in __init_atm_core_MOD_init_atm_core_run
        at src/core_init_atmosphere/mpas_init_atm_core.F:92
  #5  0x406084 in __mpas_subdriver_MOD_mpas_run
        at src/driver/mpas_subdriver.F:416
  #6  0x4046da in mpas
        at src/driver/mpas.F:20
  #7  0x404745 in main
        at src/driver/mpas.F:10

By initializing the members of the met_data type, these unpredictable errors can be avoided.

This commit adds default initialization for the members of the met_data derived
type in the init_atm_read_met module. Without well-defined values for some
members, unpredictable floating-point exceptions were possible, e.g.,

  Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

  Backtrace for this error:
  #0  0x15494ec288ff in ???
  MPAS-Dev#1  0x59ddc0 in __init_atm_read_met_MOD_read_next_met_field
        at src/core_init_atmosphere/mpas_init_atm_read_met.F:388
  MPAS-Dev#2  0x4ccb7a in __init_atm_cases_MOD_init_atm_case_lbc
        at src/core_init_atmosphere/mpas_init_atm_cases.F:6218
  MPAS-Dev#3  0x58a373 in __init_atm_cases_MOD_init_atm_setup_case
        at src/core_init_atmosphere/mpas_init_atm_cases.F:327
  MPAS-Dev#4  0x497807 in __init_atm_core_MOD_init_atm_core_run
        at src/core_init_atmosphere/mpas_init_atm_core.F:92
  MPAS-Dev#5  0x406084 in __mpas_subdriver_MOD_mpas_run
        at src/driver/mpas_subdriver.F:416
  MPAS-Dev#6  0x4046da in mpas
        at src/driver/mpas.F:20
  MPAS-Dev#7  0x404745 in main
        at src/driver/mpas.F:10

By initializing the members of the met_data type, these unpredictable errors can
be avoided.
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.

1 participant