Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@
<option name="comment">Test for SE-CSLAM dycore (with TJ2016 [moist Held-Suarez] physics)</option>
</options>
</test>
<test compset="FADIAB" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln9" testmods="cam/outfrq_se_cslam">
<machines>
<machine name="derecho" compiler="intel" category="aux_sima"/>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment">Test for SE-CSLAM dycore with dry adiabatic settings (no physics forcings)</option>
</options>
</test>

<!-- CAM7 physics tests -->
<test compset="FCAM7" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln9" testmods="cam/outfrq_se_cslam_analy_ic">
Expand Down
32 changes: 7 additions & 25 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
eccen, obliqr, lambm0, mvelpp, &
perpetual_run, perpetual_ymd, &
dtime, start_ymd, start_tod, ref_ymd, ref_tod, &
stop_ymd, stop_tod, curr_ymd, curr_tod, &
cam_out, cam_in)
stop_ymd, stop_tod, curr_ymd, curr_tod)

!-----------------------------------------------------------------------
!
Expand Down Expand Up @@ -145,9 +144,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
integer, intent(in) :: ref_ymd ! Reference date (YYYYMMDD)
integer, intent(in) :: ref_tod ! Reference time of day (sec)

type(cam_out_t), pointer :: cam_out ! Output from CAM to surface
type(cam_in_t), pointer :: cam_in ! Merged input state to CAM

! Local variables
character(len=cs) :: filein ! Input namelist filename
integer :: errflg
Expand Down Expand Up @@ -345,7 +341,7 @@ end subroutine cam_timestep_init
!
!-----------------------------------------------------------------------
!
subroutine cam_run1(cam_in, cam_out)
subroutine cam_run1()
!-----------------------------------------------------------------------
!
! Purpose: First phase of atmosphere model run method.
Expand All @@ -357,9 +353,6 @@ subroutine cam_run1(cam_in, cam_out)
use phys_comp, only: phys_run1
! use ionosphere_interface, only: ionosphere_run1

type(cam_in_t), pointer, intent(inout) :: cam_in ! Input from surface to CAM
type(cam_out_t), pointer, intent(inout) :: cam_out ! Output from CAM to surface

!----------------------------------------------------------
! first phase of ionosphere -- write to IC file if needed
!----------------------------------------------------------
Expand All @@ -381,7 +374,7 @@ end subroutine cam_run1
!-----------------------------------------------------------------------
!

subroutine cam_run2(cam_out, cam_in)
subroutine cam_run2()
!-----------------------------------------------------------------------
!
! Purpose: Second phase of atmosphere model run method.
Expand All @@ -396,9 +389,6 @@ subroutine cam_run2(cam_out, cam_in)
use stepon, only: stepon_run2
! use ionosphere_interface, only: ionosphere_run2

type(cam_out_t), pointer, intent(inout) :: cam_out ! Output from CAM to surface
type(cam_in_t), pointer, intent(inout) :: cam_in ! Input from surface to CAM

!
! Second phase of physics (after surface model update)
!
Expand Down Expand Up @@ -428,7 +418,7 @@ end subroutine cam_run2
!-----------------------------------------------------------------------
!

subroutine cam_run3(cam_out)
subroutine cam_run3()
!-----------------------------------------------------------------------
!
! Purpose: Third phase of atmosphere model run method. This consists
Expand All @@ -438,8 +428,8 @@ subroutine cam_run3(cam_out)
!
!-----------------------------------------------------------------------
use stepon, only: stepon_run3
use physics_types, only: cam_out ! Output from CAM to surface
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example that will work instead of passing in through the subroutine. In the end they're all the same object.


type(cam_out_t), pointer, intent(inout) :: cam_out ! Output from CAM to surface
!-----------------------------------------------------------------------

!
Expand All @@ -457,7 +447,7 @@ end subroutine cam_run3
!-----------------------------------------------------------------------
!

subroutine cam_run4(cam_out, cam_in, rstwr, nlend, &
subroutine cam_run4(rstwr, nlend, &
yr_spec, mon_spec, day_spec, sec_spec)

!-----------------------------------------------------------------------
Expand All @@ -470,8 +460,6 @@ subroutine cam_run4(cam_out, cam_in, rstwr, nlend, &
! use cam_restart, only: cam_write_restart
! use qneg_module, only: qneg_print_summary

type(cam_out_t), intent(inout) :: cam_out ! Output from CAM to surface
type(cam_in_t), intent(inout) :: cam_in ! Input from surface to CAM
logical, intent(in) :: rstwr ! write restart file
logical, intent(in) :: nlend ! this is final timestep
integer, intent(in), optional :: yr_spec ! Simulation year
Expand Down Expand Up @@ -549,7 +537,7 @@ end subroutine cam_timestep_final
!-----------------------------------------------------------------------
!

subroutine cam_final(cam_out, cam_in)
subroutine cam_final()
!-----------------------------------------------------------------------
!
! Purpose: CAM finalization.
Expand All @@ -561,12 +549,6 @@ subroutine cam_final(cam_out, cam_in)
! use ionosphere_interface, only: ionosphere_final
use cam_control_mod, only: initial_run

!
! Arguments
!
type(cam_out_t), pointer :: cam_out ! Output from CAM to surface
type(cam_in_t), pointer :: cam_in ! Input from merged surface to CAM

!-----------------------------------------------------------------------

call phys_final()
Expand Down
24 changes: 10 additions & 14 deletions src/cpl/nuopc/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module atm_comp_nuopc
use cam_instance , only : cam_instance_init, inst_suffix, inst_index
use cam_comp , only : cam_init, cam_run1, cam_run2, cam_run3, cam_run4, cam_final
use cam_comp , only : cam_timestep_init, cam_timestep_final
use physics_types , only : cam_out_t, cam_in_t
use physics_types , only : cam_out, cam_in
! use radiation , only : nextsw_cday !uncomment once radiation has been CCPP-ized -JN
use cam_logfile , only : cam_set_log_unit, iulog
use cam_abortutils , only : check_allocate
Expand Down Expand Up @@ -108,8 +108,6 @@ module atm_comp_nuopc
integer :: nthrds
integer :: ierr ! allocate status
integer , parameter :: dbug_flag = 0
type(cam_in_t) , pointer :: cam_in
type(cam_out_t) , pointer :: cam_out
integer , pointer :: dof(:) ! global index space decomposition
character(len=256) :: rsfilename_spec_cam ! Filename specifier for restart surface file
character(*) ,parameter :: modName = "(atm_comp_nuopc)"
Expand Down Expand Up @@ -664,9 +662,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
stop_ymd=stop_ymd, &
stop_tod=stop_tod, &
curr_ymd=curr_ymd, &
curr_tod=curr_tod, &
cam_out=cam_out, &
cam_in=cam_in)
curr_tod=curr_tod)

if (mediator_present) then

Expand Down Expand Up @@ -918,7 +914,7 @@ subroutine DataInitialize(gcomp, rc)
call import_fields( gcomp, cam_in, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call cam_timestep_init()
call cam_run1 ( cam_in, cam_out )
call cam_run1 ()
call export_fields( gcomp, model_mesh, model_clock, cam_out, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
Expand All @@ -927,7 +923,7 @@ subroutine DataInitialize(gcomp, rc)
call import_fields( gcomp, cam_in, restart_init=.true., rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call cam_timestep_init()
call cam_run1 ( cam_in, cam_out )
call cam_run1 ()
call export_fields( gcomp, model_mesh, model_clock, cam_out, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
Expand Down Expand Up @@ -980,7 +976,7 @@ subroutine DataInitialize(gcomp, rc)
!---------------------------------------------------------------

call cam_timestep_init()
call cam_run1 ( cam_in, cam_out )
call cam_run1 ()

call NUOPC_CompAttributeSet(gcomp, name="InitializeDataComplete", value="true", rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -1156,15 +1152,15 @@ subroutine ModelAdvance(gcomp, rc)
! This includes the "physics_after_coupler" CCPP physics group.

call t_startf ('CAM_run2')
call cam_run2( cam_out, cam_in )
call cam_run2()
call t_stopf ('CAM_run2')

call t_startf ('CAM_run3')
call cam_run3( cam_out )
call cam_run3()
call t_stopf ('CAM_run3')

call t_startf ('CAM_run4')
call cam_run4( cam_out, cam_in, rstwr, nlend, &
call cam_run4( rstwr, nlend, &
yr_spec=yr_sync, mon_spec=mon_sync, day_spec=day_sync, sec_spec=tod_sync)
call t_stopf ('CAM_run4')
call cam_timestep_final(rstwr, nlend, do_ncdata_check=do_ncdata_check)
Expand All @@ -1180,7 +1176,7 @@ subroutine ModelAdvance(gcomp, rc)
! This includes the "physics_before_coupler" CCPP physics group.

call t_startf ('CAM_run1')
call cam_run1 ( cam_in, cam_out )
call cam_run1 ()
call t_stopf ('CAM_run1')

end do
Expand Down Expand Up @@ -1453,7 +1449,7 @@ subroutine ModelFinalize(gcomp, rc)
endif

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

if (masterproc) then
write(iulog,F91)
Expand Down
31 changes: 25 additions & 6 deletions src/utils/cam_field_read.F90
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,28 @@ subroutine infld_real8_3d(varname, ncid, field, readvar, dim3name, &
!
! Ensure that <field> is configured correctly
if (dim_bounds(2,2) < dim_bounds(2,1)) then
if (present(gridname)) then
write(errormsg, *) ': grid, ', trim(gridname), &
' invalid for3D field'
if(unstruct) then
! Unstructured grid expects that a second dimension does not
! exist horizontally. Receive vertical dimension from caller
if (present(dim3_pos)) then
if ((dim3_pos < 1) .or. (dim3_pos > 3)) then
call safe_endrun(subname//': Bad value for dim3_pos')
end if
index = dim3_pos
else
index = 2
end if
dim_bounds(index,1) = dim3_bnds(1)
dim_bounds(index,2) = dim3_bnds(2)
else
write(errormsg, *) ': grid, physgrid, invalid for3D field'
end if
if (present(gridname)) then
write(errormsg, *) ': grid, ', trim(gridname), &
' invalid for 3D field'
else
write(errormsg, *) ': grid, physgrid, invalid for 3D field'
end if
call safe_endrun(subname//errormsg)
endif
else
if (present(dim3_pos)) then
if ((dim3_pos < 1) .or. (dim3_pos > 3)) then
Expand Down Expand Up @@ -866,7 +882,10 @@ subroutine infld_real8_3d(varname, ncid, field, readvar, dim3name, &
(grid_dimlens(1) * grid_dimlens(2))
call safe_endrun(subname//trim(errormsg))
end if
else
else if (unstruct) then
! Initialize index offset to remove vertical dimension from dimlens
! to be checked.
index = 0
do jndex = 1, target_ndims
if (trim(file_dnames(jndex)) == trim(dim3name)) then
! The vertical dimension may be in between array dims
Expand Down