<p><b>duda</b> 2010-05-12 16:31:47 -0600 (Wed, 12 May 2010)</p><p>BRANCH COMMIT<br>
<br>
Write output files from MPAS every config_output_interval dynamics<br>
timesteps when MPAS is being driven through the CAM-MPAS interface<br>
routines. <br>
<br>
M module_mpas_cam_interface.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F
===================================================================
--- branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F        2010-05-12 20:15:56 UTC (rev 266)
+++ branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F        2010-05-12 22:31:47 UTC (rev 267)
@@ -12,6 +12,7 @@
type (domain_type), pointer :: domain
real (kind=RKIND) :: dt_dynamics, dt_physics, p0
integer :: itimestep, n_subcycle_steps
+ type (io_output_object) :: output_obj
contains
@@ -50,6 +51,8 @@
call read_namelist(dminfo)
+ itimestep = 0
+
!
! Set physics timestep and verify that it is evenly divided by dynamics timestep
!
@@ -583,6 +586,10 @@
call mpas_init(block_ptr, block_ptr % mesh, dt_dynamics)
block_ptr => block_ptr % next
end do
+
+ output_frame = 1
+ call output_state_init(output_obj, domain, "OUTPUT")
+ call output_state_for_domain(output_obj, domain, output_frame)
end subroutine mpas_init2
@@ -838,13 +845,17 @@
write(0,*) 'Called MPAS_DYN_RUN'
- itimestep = 1
-
do idynstep=1,n_subcycle_steps
+ itimestep = itimestep + 1
call mpas_timestep(domain, itimestep, dt_dynamics)
! Move time level 2 fields back into time level 1 for next time step
call shift_time_levels(domain)
+
+ if (mod(itimestep, config_output_interval) == 0) then
+ output_frame = output_frame + 1
+ call output_state_for_domain(output_obj, domain, output_frame)
+ end if
end do
end subroutine mpas_dyn_run
@@ -865,9 +876,7 @@
write(0,*) 'Called MPAS_WRITE_OUTPUT'
- call output_state_init(output_obj, domain, "OUTPUT")
call output_state_for_domain(output_obj, domain, 1)
- call output_state_finalize(output_obj, domain % dminfo)
end subroutine mpas_write_output
!************** TEST ROUTINE -- NOT PART OF CAM-MPAS INTERFACE *************
@@ -886,6 +895,7 @@
write(0,*) 'Called MPAS_FINAL'
+ call output_state_finalize(output_obj, domain % dminfo)
call deallocate_domain(domain)
call dmpar_finalize(dminfo)
</font>
</pre>