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

Add new PBL diagnostic variables dkt and dku #607

Merged
merged 26 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
100a646
Cleanup trailing whitespace for some new added/modified source code r…
BinLiu-NOAA Jun 24, 2020
a8265eb
Merge pull request #4 from hafs-community/feature/merge_hwrf_physics
climbfuji Jun 25, 2020
c13b36d
Merge pull request #2 from climbfuji/update_hafs_from_dtc_hwrf_physic…
climbfuji Jun 26, 2020
8f34789
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Jul 2, 2020
53fc0ff
In GFS_rrtmg_pre.F90, separate out the imp_physics == 6 option and le…
BinLiu-NOAA Jul 8, 2020
81b1ba2
Merge remote-tracking branch 'remotes/upstream/master' into feature/s…
BinLiu-NOAA Jul 8, 2020
643ede9
Merge remote-tracking branch 'remotes/upstream/master' into feature/s…
BinLiu-NOAA Jul 8, 2020
a1f0373
Merge branch 'feature/sync_master_20200703' of https://github.com/haf…
BinLiu-NOAA Jul 8, 2020
0a8bd93
Initialize crtlame properly in physics/samfdeepcnv.f.
BinLiu-NOAA Jul 9, 2020
b6dd33b
Merge remote-tracking branch 'remotes/upstream/master' into feature/s…
BinLiu-NOAA Jul 16, 2020
1b400f5
Follow the master branch to change the unit of radians into radian in
BinLiu-NOAA Jul 17, 2020
3a834f9
Merge remote-tracking branch 'upstream/master' into support/HAFS
BinLiu-NOAA Nov 24, 2020
d07d53b
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Dec 12, 2020
2345803
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Jan 7, 2021
746cb5b
Merge commit '13b8889' used by ufs-weather-model as of 20210120 into …
BinLiu-NOAA Jan 21, 2021
c0ac40b
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Feb 2, 2021
048d605
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Feb 16, 2021
97f409e
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Mar 12, 2021
094d39c
Merge remote-tracking branch 'remotes/upstream/master' into support/HAFS
BinLiu-NOAA Mar 31, 2021
6f9c83e
Merge remote-tracking branch 'upstream/master' into support/HAFS
BinLiu-NOAA Apr 1, 2021
9143484
Add dkudiagnostic in moninedmf from Andy Hazelton.
BinLiu-NOAA Apr 2, 2021
2ce81df
Merge remote-tracking branch 'upstream/master' into feature/dkudiagno…
BinLiu-NOAA Apr 16, 2021
8c44643
*Rename dkudiagnostic into dku in moninedmf.f and satmedmfvdifq.F.
BinLiu-NOAA Apr 16, 2021
4c84630
Use unique standard_name for the new added dkt and dku diagnostic var…
BinLiu-NOAA Apr 16, 2021
28c815a
Unify the usage of Diag%dkt and Interstitial%dkt and change the stand…
BinLiu-NOAA Apr 20, 2021
7b7eb85
Merge remote-tracking branch 'remotes/upstream/master' into feature/d…
BinLiu-NOAA Apr 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions physics/moninedmf.f
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ subroutine hedmf_run (im,km,ntrac,ntcw,dv,du,tau,rtg, &
& psk,rbsoil,zorl,u10m,v10m,fm,fh, &
& tsea,heat,evap,stress,spd1,kpbl, &
& prsi,del,prsl,prslk,phii,phil,delt,dspheat, &
& dusfc,dvsfc,dtsfc,dqsfc,hpbl,hgamt,hgamq,dkt, &
& dusfc,dvsfc,dtsfc,dqsfc,hpbl,hgamt,hgamq,dkt,dku, &
& kinver,xkzm_m,xkzm_h,xkzm_s,lprnt,ipr, &
& xkzminv,moninq_fac,hurr_pbl,islimsk,var_ric, &
& coef_ric_l,coef_ric_s,lssav,ldiag3d,qdiag3d,ntoz, &
Expand Down Expand Up @@ -114,7 +114,9 @@ subroutine hedmf_run (im,km,ntrac,ntcw,dv,du,tau,rtg, &
real(kind=kind_phys), intent(out) :: &
& dusfc(im), dvsfc(im), &
& dtsfc(im), dqsfc(im), &
& hpbl(im), dkt(im,km-1)
& hpbl(im)
real(kind=kind_phys), intent(out) :: &
& dkt(im,km-1), dku(im,km-1)
real(kind=kind_phys), intent(inout) :: &
& hgamt(im), hgamq(im)
!
Expand Down Expand Up @@ -148,8 +150,8 @@ subroutine hedmf_run (im,km,ntrac,ntcw,dv,du,tau,rtg, &
& zd(im), zdd(im), thlvx1(im)
!
real(kind=kind_phys) rdzt(im,km-1),dktx(im,km-1), &
& zi(im,km+1), zl(im,km), xkzo(im,km-1), &
& dku(im,km-1), xkzmo(im,km-1), &
& zi(im,km+1), zl(im,km), &
& xkzo(im,km-1), xkzmo(im,km-1), &
& cku(im,km-1), ckt(im,km-1), &
& ti(im,km-1), shr2(im,km-1), &
& al(im,km-1), ad(im,km), &
Expand Down Expand Up @@ -1402,6 +1404,7 @@ subroutine hedmf_run (im,km,ntrac,ntcw,dv,du,tau,rtg, &
!
enddo
enddo
!
! solve tridiagonal problem for momentum
!
Expand Down
13 changes: 12 additions & 1 deletion physics/moninedmf.meta
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,23 @@
intent = inout
optional = F
[dkt]
standard_name = atmosphere_heat_diffusivity
standard_name = atmosphere_heat_diffusivity_from_gfspbl
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove _from_gfspbl here and also for [dku]. Same in physics/satmedmfvdifq.meta and in GFS_typedefs.meta. There is no reason why these variables should be specific to GFS PBL.

Copy link
Collaborator Author

@BinLiu-NOAA BinLiu-NOAA Apr 19, 2021

Choose a reason for hiding this comment

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

@climbfuji We actually were using the names without adding "_from_gfspbl" in the dkt/dku stand_names originally, However, the model build failed due to the complaining that there are duplicated standard names of "atmosphere_heat_diffusivity" in ccpp/data/GFS_typedefs.meta.
As you can see, there is already a dkt under the GFS_interstitial_type section with a standard name of "atmosphere_heat_diffusivity". After looking into it a little more, we saw some examples on how to use different names for the same/similar variables in this GFS_typedefs.meta file, for example:
standard_name = instantaneous_atmosphere_heat_diffusivity
standard_name = atmosphere_heat_diffusivity_background
standard_name = atmosphere_heat_diffusivity_background_maximum
standard_name = atmosphere_heat_diffusivity_from_shoc
standard_name = atmosphere_heat_diffusivity_for_mynnpbl
standard_name = atmosphere_heat_diffusivity
With that, we introduced the
standard_name = atmosphere_heat_diffusivity_from_gfspbl
for dkt (did the same for dku). After that the build worked fine. Agree that, this is not an elegant way and sometime confusing to use different standard_names for the same variable. It would be nice to standardize or unify this from the model and ccpp interface side. Please let us know if you have any comments/suggestions. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@climbfuji We actually were using the names without adding "_from_gfspbl" in the dkt/dku stand_names originally, However, the model build failed due to the complaining that there are duplicated standard names of "atmosphere_heat_diffusivity" in ccpp/data/GFS_typedefs.meta.
As you can see, there is already a dkt under the GFS_interstitial_type section with a standard name of "atmosphere_heat_diffusivity". After looking into it a little more, we saw some examples on how to use different names for the same/similar variables in this GFS_typedefs.meta file, for example:
standard_name = instantaneous_atmosphere_heat_diffusivity
standard_name = atmosphere_heat_diffusivity_background
standard_name = atmosphere_heat_diffusivity_background_maximum
standard_name = atmosphere_heat_diffusivity_from_shoc
standard_name = atmosphere_heat_diffusivity_for_mynnpbl
standard_name = atmosphere_heat_diffusivity
With that, we introduced the
standard_name = atmosphere_heat_diffusivity_from_gfspbl
for dkt (did the same for dku). After that the build worked fine. Agree that, this is not an elegant way and sometime confusing to use different standard_names for the same variable. It would be nice to standardize or unify this from the model and ccpp interface side. Please let us know if you have any comments/suggestions. Thanks!

Oh, I see. Not your fault at all, just terrible precedence. In this case, I suggest to leave the PR as-is, let's clean this up afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, some confusion about what was going on with these similarly-named variables is why I made a new one "dkudiagnostic" for momentum diffusivity, but that's obviously not the best solution memory-wise. Definitely would be good if we can help clean this up in the future hopefully.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@climbfuji, With some further discussions and code digging with @ChunxiZhang-NOAA, it looks like our current solution for diagnostic dkt variable will probably break the the existing interstitial dkt usage in physics/moninedmf.f[meta] and in ccpp/data/GFS_typedefs.F90[meta]. Currently, we were thinking of the following two potential solutions:

  • A. Using dkt_diag and dku_diag (atmosphere_heat_diffusivity_diag and atmosphere_momentum_diffusivity_diag) for the the diagnostic output so that they are not conflict with other usages (interstitial, coupling, etc.);
  • B. Currently only outputting dku (atmosphere_momentum_diffusivity) as a new diagnostic variable (which should not be conflicted with other dku usage at this moment), while dropping off the proposed dkt diagnostic output.

Appreciate it if you could provide any insight/recommendation on how to move forward with this change. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@climbfuji Yes, this is also a good solution. I searched out the usage of "Interstitial%dkt" inside ufs-weather-model. These are the locations the Interstitial%dkt was used:

grep -ir "Interstitial%dkt" *
FV3/ccpp/data/GFS_typedefs.F90: allocate (Interstitial%dkt (IM,Model%levs-1))
FV3/ccpp/data/GFS_typedefs.F90: Interstitial%dkt = clear_val
FV3/ccpp/data/GFS_typedefs.F90: write (0,*) 'sum(Interstitial%dkt ) = ', sum(Interstitial%dkt )
FV3/ccpp/physics/physics/GFS_debug.F90: call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Interstitial%dkt ', Interstitial%dkt )

So, if we move the dkt into the Diag%dkt section. Then the above will be the places need to be replaced by Diag%dkt, right? Of course, in this case the dkt and dku can then use the names of atmosphere_heat_diffusivity and atmosphere_momentum_diffusivity. Do you think this will work? Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think so, yes. The whole point moving it from Interstitial% to Diag% is to make it persistent so that it can be written out. In GFS_debug.F90, it will need to go from module GFS_interstitialtoscreen to GFS_diagtoscreen, but that should be pretty much self-explanatory in the file.

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 @climbfuji! I have just made and pushed the changes into this branch and in the FV3atm side as well. Please help to check/review the changes when you get a chance. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, let's get started with testing this today, your PR will go next after the current LAM post commit.

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. Just synced this branch with the latest master to get it ready for model level RT.

long_name = diffusivity for heat
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension_minus_one)
type = real
kind = kind_phys
intent = out
optional = F
[dku]
standard_name = atmosphere_momentum_diffusivity_from_gfspbl
long_name = diffusivity for momentum
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension_minus_one)
type = real
kind = kind_phys
intent = out
optional = F
[kinver]
standard_name = index_of_highest_temperature_inversion
long_name = index of highest temperature inversion
Expand Down Expand Up @@ -538,6 +547,8 @@
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[lssav]
standard_name = flag_diagnostics
long_name = logical flag for storing diagnostics
Expand Down
8 changes: 5 additions & 3 deletions physics/satmedmfvdifq.F
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntiw,ntke, &
& snwdph_lnd,psk,rbsoil,zorl,u10m,v10m,fm,fh, &
& tsea,heat,evap,stress,spd1,kpbl, &
& prsi,del,prsl,prslk,phii,phil,delt, &
& dspheat,dusfc,dvsfc,dtsfc,dqsfc,hpbl, &
& dspheat,dusfc,dvsfc,dtsfc,dqsfc,hpbl,dkt,dku, &
& kinver,xkzm_m,xkzm_h,xkzm_s,dspfac,bl_upfr,bl_dnfr, &
& ntoz,du3dt,dv3dt,dt3dt,dq3dt,do3dt,gen_tend,ldiag3d,qdiag3d, &
& errmsg,errflg)
Expand Down Expand Up @@ -109,6 +109,8 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntiw,ntke, &
& dusfc(im), dvsfc(im), &
& dtsfc(im), dqsfc(im), &
& hpbl(im)
real(kind=kind_phys), intent(out) :: &
& dkt(im,km-1), dku(im,km-1)
!
logical, intent(in) :: dspheat
character(len=*), intent(out) :: errmsg
Expand All @@ -130,8 +132,7 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntiw,ntke, &
& qlx(im,km), thetae(im,km),thlx(im,km),
& slx(im,km), svx(im,km), qtx(im,km),
& tvx(im,km), pix(im,km), radx(im,km-1),
& dku(im,km-1),dkt(im,km-1), dkq(im,km-1),
& cku(im,km-1),ckt(im,km-1)
& dkq(im,km-1),cku(im,km-1), ckt(im,km-1)
!
real(kind=kind_phys) plyr(im,km), rhly(im,km), cfly(im,km),
& qstl(im,km)
Expand Down Expand Up @@ -1538,6 +1539,7 @@ subroutine satmedmfvdifq_run(im,km,ntrac,ntcw,ntiw,ntke, &
!
enddo
enddo
c
!> - Call tridi2() to solve tridiagonal problem for momentum
c
Expand Down
18 changes: 18 additions & 0 deletions physics/satmedmfvdifq.meta
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,24 @@
kind = kind_phys
intent = out
optional = F
[dkt]
standard_name = atmosphere_heat_diffusivity_from_gfspbl
long_name = diffusivity for heat
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension_minus_one)
type = real
kind = kind_phys
intent = out
optional = F
[dku]
standard_name = atmosphere_momentum_diffusivity_from_gfspbl
long_name = diffusivity for momentum
units = m2 s-1
dimensions = (horizontal_loop_extent,vertical_dimension_minus_one)
type = real
kind = kind_phys
intent = out
optional = F
[kinver]
standard_name = index_of_highest_temperature_inversion
long_name = index of highest temperature inversion
Expand Down