[cig-commits] r4082 - in long/3D/Gale/trunk/src/Underworld: . Rheology/src

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


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

Modified:
   long/3D/Gale/trunk/src/Underworld/
   long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.c
   long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.h
   long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.c
   long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.h
   long/3D/Gale/trunk/src/Underworld/Rheology/src/MohrCoulomb.c
   long/3D/Gale/trunk/src/Underworld/Rheology/src/NonNewtonian.c
   long/3D/Gale/trunk/src/Underworld/Rheology/src/YieldRheology.c
Log:
 r376 at earth:  boo | 2006-07-20 20:05:20 -0700
  r361 at earth (orig r263):  PatrickSunter | 2006-07-17 19:39:45 -0700
  Commiting work so far to fix problem Jules G identified:
  Underworld models that include a yield rheology not
  performing exactly the same after restarting.
  
  The problem appears to be that in the first timestep
  after restart, the Yield rheology's are unaware that
  a previous solution existed.
  
  Have made what seems the appropriate fix, but preliminary
  tests didn't get exactly the same result after restart
  still, so more work probably needed.
  This line, and those below, will be ignored--
  
  M    Rheology/src/NonNewtonian.c
  M    Rheology/src/YieldRheology.c
  M    Rheology/src/ConstitutiveMatrix.c
  M    Rheology/src/ConstitutiveMatrix.h
  M    Rheology/src/MohrCoulomb.c
  M    Rheology/src/ConstitutiveMatrixCartesian.c
  M    Rheology/src/ConstitutiveMatrixCartesian.h
  
 



Property changes on: long/3D/Gale/trunk/src/Underworld
___________________________________________________________________
Name: svk:merge
   - 9570c393-cf10-0410-b476-9a651db1e55a:/cig:375
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:262
   + 9570c393-cf10-0410-b476-9a651db1e55a:/cig:376
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:263

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.c	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.c	2006-07-21 03:12:02 UTC (rev 4082)
@@ -112,8 +112,9 @@
 }
 
 void _ConstitutiveMatrix_Init(
-		ConstitutiveMatrix*	                       self,
+		ConstitutiveMatrix*	                   self,
 		Dimension_Index                            dim,	
+		FiniteElementContext*                      context,	
 		Materials_Register*                        materials_Register ) 
 {
 	/* General and Function pointers for this class that are not on the parent class should be set here should already be set */
@@ -121,10 +122,8 @@
 	/* ConstitutiveMatrix info */
 	self->isConstructed = True;
 
-	self->isDiagonal          = False;
-	self->materials_Register  = materials_Register;
+	self->matrixData = NULL;
 	self->dim                 = dim;
-
 	self->isSwarmTypeIntegrationPointsSwarm = Stg_Class_IsInstance( self->integrationSwarm, IntegrationPointsSwarm_Type );
 	Journal_Firewall(
 		self->isSwarmTypeIntegrationPointsSwarm,
@@ -142,19 +141,39 @@
 		__func__,
 		self->name,
 		self->integrationSwarm->name );
+
+	self->materials_Register  = materials_Register;
+	self->isDiagonal          = False;
+	self->columnSize          = 0;
+	self->rowSize             = 0;
+
+	/* If we are restarting, there will be an existing valid solution for the velocity, pressure
+	etc fields - thus we record this so any yield rheologies will behave correctly */
+	if ( True == context->loadFromCheckPoint ) {
+		self->previousSolutionExists = True;
+	}
+	else {
+		/* Otherwise, we don't want to set this as true till we've done at least one iteration of the
+		first solve */
+		self->previousSolutionExists = False;
+	}
+	
+	self->sleNonLinearIteration_I = 0;
 }
 
+
 void ConstitutiveMatrix_InitAll( 
 		void*	                                     constitutiveMatrix,
 		StiffnessMatrix*                             stiffnessMatrix,
 		Swarm*                                       swarm,
 		Dimension_Index                              dim,
+		FiniteElementContext*                        context,
 		Materials_Register*                          materials_Register ) 
 {
 	ConstitutiveMatrix* self = (ConstitutiveMatrix*)constitutiveMatrix;
 
 	StiffnessMatrixTerm_InitAll( self, stiffnessMatrix, swarm, NULL );
-	_ConstitutiveMatrix_Init( self, dim, materials_Register );
+	_ConstitutiveMatrix_Init( self, dim, context, materials_Register );
 }
 
 void _ConstitutiveMatrix_Delete( void* constitutiveMatrix ) {
@@ -194,7 +213,7 @@
 	Journal_PrintValue( stream, self->dim );
 	Journal_PrintValue( stream, self->columnSize );
 	Journal_PrintValue( stream, self->rowSize );
-	Journal_PrintBool( stream, self->sleHasExecuted );
+	Journal_PrintBool( stream, self->previousSolutionExists );
 	
 	Stream_UnIndent( stream );
 }
@@ -215,6 +234,7 @@
 	ConstitutiveMatrix*         self          = (ConstitutiveMatrix*)constitutiveMatrix;
 	Dimension_Index             dim;
 	Materials_Register*         materialsRegister;
+	FiniteElementContext*       context;
 
 	_StiffnessMatrixTerm_Construct( self, cf );
 	
@@ -223,7 +243,9 @@
 
 	dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, "dim", 0 );
 
-	_ConstitutiveMatrix_Init( self, dim, materialsRegister );
+	context = (FiniteElementContext*)Stg_ComponentFactory_ConstructByName( cf, "context", FiniteElementContext, True );
+
+	_ConstitutiveMatrix_Init( self, dim, context, materialsRegister );
 }
 
 void _ConstitutiveMatrix_Build( void* constitutiveMatrix, void* data ) {

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.h	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrix.h	2006-07-21 03:12:02 UTC (rev 4082)
@@ -76,7 +76,7 @@
 		Bool                                         isDiagonal;                        \
 		Index                                        columnSize;                        \
 		Index                                        rowSize;                           \
-		Bool                                         sleHasExecuted;                    \
+		Bool                                         previousSolutionExists;            \
 		Iteration_Index                              sleNonLinearIteration_I;
 		
 	struct ConstitutiveMatrix { __ConstitutiveMatrix };
@@ -108,6 +108,7 @@
 		StiffnessMatrix*                             stiffnessMatrix,
 		Swarm*                                       swarm,
 		Dimension_Index                              dim,
+		FiniteElementContext*                        context,
 		Materials_Register*                          materials_Register );
 	
 	/* 'Stg_Class' Virtual Functions */

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.c	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.c	2006-07-21 03:12:02 UTC (rev 4082)
@@ -69,11 +69,12 @@
 		StiffnessMatrix*                                    stiffnessMatrix,
 		Swarm*                                              swarm,
 		Dimension_Index                                     dim,
+		FiniteElementContext*                               context,
 		Materials_Register*                                 materials_Register )
 {
 	ConstitutiveMatrixCartesian* self = (ConstitutiveMatrixCartesian*) _ConstitutiveMatrixCartesian_DefaultNew( name );
 
-	ConstitutiveMatrixCartesian_InitAll( self, stiffnessMatrix, swarm, dim, materials_Register );
+	ConstitutiveMatrixCartesian_InitAll( self, stiffnessMatrix, swarm, dim, context, materials_Register );
 
 	return self;
 }
@@ -142,11 +143,12 @@
 		StiffnessMatrix*                             stiffnessMatrix,
 		Swarm*                                       swarm,
 		Dimension_Index                              dim,
+		FiniteElementContext*                        context,
 		Materials_Register*                          materials_Register )
 {
 	ConstitutiveMatrixCartesian* self = (ConstitutiveMatrixCartesian*) constitutiveMatrix;
 
-	ConstitutiveMatrix_InitAll( self, stiffnessMatrix, swarm, dim, materials_Register );
+	ConstitutiveMatrix_InitAll( self, stiffnessMatrix, swarm, dim, context, materials_Register );
 	_ConstitutiveMatrixCartesian_Init( self );
 }
 
@@ -262,7 +264,14 @@
 	/* Determine whether this is the first solve for not */
 	Journal_Firewall( sle != NULL, Journal_Register( Error_Type, ConstitutiveMatrix_Type ), 
 			"In func %s: SLE is NULL.\n", __func__ );
-	self->sleHasExecuted = sle->hasExecuted;
+
+	/* Note: we may have deliberately set the previousSolutionExists flag to true in the
+		parent ConstitutiveMatrix constructor if in restart mode, even if the SLE hasn't executed yet
+		in this run - so only update to the sle's value when SLE is confirming it has
+		executed */
+	if ( True == sle->hasExecuted ) {
+		self->previousSolutionExists = sle->hasExecuted;
+	}
 	self->sleNonLinearIteration_I = sle->nonLinearIteration_I;
 	
 	/* Loop over points to build Stiffness Matrix */

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.h	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/ConstitutiveMatrixCartesian.h	2006-07-21 03:12:02 UTC (rev 4082)
@@ -64,6 +64,7 @@
 		StiffnessMatrix*                                    stiffnessMatrix,
 		Swarm*                                              swarm,
 		Dimension_Index                                     dim,
+		FiniteElementContext*                               context,	
 		Materials_Register*                                 materials_Register );
 
 	ConstitutiveMatrixCartesian* _ConstitutiveMatrixCartesian_New( 
@@ -92,6 +93,7 @@
 		StiffnessMatrix*                                    stiffnessMatrix,
 		Swarm*                                              swarm,
 		Dimension_Index                                     dim,
+		FiniteElementContext*                               context,
 		Materials_Register*                                 materials_Register );
 
 	void _ConstitutiveMatrixCartesian_Delete( void* constitutiveMatrix );

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/MohrCoulomb.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/MohrCoulomb.c	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/MohrCoulomb.c	2006-07-21 03:12:02 UTC (rev 4082)
@@ -385,7 +385,7 @@
 	double                          yieldIndicator;  /* A materialPoint will yield if yieldCriterion < yieldIndicator */
 
 	/* Don't want to yield on the first ever solve */
-	if ( constitutiveMatrix->sleHasExecuted == False ) {
+	if ( constitutiveMatrix->previousSolutionExists == False ) {
 		return;
 	}
 

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/NonNewtonian.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/NonNewtonian.c	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/NonNewtonian.c	2006-07-21 03:12:02 UTC (rev 4082)
@@ -151,7 +151,7 @@
 	double                        n;
 
 	/* Don't want to yield on the first ever solve */
-	if ( !constitutiveMatrix->sleHasExecuted )
+	if ( !constitutiveMatrix->previousSolutionExists )
 		return;
 
 	/* Calculate Parameters */

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/YieldRheology.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/YieldRheology.c	2006-07-21 03:11:53 UTC (rev 4081)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/YieldRheology.c	2006-07-21 03:12:02 UTC (rev 4082)
@@ -214,7 +214,7 @@
 	double                           yieldIndicator; /* A particle will yield if yieldCriterion < yieldIndicator */
 	
 	/* Don't want to yield on the first ever solve */
-	if ( !constitutiveMatrix->sleHasExecuted )
+	if ( !constitutiveMatrix->previousSolutionExists )
 		return;
 		
 	yieldIndicator = YieldRheology_GetYieldIndicator( self, constitutiveMatrix, materialPointsSwarm, lElement_I, materialPoint, xi );



More information about the cig-commits mailing list