hailwat tracer index is uninitialized in setup_pt_NH_BC
Closed this issue · 0 comments
SamuelTrahanNOAA commented
Describe the bug
In subroutine setup_pt_NH_BC
within fv_nesting.F90
, you will find this code:
integer :: liq_wat, ice_wat, rainwat, snowwat, graupel, hailwat
...
liq_wat = get_tracer_index (MODEL_ATMOS, 'liq_wat')
ice_wat = get_tracer_index (MODEL_ATMOS, 'ice_wat')
rainwat = get_tracer_index (MODEL_ATMOS, 'rainwat')
snowwat = get_tracer_index (MODEL_ATMOS, 'snowwat')
graupel = get_tracer_index (MODEL_ATMOS, 'graupel')
...
if (hailwat > 0) then
hailwatBC_west => q_BC(hailwat)%west_t1
hailwatBC_east => q_BC(hailwat)%east_t1
hailwatBC_north => q_BC(hailwat)%north_t1
hailwatBC_south => q_BC(hailwat)%south_t1
else
hailwatBC_west => dum_west
hailwatBC_east => dum_east
hailwatBC_north => dum_north
hailwatBC_south => dum_south
endif
Notice the hailwat is never initialized.
I suspect the correct solution is to add this line:
hailwat = get_tracer_index (MODEL_ATMOS, 'hailwat')
To Reproduce
There is no straightforward way to reproduce this behavior at runtime, but it is obvious from the code.
Expected behavior
Variables should be initialized and array indexes should be correct.
System Environment
N/A - the error is plainly visible in the source code
Additional context
N/A