[cig-commits] r11882 - in long/3D/Gale/trunk: . src/StgFEM/SLE/SystemSetup/src
walter at geodynamics.org
walter at geodynamics.org
Thu May 1 10:37:44 PDT 2008
Author: walter
Date: 2008-05-01 10:37:44 -0700 (Thu, 01 May 2008)
New Revision: 11882
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c
Log:
r2128 at earth: boo | 2008-05-01 10:36:07 -0700
Modify the nonlinear loop to get static friction working
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2127
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2128
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-01 17:37:39 UTC (rev 11881)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SystemLinearEquations.c 2008-05-01 17:37:44 UTC (rev 11882)
@@ -647,8 +647,8 @@
void SystemLinearEquations_NonLinearExecute( void* sle, void* _context ) {
SystemLinearEquations* self = (SystemLinearEquations*) sle;
- Vector* previousVector;
- Vector* currentVector;
+ Vector* previousVector = NULL;
+ Vector* currentVector = NULL;
double residual;
double tolerance = self->nonLinearTolerance;
Iteration_Index maxIterations = self->nonLinearMaxIterations;
@@ -681,47 +681,75 @@
/* TODO - Give option which solution vector to test */
currentVector = SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
- Vector_Duplicate( currentVector, (void**)&previousVector );
- Vector_SetLocalSize( previousVector, Vector_GetLocalSize(currentVector));
for ( self->nonLinearIteration_I = 1 ; self->nonLinearIteration_I < maxIterations ; self->nonLinearIteration_I++ ) {
- /* Add this to create a new set of bcs dependent on the stress used in friction bc's. */
-/* if(stress!=NULL && self->nonLinearIteration_I!=1) */
-/* { */
-/* ParticleFeVariable_Update( stress ); */
-/* _SystemLinearEquations_Build(sle,_context); */
-/* } */
+ if(previousVector!=NULL)
+ _Vector_Delete(previousVector);
+ Vector_Duplicate( currentVector, (void**)&previousVector );
+ Vector_SetLocalSize(previousVector,
+ Vector_GetLocalSize(currentVector));
+ Vector_CopyEntries( currentVector, previousVector );
+ /* Add this to create a new set of bcs dependent on the
+ stress used in friction bc's. */
+ if(stress!=NULL)
+ {
+ ParticleFeVariable_Update( stress );
+ _SystemLinearEquations_Build(sle,_context);
+ }
- Vector_CopyEntries( currentVector, previousVector );
+
Journal_Printf(self->info,"Non linear solver - iteration %d\n", self->nonLinearIteration_I);
self->linearExecute( self, _context );
- /* Calculate Residual */
- Vector_AddScaled( previousVector, -1.0, currentVector );
- residual = Vector_L2Norm( previousVector ) / Vector_L2Norm( currentVector );
+ currentVector = SystemLinearEquations_GetSolutionVectorAt( self, 0 )->vector;
+ /* Check whether the number of boundary elements has
+ changed. I don't really like this, since it seems
+ you could get it converging on some processors and
+ not on others if a boundary element is lost on one
+ processor and gained on another. */
- 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);
+ printf("resid %lf %lf\n",Vector_L2Norm(previousVector),Vector_L2Norm(currentVector));
+ if(Vector_GetLocalSize(currentVector)
+ ==Vector_GetLocalSize(previousVector)
+ && Vector_GetGlobalSize(currentVector)
+ ==Vector_GetGlobalSize(previousVector))
+ {
+ /* Calculate Residual */
+ Vector_AddScaled( previousVector, -1.0, currentVector );
+ residual = Vector_L2Norm( previousVector )
+ / Vector_L2Norm( currentVector );
- 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 );
+ }
+
+ /* 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;
+ }
+ else
+ {
+ Journal_Printf(self->info,"Non linear solver - The number of boundary elements has changed %d %d %d %d: Not converged\n",
+ Vector_GetLocalSize(currentVector),
+ Vector_GetLocalSize(previousVector),
+ Vector_GetGlobalSize(currentVector),
+ Vector_GetGlobalSize(previousVector));
+ }
+ }
/* Print Info */
if ( converged ) {
More information about the cig-commits
mailing list