Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: UFS Replay #372

Merged
merged 83 commits into from
May 2, 2023
Merged

Conversation

dustinswales
Copy link
Collaborator

The first is the functionality to create SCM cases using standard output from the UFS weather model. The changes contained here are built on-top of https://github.com/grantfirl/ccpp-scm/tree/UFS_forcing_20210203/scm. The dynamic tendencies to drive the SCM are derived in UFS_IC_generator.py. Then, along with the necessary initial conditions, these derived forcing terms are stored in DEPHYv1 format.

@dustinswales
Copy link
Collaborator Author

@grantfirl Documentation added, section 5.5. I think this is ready to go otherwise.

@mkavulich
Copy link
Collaborator

@dustinswales I have taken a brief look at the code but was waiting to test it myself as I see you are still making changes to the CI tests. Do you think this PR is stable enough to start a thorough review?

@dustinswales
Copy link
Collaborator Author

dustinswales commented Apr 13, 2023

@mkavulich Thanks! Yes, it's ready for review.
The CI test is working, well mostly. It does two things. A) Creates a UFS-replay case from staged UWM RT data on the DTC FTP website and then B) Builds and runs SCM with the UFS_replay case. It's failing at the very end of the last step.

Maybe this is all too much anyways? Since what we really need is to be alerted to UWM input/output changes that break the case generation script (we have another CI test that does the full workflow for DEPHY formatted input, which is what comes out of the case generation script). The functionality of this test is only useful if the data from the UWM is somewhat up-to-date.

@dustinswales
Copy link
Collaborator Author

@grantfirl The new CI test to create the UFS-replay cases from staged UWM RT data is working, and passing.

# Get command line arguments
args = parser.parse_args()

if (not args.dir):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be necessary due to the required=True for the dir argument.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I will remove.

# Call UFS_IC_generator.py
case_name = args.case_name +"_n" + str(pt).zfill(3)
file_scminput = "../../data/processed_case_input/"+case_name+"_SCM_driver.nc"
com = "./UFS_IC_generator.py -l " +str(lons[pt]) + " " + str(lats[pt]) + \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this slow? Would it benefit from using multiprocessing, e.g. a solution like the execute function in the run script?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This refers to using the os.system(com) serially, below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's serially slow.
I will revisit this in the future.

Copy link
Collaborator

@grantfirl grantfirl left a comment

Choose a reason for hiding this comment

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

This looks good to me. I'm OK with it merged as-is and any comments addressed later. Thanks for pushing it across the finish line.

#
tend_total[0,:] = stateREGRID["t_lay"][t+1,:] - stateREGRID["t_lay"][t,:]
tend_remap[0,:] = stateREGRID["t_lay"][t,:] - stateNATIVE["t_lay"][t,:]
dtdt_adv[t,:] = (tend_total[0,:] - tend_remap[0,:]) / dtime_sec
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO, this method should be revised in the (near) future. Calculating tendencies this way includes the effect of physics already, which we want the physics in the SCM to represent. I think the "right" way to calculate advective tendencies, if we don't want to rely on having either the non-physics tendency terms or the all-physics tendency terms as "special" diagnostics (which most runs will not save due to space constraints), is to actually use the output winds with neighboring profiles of T, q with the upwind differencing scheme to derive them. I'll go ahead and start an issue so that we don't forget to do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are correct, I think of this as the quick and easier(dirtier) way.
I'm out of my lane when it comes to numerical recipes for computing advection, but it's not clear to me how using neighboring points gets around the implicit physics influence on the state? (I need to learn more)

@dustinswales dustinswales merged commit b89634d into NCAR:main May 2, 2023
@dustinswales dustinswales deleted the feature_ufs_replay branch August 1, 2023 21:23
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.

3 participants