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

Master test #17

Merged
merged 9 commits into from
Feb 21, 2020
10 changes: 5 additions & 5 deletions GFDL_tools/fv_ada_nudge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ module fv_ada_nudge_mod

real(kind=R_GRID), parameter :: radius = cnst_radius

character(len=*), parameter :: VERSION =&
& '$Id$'
character(len=*), parameter :: TAGNAME =&
& '$Name$'
! version number of this module
! Include variable "version" to be written to log file.
#include<file_version.h>

logical :: do_adiabatic_init

public fv_ada_nudge, fv_ada_nudge_init, fv_ada_nudge_end, breed_slp_inline_ada
Expand Down Expand Up @@ -1536,7 +1536,7 @@ subroutine fv_ada_nudge_init(time, axes, npz, zvir, ak, bk, ts, phis, gridstruct
10 call close_file ( unit )
end if
#endif
call write_version_number (VERSION, TAGNAME)
call write_version_number ( 'FV_ADA_NUDGE_MOD', version )
if ( master ) then
f_unit=stdlog()
write( f_unit, nml = fv_ada_nudge_nml )
Expand Down
23 changes: 12 additions & 11 deletions GFDL_tools/fv_climate_nudge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ module fv_climate_nudge_mod
public :: fv_climate_nudge_init, fv_climate_nudge, &
fv_climate_nudge_end, do_ps

character(len=128), parameter :: version = '$Id$'
character(len=128), parameter :: tagname = '$Name$'
! version number of this module
! Include variable "version" to be written to log file.
#include<file_version.h>

type var_state_type
integer :: is, ie, js, je, npz
Expand Down Expand Up @@ -134,19 +135,19 @@ subroutine fv_climate_nudge_init ( Time, axes, flag )
#else
if (file_exist('input.nml') ) then
unit = open_namelist_file()
ierr=1
ierr=1
do while (ierr /= 0)
read (unit, nml=fv_climate_nudge_nml, iostat=io, end=10)
read (unit, nml=fv_climate_nudge_nml, iostat=io, end=10)
ierr = check_nml_error (io, 'fv_climate_nudge_nml')
enddo
enddo
10 call close_file (unit)
endif
#endif

!----- write version and namelist to log file -----

unit = stdlog()
call write_version_number (version, tagname)
call write_version_number ('FV_CLIMATE_NUDGE_MOD', version)
if (mpp_pe() == mpp_root_pe()) write (unit, nml=fv_climate_nudge_nml)

! initialize flags
Expand Down Expand Up @@ -340,7 +341,7 @@ subroutine fv_climate_nudge (Time, dt, is, ie, js, je, npz, pfull, &

! vertically dependent factor
call get_factor (npz,pfull, factor)
! first time allocate state
! first time allocate state
if (do_state_alloc) then
call var_state_init ( is, ie, js, je, npz, State(1) )
call var_state_init ( is, ie, js, je, npz, State(2) )
Expand Down Expand Up @@ -633,7 +634,7 @@ subroutine get_factor (nlev,pfull,factor)
factor(k,2) = 0.
enddo
endif

! Specific humidity
if (skip_top_q > 0) then
do k = 1, skip_top_q
Expand Down Expand Up @@ -823,7 +824,7 @@ subroutine remap_coef( isd, ied, jsd, jed, lon_in, lat_in, &
!
integer, intent(out), dimension(is:ie,js:je ):: id1, id2, jdc
real, intent(out), dimension(is:ie,js:je,4):: s2c

!===============================================================================================

! local:
Expand All @@ -832,7 +833,7 @@ subroutine remap_coef( isd, ied, jsd, jed, lon_in, lat_in, &
real:: a1, b1
integer i, j, i1, i2, jc, i0, j0

!pk0(1) = ak_in(1)**KAPPA
!pk0(1) = ak_in(1)**KAPPA
!pn_top = log(ak_in(1))

do i=isd,ied-1
Expand Down Expand Up @@ -1006,7 +1007,7 @@ subroutine remap_ps( is, ie, js, je, km, &
gz(km+1) = gz_dat(i,j)
pk0(km+1) = ph_dat(i,j,km+1)**KAPPA
do k=km,1,-1
gz(k) = gz(k+1) + RDGAS*tp_dat(i,j,k)*(pn_dat(i,j,k+1)-pn_dat(i,j,k))
gz(k) = gz(k+1) + RDGAS*tp_dat(i,j,k)*(pn_dat(i,j,k+1)-pn_dat(i,j,k))
pk0(k) = ph_dat(i,j,k)**KAPPA
enddo
if ( phis(i,j) .gt. gz_dat(i,j) ) then
Expand Down
125 changes: 105 additions & 20 deletions GFDL_tools/fv_cmip_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ module fv_cmip_diag_mod

!-----------------------------------------------------------------------

type(cmip_diag_id_type) :: ID_ta, ID_ua, ID_va, ID_hus, ID_hur, ID_wap, ID_zg
type(cmip_diag_id_type) :: ID_ta, ID_ua, ID_va, ID_hus, ID_hur, ID_wap, ID_zg, &
ID_u2, ID_v2, ID_t2, ID_wap2, ID_uv, ID_ut, ID_vt, &
ID_uwap, ID_vwap, ID_twap
integer :: id_ps, id_orog
integer :: id_ua200, id_va200, id_ua850, id_va850, &
id_ta500, id_ta700, id_ta850, id_zg500, &
Expand All @@ -78,8 +80,9 @@ module fv_cmip_diag_mod

character(len=5) :: mod_name = 'atmos'

character(len=128) :: version = '$Id$'
character(len=128) :: tagname = '$Name$'
! version number of this module
! Include variable "version" to be written to log file.
#include<file_version.h>

logical :: module_is_initialized=.false.

Expand Down Expand Up @@ -131,7 +134,7 @@ subroutine fv_cmip_diag_init ( Atm, axes, Time )
!----- write version and namelist to log file -----

iunit = stdlog()
call write_version_number ( version, tagname )
call write_version_number ( 'FV_CMIP_DIAG_MOD', version )
if (mpp_pe() == mpp_root_pe()) write (iunit, nml=fv_cmip_diag_nml)


Expand Down Expand Up @@ -171,9 +174,48 @@ subroutine fv_cmip_diag_init ( Atm, axes, Time )
'Relative Humidity', '%', standard_name='relative_humidity')

ID_zg = register_cmip_diag_field_3d (mod_name, 'zg', Time, &
'Geopotential Height', 'm', standard_name='geopotential_height')
'Geopotential Height', 'm', standard_name='geopotential_height', axis='half')

!-----------------------------------------------------------------------
! register products of 3D variables (on model levels and pressure levels)

ID_u2 = register_cmip_diag_field_3d (mod_name, 'u2', Time, &
'Square of Eastward Wind', 'm2 s-2', standard_name='square_of_eastward_wind')

ID_v2 = register_cmip_diag_field_3d (mod_name, 'v2', Time, &
'Square of Northward Wind', 'm2 s-2', standard_name='square_of_northward_wind')

ID_t2 = register_cmip_diag_field_3d (mod_name, 't2', Time, &
'Square of Air Temperature', 'K2', standard_name='square_of_air_temperature')

ID_wap2 = register_cmip_diag_field_3d (mod_name, 'wap2', Time, &
'Square of Omega', 'Pa2 s-2', standard_name='square_of_omega')

ID_uv = register_cmip_diag_field_3d (mod_name, 'uv', Time, &
'Eastward Wind times Northward Wind', 'm2 s-2', &
standard_name='product_of_eastward_wind_and_northward_wind')

ID_ut = register_cmip_diag_field_3d (mod_name, 'ut', Time, &
'Air Temperature times Eastward Wind', 'K m s-1', &
standard_name='product_of_eastward_wind_and_air_temperature')

ID_vt = register_cmip_diag_field_3d (mod_name, 'vt', Time, &
'Air Temperature times Northward Wind', 'K m s-1', &
standard_name='product_of_northward_wind_and_air_temperature')

ID_uwap = register_cmip_diag_field_3d (mod_name, 'uwap', Time, &
'Eastward Wind times Omega', 'K m s-1', &
standard_name='product_of_eastward_wind_and_omega')

ID_vwap = register_cmip_diag_field_3d (mod_name, 'vwap', Time, &
'Northward Wind times Omega', 'K m s-1', &
standard_name='product_of_northward_wind_and_omega')

ID_twap = register_cmip_diag_field_3d (mod_name, 'twap', Time, &
'Air Temperature times Omega', 'K m s-1', &
standard_name='product_of_omega_and_air_temperature')

!-----------------------------------------------------------------------
! 2D fields

id_ps = register_cmip_diag_field_2d (mod_name, 'ps', Time, &
Expand Down Expand Up @@ -393,89 +435,132 @@ subroutine fv_cmip_diag ( Atm, zvir, Time )
if (query_cmip_diag_id(ID_zg)) &
used = send_cmip_data_3d (ID_zg, wz, Time, phalf=Atm(n)%peln, opt=1, ext=.true.)

!----------------------------------------------------------------------
! process product of fields on model levels and/or pressure levels

if (query_cmip_diag_id(ID_u2)) &
used = send_cmip_data_3d (ID_u2, Atm(n)%ua (isc:iec,jsc:jec,:)*Atm(n)%ua (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_v2)) &
used = send_cmip_data_3d (ID_v2, Atm(n)%va (isc:iec,jsc:jec,:)*Atm(n)%va (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_t2)) &
used = send_cmip_data_3d (ID_t2, Atm(n)%pt (isc:iec,jsc:jec,:)*Atm(n)%pt (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_wap2)) &
used = send_cmip_data_3d (ID_wap2, Atm(n)%omga(isc:iec,jsc:jec,:)*Atm(n)%omga(isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_uv)) &
used = send_cmip_data_3d (ID_uv, Atm(n)%ua (isc:iec,jsc:jec,:)*Atm(n)%va (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_ut)) &
used = send_cmip_data_3d (ID_ut, Atm(n)%ua (isc:iec,jsc:jec,:)*Atm(n)%pt (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_vt)) &
used = send_cmip_data_3d (ID_vt, Atm(n)%va (isc:iec,jsc:jec,:)*Atm(n)%pt (isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_uwap)) &
used = send_cmip_data_3d (ID_uwap, Atm(n)%ua (isc:iec,jsc:jec,:)*Atm(n)%omga(isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_vwap)) &
used = send_cmip_data_3d (ID_vwap, Atm(n)%va (isc:iec,jsc:jec,:)*Atm(n)%omga(isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

if (query_cmip_diag_id(ID_twap)) &
used = send_cmip_data_3d (ID_twap, Atm(n)%pt (isc:iec,jsc:jec,:)*Atm(n)%omga(isc:iec,jsc:jec,:), &
Time, phalf=Atm(n)%peln, opt=1)

!----------------------------------------------------------------------
! process 2D fields on specific pressure levels
!
!
if (id_ua10 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 10.e2, Atm(n)%peln, &
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ua10, dat2, Time)
endif

if (id_ua200 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 200.e2, Atm(n)%peln, &
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ua200, dat2, Time)
endif

if (id_va200 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 200.e2, Atm(n)%peln, &
Atm(n)%va(isc:iec,jsc:jec,:), dat2)
Atm(n)%va(isc:iec,jsc:jec,:), dat2)
used = send_data (id_va200, dat2, Time)
endif

if (id_ua850 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 850.e2, Atm(n)%peln, &
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
Atm(n)%ua(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ua850, dat2, Time)
endif

if (id_va850 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 850.e2, Atm(n)%peln, &
Atm(n)%va(isc:iec,jsc:jec,:), dat2)
Atm(n)%va(isc:iec,jsc:jec,:), dat2)
used = send_data (id_va850, dat2, Time)
endif

if (id_ta500 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 500.e2, Atm(n)%peln, &
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ta500, dat2, Time)
endif

if (id_ta700 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 700.e2, Atm(n)%peln, &
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ta700, dat2, Time)
endif

if (id_ta850 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 850.e2, Atm(n)%peln, &
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
Atm(n)%pt(isc:iec,jsc:jec,:), dat2)
used = send_data (id_ta850, dat2, Time)
endif

if (id_hus850 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 850.e2, Atm(n)%peln, &
Atm(n)%q(isc:iec,jsc:jec,:,sphum), dat2)
Atm(n)%q(isc:iec,jsc:jec,:,sphum), dat2)
used = send_data (id_hus850, dat2, Time)
endif

if (id_wap500 > 0) then
call interpolate_vertical (isc, iec, jsc, jec, npz, 500.e2, Atm(n)%peln, &
Atm(n)%omga(isc:iec,jsc:jec,:), dat2)
Atm(n)%omga(isc:iec,jsc:jec,:), dat2)
used = send_data (id_wap500, dat2, Time)
endif

if (id_zg10 > 0) then
call get_height_given_pressure (isc, iec, jsc, jec, ngc, npz, wz, 1, (/id_zg10/), &
call get_height_given_pressure (isc, iec, jsc, jec, npz, wz, 1, (/id_zg10/), &
(/log(10.e2)/), Atm(n)%peln, dat3)
used = send_data (id_zg10, dat3(:,:,1), Time)
endif

if (id_zg100 > 0) then
call get_height_given_pressure (isc, iec, jsc, jec, ngc, npz, wz, 1, (/id_zg100/), &
call get_height_given_pressure (isc, iec, jsc, jec, npz, wz, 1, (/id_zg100/), &
(/log(100.e2)/), Atm(n)%peln, dat3)
used = send_data (id_zg100, dat3(:,:,1), Time)
endif

if (id_zg500 > 0) then
call get_height_given_pressure (isc, iec, jsc, jec, ngc, npz, wz, 1, (/id_zg500/), &
call get_height_given_pressure (isc, iec, jsc, jec, npz, wz, 1, (/id_zg500/), &
(/log(500.e2)/), Atm(n)%peln, dat3)
used = send_data (id_zg500, dat3(:,:,1), Time)
endif

if (id_zg1000 > 0) then
call get_height_given_pressure (isc, iec, jsc, jec, ngc, npz, wz, 1, (/id_zg1000/), &
call get_height_given_pressure (isc, iec, jsc, jec, npz, wz, 1, (/id_zg1000/), &
(/log(1000.e2)/), Atm(n)%peln, dat3)
used = send_data (id_zg1000, dat3(:,:,1), Time)
endif
Expand Down
Loading