[cig-commits] commit: Get rid of currentParticleIndex, swarmStrainRate, and swarmPressure

Mercurial hg at geodynamics.org
Sun Oct 23 12:01:11 PDT 2011


changeset:   897:e6b7ddcf70dc
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Sun Oct 23 11:59:34 2011 -0700
files:       Rheology/src/Byerlee.cxx Rheology/src/Byerlee.h Rheology/src/ConstitutiveMat_Refactored.cxx Rheology/src/ConstitutiveMat_Refactored.h Rheology/src/ConstitutiveMatrix.cxx Rheology/src/ConstitutiveMatrix.h Rheology/src/ConstitutiveMatrixCartesian.cxx Rheology/src/DruckerPrager.cxx Rheology/src/DruckerPrager.h Rheology/src/MohrCoulomb.cxx Rheology/src/MohrCoulomb.h Rheology/src/VonMises.cxx Rheology/src/VonMises.h Utils/src/REP_Algorithm.cxx Utils/src/RecoveredFeVariable.cxx Utils/src/RecoveredFeVariable.h Utils/src/StressField.cxx Utils/src/ViscosityField.cxx
description:
Get rid of currentParticleIndex, swarmStrainRate, and swarmPressure


diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/Byerlee.cxx
--- a/Rheology/src/Byerlee.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/Byerlee.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -69,7 +69,6 @@ Byerlee* Byerlee_New(
       MaterialPointsSwarm*  materialPointsSwarm, 
       double                minVisc, 
       FeVariable*           strainRateField,
-      SwarmVariable*        swarmStrainRate,
       double                cohesion,
       double                cohesionAfterSoftening,
       Bool                  strainRateSoftening,
@@ -80,7 +79,7 @@ Byerlee* Byerlee_New(
 
    _Rheology_Init( self, (PICelleratorContext*)context );
    _YieldRheology_Init( (YieldRheology*)self, strainWeakening, materialPointsSwarm, minVisc ); 
-   _VonMises_Init( (VonMises*)self, strainRateField, swarmStrainRate, cohesion, cohesionAfterSoftening, strainRateSoftening );
+   _VonMises_Init( (VonMises*)self, strainRateField, cohesion, cohesionAfterSoftening, strainRateSoftening );
    _Byerlee_Init( self, mesh, depthCoefficient );
    self->isConstructed = True;
    return self;
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/Byerlee.h
--- a/Rheology/src/Byerlee.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/Byerlee.h	Sun Oct 23 11:59:34 2011 -0700
@@ -68,7 +68,6 @@
       MaterialPointsSwarm*  materialPointsSwarm,
       double                minVisc,
       FeVariable*           strainRateField,
-      SwarmVariable*        swarmStrainRate,
       double                cohesion,
       double                cohesionAfterSoftening,
       Bool                  strainRateSoftening,
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/ConstitutiveMat_Refactored.cxx
--- a/Rheology/src/ConstitutiveMat_Refactored.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/ConstitutiveMat_Refactored.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -244,7 +244,6 @@ void ConstitutiveMat_Refactored_Assemble
 		void*                                              constitutiveMatrix,
 		Element_LocalIndex                                 lElement_I,
 		IntegrationPointsSwarm*				   swarm,
-		int                                                particleIndex,
 		IntegrationPoint*                                  particle )
 {
 	ConstitutiveMat_Refactored*     self          = (ConstitutiveMat_Refactored*)constitutiveMatrix;
@@ -267,7 +266,6 @@ void ConstitutiveMat_Refactored_Assemble
 	 */
 	material = (RheologyMaterial*) IntegrationPointsSwarm_GetMaterialOn( swarm, particle );
 	materialPoint = OneToOneMapper_GetMaterialPoint( swarm->mapper, particle, &materialSwarm );
-	self->currentParticleIndex = particleIndex;
 
 	/* need to change the interface for this function, so it takes in a new constitutive matrix */
 	/* TODO!!! not sure if passing a ConstitutiveMat_Refactored to this function is going to be a problem !!!TODO */
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/ConstitutiveMat_Refactored.h
--- a/Rheology/src/ConstitutiveMat_Refactored.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/ConstitutiveMat_Refactored.h	Sun Oct 23 11:59:34 2011 -0700
@@ -79,7 +79,6 @@
 		Index																columnSize; \
 		Index																rowSize; \
 		Bool																previousSolutionExists; \
-		int																currentParticleIndex; \
 		SystemLinearEquations*										sle; \
 		Iteration_Index												sleNonLinearIteration_I;
 		
@@ -173,7 +172,6 @@
 		void*							constitutiveMatrix,
 		Element_LocalIndex		lElement_I,
 		IntegrationPointsSwarm*	swarm,
-		int							particleIndex,
 		IntegrationPoint*			particle );
 
 	#define ConstitutiveMat_Refactored_SetToNonLinear( constitutiveMatrix ) \
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/ConstitutiveMatrix.cxx
--- a/Rheology/src/ConstitutiveMatrix.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/ConstitutiveMatrix.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -269,11 +269,10 @@ void ConstitutiveMatrix_Assemble(
 void ConstitutiveMatrix_Assemble(
       void*                                              constitutiveMatrix,
       Element_LocalIndex                                 lElement_I,
-      int                                                particleIndex,
       IntegrationPoint*                                  particle )
 {
   ConstitutiveMatrix*     self          = (ConstitutiveMatrix*)constitutiveMatrix;
-  ConstitutiveMatrix_Assemble(constitutiveMatrix,lElement_I,particleIndex,
+  ConstitutiveMatrix_Assemble(constitutiveMatrix,lElement_I,
                               particle,
                               (IntegrationPointsSwarm*)self->integrationSwarm);
 }
@@ -281,7 +280,6 @@ void ConstitutiveMatrix_Assemble(
 void ConstitutiveMatrix_Assemble(
       void*                                              constitutiveMatrix,
       Element_LocalIndex                                 lElement_I,
-      int                                                particleIndex,
       IntegrationPoint*                                  particle,
       IntegrationPointsSwarm* swarm)
 {
@@ -305,7 +303,6 @@ void ConstitutiveMatrix_Assemble(
     */
    material = (RheologyMaterial*) IntegrationPointsSwarm_GetMaterialOn( swarm, particle );
    materialPoint = OneToOneMapper_GetMaterialPoint( swarm->mapper, particle, &materialSwarm );
-   self->currentParticleIndex = particleIndex;
 
    RheologyMaterial_RunRheologies( material, self, materialSwarm, lElement_I, materialPoint, particle->xi );
 
@@ -333,7 +330,6 @@ void ConstitutiveMatrix_AssembleMaterial
 	matPoint = (MaterialPoint*)Swarm_ParticleAt(matSwarm, matPointInd);
 	material = (RheologyMaterial*)MaterialPointsSwarm_GetMaterialOn(matSwarm, matPoint);
 	FeMesh_CoordGlobalToLocal(matSwarm->mesh, element, matPoint->coord, xi);
-	self->currentParticleIndex = matPointInd;
 	RheologyMaterial_RunRheologies(material, self, matSwarm, element, matPoint, xi);
 
   if( self->storeConstitutiveMatrix ) {
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/ConstitutiveMatrix.h
--- a/Rheology/src/ConstitutiveMatrix.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/ConstitutiveMatrix.h	Sun Oct 23 11:59:34 2011 -0700
@@ -78,7 +78,6 @@
 		Index                                        columnSize;                        \
 		Index                                        rowSize;                           \
 		Bool                                         previousSolutionExists;            \
-		int                                          currentParticleIndex;              \
 		SystemLinearEquations*                       sle;                               \
 		Iteration_Index                              sleNonLinearIteration_I;           \
     /* below is needed to store the constitutiveMatrix per particle */ \
@@ -162,11 +161,9 @@
 	void ConstitutiveMatrix_Assemble( 
 		void*                                              constitutiveMatrix,
 		Element_LocalIndex                                 lElement_I,
-		int                                                particleIndex,
 		IntegrationPoint*                                  particle );
         void ConstitutiveMatrix_Assemble(void* constitutiveMatrix,
                                          Element_LocalIndex lElement_I,
-                                         int particleIndex,
                                          IntegrationPoint* particle,
                                          IntegrationPointsSwarm* swarm);
 
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/ConstitutiveMatrixCartesian.cxx
--- a/Rheology/src/ConstitutiveMatrixCartesian.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/ConstitutiveMatrixCartesian.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -327,12 +327,9 @@ void _ConstitutiveMatrixCartesian_Assemb
        IntegrationPointsSwarm*
          NNswarm((IntegrationPointsSwarm*)self->integrationSwarm);
        IntegrationPoint* NNparticle(particle);
-       int NNparticle_index(swarm->cellParticleTbl[cell_I][cParticle_I]);
-       NearestNeighbor_Replace(&NNswarm,&NNparticle,&NNparticle_index,
-                               lElement_I,dim);
+       NearestNeighbor_Replace(&NNswarm,&NNparticle,lElement_I,dim);
        ConstitutiveMatrix_Assemble(constitutiveMatrix, lElement_I,
-                                   NNparticle_index, NNparticle,
-                                   NNswarm);
+                                   NNparticle, NNswarm);
      }
 
      eta = self->matrixData[2][2];
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/DruckerPrager.cxx
--- a/Rheology/src/DruckerPrager.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/DruckerPrager.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -70,12 +70,10 @@ DruckerPrager* DruckerPrager_New(
 	MaterialPointsSwarm*  materialPointsSwarm, 
 	double                minVisc, 
 	FeVariable*           strainRateField,
-	SwarmVariable*        swarmStrainRate,
 	double                cohesion,
 	double                cohesionAfterSoftening,
 	Bool                  strainRateSoftening,
 	FeVariable*           pressureField,
-	SwarmVariable*        swarmPressure,
 	double                minimumYieldStress,
 	double                minimumViscosity,
 	double                maxStrainRate,
@@ -97,8 +95,9 @@ DruckerPrager* DruckerPrager_New(
 
    _Rheology_Init( self, (PICelleratorContext*)self->context );
    _YieldRheology_Init( (YieldRheology*)self, strainWeakening, materialPointsSwarm, minVisc ); 
-   _VonMises_Init( (VonMises*)self, strainRateField, swarmStrainRate, cohesion, cohesionAfterSoftening, strainRateSoftening );
-   _DruckerPrager_Init( self, pressureField, swarmPressure,
+   _VonMises_Init( (VonMises*)self, strainRateField, cohesion,
+                   cohesionAfterSoftening, strainRateSoftening );
+   _DruckerPrager_Init( self, pressureField,
                         materialPointsSwarm,
                         frictionCoefficient,
                         frictionCoefficientAfterSoftening,
@@ -137,7 +136,6 @@ void _DruckerPrager_Init(
 void _DruckerPrager_Init(
 		DruckerPrager*                                     self,
 		FeVariable*                                        pressureField,
-		SwarmVariable*                                     swarmPressure,
 		MaterialPointsSwarm*                               materialPointsSwarm,
 		double                                             frictionCoefficient,
 		double                                             frictionCoefficientAfterSoftening,
@@ -156,18 +154,12 @@ void _DruckerPrager_Init(
                 double                    maxStrainRate,
                 HydrostaticTerm*          hydrostaticTerm )
 {
-	DruckerPrager_Particle*   particleExt;
-	StandardParticle          materialPoint;
-	
-	self->particleExtHandle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, (Name)DruckerPrager_Type, sizeof(DruckerPrager_Particle) );
-		
 	/* Assign Pointers */
 	self->pressureField       = pressureField;
 	self->frictionCoefficient = frictionCoefficient;
 	self->minimumYieldStress  = minimumYieldStress;
 	self->minimumViscosity    = minimumViscosity;
 	self->maxStrainRate       = maxStrainRate;
-	self->swarmPressure       = swarmPressure;
 	
 	/* Strain softening of Cohesion and friction - (linear
            weakening is assumed) needs a softening factor between +0
@@ -193,18 +185,6 @@ void _DruckerPrager_Init(
 	EP_PrependClassHook( Context_GetEntryPoint( self->context, AbstractContext_EP_DumpClass ),
 								_DruckerPrager_UpdateDrawParameters, self );
 	
-	particleExt = (DruckerPrager_Particle*)ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &materialPoint, self->particleExtHandle );
-	
-	/* Setup Variables for Visualisation */
-	self->brightness = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"DruckerPragerBrightness", (ArithPointer) &particleExt->brightness - (ArithPointer) &materialPoint, Variable_DataType_Float  );
-	
-	self->opacity = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"DruckerPragerOpacity", (ArithPointer) &particleExt->opacity - (ArithPointer) &materialPoint, Variable_DataType_Float  );
-	
-	self->diameter = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"DruckerPragerDiameter", (ArithPointer) &particleExt->diameter - (ArithPointer) &materialPoint, Variable_DataType_Float  );
-
-	/* The tensileFailure variable allows to check whether a materialPoint has failed in tensile mode or not */
-	self->tensileFailure = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"DruckerPragerTensileFailure", (ArithPointer) &particleExt->tensileFailure - (ArithPointer) &materialPoint, Variable_DataType_Char );
-
         self->curFrictionCoef = 0.0;
 }
 
@@ -235,7 +215,6 @@ void _DruckerPrager_AssignFromXML( void*
 void _DruckerPrager_AssignFromXML( void* druckerPrager, Stg_ComponentFactory* cf, void* data ){
 	DruckerPrager*          self           = (DruckerPrager*)druckerPrager;
 	FeVariable*             pressureField = NULL;
-	SwarmVariable*          swarmPressure = NULL;
 	MaterialPointsSwarm*    materialPointsSwarm = NULL;
 
 	/* Construct Parent */
@@ -243,18 +222,12 @@ void _DruckerPrager_AssignFromXML( void*
 	
 	pressureField      = (FeVariable *) 
             Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, False, data  );
-   swarmPressure = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"swarmPressure", SwarmVariable, False, data );
-   Journal_Firewall( 
-			( pressureField || swarmPressure ), 
-			Journal_Register( Error_Type, (Name)self->type  ), 
-			"\n Error in component type %s, name '%s'.\n Must specify a PressureField OR a swarmPressure, but not both. \n", self->type, self->name ); 
 			
 	materialPointsSwarm     = (MaterialPointsSwarm*)
 			Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaterialPointsSwarm", MaterialPointsSwarm, True, data  );
 		
 	_DruckerPrager_Init( self, 
 			pressureField,
-			swarmPressure,
 			materialPointsSwarm, 
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficient", 0.0 ),
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"frictionCoefficientAfterSoftening", 0.0 ),
@@ -281,28 +254,16 @@ void _DruckerPrager_Build( void* rheolog
 	/* Build parent */
 	_VonMises_Build( self, data );
 
-	if(self->pressureField) Stg_Component_Build( self->pressureField, data, False );
-	if(self->swarmPressure) Stg_Component_Build( self->swarmPressure, data, False );
-	Stg_Component_Build( self->brightness, data, False );
-	Stg_Component_Build( self->opacity, data, False );
-	Stg_Component_Build( self->diameter, data, False );
-	Stg_Component_Build( self->tensileFailure, data, False );
-
+        Stg_Component_Build( self->pressureField, data, False );
 }
 
 void _DruckerPrager_Destroy( void* rheology, void* data ) {
 	DruckerPrager*          self               = (DruckerPrager*) rheology;
 
-	if(self->pressureField) Stg_Component_Destroy( self->pressureField, data, False );
-	if(self->swarmPressure) Stg_Component_Destroy( self->swarmPressure, data, False );
-	Stg_Component_Destroy( self->brightness, data, False );
-	Stg_Component_Destroy( self->opacity, data, False );
-	Stg_Component_Destroy( self->diameter, data, False );
-	Stg_Component_Destroy( self->tensileFailure, data, False );
+        Stg_Component_Destroy( self->pressureField, data, False );
 
 	/* Destroy parent */
 	_VonMises_Destroy( self, data );
-
 }
 
 
@@ -315,16 +276,11 @@ void _DruckerPrager_Initialise( void* rh
 
 	/* Initialise variables that I've created - (mainly just SwarmVariables)
 	 * This will run a Variable_Update for us */
-	if(self->pressureField) Stg_Component_Initialise( self->pressureField, data, False );
-	if(self->swarmPressure) Stg_Component_Initialise( self->swarmPressure, data, False );
+        Stg_Component_Initialise( self->pressureField, data, False );
 
 	/* We should only set initial conditions if in regular non-restart mode. If in restart mode, then
 	the particle-based variables will be set correcty when we re-load the Swarm. */
 	if ( self->context->loadFromCheckPoint == False ) {
-      Stg_Component_Initialise( self->brightness, data, False );
-      Stg_Component_Initialise( self->opacity, data, False );
-      Stg_Component_Initialise( self->diameter, data, False );
-      Stg_Component_Initialise( self->tensileFailure, data, False );
 
 		/* We don't need to Initialise hasYieldedVariable because it's a parent variable and _YieldRheology_Initialise
 		 * has already been called */
@@ -332,12 +288,7 @@ void _DruckerPrager_Initialise( void* rh
 
 		for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) { 
 		
-			Variable_SetValueFloat( self->brightness->variable, lParticle_I, 0.0 );
-			Variable_SetValueFloat( self->opacity->variable,    lParticle_I, 0.0 );
-			Variable_SetValueFloat( self->diameter->variable,   lParticle_I, 0.0 );
-		
 			Variable_SetValueChar( self->hasYieldedVariable->variable, lParticle_I, False );
-			Variable_SetValueChar( self->tensileFailure->variable,lParticle_I, False );
 		}
 	}	
 }
@@ -368,13 +319,7 @@ double _DruckerPrager_GetYieldCriterion(
 	/* Get Parameters From Rheology */
 	minimumYieldStress                 = self->minimumYieldStress;
 	
-        if( self->pressureField )
-          FeVariable_InterpolateWithinElement( self->pressureField, lElement_I, xi, &pressure );
-        else {
-          SwarmVariable_ValueAt( self->swarmPressure,
-                                 constitutiveMatrix->currentParticleIndex,
-                                 &pressure );
-        }
+        FeVariable_InterpolateWithinElement( self->pressureField, lElement_I, xi, &pressure );
 
         cell_I=CellLayout_MapElementIdToCellId(materialPointsSwarm->cellLayout,
                                                lElement_I );
@@ -545,118 +490,16 @@ double _DruckerPrager_EffectiveFrictionC
 }
 
 void _DruckerPrager_UpdateDrawParameters( void* rheology ) {
-	DruckerPrager*                   self               = (DruckerPrager*) rheology;
-	Particle_Index                   lParticle_I;
-	Particle_Index                   particleLocalCount;
-	StrainWeakening*                 strainWeakening    = self->strainWeakening;
-	MaterialPoint*                   materialPoint;
-	
-	double                           length;
-	double                           brightness;
-	double                           opacity;
-	double                           strainWeakeningRatio;
-	double                           localMaxStrainIncrement;
-	double                           localMeanStrainIncrement;
-	Particle_Index                   localFailed;
-	
-	double                           globalMaxStrainIncrement;
-	double                           globalMeanStrainIncrement;
-	Particle_Index                   globalFailed;
-	
-	double                           averagedGlobalMaxStrainIncrement = 0.0;
+  DruckerPrager* self=(DruckerPrager*) rheology;
+  StrainWeakening* strainWeakening=self->strainWeakening;
+  /* We should only update the drawing parameters if the strain
+     weakening is defined */ 
+  if (strainWeakening==NULL)
+    return;
 
-	double                           oneOverGlobalMaxStrainIncrement;
-	double                           postFailureWeakeningIncrement;
-
-	/* Note : this function defines some drawing parameters (brightness, opacity, diameter) as
-	 * functions of the strain weakening - this needs to be improved since most of the parameters
-	 * that define this dependency are hard coded here. We need to have a more flexible way
-	 * to construct the viz parameters as functions of material parameters */
-
-	/* We should only update the drawing parameters if the strain weakening is defined */ 
-	if (strainWeakening==NULL)
-		return;
-	
-	localMaxStrainIncrement = 0.0;
-	localMeanStrainIncrement = 0.0;
-	localFailed = 0;
-
-	/* Update all variables */
-	Variable_Update( self->hasYieldedVariable->variable );
-	Variable_Update( self->brightness->variable );
-	Variable_Update( self->opacity->variable );
-	Variable_Update( self->diameter->variable );
-	Variable_Update( strainWeakening->postFailureWeakeningIncrement->variable );
-
-	particleLocalCount = self->hasYieldedVariable->variable->arraySize;
-	
-	for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) { 
-		if ( Variable_GetValueChar( self->hasYieldedVariable->variable, lParticle_I )) {
-			localFailed++;
-
-			postFailureWeakeningIncrement = 
-					Variable_GetValueDouble( strainWeakening->postFailureWeakeningIncrement->variable, lParticle_I );
-			
-			localMeanStrainIncrement += postFailureWeakeningIncrement;
-		
-			if(localMaxStrainIncrement < postFailureWeakeningIncrement)
-				localMaxStrainIncrement = postFailureWeakeningIncrement;
-		}
-	}
-	
-	MPI_Allreduce( &localMaxStrainIncrement,  &globalMaxStrainIncrement,  1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
-	MPI_Allreduce( &localMeanStrainIncrement, &globalMeanStrainIncrement, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
-	MPI_Allreduce( &localFailed,              &globalFailed,              1, MPI_INT,    MPI_SUM, MPI_COMM_WORLD );
-	
-	if(globalFailed == 0) 
-		return;
-				
-	globalMeanStrainIncrement /= (double) globalFailed;
-	
-	averagedGlobalMaxStrainIncrement = 
-			0.5 * averagedGlobalMaxStrainIncrement + 
-			0.25 * globalMeanStrainIncrement +
-			0.25 * globalMaxStrainIncrement;
-	
-	/* Let's simply assume that twice the mean is a good place to truncate these values */
-	oneOverGlobalMaxStrainIncrement = 1.0 / averagedGlobalMaxStrainIncrement;
-	
-	for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) { 
-		materialPoint = (MaterialPoint*)Swarm_ParticleAt( strainWeakening->swarm, lParticle_I );
-
-		if ( Variable_GetValueChar( self->hasYieldedVariable->variable, lParticle_I ) == False ||
-					StrainWeakening_GetPostFailureWeakening( strainWeakening, materialPoint ) < 0.0 ) 
-		{
-			Variable_SetValueFloat( self->brightness->variable, lParticle_I, 0.0 );
-			Variable_SetValueFloat( self->opacity->variable, lParticle_I, 0.0 );
-			Variable_SetValueFloat( self->diameter->variable, lParticle_I, 0.0 );
-			continue;
-		}  
-
-		postFailureWeakeningIncrement = 
-				Variable_GetValueDouble( strainWeakening->postFailureWeakeningIncrement->variable, lParticle_I );
-			
-		strainWeakeningRatio = StrainWeakening_CalcRatio( strainWeakening, materialPoint );
-		
-		length     = 0.001 + 0.003 * strainWeakeningRatio;
-		brightness = strainWeakeningRatio * postFailureWeakeningIncrement * oneOverGlobalMaxStrainIncrement;
-		
-		opacity = 0.5 * brightness; 
-		
-		if( brightness > 1.0 )
-			brightness = 1.0;
-		
-		if( opacity > 0.5 )
-			opacity = 0.5;
-		
-		if( opacity < 0.1 )
-			opacity = 0.0;
-		
-		Variable_SetValueFloat( self->brightness->variable, lParticle_I, brightness );
-		Variable_SetValueFloat( self->opacity->variable,    lParticle_I, opacity );
-		Variable_SetValueFloat( self->diameter->variable,   lParticle_I, (float) length );
-	}
-	
+  /* Update all variables */
+  Variable_Update( self->hasYieldedVariable->variable );
+  Variable_Update(strainWeakening->postFailureWeakeningIncrement->variable);
 }
 
 
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/DruckerPrager.h
--- a/Rheology/src/DruckerPrager.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/DruckerPrager.h	Sun Oct 23 11:59:34 2011 -0700
@@ -49,27 +49,15 @@
    /** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
    extern const Type DruckerPrager_Type;
 
-   typedef struct {
-      float          brightness;
-      float          opacity;
-      float          diameter;
-      Particle_Bool  tensileFailure;
-   }  DruckerPrager_Particle;
-
    /** Rheology class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
    #define __DruckerPrager \
       /* Parent info */ \
       __VonMises \
       /* Virtual functions go here */ \
       /* General Info */\
-      SwarmVariable*                                      brightness;                            \
-      SwarmVariable*                                      opacity;                               \
-      SwarmVariable*                                      diameter;                              \
-      SwarmVariable*                                      tensileFailure;                        \
       ExtensionInfo_Index                                 particleExtHandle;                     \
       /* Param passed in */\
       FeVariable*                                         pressureField;                         \
-      SwarmVariable*                                      swarmPressure;                         \
       double                                              minimumYieldStress;                    \
       double                                              minimumViscosity;                      \
       double                                              maxStrainRate;                      \
@@ -98,12 +86,10 @@
       MaterialPointsSwarm*  materialPointsSwarm,
       double                minVisc,
       FeVariable*           strainRateField,
-      SwarmVariable*        swarmStrainRate,
       double                cohesion,
       double                cohesionAfterSoftening,
       Bool                  strainRateSoftening,
       FeVariable*           pressureField,
-      SwarmVariable*        swarmPressure,
       double                minimumYieldStress,
       double                minimumViscosity,
       double                maxStrainRate,
@@ -145,7 +131,6 @@
    void _DruckerPrager_Init(
 		DruckerPrager*                                     self,
 		FeVariable*                                        pressureField,
-		SwarmVariable*                                     swarmPressure,
 		MaterialPointsSwarm*                               materialPointsSwarm,
 		double                                             frictionCoefficient,
 		double                                             frictionCoefficientAfterSoftening,
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/MohrCoulomb.cxx
--- a/Rheology/src/MohrCoulomb.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/MohrCoulomb.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -80,7 +80,6 @@ void _MohrCoulomb_Init(
 		MohrCoulomb*          self,
 		FeVariable*           pressureField,
 		FeVariable*           strainRateField,
-		SwarmVariable*        swarmStrainRate,
 		MaterialPointsSwarm*  materialPointsSwarm,
 		double                cohesion,
 		double                cohesionAfterSoftening,
@@ -136,7 +135,6 @@ void _MohrCoulomb_AssignFromXML( void* r
 	FeVariable*            pressureField;
 	MaterialPointsSwarm*   materialPointsSwarm;
 	FeVariable*            strainRateField;
-	SwarmVariable*         swarmStrainRate;
 	
 	/* Construct Parent */
 	_YieldRheology_AssignFromXML( self, cf, data );
@@ -152,13 +150,10 @@ void _MohrCoulomb_AssignFromXML( void* r
 	pressureField          = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, True, data  );
 	strainRateField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StrainRateField", FeVariable, True, data  );
 
-	swarmStrainRate = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"swarmStrainRate", SwarmVariable, False, data  );
-	
 	_MohrCoulomb_Init( 
 			self,
 			pressureField,
 			strainRateField,
-			swarmStrainRate,
 			materialPointsSwarm, 
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesion", 0.0  ),
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesionAfterSoftening", 0.0  ),
@@ -385,12 +380,7 @@ void _MohrCoulomb_StoreCurrentParameters
 	double				trace;
 	
 	FeVariable_InterpolateWithinElement( self->pressureField, lElement_I, xi, &self->currentPressure );
-	if( !self->swarmStrainRate ) {
-		FeVariable_InterpolateWithinElement( self->strainRateField, lElement_I, xi, self->currentStrainRate );
-	}
-	else {
-	   SwarmVariable_ValueAt( self->swarmStrainRate, constitutiveMatrix->currentParticleIndex, self->currentStrainRate );
-	}
+        FeVariable_InterpolateWithinElement( self->strainRateField, lElement_I, xi, self->currentStrainRate );
 
 	SymmetricTensor_GetTrace(self->currentStrainRate, dim, &trace);
 
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/MohrCoulomb.h
--- a/Rheology/src/MohrCoulomb.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/MohrCoulomb.h	Sun Oct 23 11:59:34 2011 -0700
@@ -60,7 +60,6 @@
 		MaterialPointsSwarm*                                materialPointsSwarm;                                 \
 		FeVariable*                                         pressureField;                         \
 		FeVariable*                                         strainRateField;\
-		SwarmVariable*                                      swarmStrainRate;\
 		/* Director component is used to update the normal */\
 		Director*                                           director;                              \
 		double                                              cohesion;                              \
@@ -100,7 +99,6 @@
 		MohrCoulomb*          self,
 		FeVariable*           pressureField,
 		FeVariable*           strainRateField,
-		SwarmVariable*        swarmStrainRate,
 		MaterialPointsSwarm*  materialPointsSwarm,
 		double                cohesion,
 		double                cohesionAfterSoftening,
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/VonMises.cxx
--- a/Rheology/src/VonMises.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/VonMises.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -69,7 +69,6 @@ VonMises* VonMises_New(
 	MaterialPointsSwarm*  materialPointsSwarm, 
 	double                minVisc, 
 	FeVariable*           strainRateField,
-	SwarmVariable*        swarmStrainRate,
 	double                cohesion,
 	double                cohesionAfterSoftening,
 	Bool                  strainRateSoftening )
@@ -78,7 +77,7 @@ VonMises* VonMises_New(
 
    _Rheology_Init( self, (PICelleratorContext*)context );
    _YieldRheology_Init( (YieldRheology*)self, strainWeakening, materialPointsSwarm, minVisc ); 
-   _VonMises_Init( (VonMises*)self, strainRateField, swarmStrainRate, cohesion, cohesionAfterSoftening, strainRateSoftening );
+   _VonMises_Init( (VonMises*)self, strainRateField, cohesion, cohesionAfterSoftening, strainRateSoftening );
 
    self->isConstructed = True;
    return self;
@@ -102,13 +101,11 @@ void _VonMises_Init(
 void _VonMises_Init( 
 		VonMises*      self, 
 		FeVariable*    strainRateField,
-		SwarmVariable* swarmStrainRate,
 		double         cohesion, 
 		double         cohesionAfterSoftening,
 		Bool           strainRateSoftening)
 {
 	self->strainRateField        = strainRateField;
-	self->swarmStrainRate        = swarmStrainRate;
 	self->cohesion               = cohesion;
 	
 	/* Strain softening of Cohesion - (linear weakening is assumed) */
@@ -144,22 +141,15 @@ void _VonMises_AssignFromXML( void* rheo
 void _VonMises_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data ){
 	VonMises*          self           = (VonMises*)rheology;
 	FeVariable*        strainRateField;
-	SwarmVariable*     swarmStrainRate;
 
 	/* Construct Parent */
 	_YieldRheology_AssignFromXML( self, cf, data );
 	
 	strainRateField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"StrainRateField", FeVariable, False, data  );
-	swarmStrainRate = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"swarmStrainRate", SwarmVariable, False, data );
-   Journal_Firewall( 
-			(strainRateField || self->swarmStrainRate ), 
-			Journal_Register( Error_Type, (Name)self->type  ), 
-			"\n Error in component type %s, name '%s'.\n Must specify a strainRateField OR a swarmStrainRate, but not both. \n", self->type, self->name ); 
 
 	_VonMises_Init( 
 			self, 
 			strainRateField,
-			swarmStrainRate,
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesion", 0.0  ),
 			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"cohesionAfterSoftening", 0.0  ),
 			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"strainRateSoftening", False )  );
@@ -168,9 +158,7 @@ void _VonMises_Destroy( void* rheology, 
 void _VonMises_Destroy( void* rheology, void* data ){
    VonMises* self = (VonMises*) rheology;
    
-   if( self->strainRateField ) Stg_Component_Destroy( self->strainRateField, data, False );
-   if( self->swarmStrainRate ) Stg_Component_Destroy( self->swarmStrainRate, data, False );
-   
+   Stg_Component_Destroy( self->strainRateField, data, False );
    _YieldRheology_Destroy( self, data );
 }
 
@@ -180,9 +168,7 @@ void _VonMises_Build( void* rheology, vo
    /* build parent */
    _YieldRheology_Build( self, data );
    
-   if( self->strainRateField ) Stg_Component_Build( self->strainRateField, data, False );
-   if( self->swarmStrainRate ) Stg_Component_Build( self->swarmStrainRate, data, False );
-   
+   Stg_Component_Build( self->strainRateField, data, False );
 }
 
 void _VonMises_Initialise( void* rheology, void* data ){
@@ -191,9 +177,7 @@ void _VonMises_Initialise( void* rheolog
    /* Initialise parent */
    _YieldRheology_Initialise( self, data );
    
-   if( self->strainRateField ) Stg_Component_Initialise( self->strainRateField, data, False );
-   if( self->swarmStrainRate ) Stg_Component_Initialise( self->swarmStrainRate, data, False );
-   
+   Stg_Component_Initialise( self->strainRateField, data, False );
 }
 
 double _VonMises_GetYieldCriterion( 
@@ -233,16 +217,8 @@ double _VonMises_GetYieldIndicator(
         double stressTrace, strainRateTrace;
 	
 	/* Get Strain Rate */
-	if( self->strainRateField ) {
-	   FeVariable_InterpolateWithinElement(
-	      self->strainRateField, lElement_I, xi, strainRate );
-	}
-	else {
-	   SwarmVariable_ValueAt( self->swarmStrainRate,
-				  constitutiveMatrix->currentParticleIndex,
-				  strainRate );
-	}
-
+        FeVariable_InterpolateWithinElement(self->strainRateField,
+                                            lElement_I, xi, strainRate );
 	/* Get Stress */
 	ConstitutiveMatrix_CalculateStress( constitutiveMatrix, strainRate,
                                             self->stress );
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Rheology/src/VonMises.h
--- a/Rheology/src/VonMises.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Rheology/src/VonMises.h	Sun Oct 23 11:59:34 2011 -0700
@@ -56,7 +56,6 @@
 		/* Virtual functions go here */ \
 		/* Material Parameters */\
 		FeVariable*                                         strainRateField;                      \
-		SwarmVariable*                                      swarmStrainRate;                      \
 		double                                              cohesion;                             \
 		double                                              cohesionAfterSoftening;               \
 		Bool                                                strainRateSoftening;                  \
@@ -74,7 +73,6 @@
       MaterialPointsSwarm*  materialPointsSwarm, 
       double                minVisc, 
       FeVariable*           strainRateField,
-      SwarmVariable*        swarmStrainRate,
       double                cohesion,
       double                cohesionAfterSoftening,
       Bool                  strainRateSoftening );
@@ -96,7 +94,7 @@
 	/* 'Stg_Component' implementations */
 	void* _VonMises_DefaultNew( Name name ) ;
 	void _VonMises_AssignFromXML( void* rheology, Stg_ComponentFactory* cf, void* data );
-	void _VonMises_Init( VonMises* self, FeVariable* strainRateField, SwarmVariable* swarmStrainRate, double cohesion, double cohesionAfterSoftening, Bool strainRateSoftening );
+	void _VonMises_Init( VonMises* self, FeVariable* strainRateField, double cohesion, double cohesionAfterSoftening, Bool strainRateSoftening );
    void _VonMises_Destroy( void* rheology, void* data );
    void _VonMises_Build( void* rheology, void* data );
    void _VonMises_Initialise( void* rheology, void* data );
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Utils/src/REP_Algorithm.cxx
--- a/Utils/src/REP_Algorithm.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Utils/src/REP_Algorithm.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -489,7 +489,7 @@ void _REP_Algorithm_AssembleElement( REP
 
 		for( field_I = 0 ; field_I < self->repFieldCount ; field_I++ )  {
 			_RecoveredFeVariable_AssembleAtParticle( self->repFieldList[field_I], self->constitutiveMatrix, 
-					self->constitutiveMatrix->currentParticleIndex, particle, lElement_I, 
+					particle, lElement_I, 
 					globalCoord, (double**)GNx, detJac, Hi_Mat[field_I], Fi_Mat[field_I]);
 
 			/* could be a useful functionPtr later on, JG 12May09
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Utils/src/RecoveredFeVariable.cxx
--- a/Utils/src/RecoveredFeVariable.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Utils/src/RecoveredFeVariable.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -252,7 +252,6 @@ void _RecoveredFeVariable_AssembleAtPart
 void _RecoveredFeVariable_AssembleAtParticle(
    RecoveredFeVariable* self,
    ConstitutiveMatrix*  constitutiveMatrix,
-   int                  particleIndex,
    IntegrationPoint*    particle,
    int                  lElement_I, 
    double*              globalCoord,
@@ -286,7 +285,7 @@ void _RecoveredFeVariable_AssembleAtPart
          ConstitutiveMatrix_GetStoredMatrixOnParticle( constitutiveMatrix, particle, tmpC );
       } else {
          /* build total constitutive matrix - could diagree with current velcoity and pressure solution */
-         ConstitutiveMatrix_Assemble( constitutiveMatrix, lElement_I, particleIndex, particle ); 
+         ConstitutiveMatrix_Assemble( constitutiveMatrix, lElement_I, particle ); 
       }
 
       if( !self->recoverStrain ) {
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Utils/src/RecoveredFeVariable.h
--- a/Utils/src/RecoveredFeVariable.h	Sun Oct 23 11:58:12 2011 -0700
+++ b/Utils/src/RecoveredFeVariable.h	Sun Oct 23 11:59:34 2011 -0700
@@ -147,7 +147,7 @@
 	void RecoveredFeVariable_RemoveWorkSpace( RecoveredFeVariable* self );
 
 	void _RecoveredFeVariable_AssembleAtParticle( RecoveredFeVariable* self, ConstitutiveMatrix* constitutiveMatrix,
-		int particleIndex, IntegrationPoint* particle, int lElement_I, 
+		IntegrationPoint* particle, int lElement_I, 
 		double* globalCoord, double** GNx, double detJac,
 		double*** Hi_Mat, double** Fi_Mat	);
 
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Utils/src/StressField.cxx
--- a/Utils/src/StressField.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Utils/src/StressField.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -282,7 +282,7 @@ void _StressField_ValueAtParticle_Recalc
 	
 	/* Calculate stress from strain rate and constitutive matrix */
 	ConstitutiveMatrix_Assemble( self->constitutiveMatrix, lElement_I,
-                                     self->currentParticleIndex, particle, swarm);
+                                     particle, swarm);
 	FeVariable_InterpolateWithinElement( self->strainRateField, lElement_I, particle->xi, strainRate );
 	ConstitutiveMatrix_CalculateStress( self->constitutiveMatrix, strainRate, stress );
 
diff -r 1d8ec64051f0 -r e6b7ddcf70dc Utils/src/ViscosityField.cxx
--- a/Utils/src/ViscosityField.cxx	Sun Oct 23 11:58:12 2011 -0700
+++ b/Utils/src/ViscosityField.cxx	Sun Oct 23 11:59:34 2011 -0700
@@ -167,8 +167,7 @@ void _ViscosityField_ValueAtParticle( vo
 	
 	/* Calculate viscosity from constitutive matrix */
 	ConstitutiveMatrix_Assemble( self->constitutiveMatrix, lElement_I,
-                                     self->currentParticleIndex, particle,
-                                     swarm);
+                                     particle, swarm);
 	*viscosity = ConstitutiveMatrix_GetIsotropicViscosity( self->constitutiveMatrix );
 }
 



More information about the CIG-COMMITS mailing list