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

Code update for HR4_roughness, background diffusivity and shallow convection #119

Merged
merged 56 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c18c6d4
CCPP scheme simulator.
Jan 30, 2023
f9abb73
Fix file rename typo
Jan 30, 2023
ef0d369
Added MPI commands to ccpp_scheme_simulator
Jan 31, 2023
fd72b35
Work in progress...
Feb 3, 2023
ffd26ab
Some changes
Feb 6, 2023
112ac89
Some small cleanup
Feb 7, 2023
6a4c4b1
More OO changes. Will split into load_data and ccpp_scheme components…
Feb 9, 2023
be4cc2e
More OO changes
Feb 10, 2023
7001ef9
Split scheme into load and simulator components.
Feb 13, 2023
8bc8ec9
Small bug fix to nml
Feb 13, 2023
6db4af5
Remove dimension for tracer, handle tracers individualy, not with sta…
Feb 13, 2023
147cbac
Fixed bug in interpolation routine.
Feb 14, 2023
a296389
Moew changes
Feb 17, 2023
e49f1f6
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into ccpp…
Apr 5, 2023
a3933a5
CCPP scheme simulator
May 4, 2023
833b990
Merge branch 'ufs/dev-gf' into ufs-dev-PR64
grantfirl May 4, 2023
3ba2924
Merge branch 'main' into ufs-dev-PR64
grantfirl May 8, 2023
6e53907
Merge commit 'd474c2' into ufs-dev-PR26
grantfirl May 9, 2023
2515b27
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into HEAD
May 30, 2023
5d49f79
Reorganization of scheme simulator. Now stateless.
Jun 1, 2023
d8a5b1f
Merge pull request #1015 from grantfirl/ufs-dev-PR64
grantfirl Jun 13, 2023
6f12331
Merge branch 'main' into ufs-dev-PR26
grantfirl Jun 13, 2023
4d69108
fix bug in scm_sfc_flux_spec.F90
grantfirl Jun 14, 2023
6cfaad5
Merge branch 'update_HR2' into ufs-dev-PR65
grantfirl Jun 26, 2023
93e0c8d
Merge commit '81e3f5e36' into ufs-dev-PR71
grantfirl Jun 26, 2023
bc94a0f
Merge remote-tracking branch 'joe-fork/mynn_snowfix' into ufs-dev-PR71
grantfirl Jun 26, 2023
92c8a9e
Merge pull request #1016 from grantfirl/ufs-dev-PR26
grantfirl Jun 29, 2023
c5566ab
Merge branch 'main' into ufs-dev-PR65
grantfirl Jun 29, 2023
ce731f2
Merge branch 'main' into ufs-dev-PR71
grantfirl Jun 29, 2023
12d4fc2
Working as expected!
Jul 7, 2023
6ceffe3
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into HEAD
Jul 7, 2023
9b77c4e
Merge pull request #1020 from grantfirl/ufs-dev-PR65
grantfirl Jul 7, 2023
9465b6f
Housekeeping
Jul 11, 2023
c61a2a6
GNU bug found in SCM CI
Jul 13, 2023
8e5646e
Some cleanup.
Jul 18, 2023
7e8cd3a
Merge branch 'main' into ufs-dev-PR71
grantfirl Jul 19, 2023
e3c00d3
Renamed scheme simulator suite simulator
Jul 19, 2023
2d6d44c
Omission from previous commit
Jul 19, 2023
5ab1a5b
Add ability to use constant forcing data when one-dimensional data is…
Jul 19, 2023
07a25fe
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into HEAD
Aug 1, 2023
215ba6d
Merge pull request #996 from dustinswales/ccpp_scheme_sim
dustinswales Aug 1, 2023
1e7542a
Merge branch 'main' into ufs-dev-PR71
grantfirl Aug 3, 2023
fa96015
Merge pull request #1021 from grantfirl/ufs-dev-PR71
grantfirl Aug 3, 2023
4e45989
Code update for HR4_roughness
Qingfu-Liu Oct 16, 2023
3debf89
Code update for HR4_roughness
Qingfu-Liu Oct 16, 2023
c2b1301
Code update for HR4_roughness
Qingfu-Liu Oct 16, 2023
2fc24ca
Merge remote-tracking branch 'upstream/ufs/dev' into HR4_roughness
Qingfu-Liu Nov 28, 2023
91da6a0
Merge https://github.com/Qingfu-Liu/ccpp-physics into HR4_roughness
Qingfu-Liu Nov 28, 2023
562377c
remove files from old version
Qingfu-Liu Nov 28, 2023
12cd9c6
update files satmedmfvdifq.F samfshalcnv.f sfc_diff.f
Qingfu-Liu Nov 28, 2023
225848c
Merge remote-tracking branch 'upstream/ufs/dev' into HR4_roughness
Qingfu-Liu Dec 1, 2023
d65507a
Fix CI 2
Qingfu-Liu Dec 14, 2023
fa9931a
Merge remote-tracking branch 'upstream/ufs/dev' into HR4_roughness
Qingfu-Liu Jan 10, 2024
26ecb3d
Merge remote-tracking branch 'upstream/ufs/dev' into HR4_roughness
Qingfu-Liu Jan 16, 2024
97e3b1c
update surface physics z0 from waves
Qingfu-Liu Jan 18, 2024
327fbaa
Merge remote-tracking branch 'upstream/ufs/dev' into HR4_roughness
Qingfu-Liu Jan 26, 2024
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
Prev Previous commit
Next Next commit
Some small cleanup
  • Loading branch information
dustinswales committed Feb 7, 2023
commit 112ac895f62c3d4034dac67ec73b0d126b78098f
103 changes: 39 additions & 64 deletions physics/ccpp_scheme_simulator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ module ccpp_scheme_simulator
! Data driven physics tendencies
integer :: nlev_data, ntime_data
real(kind_phys), allocatable, dimension(:) :: time_data
real(kind_phys), allocatable, dimension(:,:),target :: dTdt_LWRAD_data, dTdt_SWRAD_data, &
dTdt_PBL_data, dudt_PBL_data, dvdt_PBL_data, dTdt_GWD_data, dudt_GWD_data, &
dvdt_GWD_data, dTdt_SCNV_data, dudt_SCNV_data, dvdt_SCNV_data, dTdt_DCNV_data, &
dudt_DCNV_data, dvdt_DCNV_data, dTdt_cldMP_data
real(kind_phys), allocatable, dimension(:,:,:),target :: dqdt_PBL_data, dqdt_SCNV_data, &
dqdt_DCNV_data, dqdt_cldMP_data

! Host-model initial time information
integer :: init_year, init_month, init_day, init_hour, init_min, init_sec
real(kind_phys), allocatable, dimension(:,:), target :: dTdt_LWRAD_data, &
dTdt_SWRAD_data, dTdt_PBL_data, dudt_PBL_data, dvdt_PBL_data, dTdt_GWD_data, &
dudt_GWD_data, dvdt_GWD_data, dTdt_SCNV_data, dudt_SCNV_data, dvdt_SCNV_data, &
dTdt_DCNV_data, dudt_DCNV_data, dvdt_DCNV_data, dTdt_cldMP_data
real(kind_phys), allocatable, dimension(:,:,:), target :: dqdt_PBL_data, &
dqdt_SCNV_data, dqdt_DCNV_data, dqdt_cldMP_data

public ccpp_scheme_simulator_init, ccpp_scheme_simulator_run
contains
Expand All @@ -138,12 +135,11 @@ module ccpp_scheme_simulator
!! \htmlinclude ccpp_scheme_simulator_init.html
!!
subroutine ccpp_scheme_simulator_init(mpirank, mpiroot, mpicomm, nlunit, nml_file, &
idat, errmsg, errflg)
errmsg, errflg)

! Inputs
integer, intent (in) :: mpirank, mpiroot, mpicomm, nlunit
character(len=*), intent (in) :: nml_file
integer, intent (in), dimension(8) :: idat

! Outputs
character(len=*), intent(out) :: errmsg
Expand All @@ -168,14 +164,6 @@ subroutine ccpp_scheme_simulator_init(mpirank, mpiroot, mpicomm, nlunit, nml_fil
errmsg = ''
errflg = 0

! Store model initialization time.
init_year = idat(1)
init_month = idat(2)
init_day = idat(3)
init_hour = idat(5)
init_min = idat(6)
init_sec = idat(7)

! ######################################################################################
!
! Read in namelist
Expand Down Expand Up @@ -592,10 +580,12 @@ subroutine ccpp_scheme_simulator_init(mpirank, mpiroot, mpicomm, nlunit, nml_fil
print*, "---------------------------------"
print*, " "
do iprc = 1,nPhysProcess
print*,"Process : ", trim(physics_process(iprc)%name)
print*," order : ", physics_process(iprc)%order
print*," use_sim : ", physics_process(iprc)%use_sim
print*," time_split : ", physics_process(iprc)%time_split
if (physics_process(iprc)%use_sim) then
print*,"Process : ", trim(physics_process(iprc)%name)
print*," order : ", physics_process(iprc)%order
print*," use_sim : ", physics_process(iprc)%use_sim
print*," time_split : ", physics_process(iprc)%time_split
endif
enddo
print*, "---------------------------------"
endif
Expand Down Expand Up @@ -662,7 +652,7 @@ subroutine ccpp_scheme_simulator_run(kdt, dtp, jdat, tgrs, ugrs, vgrs, qgrs, dti
nTrc = size(gq0(1,1,:))

! Allocate temporaries
allocate(gt1(nCol,nLay), gu1(nCol,nLay), gv1(nCol,nLay), gq1(nCol,nLay,1)) ! *only specific humidity to start (ntrc=1).
allocate(gt1(nCol,nLay), gu1(nCol,nLay), gv1(nCol,nLay), gq1(nCol,nLay,1))
allocate(dTdt(nCol,nLay), dudt(nCol,nLay), dvdt(nCol,nLay), dqdt(nCol,nLay,1))
allocate(dT(nLay), du(nLay), dv(nLay), dq(nLay))

Expand All @@ -675,6 +665,8 @@ subroutine ccpp_scheme_simulator_run(kdt, dtp, jdat, tgrs, ugrs, vgrs, qgrs, dti
dudt(:,:) = 0.
dvdt(:,:) = 0.
dqdt(:,:,1)= 0.

! Model internal physics timestep evolution of "state".
do iprc = 1,nPhysProcess
do iCol = 1,nCol
!
Expand All @@ -685,31 +677,21 @@ subroutine ccpp_scheme_simulator_run(kdt, dtp, jdat, tgrs, ugrs, vgrs, qgrs, dti

! Using scheme simulator
if (physics_process(iprc)%use_sim) then
print*,"Using CCPP scheme simulator for ",trim(physics_process(iprc)%name)

! Temperature
if (associated(physics_process(iprc)%tend%T)) then
call interp_data_tend("T", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dT)
call linterp_data_tend("T", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dT)
endif

! Zonal-wind
if (associated(physics_process(iprc)%tend%u)) then
call interp_data_tend("u", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, du)
call linterp_data_tend("u", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, du)
endif

! Meridional-wind
if (associated(physics_process(iprc)%tend%v)) then
call interp_data_tend("v", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dv)
call linterp_data_tend("v", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dv)
endif

! Specific-humidity
if (associated(physics_process(iprc)%tend%q)) then
call interp_data_tend("q", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dq)
call linterp_data_tend("q", physics_process(iprc)%name, iprc, fcst_year, fcst_month, fcst_day, fcst_hour, fcst_min, fcst_sec, dq)
endif

! Using data tendency from "active" scheme(s).
else
print*,"ACTIVE PHYSICS SCHEME: ",trim(physics_process(iprc)%name)
if (physics_process(iprc)%name == "LWRAD") index_of_process = index_of_process_longwave
if (physics_process(iprc)%name == "SWRAD") index_of_process = index_of_process_shortwave
if (physics_process(iprc)%name == "PBL") index_of_process = index_of_process_pbl
Expand All @@ -730,7 +712,7 @@ subroutine ccpp_scheme_simulator_run(kdt, dtp, jdat, tgrs, ugrs, vgrs, qgrs, dti
idtend = dtidx(100+ntqv,index_of_process)
if (idtend >= 1) dq = dtend(iCol,:,idtend)/dtp
endif

! Update state now?
if (physics_process(iprc)%time_split) then
gt1(iCol,:) = gt1(iCol,:) + (dTdt(iCol,:) + dT)*dtp
Expand All @@ -754,22 +736,17 @@ subroutine ccpp_scheme_simulator_run(kdt, dtp, jdat, tgrs, ugrs, vgrs, qgrs, dti
gu0(iCol,:) = gu1(iCol,:) + dudt(iCol,:)*dtp
gv0(iCol,:) = gv1(iCol,:) + dvdt(iCol,:)*dtp
gq0(iCol,:,1) = gq1(iCol,:,1) + dqdt(iCol,:,1)*dtp
enddo
!

do iCol=1,size(gq0(:,1,1))
do iLay=1,size(gq0(1,:,1))
write(*,'(i5,4f8.3)') iLay,tgrs(iCol,iLay),gt0(iCol,iLay),gt1(iCol,iLay),gt0(iCol,iLay)-gt1(iCol,iLay)
enddo
enddo

!
end subroutine ccpp_scheme_simulator_run

! ####################################################################################
! Utility functions/routines
! ####################################################################################
subroutine interp_data_tend(var_name, process_name, iprc, year, month, day, hour, minute, &
second, var_out)
! The routine interpolates the data-tendencies
subroutine linterp_data_tend(var_name, process_name, iprc, year, month, day, hour, &
minute, second, var_out)
! Inputs
character(len=*), intent(in) :: var_name, process_name
integer, intent(in) :: year, month, day, hour, minute, second, iprc
Expand All @@ -781,28 +758,26 @@ subroutine interp_data_tend(var_name, process_name, iprc, year, month, day, hour
integer :: ti(1), tf(1)
real(kind_phys) :: w1, w2, hrofday

! Linear interpolation weights
hrofday = hour*3600. + minute*60. + second
ti = findloc(abs(time_data-hrofday),minval(abs(time_data-hrofday)))
if (hrofday - time_data(ti(1)) .le. 0) ti = ti-1
tf = ti + 1
w1 = (time_data(tf(1))-hrofday) / (time_data(tf(1)) - time_data(ti(1)))
w2 = 1 - w1

if (var_name == "T") then
var_out = w1*physics_process(iprc)%tend%T(:,ti(1)) + w2*physics_process(iprc)%tend%T(:,tf(1))
endif

if (var_name == "u") then
var_out = w1*physics_process(iprc)%tend%u(:,ti(1)) + w2*physics_process(iprc)%tend%u(:,tf(1))
endif

if (var_name == "v") then
var_out = w1*physics_process(iprc)%tend%v(:,ti(1)) + w2*physics_process(iprc)%tend%v(:,tf(1))
endif

if (var_name == "q") then
var_out = w1*physics_process(iprc)%tend%q(:,ti(1),1) + w2*physics_process(iprc)%tend%q(:,tf(1),1)
endif
end subroutine interp_data_tend
!
select case(var_name)
case("T")
var_out = w1*physics_process(iprc)%tend%T(:,ti(1)) + w2*physics_process(iprc)%tend%T(:,tf(1))
case("u")
var_out = w1*physics_process(iprc)%tend%u(:,ti(1)) + w2*physics_process(iprc)%tend%u(:,tf(1))
case("v")
var_out = w1*physics_process(iprc)%tend%v(:,ti(1)) + w2*physics_process(iprc)%tend%v(:,tf(1))
case("q")
var_out = w1*physics_process(iprc)%tend%q(:,ti(1),1) + w2*physics_process(iprc)%tend%q(:,tf(1),1)
end select

end subroutine linterp_data_tend

end module ccpp_scheme_simulator
7 changes: 0 additions & 7 deletions physics/ccpp_scheme_simulator.meta
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
type = character
kind = len=*
intent = in
[idat]
standard_name = date_and_time_at_model_initialization_in_iso_order
long_name = initialization date and time
units = none
dimensions = (8)
type = integer
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down