<p><b>duda</b> 2012-10-04 14:33:36 -0600 (Thu, 04 Oct 2012)</p><p>BRANCH COMMIT<br>
<br>
Add active grid input and output streams, fully implemented in the init_nhyd_atmos and nhyd_atmos cores.<br>
<br>
<br>
M src/core_init_nhyd_atmos/mpas_init_atm_mpas_core.F<br>
M src/core_init_nhyd_atmos/Registry<br>
M src/driver/mpas_subdriver.F<br>
M src/core_nhyd_atmos/Registry<br>
M src/core_nhyd_atmos/mpas_atm_mpas_core.F<br>
M src/framework/mpas_io_input.F<br>
M src/framework/mpas_io_output.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/asd_io_work/src/core_init_nhyd_atmos/Registry
===================================================================
--- branches/asd_io_work/src/core_init_nhyd_atmos/Registry        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/core_init_nhyd_atmos/Registry        2012-10-04 20:33:36 UTC (rev 2190)
@@ -29,8 +29,10 @@
namelist logical preproc_stages config_input_sst false
namelist logical preproc_stages config_frac_seaice false
namelist character io config_input_name grid.nc
+namelist character io config_grid_input_name grid.nc
namelist character io config_sfc_update_name sfc_update.nc
namelist character io config_output_name init.nc
+namelist character io config_grid_output_name grid_init.nc
namelist character io config_restart_name restart.nc
namelist integer io config_frames_per_outfile 0
namelist integer io config_pio_num_iotasks 0
Modified: branches/asd_io_work/src/core_init_nhyd_atmos/mpas_init_atm_mpas_core.F
===================================================================
--- branches/asd_io_work/src/core_init_nhyd_atmos/mpas_init_atm_mpas_core.F        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/core_init_nhyd_atmos/mpas_init_atm_mpas_core.F        2012-10-04 20:33:36 UTC (rev 2190)
@@ -29,7 +29,7 @@
end subroutine mpas_core_init
- subroutine mpas_core_run(domain, output_obj, output_frame)
+ subroutine mpas_core_run(domain, output_obj, grid_output_obj, output_frame, grid_output_frame)
use mpas_grid_types
use mpas_io_output
@@ -40,7 +40,9 @@
type (domain_type), intent(inout) :: domain
type (io_output_object), intent(inout) :: output_obj
+ type (io_output_object), intent(inout) :: grid_output_obj
integer, intent(inout) :: output_frame
+ integer, intent(inout) :: grid_output_frame
call init_atm_setup_test_case(domain)
@@ -53,6 +55,7 @@
! call atm_initialize_deformation_weights(mesh)
call mpas_output_state_for_domain(output_obj, domain, output_frame)
+ call mpas_output_state_for_domain(grid_output_obj, domain, grid_output_frame)
end subroutine mpas_core_run
Modified: branches/asd_io_work/src/core_nhyd_atmos/Registry
===================================================================
--- branches/asd_io_work/src/core_nhyd_atmos/Registry        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/core_nhyd_atmos/Registry        2012-10-04 20:33:36 UTC (rev 2190)
@@ -38,8 +38,10 @@
namelist real damping config_zd 22000.0
namelist real damping config_xnutr 0.0
namelist character io config_input_name init.nc
+namelist character io config_grid_input_name init.nc
namelist character io config_sfc_update_name sfc_update.nc
namelist character io config_output_name output.nc
+namelist character io config_grid_output_name grid_output.nc
namelist character io config_restart_name restart.nc
namelist character io config_output_interval 06:00:00
namelist integer io config_frames_per_outfile 0
Modified: branches/asd_io_work/src/core_nhyd_atmos/mpas_atm_mpas_core.F
===================================================================
--- branches/asd_io_work/src/core_nhyd_atmos/mpas_atm_mpas_core.F        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/core_nhyd_atmos/mpas_atm_mpas_core.F        2012-10-04 20:33:36 UTC (rev 2190)
@@ -235,7 +235,7 @@
end subroutine atm_mpas_init_block
- subroutine mpas_core_run(domain, output_obj, output_frame)
+ subroutine mpas_core_run(domain, output_obj, grid_output_obj, output_frame, grid_output_frame)
use mpas_grid_types
use mpas_kind_types
@@ -246,7 +246,9 @@
type (domain_type), intent(inout) :: domain
type (io_output_object), intent(inout) :: output_obj
+ type (io_output_object), intent(inout) :: grid_output_obj
integer, intent(inout) :: output_frame
+ integer, intent(inout) :: grid_output_frame
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
@@ -260,6 +262,7 @@
dt = config_dt
call atm_write_output_frame(output_obj, output_frame, domain)
+ call atm_write_output_frame(grid_output_obj, grid_output_frame, domain)
! During integration, time level 1 stores the model state at the beginning of the
! time step, and time level 2 stores the state advanced dt in time by timestep(...)
@@ -299,8 +302,11 @@
if(output_frame == 1) then
call mpas_output_state_finalize(output_obj, domain % dminfo)
call mpas_output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp))
+ call mpas_output_state_finalize(grid_output_obj, domain % dminfo)
+ call mpas_output_state_init(grid_output_obj, domain, "GRID", trim(timeStamp))
end if
call atm_write_output_frame(output_obj, output_frame, domain)
+ call atm_write_output_frame(grid_output_obj, grid_output_frame, domain)
end if
if (mpas_is_alarm_ringing(clock, restartAlarmID, ierr=ierr)) then
Modified: branches/asd_io_work/src/driver/mpas_subdriver.F
===================================================================
--- branches/asd_io_work/src/driver/mpas_subdriver.F        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/driver/mpas_subdriver.F        2012-10-04 20:33:36 UTC (rev 2190)
@@ -7,7 +7,8 @@
type (dm_info), pointer :: dminfo
type (domain_type), pointer :: domain
type (io_output_object), save :: output_obj
- integer :: output_frame
+ type (io_output_object), save :: grid_output_obj
+ integer :: output_frame, grid_output_frame
contains
@@ -43,11 +44,14 @@
! Set up output streams to be written to by the MPAS core
!
output_frame = 1
+ grid_output_frame = 1
if(config_frames_per_outfile > 0) then
call mpas_output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp))
+ call mpas_output_state_init(grid_output_obj, domain, "GRID", trim(timeStamp))
else
call mpas_output_state_init(output_obj, domain, "OUTPUT")
+ call mpas_output_state_init(grid_output_obj, domain, "GRID")
end if
@@ -58,7 +62,7 @@
implicit none
- call mpas_core_run(domain, output_obj, output_frame)
+ call mpas_core_run(domain, output_obj, grid_output_obj, output_frame, grid_output_frame)
end subroutine mpas_run
@@ -71,6 +75,7 @@
! Finalize output streams
!
call mpas_output_state_finalize(output_obj, domain % dminfo)
+ call mpas_output_state_finalize(grid_output_obj, domain % dminfo)
!
Modified: branches/asd_io_work/src/framework/mpas_io_input.F
===================================================================
--- branches/asd_io_work/src/framework/mpas_io_input.F        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/framework/mpas_io_input.F        2012-10-04 20:33:36 UTC (rev 2190)
@@ -44,6 +44,7 @@
integer :: i, j, k
type (io_input_object) :: input_obj
+ type (io_input_object) :: grid_input_obj
#include "dim_decls.inc"
character (len=StrKIND) :: c_on_a_sphere
@@ -52,6 +53,7 @@
integer :: ierr
integer, dimension(:), pointer :: readIndices
type (MPAS_IO_Handle_type) :: inputHandle
+ type (MPAS_IO_Handle_type) :: gridInputHandle
type (field1dInteger), pointer :: indexToCellIDField
type (field1dInteger), pointer :: indexToEdgeIDField
@@ -130,6 +132,24 @@
call mpas_dmpar_abort(domain % dminfo)
end if
+ grid_input_obj % filename = trim(config_grid_input_name)
+ grid_input_obj % stream = STREAM_GRID
+ gridInputHandle = MPAS_io_open(trim(grid_input_obj % filename), MPAS_IO_READ, MPAS_IO_PNETCDF, ierr)
+ if (ierr /= MPAS_IO_NOERR) then
+ write(0,*) ' '
+ if (grid_input_obj % stream == STREAM_RESTART) then
+ write(0,*) 'Error opening restart file ''', trim(grid_input_obj % filename), ''''
+ else if (grid_input_obj % stream == STREAM_INPUT) then
+ write(0,*) 'Error opening input file ''', trim(grid_input_obj % filename), ''''
+ else if (grid_input_obj % stream == STREAM_SFC) then
+ write(0,*) 'Error opening sfc file ''', trim(grid_input_obj % filename), ''''
+ else if (grid_input_obj % stream == STREAM_GRID) then
+ write(0,*) 'Error opening grid file ''', trim(grid_input_obj % filename), ''''
+ end if
+ write(0,*) ' '
+ call mpas_dmpar_abort(domain % dminfo)
+ end if
+
!
! Read global number of cells/edges/vertices
!
@@ -158,12 +178,12 @@
! which cells/edges/vertices are owned by each block, and which are ghost
!
- call mpas_io_setup_cell_block_fields(inputHandle, nreadCells, readCellStart, readingBlock, maxEdges, indexTocellIDField, xCellField, &
+ call mpas_io_setup_cell_block_fields(gridInputHandle, nreadCells, readCellStart, readingBlock, maxEdges, indexTocellIDField, xCellField, &
yCellField, zCellField, nEdgesOnCellField, cellsOnCellField, edgesOnCellField, verticesOnCellField)
- call mpas_io_setup_edge_block_fields(inputHandle, nReadEdges, readEdgeStart, readingBlock, indexToEdgeIDField, xEdgeField, yEdgeField, zEdgeField, cellsOnEdgeField)
+ call mpas_io_setup_edge_block_fields(gridInputHandle, nReadEdges, readEdgeStart, readingBlock, indexToEdgeIDField, xEdgeField, yEdgeField, zEdgeField, cellsOnEdgeField)
- call mpas_io_setup_vertex_block_fields(inputHandle, nReadVertices, readVertexStart, readingBlock, vertexDegree, indexToVertexIDField, &
+ call mpas_io_setup_vertex_block_fields(gridInputHandle, nReadVertices, readVertexStart, readingBlock, vertexDegree, indexToVertexIDField, &
xVertexField, yVertexField, zVertexField, cellsOnVertexField)
!
! Set up a graph derived data type describing the connectivity for the cells
@@ -215,6 +235,7 @@
call mpas_io_input_init(input_obj, domain % blocklist, domain % dminfo)
+ call mpas_io_input_init(grid_input_obj, domain % blocklist, domain % dminfo)
call MPAS_readStreamAtt(input_obj % io_stream, 'sphere_radius', r_sphere_radius, ierr)
if (ierr /= MPAS_STREAM_NOERR) then
@@ -253,17 +274,19 @@
if (.not. config_do_restart) then
input_obj % time = 1
+ grid_input_obj % time = 1
else
!
! If doing a restart, we need to decide which time slice to read from the
! restart file
!
+!MGD IO MAY NEED TO SEEK BASED ON GRID STREAM AND COPY TIME SLICE TO INPUT STREAM?
input_obj % time = MPAS_seekStream(input_obj % io_stream, config_start_time, MPAS_STREAM_EXACT_TIME, timeStamp, ierr)
+ grid_input_obj % time = MPAS_seekStream(grid_input_obj % io_stream, config_start_time, MPAS_STREAM_EXACT_TIME, timeStamp, ierr)
if (ierr == MPAS_IO_ERR) then
write(0,*) 'Error: restart file '//trim(filename)//' did not contain time '//trim(config_start_time)
call mpas_dmpar_abort(domain % dminfo)
end if
-!write(0,*) 'MGD DEBUGGING time = ', input_obj % time
write(0,*) 'Restarting model from time ', timeStamp
end if
@@ -278,15 +301,19 @@
! {send,recv}{Cell,Edge,Vertex}List
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
call mpas_read_and_distribute_fields(input_obj)
+ call mpas_read_and_distribute_fields(grid_input_obj)
call mpas_io_input_finalize(input_obj, domain % dminfo)
+ call mpas_io_input_finalize(grid_input_obj, domain % dminfo)
call MPAS_io_close(inputHandle, ierr)
+ call MPAS_io_close(gridInputHandle, ierr)
!
! Exchange halos for all of the fields that were read from the input file
!
call mpas_exch_input_field_halos(domain, input_obj)
+ call mpas_exch_input_field_halos(domain, grid_input_obj)
call mpas_block_creator_reindex_block_fields(domain % blocklist)
Modified: branches/asd_io_work/src/framework/mpas_io_output.F
===================================================================
--- branches/asd_io_work/src/framework/mpas_io_output.F        2012-10-04 16:18:37 UTC (rev 2189)
+++ branches/asd_io_work/src/framework/mpas_io_output.F        2012-10-04 20:33:36 UTC (rev 2190)
@@ -58,7 +58,12 @@
! Keep filename as whatever was set by the user
output_obj % stream = SFC
else if (trim(stream) == 'GRID') then
- ! Keep filename as whatever was set by the user
+ if(present(outputSuffix)) then
+ call mpas_insert_string_suffix(config_grid_output_name, outputSuffix, tempfilename)
+ else
+ tempfilename = config_grid_output_name
+ end if
+ output_obj % filename = trim(tempfilename)
output_obj % stream = GRID
end if
@@ -345,7 +350,13 @@
integer :: nferr, ierr
integer, dimension(10) :: dimlist
- call MPAS_createStream(output_obj % io_stream, trim(output_obj % filename), MPAS_IO_PNETCDF, MPAS_IO_WRITE, 1, nferr)
+ if (output_obj % stream == OUTPUT) then
+ call MPAS_createStream(output_obj % io_stream, trim(output_obj % filename), MPAS_IO_PNETCDF, MPAS_IO_WRITE, 1, nferr)
+ else if (output_obj % stream == GRID) then
+ call MPAS_createStream(output_obj % io_stream, trim(output_obj % filename), MPAS_IO_PNETCDF, MPAS_IO_WRITE, 1, nferr)
+ else
+ call MPAS_createStream(output_obj % io_stream, trim(output_obj % filename), MPAS_IO_PNETCDF, MPAS_IO_WRITE, 1, nferr)
+ end if
#include "add_output_fields.inc"
</font>
</pre>