[cig-commits] r11898 - in long/3D/Gale/trunk: . src/StgFEM/SLE/SystemSetup/src
walter at geodynamics.org
walter at geodynamics.org
Fri May 2 14:06:36 PDT 2008
Author: walter
Date: 2008-05-02 14:06:36 -0700 (Fri, 02 May 2008)
New Revision: 11898
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c
Log:
r2137 at earth: boo | 2008-05-02 14:05:51 -0700
Don't do extra iterations for BC's
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2135
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2137
Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c 2008-05-02 03:14:00 UTC (rev 11897)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c 2008-05-02 21:06:36 UTC (rev 11898)
@@ -657,7 +657,7 @@
double wallTime;
Iteration_Index minIterations = self->nonLinearMinIterations;
FeVariable* stress = NULL;
- int bc_iterations=0;
+/* int bc_iterations=0; */
Journal_Printf( self->info, "In %s\n", __func__ );
Stream_IndentBranch( StgFEM_Debug );
@@ -672,102 +672,80 @@
_SystemLinearEquations_Build(sle,_context);
}
- /* Iterate until the boundary conditions are no longer
- changing. This involves a full nonlinear solve each time
- to get a real solution. */
- do {
+ self->linearExecute( self, _context );
+ self->hasExecuted = True;
+ currentVector =
+ SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
+
+ /* Non linear iterations */
+ converged=0;
+ for ( self->nonLinearIteration_I = 1 ;
+ self->nonLinearIteration_I < maxIterations ;
+ self->nonLinearIteration_I++ ) {
+ Journal_Printf(self->info,"\nNon linear solver - iteration %d\n",
+ self->nonLinearIteration_I);
+
+ if(previousVector!=NULL)
+ FreeObject(previousVector);
+ Vector_Duplicate( currentVector, (void**)&previousVector );
+ Vector_SetLocalSize(previousVector,
+ Vector_GetLocalSize(currentVector));
+ Vector_CopyEntries( currentVector, previousVector );
+
self->linearExecute( self, _context );
self->hasExecuted = True;
+
+ /* TODO - Give option which solution vector to test */
currentVector =
SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
-
- /* Non linear iterations */
- converged=0;
- for ( self->nonLinearIteration_I = 1 ;
- self->nonLinearIteration_I < maxIterations ;
- self->nonLinearIteration_I++ ) {
- Journal_Printf(self->info,"\nNon linear solver - iteration %d\n",
- self->nonLinearIteration_I);
- if(previousVector!=NULL)
- FreeObject(previousVector);
- Vector_Duplicate( currentVector, (void**)&previousVector );
- Vector_SetLocalSize(previousVector,
- Vector_GetLocalSize(currentVector));
- Vector_CopyEntries( currentVector, previousVector );
-
- self->linearExecute( self, _context );
- self->hasExecuted = True;
+ /* Calculate Residual */
+ Vector_AddScaled( previousVector, -1.0, currentVector );
+ residual = Vector_L2Norm( previousVector )
+ / Vector_L2Norm( currentVector );
- /* TODO - Give option which solution vector to test */
- currentVector =
- SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
-
- /* Calculate Residual */
- Vector_AddScaled( previousVector, -1.0, currentVector );
- residual = Vector_L2Norm( previousVector )
- / Vector_L2Norm( currentVector );
-
- Journal_Printf( self->info, "In func %s: Iteration %u of %u - Residual %.5g - Tolerance = %.5g\n",
- __func__, self->nonLinearIteration_I,
- maxIterations, residual, tolerance );
- if ( self->makeConvergenceFile ) {
- Journal_Printf( self->convergenceStream,
- "%d\t\t%d\t\t%.5g\t\t%.5g\n",
- self->context->timeStep,
- self->nonLinearIteration_I,
- residual, tolerance );
- }
-
- /* Check if residual is below tolerance */
- converged = (residual < tolerance);
-
- Journal_Printf(self->info,"Non linear solver - Residual %.8e; Tolerance %.4e%s%s - %g (secs)\n\n", residual, tolerance,
- (converged) ? " - Converged" : " - Not converged",
- (self->nonLinearIteration_I < maxIterations) ? ""
- : " - Reached iteration limit",
- MPI_Wtime() - wallTime );
-
- if ( (converged) && (self->nonLinearIteration_I>=minIterations) )
- break;
+ Journal_Printf( self->info, "In func %s: Iteration %u of %u - Residual %.5g - Tolerance = %.5g\n",
+ __func__, self->nonLinearIteration_I,
+ maxIterations, residual, tolerance );
+ if ( self->makeConvergenceFile ) {
+ Journal_Printf( self->convergenceStream,
+ "%d\t\t%d\t\t%.5g\t\t%.5g\n",
+ self->context->timeStep,
+ self->nonLinearIteration_I,
+ residual, tolerance );
}
- /* Print Info */
- if ( converged ) {
- Journal_Printf( self->info, "In func %s: Converged after %u iterations.\n",
- __func__, self->nonLinearIteration_I );
+ /* Check if residual is below tolerance */
+ converged = (residual < tolerance);
+
+ Journal_Printf(self->info,"Non linear solver - Residual %.8e; Tolerance %.4e%s%s - %g (secs)\n\n", residual, tolerance,
+ (converged) ? " - Converged" : " - Not converged",
+ (self->nonLinearIteration_I < maxIterations) ? ""
+ : " - Reached iteration limit",
+ MPI_Wtime() - wallTime );
+
+ if ( (converged) && (self->nonLinearIteration_I>=minIterations) )
+ break;
+ }
+
+ /* Print Info */
+ if ( converged ) {
+ Journal_Printf( self->info, "In func %s: Converged after %u iterations.\n",
+ __func__, self->nonLinearIteration_I );
+ }
+ else {
+ Journal_Printf( errorStream, "In func %s: Failed to converge after %u iterations.\n",
+ __func__, self->nonLinearIteration_I);
+ if ( self->killNonConvergent ) {
+ abort();
}
- else {
- Journal_Printf( errorStream, "In func %s: Failed to converge after %u iterations.\n",
- __func__, self->nonLinearIteration_I);
- if ( self->killNonConvergent ) {
- abort();
- }
- }
- if(stress!=NULL)
- {
- ParticleFeVariable_Update( stress );
- _SystemLinearEquations_Build(sle,_context);
- }
-
- currentVector =
- SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
-
- Journal_Printf
- (self->info,
- "BC iteration %d - The number of elements: %d %d %d %d\n",
- bc_iterations,
- Vector_GetLocalSize(currentVector),
- Vector_GetLocalSize(previousVector),
- Vector_GetGlobalSize(currentVector),
- Vector_GetGlobalSize(previousVector));
-
- ++bc_iterations;
- } while(Vector_GetLocalSize(currentVector)
- !=Vector_GetLocalSize(previousVector)
- || Vector_GetGlobalSize(currentVector)
- !=Vector_GetGlobalSize(previousVector));
-
+ }
+
+ Journal_Printf
+ (self->info,
+ "BC: The number of elements: %d\n",
+ Vector_GetGlobalSize(currentVector));
+
Stream_UnIndentBranch( StgFEM_Debug );
FreeObject( previousVector );
More information about the cig-commits
mailing list