LCOV - code coverage report
Current view: | top level - control - history_scam.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 122 | 0.0 %
Date: | 2024-12-17 17:57:11 |  | Functions: | 0 | 2 | 0.0 %

              Line data    Source code
           1             : module history_scam
           2             : !-----------------------------------------------------------------------
           3             : !
           4             : ! Purpose: SCAM specific history code.
           5             : !
           6             : ! Public functions/subroutines:
           7             : !   bldfld, h_default
           8             : !
           9             : ! Author: anonymous from code in cam_history.F90
          10             : !-----------------------------------------------------------------------
          11             :    use shr_kind_mod, only: r8 => shr_kind_r8
          12             :    use cam_history, only: addfld, add_default, horiz_only
          13             :    use cam_grid_support, only: max_hcoordname_len
          14             :
          15             :    implicit none
          16             :
          17             : PRIVATE
          18             :
          19             :    public :: scm_intht
          20             :    public :: initialize_iop_history
          21             :
          22             : !#######################################################################
          23             : CONTAINS
          24           0 :    subroutine scm_intht()
          25             : !-----------------------------------------------------------------------
          26             : !
          27             : ! Purpose:
          28             : !
          29             : ! add master list fields to scm
          30             : !
          31             : ! Method: Call a subroutine to add each field
          32             : !
          33             : ! Author: CCM Core Group
          34             : !
          35             : !-----------------------------------------------------------------------
          36             :       use dycore,      only: dycore_is
          37             :       use cam_history, only: write_camiop
          38             : !-----------------------------------------------------------------------
          39             : !
          40             : !-----------------------------------------------------------------------
          41             : ! Local variables
          42             : !
          43             :       character(len=max_hcoordname_len) outgrid
          44             :
          45           0 :       if (dycore_is('SE')) then
          46             :          ! for camiop mode use the GLL grid otherwise use physics grids for SCM mode output
          47           0 :          if (write_camiop) then
          48           0 :             outgrid = 'GLL'
          49             :          else
          50           0 :             outgrid = 'physgrid'
          51             :          end if
          52           0 :       else if (dycore_is('EUL')) then
          53           0 :          outgrid = 'gauss_grid'
          54             :       else
          55           0 :          outgrid = 'unknown'
          56             :       end if
          57             : !
          58             : ! Call addfld to add each field to the Master Field List.
          59             : !
          60           0 :       call addfld ('TDIFF',    (/ 'lev' /), 'A', 'K','difference from observed temp',                    gridname=trim(outgrid))
          61           0 :       call addfld ('UDIFF',    (/ 'lev' /), 'A', 'K','difference from observed u wind',                  gridname=trim(outgrid))
          62           0 :       call addfld ('VDIFF',    (/ 'lev' /), 'A', 'K','difference from observed v wind',                  gridname=trim(outgrid))
          63             :
          64           0 :       call addfld ('TOBS',     (/ 'lev' /), 'A', 'K','observed temp')
          65           0 :       call addfld ('QDIFF',    (/ 'lev' /), 'A', 'kg/kg','difference from observed water',               gridname=trim(outgrid))
          66             :
          67           0 :       call addfld ('QOBS',     (/ 'lev' /), 'A', 'kg/kg','observed water',                               gridname='physgrid')
          68             :       call addfld ('PRECOBS',  (/ 'lev' /), 'A', 'mm/day','Total (convective and large-scale) precipitation rate',             &
          69           0 :                                                                                                          gridname='physgrid')
          70           0 :       call addfld ('DIVQ',     (/ 'lev' /), 'A', 'kg/kg/s','Q advection tendency (horizontal)',          gridname='physgrid')
          71           0 :       call addfld ('DIVQ3D',   (/ 'lev' /), 'A', 'kg/kg/s','Q advection tendency (horiz/vert combined)', gridname=trim(outgrid))
          72           0 :       call addfld ('DIVV',     (/ 'lev' /), 'A', 'm/s2','V advection tendency (horizontal)',             gridname='physgrid')
          73           0 :       call addfld ('DIVU',     (/ 'lev' /), 'A', 'm/s2','U advection tendency (horizontal)',             gridname='physgrid')
          74           0 :       call addfld ('DIVT',     (/ 'lev' /), 'A', 'K/s','T advection tendency (horizontal)',              gridname='physgrid')
          75           0 :       call addfld ('DIVT3D',   (/ 'lev' /), 'A', 'K/s','T advection tendency (horiz/vert combined)',     gridname=trim(outgrid))
          76           0 :       call addfld ('DIVU3D',   (/ 'lev' /), 'A', 'K/s','U advection tendency (horiz/vert combined)',     gridname=trim(outgrid))
          77           0 :       call addfld ('DIVV3D',   (/ 'lev' /), 'A', 'K/s','V advection tendency (horiz/vert combined)',     gridname=trim(outgrid))
          78             :
          79           0 :       call addfld ('SHFLXOBS', horiz_only,  'A', 'W/m2','Obs Surface sensible heat flux',                gridname='physgrid')
          80           0 :       call addfld ('LHFLXOBS', horiz_only,  'A', 'W/m2','Obs Surface latent heat flux',                  gridname='physgrid')
          81           0 :       call addfld ('TRELAX',   (/ 'lev' /), 'A', 'K','t relaxation amount',                              gridname=trim(outgrid))
          82           0 :       call addfld ('QRELAX',   (/ 'lev' /), 'A', 'kg/kg','q relaxation amount',                          gridname=trim(outgrid))
          83           0 :       call addfld ('TAURELAX', (/ 'lev' /), 'A', 'seconds','relaxation time constant',                   gridname=trim(outgrid))
          84           0 :       call add_default ('TDIFF', 1, ' ')
          85           0 :       call add_default ('QDIFF', 1, ' ')
          86             :
          87             :     ! Vertical advective forcing of 'T,u,v,qv,ql,qi,nl,ni' in forecast.F90
          88             :
          89           0 :       call addfld ('TTEN_XYADV',   (/ 'lev' /), 'I', 'K/s',    'T  horizontal advective forcing',        gridname=trim(outgrid) )
          90           0 :       call addfld ('UTEN_XYADV',   (/ 'lev' /), 'I', 'm/s^2',  'U  horizontal advective forcing',        gridname=trim(outgrid) )
          91           0 :       call addfld ('VTEN_XYADV',   (/ 'lev' /), 'I', 'm/s^2',  'V  horizontal advective forcing',        gridname=trim(outgrid) )
          92           0 :       call addfld ('QVTEN_XYADV',  (/ 'lev' /), 'I', 'kg/kg/s','QV horizontal advective forcing',        gridname=trim(outgrid) )
          93           0 :       call addfld ('QLTEN_XYADV',  (/ 'lev' /), 'I', 'kg/kg/s','QL horizontal advective forcing',        gridname=trim(outgrid) )
          94           0 :       call addfld ('QITEN_XYADV',  (/ 'lev' /), 'I', 'kg/kg/s','QI horizontal advective forcing',        gridname=trim(outgrid) )
          95           0 :       call addfld ('NLTEN_XYADV',  (/ 'lev' /), 'I', '#/kg/s', 'NL horizontal advective forcing',        gridname=trim(outgrid) )
          96           0 :       call addfld ('NITEN_XYADV',  (/ 'lev' /), 'I', '#/kg/s', 'NI horizontal advective forcing',        gridname=trim(outgrid) )
          97             :
          98           0 :       call addfld ('TTEN_ZADV',   (/ 'lev' /), 'I', 'K/s',    'T  vertical   advective forcing',         gridname=trim(outgrid) )
          99           0 :       call addfld ('UTEN_ZADV',   (/ 'lev' /), 'I', 'm/s^2',  'U  vertical   advective forcing',         gridname=trim(outgrid) )
         100           0 :       call addfld ('VTEN_ZADV',   (/ 'lev' /), 'I', 'm/s^2',  'V  vertical   advective forcing',         gridname=trim(outgrid) )
         101           0 :       call addfld ('QVTEN_ZADV',  (/ 'lev' /), 'I', 'kg/kg/s','QV vertical   advective forcing',         gridname=trim(outgrid) )
         102           0 :       call addfld ('QLTEN_ZADV',  (/ 'lev' /), 'I', 'kg/kg/s','QL vertical   advective forcing',         gridname=trim(outgrid) )
         103           0 :       call addfld ('QITEN_ZADV',  (/ 'lev' /), 'I', 'kg/kg/s','QI vertical   advective forcing',         gridname=trim(outgrid) )
         104           0 :       call addfld ('NLTEN_ZADV',  (/ 'lev' /), 'I', '#/kg/s', 'NL vertical   advective forcing',         gridname=trim(outgrid) )
         105           0 :       call addfld ('NITEN_ZADV',  (/ 'lev' /), 'I', '#/kg/s', 'NI vertical   advective forcing',         gridname=trim(outgrid) )
         106             :
         107           0 :       call addfld ('TTEN_PHYS',   (/ 'lev' /), 'I', 'K/s',    'T  vertical   advective forcing',         gridname=trim(outgrid) )
         108           0 :       call addfld ('UTEN_PHYS',   (/ 'lev' /), 'I', 'm/s^2',  'U  vertical   advective forcing',         gridname=trim(outgrid) )
         109           0 :       call addfld ('VTEN_PHYS',   (/ 'lev' /), 'I', 'm/s^2',  'V  vertical   advective forcing',         gridname=trim(outgrid) )
         110           0 :       call addfld ('QVTEN_PHYS',   (/ 'lev' /), 'I','kg/kg/s','QV vertical   advective forcing',         gridname=trim(outgrid) )
         111           0 :       call addfld ('QLTEN_PHYS',   (/ 'lev' /), 'I','kg/kg/s','QL vertical   advective forcing',         gridname=trim(outgrid) )
         112           0 :       call addfld ('QITEN_PHYS',   (/ 'lev' /), 'I','kg/kg/s','QI vertical   advective forcing',         gridname=trim(outgrid) )
         113           0 :       call addfld ('NLTEN_PHYS',   (/ 'lev' /), 'I','#/kg/s', 'NL vertical   advective forcing',         gridname=trim(outgrid) )
         114           0 :       call addfld ('NITEN_PHYS',   (/ 'lev' /), 'I','#/kg/s', 'NI vertical   advective forcing',         gridname=trim(outgrid) )
         115             :
         116           0 :    end subroutine scm_intht
         117             : !#######################################################################
         118           0 :    subroutine initialize_iop_history()
         119             : !-----------------------------------------------------------------------
         120             : !
         121             : ! Purpose: Add fields and set defaults for SCAM CAM BFB IOP initial file
         122             : ! as well as single column output history
         123             : !
         124             : ! Method: Call a subroutine to add each field
         125             : !
         126             : !-----------------------------------------------------------------------
         127             : !
         128             : ! !USES:
         129           0 :     use constituents,     only: pcnst, cnst_name
         130             :     use dycore,           only: dycore_is
         131             : ! !ARGUMENTS:
         132             :     implicit none
         133             :
         134             : ! !LOCAL VARIABLES:
         135             :     integer m
         136             :     character(len=max_hcoordname_len) outgrid
         137             :
         138             : !-----------------------------------------------------------------------
         139             :
         140           0 :     if (dycore_is('SE')) then
         141           0 :        outgrid = 'GLL'
         142           0 :     else if (dycore_is('EUL')) then
         143           0 :        outgrid = 'gauss_grid'
         144           0 :     else if (dycore_is('EUL')) then
         145           0 :        outgrid = 'unknown'
         146             :     end if
         147             :
         148           0 :     if (trim(outgrid) == 'gauss_grid') then
         149           0 :        call addfld ('CLAT1&IC',  horiz_only,  'I', ' ','cos lat for bfb testing', gridname=trim(outgrid))
         150           0 :        call add_default ('CLAT1&IC',0,'I')
         151           0 :        call addfld ('CLON1&IC',  horiz_only,  'I', ' ','cos lon for bfb testing', gridname=trim(outgrid))
         152           0 :        call add_default ('CLON1&IC',0,'I')
         153           0 :        call addfld ('PHI&IC',    horiz_only,  'I', ' ','lat for bfb testing', gridname=trim(outgrid))
         154           0 :        call add_default ('PHI&IC',0,  'I')
         155           0 :        call addfld ('LAM&IC',    horiz_only,  'I', ' ','lon for bfb testing', gridname=trim(outgrid))
         156           0 :        call add_default ('LAM&IC',0,  'I')
         157             :
         158           0 :        call addfld ('CLAT',    horiz_only,   'A', ' ',   'cos lat for bfb testing', gridname=trim(outgrid))
         159           0 :        call add_default ('CLAT',2,' ')
         160             :
         161           0 :        call addfld ('fixmas',  horiz_only,   'A', 'percent','Mass fixer',gridname=trim(outgrid))
         162           0 :        call add_default ('fixmas',2,' ')
         163           0 :        call addfld ('beta',    horiz_only,   'A', 'percent','Energy fixer',gridname=trim(outgrid))
         164           0 :        call add_default ('beta',2,' ')
         165             :     end if
         166             :
         167           0 :     call addfld ('q',       (/ 'lev' /),  'A', 'kg/kg',  'Q for scam',gridname=trim(outgrid))
         168           0 :     call add_default ('q',2, ' ')
         169           0 :     call addfld ('u',       (/ 'lev' /),  'A', 'm/s',    'U for scam',gridname=trim(outgrid))
         170           0 :     call add_default ('u',2,' ')
         171           0 :     call addfld ('v',       (/ 'lev' /),  'A', 'm/s',    'V for scam',gridname=trim(outgrid))
         172           0 :     call add_default ('v',2,' ')
         173           0 :     call addfld ('t',       (/ 'lev' /),  'A', 'K',      'Temperature for scam',gridname=trim(outgrid))
         174           0 :     call add_default ('t',2,' ')
         175           0 :     call addfld ('Tg',      horiz_only,   'A', 'K',      'Surface temperature (radiative) for scam',gridname='physgrid')
         176           0 :     call add_default ('Tg',2,' ')
         177           0 :     call addfld ('Ps',      horiz_only,   'A', 'Pa',     'Surface Pressure for SCAM',gridname=trim(outgrid))
         178           0 :     call add_default ('Ps',2,' ')
         179           0 :     call addfld ('divT3d',  (/ 'lev' /),  'A', 'K',      'Dynamics Residual for T',gridname=trim(outgrid))
         180           0 :     call add_default ('divT3d',2,' ')
         181           0 :     call addfld ('divU3d',  (/ 'lev' /),  'A', 'K',      'Dynamics Residual for U',gridname=trim(outgrid))
         182           0 :     call add_default ('divU3d',2,' ')
         183           0 :     call addfld ('divV3d',  (/ 'lev' /),  'A', 'K',      'Dynamics Residual for V',gridname=trim(outgrid))
         184           0 :     call add_default ('divV3d',2,' ')
         185           0 :     call addfld ('heat_glob',horiz_only, 'A', 'K/s', 'Global mean total energy difference')
         186           0 :     call add_default ('heat_glob',2,' ')
         187           0 :     do m=1,pcnst
         188           0 :        call addfld (trim(cnst_name(m))//'_dten', (/ 'lev' /), 'A', 'kg/kg', &
         189           0 :             trim(cnst_name(m))//' IOP Dynamics Residual for '//trim(cnst_name(m)),gridname=trim(outgrid))
         190           0 :        call add_default (trim(cnst_name(m))//'_dten',2,' ')
         191           0 :        if (trim(outgrid) == 'gauss_grid') then
         192             :           call addfld (trim(cnst_name(m))//'_alph', horiz_only, 'A', 'kg/kg',trim(cnst_name(m))//' alpha constituent fixer', &
         193           0 :                gridname=trim(outgrid))
         194           0 :           call add_default (trim(cnst_name(m))//'_alph',2,' ')
         195             :           call addfld (trim(cnst_name(m))//'_dqfx', (/ 'lev' /), 'A', 'kg/kg',trim(cnst_name(m))//' dqfx3 fixer',            &
         196           0 :                gridname=trim(outgrid))
         197           0 :           call add_default (trim(cnst_name(m))//'_dqfx',2,' ')
         198             :        end if
         199             :     end do
         200           0 :     call addfld ('shflx',  horiz_only,  'A', 'W/m2', 'Surface sensible heat flux for scam',gridname='physgrid')
         201           0 :     call add_default ('shflx',2,' ')
         202           0 :     call addfld ('lhflx',  horiz_only,  'A', 'W/m2', 'Surface latent heat flux for scam',gridname='physgrid')
         203           0 :     call add_default ('lhflx',2,' ')
         204           0 :     call addfld ('trefht', horiz_only,  'A', 'K',    'Reference height temperature',gridname='physgrid')
         205           0 :     call add_default ('trefht',2,' ')
         206           0 :     call addfld ('Tsair',  horiz_only,  'A', 'K',    'Reference height temperature for scam',gridname='physgrid')
         207           0 :     call add_default ('Tsair',2,' ')
         208           0 :     call addfld ('phis',   horiz_only,  'I', 'm2/s2','Surface geopotential for scam',gridname='physgrid')
         209           0 :     call add_default ('phis',2,' ')
         210             :     call addfld ('Prec',   horiz_only,  'A', 'm/s',  'Total (convective and large-scale) precipitation rate for scam',   &
         211           0 :          gridname='physgrid')
         212           0 :     call add_default ('Prec',2,' ')
         213           0 :     call addfld ('omega',  (/ 'lev' /), 'A', 'Pa/s', 'Vertical velocity (pressure)',gridname='physgrid')
         214           0 :     call add_default ('omega',2,' ')
         215             :
         216           0 :   end subroutine initialize_iop_history
         217             :
         218             : !#######################################################################
         219             :  end module history_scam

Generated by: LCOV version 1.14