[cig-commits] r4084 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Utils/src

walter at geodynamics.org walter at geodynamics.org
Thu Jul 20 20:12:27 PDT 2006


Author: walter
Date: 2006-07-20 20:12:27 -0700 (Thu, 20 Jul 2006)
New Revision: 4084

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/TimeIntegratee.c
Log:
 r2549 at earth:  boo | 2006-07-20 20:01:50 -0700
  r2525 at earth (orig r3694):  LukeHodkinson | 2006-07-19 19:54:10 -0700
  Modified the first-order time integratee method to store
  all time derivatives before advecting any values. The reason
  for this is a result of attempting to advect mesh vertices 
  and velocity interpolations using those vertices; as the points
  move the interpolated velocities change, unless they're all
  calculated first and applied later.
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2548
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3693
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2549
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3694

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/TimeIntegratee.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/TimeIntegratee.c	2006-07-21 03:12:24 UTC (rev 4083)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/TimeIntegratee.c	2006-07-21 03:12:27 UTC (rev 4084)
@@ -233,7 +233,7 @@
 	Variable*       variable       = self->variable;
 	double*         arrayDataPtr;
 	double*         startDataPtr;
-	double*         timeDeriv;
+	double**        timeDeriv;
 	Index           component_I; 
 	Index           componentCount = *variable->dataTypeCounts;
 	Index           array_I; 
@@ -243,26 +243,26 @@
 
 	Journal_DPrintf( self->debug, "In func %s for %s '%s'\n", __func__, self->type, self->name );
 
-	timeDeriv = Memory_Alloc_Array( double, componentCount, "Time Deriv" );
-	memset( timeDeriv, 0, componentCount * sizeof( double ) );
-
 	/* Update Variables */
 	Variable_Update( variable );
 	Variable_Update( startValue );
 	arrayCount     = variable->arraySize;
-	
-	for ( array_I = 0 ; array_I < arrayCount ; array_I++ ) {
-		arrayDataPtr = Variable_GetPtrDouble( variable, array_I );
-		startDataPtr = Variable_GetPtrDouble( startValue, array_I );
-		
-		successFlag = TimeIntegratee_CalculateTimeDeriv( self, array_I, timeDeriv );
+
+	timeDeriv = Memory_Alloc_2DArray( double, arrayCount, componentCount, "Time Deriv" );
+	for( array_I = 0; array_I < arrayCount; array_I++ ) {
+		successFlag = TimeIntegratee_CalculateTimeDeriv( self, array_I, timeDeriv[array_I] );
 		Journal_Firewall( True == successFlag, errorStream,
 			"Error - in %s(), for TimeIntegratee \"%s\" of type %s: When trying to find time "
 			"deriv for item %u in step %u, *failed*.\n",
 			__func__, self->name, self->type, array_I, 1 );
+	}
 
+	for ( array_I = 0 ; array_I < arrayCount ; array_I++ ) {
+		arrayDataPtr = Variable_GetPtrDouble( variable, array_I );
+		startDataPtr = Variable_GetPtrDouble( startValue, array_I );
+		
 		for ( component_I = 0 ; component_I < componentCount ; component_I++ ) {
-			arrayDataPtr[ component_I ] = startDataPtr[ component_I ] + dt * timeDeriv[ component_I ];
+			arrayDataPtr[ component_I ] = startDataPtr[ component_I ] + dt * timeDeriv[array_I][ component_I ];
 		}
 	
 		TimeIntegratee_Intermediate( self, array_I );



More information about the cig-commits mailing list