The coupler is required to do certain diagnostics, those calculations are located in this module.
REMARKS:
Sign convention: positive value <=> the model is gaining water, heat, momentum, etc. Unit convention: heat flux ~ W/m^2 momentum flux ~ N/m^2 water flux ~ (kg/s)/m^2 salt flux ~ (kg/s)/m^2REVISION HISTORY:
199x-mmm-dd - B. Kauffman - original cpl5 version 2002-nov-21 - R. Jacob - initial port to cpl6. Does atm and lnd 2002-nov-27 - R. Jacob - add ocean 2002-dec-03 - R. Jacob - add solar diagnostics 2002-dec-15 - R. Jacob - time average diagnostics 2003-Feb-10 - R. Jacob - calculate sums locallyINTERFACE:
module diag_modUSES:
use shr_date_mod ! shared date module use shr_sys_mod ! shared system routines use shr_timer_mod ! shared timers use shr_mpi_mod ! shared mpi layer use cpl_kind_mod ! kinds use cpl_const_mod ! physical constants use cpl_mct_mod ! mct library use cpl_comm_mod ! communicator module use cpl_fields_mod ! index to fields in bundles use cpl_domain_mod ! domain data types use cpl_bundle_mod ! bundle data types use cpl_control_mod ! cpl control flags & methods implicit none private ! exceptPUBLIC TYPES:
! nonePUBLIC MEMBER FUNCTIONS:
public :: diag_doDiag ! coordinates all diagnostic subroutines public :: diag_solar ! verifies net-solar coordinationPUBLIC DATA MEMBERS:
!--- note: this partial-sum data needs to be saved in a restart file --- real(R8),save,public :: diag_eday0 ! partial sum: start date real(R8),save,public :: diag_eday1 ! partial sum: end date real(R8),save,public :: diag_ns ! partial sum: number of samples real(R8),save,public,target :: diag_datas(8,6,3) ! partial sum: the p-sum data
Calculate global diagnostics.
REMARKS:
if (cpl_control_diagNow ) then print instantaneous diagnostics if (cpl_control_avDiagNow) then print time-avg diagnostics This is hard-coded to print/reset the t-avg data at the end of every year.REVISION HISTORY:
199x-mmm-dd - B. Kauffman original cpl5 version, called diagnos in diag_modINTERFACE:
subroutine diag_doDiag(date,bun_a2c,bun_c2a ,bun_l2c ,bun_c2l ,bun_r2c , & & bun_i2c,bun_c2i ,bun_o2c ,bun_c2o ,bun_a2c_o, & & bun_alb,bun_lfrac,bun_ifrac,bun_ofrac)USES:
implicit noneINPUT PARAMETERS:
type(shr_date) ,intent(in) :: date ! current model date type(cpl_bundle),intent(in) :: bun_a2c ! atm->cpl bundle type(cpl_bundle),intent(in) :: bun_c2a ! cpl->atm bundle type(cpl_bundle),intent(in) :: bun_l2c ! lnd->cpl bundle type(cpl_bundle),intent(in) :: bun_c2l ! cpl->lnd bundle type(cpl_bundle),intent(in) :: bun_r2c ! rof->cpl bundle type(cpl_bundle),intent(in) :: bun_i2c ! ice->cpl bundle type(cpl_bundle),intent(in) :: bun_c2i ! cpl->ice bundle type(cpl_bundle),intent(in) :: bun_o2c ! ocn->cpl bundle type(cpl_bundle),intent(in) :: bun_c2o ! cpl->ocn bundle type(cpl_bundle),intent(in) :: bun_a2c_o ! atm->cpl bundle type(cpl_bundle),intent(in) :: bun_alb ! albedo bundle type(cpl_bundle),intent(in) :: bun_lfrac ! surface fractions on lnd domain type(cpl_bundle),intent(in) :: bun_ifrac ! surface fractions on ice domain type(cpl_bundle),intent(in) :: bun_ofrac ! surface fractions on ocn domain
Compute atmosphere diagnostics (instantaneous global averages)
REMARKS:
Area averages are relative to the entire unit sphere, area = 4*pi rad^2REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_atm(bun_a2c,bun_c2a)USES:
implicit noneINPUT PARAMETERS:
type(cpl_bundle),intent(in ) :: bun_a2c ! atm->cpl bundle type(cpl_bundle),intent(in ) :: bun_c2a ! cpl->atm bundle
Compute land diagnostics (instantaneous global averages)
REMARKS:
Area averages are relative to the entire unit sphere, area = 4*pi rad^2REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_lnd(bun_l2c,bun_c2l,bun_r2c,bun_lfrac)USES:
implicit noneINPUT PARAMETERS:
type(cpl_bundle),intent(in) :: bun_l2c ! lnd->cpl bundle type(cpl_bundle),intent(in) :: bun_c2l ! cpl->lnd bundle type(cpl_bundle),intent(in) :: bun_r2c ! rof->cpl bundle type(cpl_bundle),intent(in) :: bun_lfrac ! surface fractions on lnd domain
Compute ice model diagnostics (instantaneous global averages)
REMARKS:
Area averages are relative to the entire unit sphere, area = 4*pi rad^2 This routine assumes ice and ocean are on the same grid.REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_ice(bun_i2c,bun_c2i,bun_o2c,bun_ifrac)USES:
implicit noneINPUT PARAMETERS:
type(cpl_bundle),intent(in ) :: bun_i2c ! ice->cpl bundle type(cpl_bundle),intent(in ) :: bun_c2i ! cpl->ice bundle type(cpl_bundle),intent(in ) :: bun_o2c ! ocn->cpl bundle type(cpl_bundle),intent(in ) :: bun_ifrac ! surface fractions on ice domain
Compute ocean diagnostics (instantaneous global averages)
REMARKS:
Area averages are relative to the entire unit sphere, area = 4*pi rad^2REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_ocn(bun_o2c,bun_c2o,bun_a2c,bun_i2c,bun_alb,bun_ofrac)USES:
implicit noneINPUT PARAMETERS:
type(cpl_bundle),intent(in ) :: bun_o2c ! ocn->cpl bundle type(cpl_bundle),intent(in ) :: bun_c2o ! cpl->ocn bundle type(cpl_bundle),intent(in ) :: bun_a2c ! atm->cpl bundle type(cpl_bundle),intent(in ) :: bun_i2c ! ice->cpl bundle type(cpl_bundle),intent(in ) :: bun_alb ! albedo bundle type(cpl_bundle),intent(in ) :: bun_ofrac ! surface fractions on ocn domain
Print the diagnostics and their sum in each category
REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_print(date)USES:
implicit noneINPUT PARAMETERS:
type(shr_date),intent(in) :: date ! current model date
Print the diagnostics and their sum in each category
REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_printAvg(date)USES:
implicit noneINPUT PARAMETERS:
type(shr_date),intent(in) :: date ! current model date
Compare expected vs. actual short-wave net (absorbed solar)
REVISION HISTORY:
INTERFACE:
SUBROUTINE diag_solar(bun_a2c,bun_l2c,bun_i2c,bun_lfrac,bun_ifrac)INPUT PARAMETERS:
implicit none type(cpl_bundle),intent(in) :: bun_a2c ! atm->cpl bundle type(cpl_bundle),intent(in) :: bun_l2c ! lnd->cpl bundleand data type(cpl_bundle),intent(in) :: bun_i2c ! ice->cpl bundlece data type(cpl_bundle),intent(in) :: bun_lfrac ! surface fractions on lnd domain type(cpl_bundle),intent(in) :: bun_ifrac ! surface fractions on ice domain