Skip to content

Commit

Permalink
address next chunk of reviewer comments; through cam_history_support
Browse files Browse the repository at this point in the history
  • Loading branch information
peverwhee committed Sep 5, 2024
1 parent 0784bcf commit 68b73b5
Show file tree
Hide file tree
Showing 12 changed files with 724 additions and 456 deletions.
19 changes: 15 additions & 4 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ end subroutine cam_run4
!
!-----------------------------------------------------------------------
!
subroutine cam_timestep_final(rstwr, nlend, do_ncdata_check)
subroutine cam_timestep_final(rstwr, nlend, do_ncdata_check, do_history_write)
!-----------------------------------------------------------------------
!
! Purpose: Timestep final runs at the end of each timestep
Expand All @@ -444,12 +444,23 @@ subroutine cam_timestep_final(rstwr, nlend, do_ncdata_check)
!Flag for whether a snapshot (ncdata) check should be run or not
! - flag is true if this is not the first or last step
logical, intent(in) :: do_ncdata_check
!Flag for whether to perform the history write
logical, optional, intent(in) :: do_history_write

if (do_ncdata_check .or. get_nstep() == 0) then
logical :: history_write_loc

if (present(do_history_write)) then
history_write_loc = do_history_write
else
history_write_loc = .true.
end if

if (history_write_loc) then
call history_write_files()
! peverwhee - todo: handle restarts
call history_wrap_up(rstwr, nlend)
end if
! peverwhee - todo: handle restarts
call history_wrap_up(rstwr, nlend)

!
!----------------------------------------------------------
! PHYS_TIMESTEP_FINAL Call the Physics package
Expand Down
19 changes: 9 additions & 10 deletions src/control/cam_physics_control.F90
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module cam_physics_control
!------------------------------------------------------------------------------
!
! High level control variables. Information received from the driver/coupler is
! stored here.
! High level physics control variables. Information received from the
! driver/coupler is stored here.
!
!------------------------------------------------------------------------------

Expand All @@ -19,15 +19,8 @@ module cam_physics_control
!
! cam_ctrl_set_physics_type

logical, protected :: adiabatic ! true => no physics
logical, protected :: ideal_phys ! true => run Held-Suarez (1994) physics
logical, protected :: kessler_phys ! true => run Kessler physics
logical, protected :: tj2016_phys ! true => run tj2016 physics
logical, protected :: grayrad_phys ! true => run gray radiation (frierson) physics
logical, protected :: simple_phys ! true => adiabatic or ideal_phys or kessler_phys
! or tj2016 or grayrad
logical, protected :: moist_physics ! true => moist physics enabled, i.e.,
! (.not. ideal_phys) .and. (.not. adiabatic)


!==============================================================================
Expand All @@ -45,6 +38,12 @@ subroutine cam_ctrl_set_physics_type()
character(len=SHR_KIND_CS), allocatable :: suite_names(:)
! suite_name: CCPP suite we are running
character(len=SHR_KIND_CS) :: suite_name
logical :: adiabatic
logical :: ideal_phys
logical :: kessler_phys
logical :: tj2016_phys
logical :: grayrad_phys
logical :: moist_physics

character(len=*), parameter :: subname = 'cam_ctrl_set_physics_type'

Expand All @@ -69,7 +68,7 @@ subroutine cam_ctrl_set_physics_type()
if (masterproc) then
if (adiabatic) then
write(iulog,*) 'Run model ADIABATICALLY (i.e. no physics)'
write(iulog,*) ' Global energy fixer is on for non-Eulerian dycores.'
write(iulog,*) ' Global energy fixer is on for dycores.'
else if (ideal_phys) then
write(iulog,*) 'Run model with Held-Suarez physics forcing'
else if (kessler_phys) then
Expand Down
5 changes: 4 additions & 1 deletion src/cpl/nuopc/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ subroutine ModelFinalize(gcomp, rc)
call ESMF_AlarmRingerOff( alarm, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
if (ChkErr(rc,__LINE__,u_FILE_u)) return
rstwr = .false.
endif

Expand All @@ -1444,12 +1445,14 @@ subroutine ModelFinalize(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
nlend = .true.
else
if (ChkErr(rc,__LINE__,u_FILE_u)) return
nlend = .false.
endif

call cam_timestep_final(rstwr, nlend, do_ncdata_check=.false.)
call cam_timestep_final(rstwr, nlend, do_ncdata_check=.false., do_history_write=.false.)
call cam_final(cam_out, cam_in)

if (masterproc) then
Expand Down
27 changes: 0 additions & 27 deletions src/data/registry_v1_0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,6 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="netcdf_name_type">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z][A-Za-z0-9_]{0,256}"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="avgflag_type">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z][A-Za-z_]{0,3}"/>
</xs:restriction>
</xs:simpleType>

<!-- attributes -->

<xs:attribute name="access" type="access_type"/>
Expand Down Expand Up @@ -137,10 +125,6 @@
<xs:list itemType="input_name_type"/>
</xs:simpleType>

<xs:simpleType name="netcdf_variable_names">
<xs:list itemType="netcdf_name_type"/>
</xs:simpleType>

<!-- definition of complex types -->

<xs:complexType name="initial_value">
Expand All @@ -151,21 +135,11 @@
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="diagnostic_type">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="netcdf_name_type" />
<xs:attribute name="flag" type="netcdf_name_type" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="array_element_type">
<xs:sequence>
<xs:element name="long_name" type="xs:string" minOccurs="0"/>
<xs:element name="initial_value" type="initial_value" minOccurs="0"/>
<xs:element name="ic_file_input_names" type="ic_file_input_names" minOccurs="0"/>
<xs:element name="diagnostic" type="diagnostic_type" minOccurs="0"/>
</xs:sequence>
<xs:attribute ref="standard_name" use="required"/>
<xs:attribute ref="units" use="optional"/>
Expand All @@ -185,7 +159,6 @@
<xs:element name="dimensions" type="dimensions" minOccurs="0"/>
<xs:element name="initial_value" type="initial_value" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ic_file_input_names" type="ic_file_input_names" minOccurs="0"/>
<xs:element name="diagnostic" type="diagnostic_type" minOccurs="0"/>
</xs:sequence>
<xs:attribute ref="local_name" use="required"/>
<xs:attribute ref="standard_name" use="required"/>
Expand Down
1 change: 1 addition & 0 deletions src/dynamics/utils/hycoef.F90
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ subroutine hycoef_init(file, psdry)
if (dry_coord) then
call add_vert_coord('lev', pver, &
'hybrid level at midpoints (1000*(A+B))', 'hPa', alev, &
standard_name='atmosphere_hybrid_sigma_pressure_coordinate', &
positive='down')
call add_hist_coord('hyam', pver, &
'hybrid A coefficient at layer midpoints', '1', hyam, dimname='lev')
Expand Down
6 changes: 3 additions & 3 deletions src/history/cam_hist_file.F90
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@ subroutine config_configure(this, volume, out_prec, max_frames, &
inst_fields, avg_fields, min_fields, max_fields, var_fields, &
write_nstep0, interp_out, interp_nlat, interp_nlon, interp_grid, &
interp_type)
use shr_string_mod, only: to_lower => shr_string_toLower
use string_utils, only: parse_multiplier
use cam_abortutils, only: endrun, check_allocate
use shr_string_mod, only: to_lower => shr_string_toLower
use cam_history_support, only: parse_multiplier
use cam_abortutils, only: endrun, check_allocate
! Dummy arguments
class(hist_file_t), intent(inout) :: this
character(len=*), intent(in) :: volume
Expand Down
Loading

0 comments on commit 68b73b5

Please sign in to comment.