Skip to content

Fix time-averaged radiation variables#1038

Closed
Qingfu-Liu wants to merge 1 commit into
NOAA-EMC:developfrom
Qingfu-Liu:develop
Closed

Fix time-averaged radiation variables#1038
Qingfu-Liu wants to merge 1 commit into
NOAA-EMC:developfrom
Qingfu-Liu:develop

Conversation

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator

@Qingfu-Liu Qingfu-Liu commented Nov 21, 2025

Description

This PR fixes some of the UFS-ATM issue discussed in ufs-weather-model issues #1767.
ufs-community/ufs-weather-model#1767
The problem in retro tests has been discussed in detail in GFS issues #43:
NOAA-EMC/GFS#43 (comment)
@JongilHan66 noticed the time averaged cloud cover, which should range from 0-100%, only range across 0-4% in his experiment based on the retrotest16update branch . Abnormal ranges happen to all time averaged cloud cover, and related radiative fluxes. The instantaneous cloud covers and radiative fluxes are fine. The issue is from the UWM and exists in the sfc history files.
There are two different problems related to the radiation fields, one is the instantaneous values used for the coupling (the radiation time step is 3600s, and the physics time step or dynamic time steps are much smaller, for example 360s or 720s), so the coupling need to estimate the radiation flux at the coupling time step which needs to extrapolate the radiation fluxes from the earlier radiation calculation. This extrapolation is not a bug, but not accurate. The second problem is the time-averaged calculation which is a bug. The time-averaged quantities related to the radiation variables are wrong in current UFS community repository.
As Fanglin mentioned in his e-mail:
"This outstanding issue has been affecting us for some time. A number of people have been involved in the discussion or contributed code changes in the past few years. Thank you, in particular, Denise for bringing the issue to everyone's attention in the first place, Grant, for taking this over after Larissa's departure, Dusan, for providing the working solution, and Qingfu, for the testing and confirmation."

The changes of answers are expected from this PR.

Issue(s) addressed

Testing

The code changes have been tested in ufs-weather-model regression tests, and the results have been plotted/diagnosed for all the radiation related variables.
The code updates change the regression test baseline if the output interval is smaller than the averaging interval, otherwise, the code will not change the test baseline.
(no regression test log files since I have not run all the baseline tests. Hope someone can help to run the regression tests and provide the log files)

Dependencies

No dependency

@dpsarmie
Copy link
Copy Markdown
Collaborator

@Qingfu-Liu , thanks for testing this fix. I can help out with running the full regression test suite if you'd like.

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

DeniseWorthen commented Nov 21, 2025

I ran a case w/ this change to examine the shape of the exported SW components.

The fixes in this PR do not "fix" the exported fields, since the exported fields are the instantaneous (not averaged) values at each timestep. The exported fields still contain the sawtooth shape, primarily in the diffuse components, as shown in the original issue. I think this is the expected result.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

Qingfu-Liu commented Nov 21, 2025 via email

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

Qingfu-Liu commented Nov 21, 2025 via email

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

DeniseWorthen commented Nov 21, 2025

@Qingfu-Liu The plots are show at the beginning of the original Issue (#1767). I made my test case based on the changes shown in this comment but I can re-test w/ your actual PR.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

Qingfu-Liu commented Nov 21, 2025

@DeniseWorthen I use time step 720s and output every 12 minutes

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

@Qingfu-Liu Your fix is for time-averaged radiation fields that are written to the history files, right?

For the coupled model, the ATM exports the instantaneous (not average) SW components

ufsatm/fv3/atmos_model.F90

Lines 3496 to 3506 in f6dc207

case ('inst_down_sw_ir_dir_flx')
call block_data_copy(datar82d, GFS_coupling%dnirbmi_cpl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous sfc downward nir diffused flux (W/m**2)
case ('inst_down_sw_ir_dif_flx')
call block_data_copy(datar82d, GFS_coupling%dnirdfi_cpl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous sfc downward uv+vis direct flux (W/m**2)
case ('inst_down_sw_vis_dir_flx')
call block_data_copy(datar82d, GFS_coupling%dvisbmi_cpl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)
! Instantaneous sfc downward uv+vis diffused flux (W/m**2)
case ('inst_down_sw_vis_dif_flx')
call block_data_copy(datar82d, GFS_coupling%dvisdfi_cpl, Atm_block, nb, offset=GFS_Control%chunk_begin(nb), rc=localrc)

Your changes don't impact variables like dvisbmi_cpl, right?

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

Qingfu-Liu commented Nov 21, 2025 via email

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

@dpsarmie Can you run the regression tests? Although the code changes do not fix the coupled variables (which using extrapolation to estimate the instantaneous values) , but it does fix the time-averaged radiation variables. The fix should be added to the repository

@dpsarmie
Copy link
Copy Markdown
Collaborator

@dpsarmie Can you run the regression tests? Although the code changes do not fix the coupled variables (which using extrapolation to estimate the instantaneous values) , but it does fix the time-averaged radiation variables. The fix should be added to the repository

Yes, I will run the regression tests and get the logs posted. But I agree that we should also make sure that the fix is working as intended before moving forward. EPIC has been made aware that this will have priority and it will be merged when everything checks out.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

More comments on this PR: There are two different problems related to the radiation fields, one is the instantaneous values used for the coupling (the radiation time step is 3600s, and the physics time step or dynamic time steps are much smaller, for example 360s or 720s), so the coupling need to estimate the radiation flux at the coupling time step which needs to extrapolate the radiation fluxes from the earlier radiation calculation. This extrapolation is not a bug, but not accurate. The second problem is the time-averaged calculation which is a bug. The time-averaged quantities related to the radiation variables are wrong in current UFS community repository.

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

@Qingfu-Liu I agree that the sawtooth in the exported SW is due to the extrapolation (inaccurate). I did not expect your fix for the history files to impact it.

@dpsarmie
Copy link
Copy Markdown
Collaborator

@Qingfu-Liu I ran the full regression test suite on Ursa for your UFS branch (https://github.com/Qingfu-Liu/ufs-weather-model/tree/fix_time_averaged_radiation) but I didn't see any baseline changes, which seemed odd. I reran on Hercules just to make sure and double-checked that these UFSATM changes were checked out. The rerun still had no changes to the baselines.

Ruiyu's fix/reversion (ufs-community/ufs-weather-model@4ec82c9) had changes to baselines. I'm going to give this another look but I wanted to confirm.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

@dpsarmie Did you check the code change in the following two files: io/fv3atm_history_io.F90 and fv3/atmos_model.F90 compared to the community develop repository?

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

@dpsarmie
Copy link
Copy Markdown
Collaborator

Yes, here's a sample of the code that was compiled on Hercules:
image

Path on Hercules is /work/noaa/stmp/dsarmien/Qingfu-ufs
Path on Ursa is /scratch3/NCEPDEV/stmp/Daniel.Sarmiento/Qingfu_ufs
in case anyone wanted to verify.

@DusanJovic-NOAA
Copy link
Copy Markdown
Collaborator

The changes in this PR have impact only in configurations where the output interval is smaller than the averaging interval, which I do not think is the case in any of our regression tests.

@dpsarmie
Copy link
Copy Markdown
Collaborator

The changes in this PR have impact only in configurations where the output interval is smaller than the averaging interval, which I do not think is the case in any of our regression tests.

Ok, thank you Dusan. I just wanted confirmation that this was expected behavior before moving forward with the PR.

@dpsarmie
Copy link
Copy Markdown
Collaborator

dpsarmie commented Nov 24, 2025

@Qingfu-Liu I'm going to go ahead and edit your UFS#2996 PR and reopen it so I can upload the logs and get it into the queue if that's ok with you.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

@dpsarmie and @DusanJovic-NOAA Thank you very much.
@dpsarmie please edit both PRs, the regression tests part need to be changed

@dustinswales
Copy link
Copy Markdown
Collaborator

The changes in this PR have impact only in configurations where the output interval is smaller than the averaging interval, which I do not think is the case in any of our regression tests.

@DusanJovic-NOAA Is this something that we want to allow? If not, we could add a test to atmos_init to check.

@DusanJovic-NOAA
Copy link
Copy Markdown
Collaborator

The changes in this PR have impact only in configurations where the output interval is smaller than the averaging interval, which I do not think is the case in any of our regression tests.

@DusanJovic-NOAA Is this something that we want to allow? If not, we could add a test to atmos_init to check.

I don't know. But that was the configuration that Larissa showed here (ufs-community/ufs-weather-model#1767 (comment)), and which was attempted to be fixed in a PR that we had to revert. If we restrict the output interval to be at least as the averaging, then this PR is not necessary.

@JessicaMeixner-NOAA
Copy link
Copy Markdown
Collaborator

Are additional PR reviews needed before ufs-community/ufs-weather-model#2996 can mark that it's sub component PRs are reviewed?

Copy link
Copy Markdown
Collaborator

@yangfanglin yangfanglin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed to move ahead with this update. The instantaneous flux used for coupling could be further improved for accuracy in the future.

@Qingfu-Liu
Copy link
Copy Markdown
Collaborator Author

Qingfu-Liu commented Dec 5, 2025

@dpsarmie I saw PR#1038 has a line says that "Qingfu-Liu wants to merge 1 commit into NOAA-EMC:develop from Qingfu-Liu:develop". Why not from Qingfu-Liu:fix_time_averaged_radiation? Did I made a mistake to point to a wrong branch? By the way, I do see that your tests are using the correct branch.

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

@DusanJovic-NOAA The calendar says @Qingfu-Liu is out for the next 3weeks. Can you update his branch w/ latest develop? I don't think I have permissions for that, do you?

@DusanJovic-NOAA
Copy link
Copy Markdown
Collaborator

@DusanJovic-NOAA The calendar says @Qingfu-Liu is out for the next 3weeks. Can you update his branch w/ latest develop? I don't think I have permissions for that, do you?

I can not push to his develop branch.

@DeniseWorthen
Copy link
Copy Markdown
Collaborator

OK, I'll re-create his branch and make a new PR.

@DusanJovic-NOAA
Copy link
Copy Markdown
Collaborator

Merged via #1043. Closing.

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.

7 participants