Skip to content

Commit

Permalink
fix for restart with COSP
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Apr 17, 2024
1 parent 66534c9 commit 168c302
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
20 changes: 8 additions & 12 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ model top of about 1 Pa which is above where the cloud parameterizations
operate. The COSP interface routine was modified so that COSP operates on
the same vertical domain as the cloud parameterizations which is set the
the namelist variable trop_cloud_top_press (1 mb by default). Changing to
a dynamically determined top required reordering of calls to COSP interface
routines. In addition a lot of code cleanup was done, and a bug fix was
made for the layer interface values of height and pressure passed from CAM
to COSP.
a dynamically determined top required moving the call to COSP's
initialization. In addition a lot of code cleanup was done, and a bug fix
was made for the layer interface values of height and pressure passed from
CAM to COSP.

. resolves #967- COSP prevents running "FMT" compsets.

Expand All @@ -43,19 +43,15 @@ src/control/cam_history_support.F90
src/physics/cam/cospsimulator_intr.F90
. set top of data operated on by COSP using trop_cloud_top_lev
. cospsimulator_intr_register
- routine removed. Not needed since no constituents or pbuf fields to
register. Contents moved to cospsimulator_intr_init.
- move the setcosp2values call here. That routine contains the call to
COSP's initialization.
. cospsimulator_intr_readnl
- move the call to setcosp2values to cospsimulator_intr_init.
- move the call to setcosp2values to cospsimulator_intr_register.
. remove outdated and/or unhelpful comments
. remove unused variables
. remove added history fields with no corresponding outfld calls
. remove added history fields that had no corresponding outfld calls
. remove array section notation from places where the whole array is used

src/physics/cam/physpkg.F90
src/physics/cam_dev/physpkg.F90
. remove call to cospsimulator_intr_register

src/physics/cam/ref_pres.F90
. add calls to create vertical coordinate variables for the domain bounded
by trop_cloud_lev_top. Some COSP history fields need this coordinate.
Expand Down
39 changes: 27 additions & 12 deletions src/physics/cam/cospsimulator_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module cospsimulator_intr
! Public functions/subroutines
public :: &
cospsimulator_intr_readnl, &
cospsimulator_intr_register,&
cospsimulator_intr_init, &
cospsimulator_intr_run

Expand Down Expand Up @@ -262,8 +263,6 @@ module cospsimulator_intr

! ######################################################################################
! SUBROUTINE cospsimulator_intr_readnl
!
! Read namelist variables and run setcospvalues subroutine.
! ######################################################################################
subroutine cospsimulator_intr_readnl(nlfile)
use namelist_utils, only: find_group_name
Expand Down Expand Up @@ -431,29 +430,26 @@ subroutine cospsimulator_intr_readnl(nlfile)
end subroutine cospsimulator_intr_readnl

! ######################################################################################
! SUBROUTINE cospsimulator_intr_init
! SUBROUTINE cospsimulator_intr_register
! ######################################################################################
subroutine cospsimulator_intr_init()
subroutine cospsimulator_intr_register()

#ifdef USE_COSP
! The coordinate variables used for COSP output are defined here. This
! needs to be done before the call to read_restart_history in order for
! restarts to work.

use cam_history, only: addfld, add_default, horiz_only
use cam_history_support, only: add_hist_coord
use physics_buffer, only: pbuf_get_index

use mod_cosp_config, only : R_UNDEF

integer :: i, ierr
!---------------------------------------------------------------------------

! Set number of levels used by COSP to the number of levels used by
! CAM's cloud macro/microphysics parameterizations.
nlay = pver - ktop + 1
nlayp = nlay + 1

! COSP initialization
! Set COSP coordinate arrays
call setcosp2values()

#ifdef USE_COSP
! Define coordinate variables for COSP outputs.
if (lisccp_sim .or. lmodis_sim) then
call add_hist_coord('cosp_prs', nprs_cosp, 'COSP Mean ISCCP pressure', &
Expand Down Expand Up @@ -513,6 +509,25 @@ subroutine cospsimulator_intr_init()
bounds_name='cosp_reffliq_bnds',bounds=reffLIQ_binEdges_cosp)
end if

#endif
end subroutine cospsimulator_intr_register

! ######################################################################################
! SUBROUTINE cospsimulator_intr_init
! ######################################################################################
subroutine cospsimulator_intr_init()

#ifdef USE_COSP

use cam_history, only: addfld, add_default, horiz_only
use physics_buffer, only: pbuf_get_index

integer :: i, ierr
!---------------------------------------------------------------------------

! The COSP init method was run from cospsimulator_intr_register in order to add
! the history coordinate variables earlier as needed for the restart time sequencing.

! ISCCP OUTPUTS
if (lisccp_sim) then
call addfld('FISCCP1_COSP', (/'cosp_tau','cosp_prs'/), 'A', 'percent', &
Expand Down
4 changes: 4 additions & 0 deletions src/physics/cam/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ subroutine phys_register
use aircraft_emit, only: aircraft_emit_register
use cam_diagnostics, only: diag_register
use cloud_diagnostics, only: cloud_diagnostics_register
use cospsimulator_intr, only: cospsimulator_intr_register
use rad_constituents, only: rad_cnst_get_info ! Added to query if it is a modal aero sim or not
use radheat, only: radheat_register
use subcol, only: subcol_register
Expand Down Expand Up @@ -325,6 +326,9 @@ subroutine phys_register
call cloud_diagnostics_register
call radheat_register

! COSP
call cospsimulator_intr_register

! vertical diffusion
call vd_register()
else
Expand Down
4 changes: 4 additions & 0 deletions src/physics/cam_dev/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ subroutine phys_register
use aircraft_emit, only: aircraft_emit_register
use cam_diagnostics, only: diag_register
use cloud_diagnostics, only: cloud_diagnostics_register
use cospsimulator_intr, only: cospsimulator_intr_register
use rad_constituents, only: rad_cnst_get_info ! Added to query if it is a modal aero sim or not
use radheat, only: radheat_register
use subcol, only: subcol_register
Expand Down Expand Up @@ -301,6 +302,9 @@ subroutine phys_register
call cloud_diagnostics_register
call radheat_register

! COSP
call cospsimulator_intr_register

! vertical diffusion
call vd_register()
else
Expand Down

0 comments on commit 168c302

Please sign in to comment.