<p><b>duda</b> 2011-07-20 15:54:34 -0600 (Wed, 20 Jul 2011)</p><p>BRANCH COMMIT<br>
<br>
Add changes to I/O and registry infrastructure to support periodic input<br>
on a separate stream.<br>
<br>
To make use of this functionality, a core will need to:<br>
<br>
0. Add 's' to the I/O attributes of a field in the Registry file<br>
<br>
1. Declare a new variable of type io_input_object, setting the 'stream'<br>
component of the type to STREAM_SFC<br>
<br>
2. Call io_input_init(...) for the new io_input_object type<br>
<br>
3. Periodically call read_and_distribute_fields(...) after setting <br>
the time frame to read in the new io_input_object type to read <br>
in all fields marked as being input on stream 's' (compared with i, r, and o)<br>
<br>
4. Call io_input_finalize(...) for the new io_input_type before completing<br>
the simulation<br>
<br>
Using this new functionality as described above, one can now choose to<br>
read the SST field from the new input stream, e.g., using<br>
<br>
var persistent real sst ( nCells Time ) 1 sro sst sfc_input - -<br>
<br>
<br>
M src/registry/registry_types.h<br>
M src/registry/gen_inc.c<br>
M src/registry/parse.c<br>
M src/framework/module_io_input.F<br>
M src/framework/module_grid_types.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/framework/module_grid_types.F
===================================================================
--- branches/atmos_physics/src/framework/module_grid_types.F        2011-07-19 23:39:41 UTC (rev 924)
+++ branches/atmos_physics/src/framework/module_grid_types.F        2011-07-20 21:54:34 UTC (rev 925)
@@ -11,6 +11,7 @@
integer, dimension(4) :: start
integer, dimension(4) :: count
logical :: input
+ logical :: sfc
logical :: restart
logical :: output
end type io_info
Modified: branches/atmos_physics/src/framework/module_io_input.F
===================================================================
--- branches/atmos_physics/src/framework/module_io_input.F        2011-07-19 23:39:41 UTC (rev 924)
+++ branches/atmos_physics/src/framework/module_io_input.F        2011-07-20 21:54:34 UTC (rev 925)
@@ -10,9 +10,12 @@
use zoltan_interface
#endif
+ integer, parameter :: STREAM_INPUT=1, STREAM_SFC=2, STREAM_RESTART=3
+
type io_input_object
character (len=1024) :: filename
integer :: rd_ncid
+ integer :: stream
integer :: time
@@ -36,7 +39,17 @@
module procedure io_input_field3dReal_time
module procedure io_input_field1dInteger_time
end interface io_input_field_time
+
+ type (exchange_list), pointer :: sendCellList, recvCellList
+ type (exchange_list), pointer :: sendEdgeList, recvEdgeList
+ type (exchange_list), pointer :: sendVertexList, recvVertexList
+ type (exchange_list), pointer :: sendVertLevelList, recvVertLevelList
+ integer :: readCellStart, readCellEnd, nReadCells
+ integer :: readEdgeStart, readEdgeEnd, nReadEdges
+ integer :: readVertexStart, readVertexEnd, nReadVertices
+ integer :: readVertLevelStart, readVertLevelEnd, nReadVertLevels
+
contains
@@ -54,11 +67,6 @@
character (len=16) :: c_on_a_sphere
real (kind=RKIND) :: r_sphere_radius
- integer :: readCellStart, readCellEnd, nReadCells
- integer :: readEdgeStart, readEdgeEnd, nReadEdges
- integer :: readVertexStart, readVertexEnd, nReadVertices
- integer :: readVertLevelStart, readVertLevelEnd, nReadVertLevels
-
type (field1dInteger) :: indexToCellIDField
type (field1dInteger) :: indexToEdgeIDField
type (field1dInteger) :: indexToVertexIDField
@@ -103,10 +111,6 @@
integer, dimension(:), pointer :: local_cell_list, local_edge_list, local_vertex_list
integer, dimension(:), pointer :: local_vertlevel_list, needed_vertlevel_list
integer :: nlocal_edges, nlocal_vertices
- type (exchange_list), pointer :: sendCellList, recvCellList
- type (exchange_list), pointer :: sendEdgeList, recvEdgeList
- type (exchange_list), pointer :: sendVertexList, recvVertexList
- type (exchange_list), pointer :: sendVertLevelList, recvVertLevelList
type (exchange_list), pointer :: send1Halo, recv1Halo
type (exchange_list), pointer :: send2Halo, recv2Halo
type (graph) :: partial_global_graph_info
@@ -118,8 +122,10 @@
if (config_do_restart) then
input_obj % filename = trim(config_restart_name)
+ input_obj % stream = STREAM_RESTART
else
input_obj % filename = trim(config_input_name)
+ input_obj % stream = STREAM_INPUT
end if
call io_input_init(input_obj, domain % dminfo)
@@ -1063,10 +1069,12 @@
if (nferr /= NF_NOERR) then
write(0,*) ' '
- if (config_do_restart) then
+ if (input_obj % stream == STREAM_RESTART) then
write(0,*) 'Error opening restart file ''', trim(input_obj % filename), ''''
- else
+ else if (input_obj % stream == STREAM_INPUT) then
write(0,*) 'Error opening input file ''', trim(input_obj % filename), ''''
+ else if (input_obj % stream == STREAM_SFC) then
+ write(0,*) 'Error opening sfc file ''', trim(input_obj % filename), ''''
end if
write(0,*) ' '
call dmpar_abort(dminfo)
Modified: branches/atmos_physics/src/registry/gen_inc.c
===================================================================
--- branches/atmos_physics/src/registry/gen_inc.c        2011-07-19 23:39:41 UTC (rev 924)
+++ branches/atmos_physics/src/registry/gen_inc.c        2011-07-20 21:54:34 UTC (rev 925)
@@ -574,6 +574,11 @@
else
fortprintf(fd, " %s %% %s %% ioinfo %% input = .false.</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array);
+ if (var_ptr2->iostreams & SFC0)
+ fortprintf(fd, " %s %% %s %% ioinfo %% sfc = .true.</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array);
+ else
+ fortprintf(fd, " %s %% %s %% ioinfo %% sfc = .false.</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array);
+
if (var_ptr2->iostreams & RESTART0)
fortprintf(fd, " %s %% %s %% ioinfo %% restart = .true.</font>
<font color="gray">", group_ptr->name, var_ptr2->super_array);
else
@@ -620,6 +625,11 @@
else
fortprintf(fd, " %s %% %s %% ioinfo %% input = .false.</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code);
+ if (var_ptr->iostreams & SFC0)
+ fortprintf(fd, " %s %% %s %% ioinfo %% sfc = .true.</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code);
+ else
+ fortprintf(fd, " %s %% %s %% ioinfo %% sfc = .false.</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code);
+
if (var_ptr->iostreams & RESTART0)
fortprintf(fd, " %s %% %s %% ioinfo %% restart = .true.</font>
<font color="gray">", group_ptr->name, var_ptr->name_in_code);
else
@@ -1217,12 +1227,14 @@
else if (var_ptr->vtype == REAL) sprintf(vtype, "real");
if (strncmp(var_ptr->super_array, "-", 1024) != 0) {
- fortprintf(fd, " if ((%s %% %s %% ioinfo %% input .and. .not. config_do_restart) .or. &</font>
<font color="red">", struct_deref, var_ptr->super_array);
- fortprintf(fd, " (%s %% %s %% ioinfo %% restart .and. config_do_restart)) then</font>
<font color="blue">", struct_deref, var_ptr->super_array);
+ fortprintf(fd, " if ((%s %% %s %% ioinfo %% input .and. input_obj %% stream == STREAM_INPUT) .or. &</font>
<font color="blue">", struct_deref, var_ptr->super_array);
+ fortprintf(fd, " (%s %% %s %% ioinfo %% sfc .and. input_obj %% stream == STREAM_SFC) .or. &</font>
<font color="blue">", struct_deref, var_ptr->super_array);
+ fortprintf(fd, " (%s %% %s %% ioinfo %% restart .and. input_obj %% stream == STREAM_RESTART)) then</font>
<font color="red">", struct_deref, var_ptr->super_array);
}
else {
- fortprintf(fd, " if ((%s %% %s %% ioinfo %% input .and. .not. config_do_restart) .or. &</font>
<font color="red">", struct_deref, var_ptr->name_in_code);
- fortprintf(fd, " (%s %% %s %% ioinfo %% restart .and. config_do_restart)) then</font>
<font color="blue">", struct_deref, var_ptr->name_in_code);
+ fortprintf(fd, " if ((%s %% %s %% ioinfo %% input .and. input_obj %% stream == STREAM_INPUT) .or. &</font>
<font color="blue">", struct_deref, var_ptr->name_in_code);
+ fortprintf(fd, " (%s %% %s %% ioinfo %% sfc .and. input_obj %% stream == STREAM_SFC) .or. &</font>
<font color="blue">", struct_deref, var_ptr->name_in_code);
+ fortprintf(fd, " (%s %% %s %% ioinfo %% restart .and. input_obj %% stream == STREAM_RESTART)) then</font>
<font color="gray">", struct_deref, var_ptr->name_in_code);
}
while (dimlist_ptr) {
if (i < var_ptr->ndims) {
Modified: branches/atmos_physics/src/registry/parse.c
===================================================================
--- branches/atmos_physics/src/registry/parse.c        2011-07-19 23:39:41 UTC (rev 924)
+++ branches/atmos_physics/src/registry/parse.c        2011-07-20 21:54:34 UTC (rev 925)
@@ -195,6 +195,7 @@
*/
getword(regfile, word);
if (strchr(word, (int)'i')) var_ptr->iostreams |= INPUT0;
+ if (strchr(word, (int)'s')) var_ptr->iostreams |= SFC0;
if (strchr(word, (int)'r')) var_ptr->iostreams |= RESTART0;
if (strchr(word, (int)'o')) var_ptr->iostreams |= OUTPUT0;
Modified: branches/atmos_physics/src/registry/registry_types.h
===================================================================
--- branches/atmos_physics/src/registry/registry_types.h        2011-07-19 23:39:41 UTC (rev 924)
+++ branches/atmos_physics/src/registry/registry_types.h        2011-07-20 21:54:34 UTC (rev 925)
@@ -9,6 +9,7 @@
#define INPUT0 0x00000001
#define RESTART0 0x00000002
#define OUTPUT0 0x00000004
+#define SFC0 0x00000008
#define NEW_NAMELIST(X) X = (struct namelist *)malloc(sizeof(struct namelist)); X->next = NULL;
#define NEW_DIMENSION(X) X = (struct dimension *)malloc(sizeof(struct dimension)); X->next = NULL;
</font>
</pre>