Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Bug/feature in cam_diagnostics.F90 produces wrong Q925 output

Hello

FYI I am using CAM from CESM 2.1.

The code logic in cam_diagnostics.F90 near line 1413 is not correct, and produces a wrong Q925 output,
which is nonphysical, follows the topography; has a range that straddles negative values; has near-zero values over the ocean, etc.
That code logic should work if the variable THE9251000 is also part of the output.
However, it doesn't work if only Q925 is output (my case),
because in this case the array p_surf_q2 is not interpolated by vertinterp,
thus retains whatever values the compiler initializes it to (probably zeros).

I enclose below the original code and my code modification that corrects this error.
The only change is in lines 1413-1414.

I also attach a figure showing Q925 produced by
the original/wrong code (left) and the modified/corrected code (right).

*** original/wrong code ***
1413 if (hist_fld_active('THE9251000')) then
1414 call vertinterp(ncol, pcols, pver, state%pmid, 92500._r8, state%q(1,1,1), p_surf_q2)
1415 end if
1416
1417 !!! at 1000 mb and 925 mb
1418 if (hist_fld_active('Q1000')) then
1419 call outfld('Q1000 ', p_surf_q1, pcols, lchnk )
1420 end if
1421
1422 if (hist_fld_active('Q925')) then
1423 call outfld('Q925 ', p_surf_q2, pcols, lchnk )
1424 end if


*** modified/corrected code ***

1413 if ( hist_fld_active('Q925') .or. &
1414 hist_fld_active('THE9251000')) then
1415 call vertinterp(ncol, pcols, pver, state%pmid, 92500._r8, state%q(1,1,1), p_surf_q2)
1416 end if
1417
1418 !!! at 1000 mb and 925 mb
1419 if (hist_fld_active('Q1000')) then
1420 call outfld('Q1000 ', p_surf_q1, pcols, lchnk )
1421 end if
1422
1423 if (hist_fld_active('Q925')) then
1424 call outfld('Q925 ', p_surf_q2, pcols, lchnk )
1489 end if

****

Thank you.
Gus Correa
LDEO
 

Attachments

  • Q925WrongAndRight.pdf
    226.8 KB · Views: 3

eaton

CSEG and Liaisons
Thanks for pointing this out. I agree with your analysis and solution. We'll get this fix in the next 2.1 release which will be out soon.
 
Top