Skip to content

Commit

Permalink
merged d6
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Feb 21, 2024
2 parents 3529627 + 0641a5d commit a8990cf
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 64 deletions.
84 changes: 54 additions & 30 deletions io/post_fv3.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
!> @file
!> @brief Run post on write grid comp.
!> @author Jun Wang @date Jul, 2019

!> @brief Run post on write grid comp.
!>
!> ## Module History
!>
!> Date | Programmer | Modification
!> -----|------------|-------------
!> Jul 2019 | J. Wang | create interface to run inline post for FV3
!> Sep 2020 | J. Dong/J. Wang | create interface to run inline post for FV3-LAM
!> Apr 2021 | R. Sun | Added variables for Thomspon MP
!> Apr 2022 | W. Meng | 1)unify global and regional inline post interfaces
!> Apr 2022 | W. Meng | 2)add bug fix for dx/dy computation
!> Apr 2022 | W. Meng | 3)add reading pwat from FV3
!> Apr 2022 | W. Meng | 4)remove some variable initializations
!> Apr 2022 | W. Meng | 5)read max/min 2m T from tmax_max2m/tmin_min2m for GFS, and from t02max/min for RRFS and HAFS.
!> Apr 2022 | W. Meng | 6)read 3D cloud fraction from cld_amt for GFDL MP, and from cldfra for other MPs.
!> Jun 2022 | J. Meng | 2D decomposition
!> Jul 2022 | W. Meng | 1)output lat/lon of four corner point for rotated lat-lon grid. 2)read instant model top logwave
!>
!> @author Jun Wang @date Jul, 2019
module post_fv3

use mpi
Expand All @@ -10,35 +33,26 @@ module post_fv3

implicit none

public post_run_fv3
public post_run_fv3 !< Interface to run inline post

contains

!> Interface to run inline post.
!>
!> @param[in] wrt_int_state write grid component internal state.
!> @param[in] grid_id id number of the output grid.
!> @param[in] mype MPI rank.
!> @param[in] mpicomp MPI communicator of the write grid component.
!> @param[in] lead_write lead task of the write group.
!> @param[in] itasks number of MPI tasks in i direction of output domain.
!> @param[in] jtasks number of MPI tasks in j direction of output domain.
!> @param[in] mynfhr output forecast hours on the write grid component.
!> @param[in] mynfmin output forecast minutes on the write grid component.
!> @param[in] mynfsec output forecast secondson the write grid component.
!>
!> @author Jun Wang @date Jul, 2019
subroutine post_run_fv3(wrt_int_state,grid_id,mype,mpicomp,lead_write, &
itasks,jtasks,mynfhr,mynfmin,mynfsec)
!
! revision history:
! Jul 2019 J. Wang create interface to run inline post for FV3
! Sep 2020 J. Dong/J. Wang create interface to run inline post for FV3-LAM
! Apr 2021 R. Sun Added variables for Thomspon MP
! Apr 2022 W. Meng 1)unify global and regional inline post interfaces
! 2)add bug fix for dx/dy computation
! 3)add reading pwat from FV3
! 4)remove some variable initializations
! 5)read max/min 2m T from tmax_max2m/tmin_min2m
! for GFS, and from t02max/min for RRFS
! and HAFS.
! 6)read 3D cloud fraction from cld_amt for GFDL MP,
! and from cldfra for other MPs.
! Jun 2022 J. Meng 2D decomposition
! Jul 2022 W. Meng 1)output lat/lon of four corner point for rotated
! lat-lon grid.
! 2)read instant model top logwave
!
!-----------------------------------------------------------------------
!*** run post on write grid comp
!-----------------------------------------------------------------------
!
use ctlblk_mod, only : komax,ifhr,ifmin,modelname,datapd,fld_info, &
npset,grib,jsta, &
jend,ista,iend, im, nsoil, filenameflat,numx
Expand Down Expand Up @@ -215,9 +229,13 @@ subroutine post_run_fv3(wrt_int_state,grid_id,mype,mpicomp,lead_write, &
call post_finalize('grib2')

end subroutine post_run_fv3
!
!-----------------------------------------------------------------------
!

!> Subroutine to get attributes for post processing.
!>
!> @param[in] wrt_int_state write grid component internal state.
!> @param[in] grid_id id number of the output grid.
!>
!> @author Jun Wang @date Jul, 2019
subroutine post_getattr_fv3(wrt_int_state,grid_id)
!
use esmf
Expand Down Expand Up @@ -485,9 +503,15 @@ subroutine post_getattr_fv3(wrt_int_state,grid_id)
enddo !end nfb
!
end subroutine post_getattr_fv3
!
!-----------------------------------------------------------------------
!

!> Subroutine to set post variables.
!>
!> @param[in] wrt_int_state write grid component internal state.
!> @param[in] grid_id id number of the output grid.
!> @param[in] mype MPI rank.
!> @param[in] mpicomp MPI communicator of the write grid component.
!>
!> @author Jun Wang @date Jul 2019
subroutine set_postvars_fv3(wrt_int_state,grid_id,mype,mpicomp)
!
! revision history:
Expand Down
84 changes: 50 additions & 34 deletions io/post_nems_routines.F90
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
!-----------------------------------------------------------------------
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!-----------------------------------------------------------------------
!
subroutine post_alctvars(imi,jmi,lmi,mype,nwtlpes,lead_write, mpicomp, &
jts,jte,jtsgrp,jtegrp,its,ite,itsgrp,itegrp)
!
!
! revision history:
! Jul 2019 Jun Wang: allocate arrays for post processing
! Feb 2022 J. Meng/B. Cui: create interface to run inline post with post_2d_decomp
!
!-----------------------------------------------------------------------
!*** allocate post variables
!-----------------------------------------------------------------------
!
!> @file
!> @brief Miscellaneous subroutines to support inline post.
!> @author Jun Wang @date Oct 8, 2019

!> Allocate post variables.
!>
!> ## Subroutine History
!>
!> Date | Programmer | Modification
!> -----|------------|-------------
!> Jul 2019 | Jun Wang | allocate arrays for post processing
!> Feb 2022 | J. Meng/B. Cui | create interface to run inline post with post_2d_decomp
!>
!> @param[in] imi i dimension size of the output grid.
!> @param[in] jmi j dimension size of the output grid.
!> @param[in] lmi l (layer) dimension size of the output grid.
!> @param[in] mype MPI rank.
!> @param[in] nwtlpes number of write tasks in the write group.
!> @param[in] lead_write lead task of the write group.
!> @param[in] mpicomp MPI communicator of the write grid component.
!> @param[in] jts start index in j dimention in a task subdomain.
!> @param[in] jte end index in j dimention in a task subdomain.
!> @param[in] jtsgrp start index in j dimention of all write tasks.
!> @param[in] jtegrp end index in j dimention of all write tasks.
!> @param[in] its start index in i dimention in a task subdomain.
!> @param[in] ite end index in j dimention in a task subdomain.
!> @param[in] itsgrp start index in i dimention of all write tasks.
!> @param[in] itegrp end idex in i dimention of all write tasks.
!>
!> @author Jun Wang @date Oct 8 2019
subroutine post_alctvars(imi,jmi,lmi,mype,nwtlpes,lead_write, mpicomp, &
jts,jte,jtsgrp,jtegrp,its,ite,itsgrp,itegrp)
use vrbls4d
use vrbls3d
use vrbls2d
Expand Down Expand Up @@ -215,11 +231,18 @@ subroutine post_alctvars(imi,jmi,lmi,mype,nwtlpes,lead_write, mpicomp, &
end do
end do
end subroutine post_alctvars
!
!---------------------------------------------------------------------
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!---------------------------------------------------------------------
!

!> Read post namelist.
!>
!> @param[in] kpo number of pressure levels.
!> @param[in] kth number of isentropic levels.
!> @param[in] kpv number of potential vorticity levels.
!> @param[in] po pressure levels to output.
!> @param[in] th isentropic levels to output.
!> @param[in] pv potential vorticity levels to output.
!> @param[in] post_namelist post namelist array.
!>
!> @author Jun Wang @date Jul 2019
subroutine read_postnmlt(kpo,kth,kpv,po,th,pv,post_namelist)
!
use ctlblk_mod, only : komax,fileNameD3D,lsm,lsmp1,spl,spldef, &
Expand All @@ -228,10 +251,6 @@ subroutine read_postnmlt(kpo,kth,kpv,po,th,pv,post_namelist)
isf_surface_physics,modelname,submodelname,&
rdaod,d2d_chem,nasa_on,gccpp_on
use upp_ifi_mod, only: write_ifi_debug_files
!
! revision history:
! Jul 2019 Jun Wang: read post namelist
!
implicit none
!---
character (len=*), intent(in) :: post_namelist
Expand Down Expand Up @@ -335,16 +354,13 @@ subroutine read_postnmlt(kpo,kth,kpv,po,th,pv,post_namelist)
1000 continue

end subroutine read_postnmlt
!
!---------------------------------------------------------------------
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!---------------------------------------------------------------------
!

!> Finalize post step.
!>
!> @param[in] post_gribversion grib version(1 or 2) used in post.
!>
!> @author Jun Wang @date Jul 2019
subroutine post_finalize(post_gribversion)
!
! revision history:
! Jul 2019 Jun Wang: finalize post step
!
use grib2_module, only : grib_info_finalize
!
character(*),intent(in) :: post_gribversion
Expand Down

0 comments on commit a8990cf

Please sign in to comment.