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

gmtb/develop: address physics issue 300 and coupled code with bugfix #308

Conversation

climbfuji
Copy link
Collaborator

@climbfuji climbfuji commented Aug 28, 2019

This PR combines PRs address issue 300 (#302) from @grantfirl and add capability to run in coupled configuration (#299) from @panll, with bugfixes from @climbfuji for PR #299.

See https://github.com/NCAR/FV3/pull/195 for regression testing information.

linlin-pan and others added 10 commits August 15, 2019 09:05
…he code for RUC LSM); change units of soil moisture content and runoff variables to kg m-2 (CCPP metadata had been in error and they only were in kg m-2 after a conversion in GFS_diagnostics.F90); should be merged with removal of conversion factor in GFS_diagnostics.F90 in FV3 repo
modified according to Dom's comments
passed regression test.
modified sfc_cice.f
@climbfuji
Copy link
Collaborator Author

climbfuji commented Aug 28, 2019

@climbfuji climbfuji marked this pull request as ready for review August 28, 2019 19:36
@@ -263,28 +261,19 @@ subroutine sfc_sice_run &
errflg = 0

if(cplflx)then
write(*,*)'Fatal error: CCPP is not ready for cplflx=true!!'
write(*,*)'Fatal error: CCPP not been tested with cplflx=true!'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need this here after this PR? Until the NEMSCompset changes are made to work with CCPP?

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, we agreed to keep this in here until we have actually tested it on our end in a coupled configuration.

endif
enddo
endif
if (cplflx) then
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this syntax. It makes sense to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! Very pythonic and easily readable.

hice_cice(i) = hice(i)
if(flag_cice(i)) tsfc(i) = fice_cice(i)*tisfc_cice(i) + (1. - fice_cice(i))*tsea_cice(i)
enddo
else
Copy link
Collaborator

Choose a reason for hiding this comment

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

flag_cice is already set to F in interstitial_phys_reset, so this isn't necessary, although it doesn't hurt.

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. Same for line 266 just above. I can remove lines 265-266 and lines 279-281 if you prefer (I'll repeat a small set of tests, e.g. rt_ccpp_gsd in verify mode).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed those lines

!! | q1 | water_vapor_specific_humidity_at_lowest_model_layer_for_diag | layer 1 specific humidity for diag | kg kg-1 | 1 | real | kind_phys | in | F |
!! | prsl | air_pressure | mean layer pressure | Pa | 2 | real | kind_phys | in | F |
!! | hflx | kinematic_surface_upward_sensible_heat_flux | kinematic surface upward sensible heat flux | K m s-1 | 1 | real | kind_phys | in | F |
!! | ushfsfci | instantaneous_upward_sensible_heat_flux | instantaneous upward sensible heat flux | W m-2 | 1 | real | kind_phys | out | F |
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is very close to the other standard name 'instantaneous_surface_upward_sensible_heat_flux'. Other variables in the Coupling DDT that have similar names (or represent the same physical quantities) as those in other DDTs have been distinguished by appending "for_coupling" to the end. So, maybe consider "instantaneous_surface_upward_sensible_heat_flux_for_coupling" for a standard name (also change in GFS_typedefs metadata).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But dtsfci_cpl already has the standard name instantaneous_surface_upward_sensible_heat_flux_for_coupling (also present in the same metadata table)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What shall we do with this? Keep the "dangerous" name or decorate with something else?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if you can hear my sigh through the internet. :)

So many variables for the same thing with tiny nuances. In this instance, I cannot tell at first glance the difference between dtsfci_cpl and ushfsfci. Different sign? Looks like ushfsfci is only used for chemistry coupling. Could we add "for_chemistry_coupling" instead?

It would be really nice to have a written procedure for 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.

Ok I will do this. You should be glad that you can't hear my cursing through the internet!

tem = prsl(i,1) / (rd*t1(i)*(1.0+fvirt*tem1))
ushfsfci(i) = -cp * tem * hflx(i) ! upward sensible heat flux
enddo
!! Coupling%dkt (:,:) = dkt (:,:)
Copy link
Collaborator

@grantfirl grantfirl Aug 28, 2019

Choose a reason for hiding this comment

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

How can we get away with not setting this? dkt is an interstitial and is reset every time step, whereas Coupling%dkt is not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would ask the original author as to why. But noting that Interstitial%dkt has dimensions (IM,Model%levs-1), while Coupling%dkt has (IM,Model%levs). Hence, we'd have to make this line

dkt_cpl(1:im,1:levs-1) = dkt(1:im,1:levs-1)

I can make this change as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made this change.

Copy link
Collaborator

@grantfirl grantfirl Aug 28, 2019

Choose a reason for hiding this comment

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

Maybe we can only get away with it because cplchm has not been turned on? @panll

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Already done.

dvsfc_cice(i) = dvsfcin_cpl(i)
dtsfc_cice(i) = dtsfcin_cpl(i)
dqsfc_cice(i) = dqsfcin_cpl(i)
tisfc_cice(i) = tisfc(i)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the equivalent of lines 273-276 in GFS_physics_driver.F90 anymore. Are they still needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed them, can't find any reference to this code in GFS_physics_driver.F90 either.

… no longer in GFS_physics_driver.F90, remove redundant assignment of default values for flag_cice
…t_flux to instantaneous_surface_upward_sensible_heat_flux_for_chemistry_coupling
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.

Looks good to me now after @climbfuji's changes. Thanks @climbfuji and @panll

@climbfuji
Copy link
Collaborator Author

Looks good to me now after @climbfuji's changes. Thanks @climbfuji and @panll

Thanks. I will rerun the rt_ccpp_gsd.conf verify-mode tests and the rt_ccpp_gmtb.conf verify-mode tests. This should be sufficient evidence that the code still gives the same answer.

@climbfuji climbfuji merged commit d858b98 into NCAR:gmtb/develop Aug 30, 2019
@climbfuji climbfuji deleted the github_gmtb_develop_address_physics_issue_300_and_coupled_code_with_bugfix branch June 27, 2022 03:14
hannahcbarnes pushed a commit to hannahcbarnes/ccpp-physics that referenced this pull request Aug 3, 2022
Features:
- Implemented sharing of atmospheric tracer metadata (name, units) to coupled model component via a standard NUOPC connector if coupling tracer field is accessed by shared memory reference
- Introduced additional metadata to tracer records in field_table to identify and validate prognostic and diagnostic chemistry tracers. A new record line starting with the `tracer_usage` keyword is now required to recognize chemistry tracer as follows:

      "tracer_usage", "chemistry"                    (default, prognostic)
      "tracer_usage", "chemistry", "type=diagnostic" (diagnostic)

- Added sanity check for input chemistry tracers, ensuring that both prognostic and diagnostic tracers in field_table are contiguous, and diagnostic tracers follow prognostic ones.
- Improved algorithm to set aerosol scavenging factors
- Exported instantaneous fields for:
   - 3D non-convective liquid and ice precipitation fluxes
   - 3D cloud fraction
   - normalized soil wetness
   -  ice fraction (as used in the atmospheric model)
   - lake fraction
   - ocean fraction
   - surface snow area fraction
- Enabled import of diagnostic tracers

Fixes:
- Prevent a divide by zero error when constant arrays are rescaled for lossy compression in `write_netcdf_parallel()`
- Correctly sample and compute elapsed time for field bundle regridding operations.
- Include hotfix (see PR NCAR#308) to allow latest `setup_exportdata()` to work with coupled chemistry.

Co-authored-by: Dom Heinzeller <[email protected]>
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.

4 participants