[cig-commits] r13437 - in long/3D/Gale/trunk: . src/Underworld/plugins/Output/VTKOutput

walter at geodynamics.org walter at geodynamics.org
Tue Dec 2 01:27:33 PST 2008


Author: walter
Date: 2008-12-02 01:27:31 -0800 (Tue, 02 Dec 2008)
New Revision: 13437

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
Log:
 r2392 at dante:  boo | 2008-12-02 01:26:03 -0800
 Make VTKOutput use timeStep-1 rather than timeStep, because that is when the data is really valid



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2390
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2392

Modified: long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c	2008-12-02 09:08:06 UTC (rev 13436)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c	2008-12-02 09:27:31 UTC (rev 13437)
@@ -86,9 +86,10 @@
 void VTKOutput_particles(IntegrationPointsSwarm*  picswarm, 
                          double defaultDiffusivity,
                          int stepping,
-                         char *outputPath, int timeStep, int dim, int myRank,
-                         int nprocs);
-void VTKOutput_fields(void *context, int myRank, int nprocs);
+                         char *outputPath, const int timeStep,
+                         int dim, int myRank, int nprocs);
+void VTKOutput_fields(void *context, int myRank, int nprocs,
+                      const int timeStep);
 
 void VTKOutput( void* _context ) {
 	UnderworldContext*	context = (UnderworldContext*)_context;
@@ -104,8 +105,11 @@
 	MPI_Comm_rank( comm, (int*)&myRank );
         MPI_Comm_size( comm, (int*)&nprocs );
 
-        /* Only dump if at the right time step. */
-        if(context->timeStep % context->dumpEvery != 0)
+        /* Only dump if at the right time step.  We use timeStep-1,
+           because we are outputing after a solve, but before
+           advection.  So timeStep-1 makes more sense in terms of when
+           the simulation looks like this. */
+        if((context->timeStep-1) % context->dumpEvery != 0)
           return;
 	
         /* Write the particles and then all of the fields. */
@@ -115,15 +119,15 @@
                             (dictionary,"defaultDiffusivity",1.0),
                             Dictionary_GetInt_WithDefault
                             (dictionary,"particleStepping",1),
-                            context->outputPath, context->timeStep,
+                            context->outputPath, context->timeStep-1,
                             context->dim,myRank,nprocs);
-        VTKOutput_fields(context,myRank,nprocs);
+        VTKOutput_fields(context,myRank,nprocs,context->timeStep-1);
 }
 
 void VTKOutput_particles(IntegrationPointsSwarm*  picswarm,
                          double defaultDiffusivity,
                          int stepping, char *outputPath,
-                         int timeStep, int dim, int myRank, int nprocs) {
+                         const int timeStep, int dim, int myRank, int nprocs) {
   double *coord;
   int iteration, i;
   Particle_Index          num_particles = picswarm->particleLocalCount;
@@ -422,7 +426,8 @@
 
 
 /* Everything is stored on cell vertices. */
-void VTKOutput_fields(void *context, int myRank, int nprocs) {
+void VTKOutput_fields(void *context, int myRank, int nprocs,
+                      const int timeStep) {
   
   FiniteElementContext*     self = (FiniteElementContext*) context;
   Index var_I;
@@ -440,7 +445,7 @@
   /* Open the file */
 
   Stg_asprintf( &field_filename, "%s/fields.%d.%05d.vts", self->outputPath,
-                myRank, self->timeStep);
+                myRank, timeStep);
 
   field_fp=fopen(field_filename,"w");
 
@@ -450,7 +455,7 @@
   if(myRank==0)
     {
       Stg_asprintf( &field_filename, "%s/fields.%05d.pvts", self->outputPath,
-                    self->timeStep);
+                    timeStep);
       pfield_fp=fopen(field_filename,"w");
       Memory_Free( field_filename );
     }
@@ -473,7 +478,7 @@
 
       feVar=(FeVariable*)fieldVar;
 
-      if(!strcmp(feVar->name,"VelocityField") && self->timeStep==0)
+      if(!strcmp(feVar->name,"VelocityField") && timeStep==0)
         FeVariable_SyncShadowValues(feVar);
       if(!header_printed)
         {
@@ -658,7 +663,7 @@
           fprintf(pfield_fp,"    <Piece Extent=\"%d %d %d %d %d %d\"\n\
              Source=\"fields.%d.%05d.vts\"/>\n",lower[0],upper[0]-1,
                   lower[1],upper[1]-1,lower[2],upper[2]-1,
-                  i,self->timeStep);
+                  i,timeStep);
         }
       fprintf(pfield_fp,"  </PStructuredGrid>\n\
 </VTKFile>\n");



More information about the CIG-COMMITS mailing list