LCOV - code coverage report
Current view: | top level - control - cam_control_mod.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 46 | 55 | 83.6 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 3 | 3 | 100.0 %

              Line data    Source code
           1             : module cam_control_mod
           2             : !------------------------------------------------------------------------------------------------
           3             : !
           4             : ! High level control variables.  Information received from the driver/coupler is
           5             : ! stored here.
           6             : !
           7             : !------------------------------------------------------------------------------------------------
           8             :
           9             : use shr_kind_mod,     only: r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl
          10             : use spmd_utils,       only: masterproc
          11             : use cam_logfile,      only: iulog
          12             : use cam_abortutils,   only: endrun
          13             :
          14             : implicit none
          15             : public
          16             : save
          17             :
          18             : ! Public Routines:
          19             : !
          20             : !   cam_ctrl_init
          21             : !   cam_ctrl_set_orbit
          22             : !   cam_ctrl_set_physics_type
          23             :
          24             : character(len=cl), protected :: caseid  ! case ID
          25             : character(len=cl), protected :: ctitle  ! case title
          26             :
          27             : logical, protected :: initial_run  ! startup mode which only requires a minimal initial file
          28             : logical, protected :: restart_run  ! continue a previous run; requires a restart file
          29             : logical, protected :: branch_run   ! branch from a previous run; requires a restart file
          30             : logical, protected :: post_assim    ! We are resuming after a pause
          31             :
          32             : logical, protected :: adiabatic         ! true => no physics
          33             : logical, protected :: ideal_phys        ! true => run Held-Suarez (1994) physics
          34             : logical, protected :: kessler_phys      ! true => run Kessler physics
          35             : logical, protected :: tj2016_phys       ! true => run tj2016 physics
          36             : logical, protected :: frierson_phys     ! true => run frierson physics
          37             : logical, protected :: simple_phys       ! true => adiabatic or ideal_phys or kessler_phys
          38             :                                         !         or tj2016 or frierson
          39             : logical, protected :: aqua_planet       ! Flag to run model in "aqua planet" mode
          40             : logical, protected :: moist_physics     ! true => moist physics enabled, i.e.,
          41             :                                         ! (.not. ideal_phys) .and. (.not. adiabatic)
          42             :
          43             : logical, protected :: brnch_retain_casename ! true => branch run may use same caseid as
          44             :                                             !         the run being branched from
          45             :
          46             : real(r8), protected :: eccen       ! Earth's eccentricity factor (unitless) (typically 0 to 0.1)
          47             : real(r8), protected :: obliqr      ! Earth's obliquity in radians
          48             : real(r8), protected :: lambm0      ! Mean longitude of perihelion at the
          49             :                                    ! vernal equinox (radians)
          50             : real(r8), protected :: mvelpp      ! Earth's moving vernal equinox longitude
          51             :                                    ! of perihelion plus pi (radians)
          52             :
          53             : !================================================================================================
          54             : contains
          55             : !================================================================================================
          56             :
          57        1536 : subroutine cam_ctrl_init( &
          58        1536 :    caseid_in, ctitle_in, &
          59             :    initial_run_in, restart_run_in, branch_run_in, post_assim_in, &
          60             :    aqua_planet_in, brnch_retain_casename_in)
          61             :
          62             :    character(len=cl), intent(in) :: caseid_in            ! case ID
          63             :    character(len=cl), intent(in) :: ctitle_in            ! case title
          64             :    logical,           intent(in) :: initial_run_in       ! true => inital run
          65             :    logical,           intent(in) :: restart_run_in       ! true => restart run
          66             :    logical,           intent(in) :: branch_run_in        ! true => branch run
          67             :    logical,           intent(in) :: post_assim_in        ! true => resume mode
          68             :    logical,           intent(in) :: aqua_planet_in       ! Flag to run model in "aqua planet" mode
          69             :    logical,           intent(in) :: brnch_retain_casename_in ! Flag to allow a branch to use the same
          70             :                                                              ! caseid as the run being branched from.
          71             :
          72             :    character(len=*), parameter :: sub='cam_ctrl_init'
          73             :    !---------------------------------------------------------------------------------------------
          74             :
          75        1536 :    caseid = caseid_in
          76        1536 :    ctitle = ctitle_in
          77             :
          78        1536 :    initial_run = initial_run_in
          79        1536 :    restart_run = restart_run_in
          80        1536 :    branch_run  = branch_run_in
          81        1536 :    post_assim  = post_assim_in
          82             :
          83        1536 :    aqua_planet = aqua_planet_in
          84             :
          85        1536 :    brnch_retain_casename = brnch_retain_casename_in
          86             :
          87        1536 :    if (masterproc) then
          88           2 :       write(iulog,*)' '
          89           2 :       write(iulog,*)' ------------------------------------------'
          90           2 :       write(iulog,*)' *********** CAM LOG OUTPUT ***************'
          91           2 :       write(iulog,*)' ------------------------------------------'
          92           2 :       if (restart_run) then
          93           1 :          write(iulog,*) '  Restart of an earlier run'
          94           1 :       else if (branch_run) then
          95           0 :          write(iulog,*) '  Branch of an earlier run'
          96           1 :       else if (post_assim) then
          97           0 :          write(iulog,*) '  DART run using CAM initial mode'
          98             :       else
          99           1 :          write(iulog,*) '         Initial run'
         100             :       end if
         101           2 :       write(iulog,*) ' ********** CASE = ',trim(caseid),' **********'
         102           2 :       write(iulog,'(1x,a)') ctitle
         103             :
         104             :
         105           2 :       if (aqua_planet) write(iulog,*) 'Run model in "AQUA_PLANET" mode'
         106             :
         107             :    end if
         108             :
         109        1536 : end subroutine cam_ctrl_init
         110             :
         111             : !--------------------------------------------------------------------------------------------------
         112             :
         113      371712 : subroutine cam_ctrl_set_orbit(eccen_in, obliqr_in, lambm0_in, mvelpp_in)
         114             :
         115             :    real(r8), intent(in) :: eccen_in
         116             :    real(r8), intent(in) :: obliqr_in
         117             :    real(r8), intent(in) :: lambm0_in
         118             :    real(r8), intent(in) :: mvelpp_in
         119             :
         120      371712 :    eccen  = eccen_in
         121      371712 :    obliqr = obliqr_in
         122      371712 :    lambm0 = lambm0_in
         123      371712 :    mvelpp = mvelpp_in
         124             :
         125      371712 : end subroutine cam_ctrl_set_orbit
         126             :
         127             : !--------------------------------------------------------------------------------------------------
         128             :
         129        1536 : subroutine cam_ctrl_set_physics_type(phys_package)
         130             :   ! Dummy argument
         131             :   character(len=*), intent(in) :: phys_package
         132             :   ! Local variable
         133             :   character(len=*), parameter :: subname = 'cam_ctrl_set_physics_type'
         134             :
         135        1536 :   adiabatic = trim(phys_package) == 'adiabatic'
         136        1536 :   ideal_phys = trim(phys_package) == 'held_suarez'
         137        1536 :   kessler_phys = trim(phys_package) == 'kessler'
         138        1536 :   tj2016_phys = trim(phys_package) == 'tj2016'
         139        1536 :   frierson_phys = trim(phys_package) == 'grayrad'
         140             :
         141        1536 :   simple_phys = adiabatic .or. ideal_phys .or. kessler_phys .or. tj2016_phys .or. frierson_phys
         142             :
         143        1536 :   moist_physics = .not. (adiabatic .or. ideal_phys)
         144             :
         145        1536 :   if ((.not. moist_physics) .and. aqua_planet) then
         146           0 :     call endrun (subname//': FATAL: AQUA_PLANET not compatible with dry physics package, ('//trim(phys_package)//')')
         147             :   end if
         148             :
         149        1536 :   if (masterproc) then
         150           2 :     if (adiabatic) then
         151           0 :       write(iulog,*) 'Run model ADIABATICALLY (i.e. no physics)'
         152           0 :       write(iulog,*) '  Global energy fixer is on for non-Eulerian dycores.'
         153           2 :     else if (ideal_phys) then
         154           0 :       write(iulog,*) 'Run model with Held-Suarez physics forcing'
         155           2 :     else if (kessler_phys) then
         156           0 :       write(iulog,*) 'Run model with Kessler warm-rain physics forcing'
         157           2 :     else if (tj2016_phys) then
         158           0 :       write(iulog,*) 'Run model with Thatcher-Jablonowski (2016) physics forcing (moist Held-Suarez)'
         159           2 :     else if (frierson_phys) then
         160           0 :       write(iulog,*) 'Run model with Frierson (2006) physics'
         161             :     end if
         162             :   end if
         163             :
         164        1536 : end subroutine cam_ctrl_set_physics_type
         165             :
         166             : end module cam_control_mod

Generated by: LCOV version 1.14