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

Physics separation merge: Step6 #28

Merged
merged 27 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
17c2248
modified: sfc_drv.f
Sep 21, 2017
918d6be
temp update before doxygen work
Oct 24, 2017
d84101f
Merge branch 'master' of https://github.com/NCAR/gmtb-gfsphysics into…
Oct 24, 2017
eaf22f3
fix doxygen for diag and diff
Oct 24, 2017
489a0fa
update sfc_diag sfc_diff doxygen doc
Oct 26, 2017
37c31d8
update sfc_diag.f sfc_diff.f for doxygen
lulinxue Oct 26, 2017
4ae10b0
Update sfc_drv.f
lulinxue Nov 2, 2017
68ee974
Update sfc_diff.f
lulinxue Nov 2, 2017
232af66
Update sfc_diag.f
lulinxue Nov 2, 2017
7a57cd1
Update sfc_diff.f
lulinxue Nov 2, 2017
e62897b
update GFS_physics
lulinxue Nov 5, 2017
d808dd2
temp
lulinxue Nov 6, 2017
40ecc18
Merge branch 'GFS_separate_Noah_LSM_master_gfsphysics' of https://git…
lulinxue Nov 6, 2017
78cdce4
intestital code for lsmnoah_pre
lulinxue Nov 8, 2017
0803a31
add GFS_surface_loop_control.f to include both sfc_diff_post and GFS_…
lulinxue Nov 22, 2017
f3d93c5
update on long name and module structures
lulinxue Nov 30, 2017
eb52704
Merge branch 'master' into GFS_separate_Noah_LSM_master_gfsphysics
lulinxue Nov 30, 2017
b2cce39
fix sfc_drv.f
lulinxue Nov 30, 2017
d23da77
fix GFS_surface_loop bugs and get bfb results
lulinxue Nov 30, 2017
c083a0e
fixed some standard name conflicts in sfc_diff.f and sfc_drv.f
grantfirl Dec 4, 2017
c8f777d
updated standard name for surface wind and updated name of table for …
grantfirl Dec 4, 2017
810436e
fix units in Noah
lulinxue Dec 6, 2017
28ae60e
fix units in Noah
lulinxue Dec 6, 2017
c856358
more unit fixes
lulinxue Dec 6, 2017
1b1d737
Merge branch 'GFS_separate_Noah_LSM_master_gfsphysics' of https://git…
llpcarson Dec 18, 2017
1dfdcd1
Fix a merge-error.
llpcarson Dec 19, 2017
ee89180
Assign a couple more variables in the noah_post_run
llpcarson Dec 20, 2017
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
129 changes: 76 additions & 53 deletions GFS_layer/GFS_physics_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module module_physics_driver
use edmf, only: edmf_run
use GFS_PBL_generic_pre, only: GFS_PBL_generic_pre_run
use GFS_PBL_generic_post, only: GFS_PBL_generic_post_run
! use sasas_deep, only: sasasdeep_run
use GFS_DCNV_generic_pre, only: GFS_DCNV_generic_pre_run
use GFS_DCNV_generic_post, only: GFS_DCNV_generic_post_run
use GFS_SCNV_generic_pre, only: GFS_SCNV_generic_pre_run
Expand All @@ -41,6 +40,15 @@ module module_physics_driver
use GFS_MP_generic_post, only: GFS_MP_generic_post_run
use GFS_MP_generic_pre, only: GFS_MP_generic_pre_run
use GFS_zhao_carr_pre, only: GFS_zhao_carr_pre_run

use lsm_noah
use lsm_noah_pre
use lsm_noah_post
use surface_exchange_coefficients
use surface_diagnose
use GFS_surface_loop_control_part1
use GFS_surface_loop_control_part2

implicit none


Expand Down Expand Up @@ -698,9 +706,9 @@ subroutine GFS_physics_driver &
endif

! --- ... transfer soil moisture and temperature from global to local variables
smsoil(:,:) = Sfcprop%smc(:,:)
! smsoil(:,:) = Sfcprop%smc(:,:)
stsoil(:,:) = Sfcprop%stc(:,:)
slsoil(:,:) = Sfcprop%slc(:,:) !! clu: slc -> slsoil
! slsoil(:,:) = Sfcprop%slc(:,:) !! clu: slc -> slsoil
! dudt(:,:) = 0.
! dvdt(:,:) = 0.
! dtdt(:,:) = 0.
Expand Down Expand Up @@ -881,20 +889,22 @@ subroutine GFS_physics_driver &
tsurf(:) = Sfcprop%tsfc(:)
flag_guess(:) = .false.
flag_iter(:) = .true.
drain(:) = 0.0
! drain(:) = 0.0
ep1d(:) = 0.0
runof(:) = 0.0
! runof(:) = 0.0
!hflx(:) = 0.0
!evap(:) = 0.0
evbs(:) = 0.0
evcw(:) = 0.0
trans(:) = 0.0
sbsno(:) = 0.0
snowc(:) = 0.0
snohf(:) = 0.0
! evbs(:) = 0.0
! evcw(:) = 0.0
! trans(:) = 0.0
! sbsno(:) = 0.0
! snowc(:) = 0.0
! snohf(:) = 0.0
Diag%zlvl(:) = Statein%phil(:,1) * onebg
Diag%smcwlt2(:) = 0.0
Diag%smcref2(:) = 0.0
! Diag%smcwlt2(:) = 0.0
! Diag%smcref2(:) = 0.0
call lsm_noah_pre_run(im,Model%lsoil,smsoil,slsoil,Sfcprop%smc(:,:),Sfcprop%slc(:,:), &
drain,runof,evbs,evcw,trans,sbsno,snowc,snohf,Diag%smcwlt2(:),Diag%smcref2(:))

! --- ... lu: iter-loop over (sfc_diff,sfc_drv,sfc_ocean,sfc_sice)

Expand All @@ -904,22 +914,24 @@ subroutine GFS_physics_driver &
!
! if (lprnt) write(0,*)' tsea=',tsea(ipr),' tsurf=',tsurf(ipr),iter

call sfc_diff (im,Statein%pgr, Statein%ugrs, Statein%vgrs, &
Statein%tgrs, Statein%qgrs, Diag%zlvl, &
! call sfc_diff (im,Statein%pgr, Statein%ugrs, Statein%vgrs, &
call sfc_ex_coef_run(im,Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), &
Statein%tgrs(:,1), Statein%qgrs(:,1,1), Diag%zlvl, &
Sfcprop%snowd, Sfcprop%tsfc, Sfcprop%zorl, cd, &
cdq, rb, Statein%prsl(1,1), work3, islmsk, stress, &
cdq, rb, Statein%prsl(:,1), work3, islmsk, stress, &
Sfcprop%ffmm, Sfcprop%ffhh, Sfcprop%uustar, &
wind, Tbd%phy_f2d(1,Model%num_p2d), fm10, fh2, &
wind, Tbd%phy_f2d(:,Model%num_p2d), fm10, fh2, &
sigmaf, vegtype, Sfcprop%shdmax, Model%ivegsrc, &
tsurf, flag_iter, Model%redrag)

! --- ... lu: update flag_guess

do i = 1, im
if (iter == 1 .and. wind(i) < 2.0) then
flag_guess(i) = .true.
endif
enddo
! do i = 1, im
! if (iter == 1 .and. wind(i) < 2.0) then
! flag_guess(i) = .true.
! endif
! enddo
call GFS_surface_loop_control_part1_run(im,iter,wind,flag_guess)

if (Model%nstf_name(1) > 0) then

Expand Down Expand Up @@ -985,13 +997,14 @@ subroutine GFS_physics_driver &
! if (lprnt) write(0,*)' tsead=',tsea(ipr),' tsurf=',tsurf(ipr),iter
! &,' pgr=',pgr(ipr),' sfcemis=',sfcemis(ipr)

call sfc_drv &
! call sfc_drv &
call lsm_noah_run &
! --- inputs:
(im, Model%lsoil, Statein%pgr, Statein%ugrs, Statein%vgrs, &
Statein%tgrs, Statein%qgrs, soiltyp, vegtype, sigmaf, &
(im, Model%lsoil, Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), &
Statein%tgrs(:,1), Statein%qgrs(:,1,1), soiltyp, vegtype, sigmaf, &
Radtend%semis, gabsbdlw, adjsfcdsw, adjsfcnsw, dtf, &
Sfcprop%tg3, cd, cdq, Statein%prsl(1,1), work3, DIag%zlvl, &
islmsk, Tbd%phy_f2d(1,Model%num_p2d), slopetyp, &
Sfcprop%tg3, cd, cdq, Statein%prsl(:,1), work3, DIag%zlvl, &
islmsk, Tbd%phy_f2d(:,Model%num_p2d), slopetyp, &
Sfcprop%shdmin, Sfcprop%shdmax, Sfcprop%snoalb, &
Radtend%sfalb, flag_iter, flag_guess, Model%isot, &
Model%ivegsrc, &
Expand Down Expand Up @@ -1056,24 +1069,26 @@ subroutine GFS_physics_driver &

! --- ... lu: update flag_iter and flag_guess

do i = 1, im
flag_iter(i) = .false.
flag_guess(i) = .false.

if (iter == 1 .and. wind(i) < 2.0) then
if ((islmsk(i) == 1) .or. ((islmsk(i) == 0) .and. &
(Model%nstf_name(1) > 0))) then
flag_iter(i) = .true.
endif
endif
! do i = 1, im
! flag_iter(i) = .false.
! flag_guess(i) = .false.
!
! if (iter == 1 .and. wind(i) < 2.0) then
! if ((islmsk(i) == 1) .or. ((islmsk(i) == 0) .and. &
! (Model%nstf_name(1) > 0))) then
! flag_iter(i) = .true.
! endif
! endif

! if(islmsk(i) == 1 .and. iter == 1) then
! if (wind(i) < 2.0) flag_iter(i) = .true.
! elseif (islmsk(i) == 0 .and. iter == 1 &
! & .and. nstf_name(1) > 0) then
! if (wind(i) < 2.0) flag_iter(i) = .true.
! endif
enddo
! enddo
call GFS_surface_loop_control_part2_run(im,iter,wind,flag_guess,&
flag_iter,islmsk,Model%nstf_name(1))

enddo ! end iter_loop

Expand All @@ -1090,9 +1105,10 @@ subroutine GFS_physics_driver &

! --- ... update near surface fields

call sfc_diag (im, Statein%pgr, Statein%ugrs, Statein%vgrs, &
Statein%tgrs, Statein%qgrs, Sfcprop%tsfc, qss, &
Sfcprop%f10m, Diag%u10m, Diag%v10m, &
! call sfc_diag (im, Statein%pgr, Statein%ugrs, Statein%vgrs, &
call sfc_diag_run(im, Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), &
Statein%tgrs(:,1), Statein%qgrs(:,1,1), Sfcprop%tsfc, qss, &
Sfcprop%f10m, Diag%u10m, Diag%v10m, &
Sfcprop%t2m, Sfcprop%q2m, work3, evap, &
Sfcprop%ffmm, Sfcprop%ffhh, fm10, fh2)

Expand Down Expand Up @@ -2678,11 +2694,16 @@ subroutine GFS_physics_driver &
!!! this change allows gocart to use filtered wind fields
!!!
if (Model%lgocart) then
call sfc_diag (im, Statein%pgr, Stateout%gu0, Stateout%gv0, &
Stateout%gt0, Stateout%gq0, Sfcprop%tsfc, qss, &
Sfcprop%f10m, Diag%u10m, Diag%v10m, Sfcprop%t2m, &
Sfcprop%q2m, work3, evap, Sfcprop%ffmm, &
Sfcprop%ffhh, fm10, fh2)
! call sfc_diag (im, Statein%pgr, Stateout%gu0, Stateout%gv0, &
! Stateout%gt0, Stateout%gq0, Sfcprop%tsfc, qss, &
! Sfcprop%f10m, Diag%u10m, Diag%v10m, Sfcprop%t2m, &
! Sfcprop%q2m, work3, evap, Sfcprop%ffmm, &
! Sfcprop%ffhh, fm10, fh2)
call sfc_diag_run(im, Statein%pgr, Statein%ugrs(:,1), Statein%vgrs(:,1), &
Statein%tgrs(:,1), Statein%qgrs(:,1,1), Sfcprop%tsfc, qss, &
Sfcprop%f10m, Diag%u10m, Diag%v10m, &
Sfcprop%t2m, Sfcprop%q2m, work3, evap, &
Sfcprop%ffmm, Sfcprop%ffhh, fm10, fh2)

if (Model%lssav) then
Diag%tmpmax (:) = max(Diag%tmpmax (:),Sfcprop%t2m(:))
Expand All @@ -2694,11 +2715,13 @@ subroutine GFS_physics_driver &

! --- ... total runoff is composed of drainage into water table and
! runoff at the surface and is accumulated in unit of meters
if (Model%lssav) then
tem = dtf * 0.001
Diag%runoff(:) = Diag%runoff(:) + (drain(:)+runof(:)) * tem
Diag%srunoff(:) = Diag%srunoff(:) + runof(:) * tem
endif
! if (Model%lssav) then
! tem = dtf * 0.001
! Diag%runoff(:) = Diag%runoff(:) + (drain(:)+runof(:)) * tem
! Diag%srunoff(:) = Diag%srunoff(:) + runof(:) * tem
! endif
call lsm_noah_post_run(im,Model%lsoil,smsoil,slsoil,Sfcprop%smc(:,:),Sfcprop%slc(:,:), &
Model%lssav,dtf,drain,runof,Diag%runoff(:),Diag%srunoff(:))

! --- ... xw: return updated ice thickness & concentration to global array
do i = 1, im
Expand All @@ -2714,9 +2737,9 @@ subroutine GFS_physics_driver &
enddo

! --- ... return updated smsoil and stsoil to global arrays
Sfcprop%smc(:,:) = smsoil(:,:)
! Sfcprop%smc(:,:) = smsoil(:,:)
Sfcprop%stc(:,:) = stsoil(:,:)
Sfcprop%slc(:,:) = slsoil(:,:)
! Sfcprop%slc(:,:) = slsoil(:,:)

! --- ... calculate column precipitable water "pwat"
! Diag%pwat(:) = 0.0
Expand Down
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ SRCS_f = \
./physics/sascnv.f \
./physics/sascnvn.f \
./physics/set_soilveg.f \
./physics/GFS_surface_loop_control.f \
./physics/sfc_cice.f \
./physics/sfc_diag.f \
./physics/sfc_diff.f \
Expand Down
121 changes: 121 additions & 0 deletions physics/GFS_surface_loop_control.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
!> \file GFS_surface_loop_control.f
!! This file contains the GFS_surface_loop_control scheme.

!> \defgroup GFS_surface_loop_control GFS_surface_loop_control scheme
!! @{
!! \brief Brief description of the parameterization
!! \section diagram Calling Hierarchy Diagram
!! \section intraphysics Intraphysics Communication

module GFS_surface_loop_control_part1
contains

subroutine GFS_surface_loop_control_part1_init
end subroutine GFS_surface_loop_control_part1_init

subroutine GFS_surface_loop_control_part1_finalize
end subroutine GFS_surface_loop_control_part1_finalize

!> \brief Brief description of the subroutine
!!
!! \section arg_table_GFS_surface_loop_control_part1_run Arguments
!!| local var name | longname | description | units | rank | type | kind | intent | optional |
!!|----------------|-------------------------------------------------------------|--------------------------------------------|------------|------|---------|-----------|--------|----------|
!!| im | horizontal_loop_extent | horizontal loop extent, start at 1 | index | 0 | integer | | in | F |
!!| iter | iteration_number | number of iteration | index | 0 | real | kind_phys | in | F |
!!| wind | wind_speed_at_lowest_model_layer | wind speed at lowest model level | m s-1 | 1 | real | kind_phys | in | F |
!!| flag_guess | flag_for_guess_run | flag for guess run | flag | 1 | logical | | inout | F |
!!
!! \section general General Algorithm
!! \section detailed Detailed Algorithm
!! @{

subroutine GFS_surface_loop_control_part1_run &
& ( im,iter,wind,flag_guess
& )

use machine, only: kind_phys

! --- interface variables
integer, intent(in) :: im, iter
real(kind=kind_phys), dimension(im), intent(in) :: &
& wind
logical, dimension(im), intent(inout) :: &
& flag_guess

do i = 1, im
if (iter == 1 .and. wind(i) < 2.0) then
flag_guess(i) = .true.
endif
enddo

end subroutine GFS_surface_loop_control_part1_run
!> @}
end module GFS_surface_loop_control_part1
!> @}

!> \defgroup GFS_surface_loop_control GFS_surface_loop_control scheme
!! @{
!! \brief Brief description of the parameterization
!! \section diagram Calling Hierarchy Diagram
!! \section intraphysics Intraphysics Communication

module GFS_surface_loop_control_part2
contains

subroutine GFS_surface_loop_control_part2_init
end subroutine GFS_surface_loop_control_part2_init

subroutine GFS_surface_loop_control_part2_finalize
end subroutine GFS_surface_loop_control_part2_finalize

!> \brief Brief description of the subroutine
!!
!! \section arg_table_GFS_surface_loop_control_part2_run Arguments
!!| local var name | longname | description | units | rank | type | kind | intent | optional |
!!|----------------|-------------------------------------------------------------|--------------------------------------------|------------|------|---------|-----------|--------|----------|
!!| im | horizontal_loop_extent | horizontal loop extent, start at 1 | index | 0 | integer | | in | F |
!!| iter | iteration_number | number of iteration | index | 0 | real | kind_phys | in | F |
!!| wind | wind_speed_at_lowest_model_layer | wind speed at lowest model level | m s-1 | 1 | real | kind_phys | in | F |
!!| flag_guess | flag_for_guess_run | flag for guess run | flag | 1 | logical | | inout | F |
!!| flag_iter | flag_for_iteration | flag for iteration | flag | 1 | logical | | in | F |
!!| islmsk | sea_land_ice_mask | landmask: sea/land/ice=0/1/2 | flag | 1 | integer | | in | F |
!!| nstf_name1 | flag_for_nsstm_run | NSSTM flag: off/uncoupled/coupled=0/1/2 | flag | 0 | integer | | in | F |
!!
!! \section general General Algorithm
!! \section detailed Detailed Algorithm
!! @{

subroutine GFS_surface_loop_control_part2_run $
$ (im,iter,wind,flag_guess,flag_iter,islmsk,nstf_name1
$ )

use machine, only: kind_phys

! --- interface variables
integer, intent(in) :: im, iter, nstf_name1
integer, dimension(im), intent(in) :: islmsk
! integer, dimension(im) :: islmsk
real(kind=kind_phys), dimension(im), intent(in) :: &
& wind
logical, dimension(im), intent(inout) :: &
& flag_guess,flag_iter

do i = 1, im
flag_iter(i) = .false.
flag_guess(i) = .false.

if (iter == 1 .and. wind(i) < 2.0) then
if ((islmsk(i) == 1) .or. ((islmsk(i) == 0) .and. &
& (nstf_name1 > 0))) then
flag_iter(i) = .true.
endif
endif

enddo

end subroutine GFS_surface_loop_control_part2_run
!> @}

end module GFS_surface_loop_control_part2
!> @}
Loading