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

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:47:33 PDT 2006


Author: walter
Date: 2006-10-11 13:47:32 -0700 (Wed, 11 Oct 2006)
New Revision: 4858

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h
Log:
 r2915 at earth:  boo | 2006-10-11 13:42:41 -0700
  r2831 at earth (orig r3819):  JulianGiordani | 2006-09-27 23:03:10 -0700
  
  Added new functions in TensorMath.* that will take the trace of a symmetric tensor or a normal tensor.
  Then in Operator.* added new operator functions called Operator_SymmetricTensor_GetNegAverageTrace and Operator_Tensor_GetNegAverageTrace which use the new trace functions and then also divide the result by ( -1 * dim ).
  
  Using these operators on the total stress field, (a field which i'm recovering ) means we can get a recovered pressure field.
  
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2914
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3818
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2915
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3819

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c	2006-10-11 20:47:26 UTC (rev 4857)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c	2006-10-11 20:47:32 UTC (rev 4858)
@@ -322,6 +322,29 @@
 	}
 }
 
+/** This function will calculate the trace of a symmetric tensor type */
+void SymmetricTensor_GetTrace( SymmetricTensor symmTensor, Dimension_Index dim, double *trace ) {
+	switch (dim) {
+	  case 1:
+		*trace = symmTensor[0];
+		break;
+	  case 2:
+		*trace = symmTensor[ST2D_00] + symmTensor[ST2D_11];
+		break;
+	  case 3:
+		*trace = symmTensor[ST3D_00] + symmTensor[ST3D_11] + symmTensor[ST3D_22];
+		break;
+	  default:{
+		Stream* error = Journal_Register( ErrorStream_Type, "TensorMath" );
+		Journal_Printf( error, "Cannot compute trace for symmetric tensor in dimension %d (in %s) since dim is not in the range [1, 3].\n", dim, __func__);
+		Journal_Firewall( False, Journal_Register( Error_Type, "TensorMath" ),
+			"In func '%s' don't understand dim = %u\n", __func__, dim );
+		break;
+		  }
+	}
+
+}
+
 /** This function prints an unnamed tensorArray */
 void Journal_PrintTensorArray_Unnamed( Stream* stream, TensorArray tensor, Dimension_Index dim ) {
 	Dimension_Index row_I, col_I;

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h	2006-10-11 20:47:26 UTC (rev 4857)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h	2006-10-11 20:47:32 UTC (rev 4858)
@@ -167,13 +167,15 @@
 void TensorArray_SetFromDoubleArray( TensorArray tensor, double** array, Dimension_Index dim ) ;
 void TensorArray_GetAntisymmetricPart( TensorArray tensor, Dimension_Index dim, TensorArray antiSymmetric ) ;
 void TensorArray_GetSymmetricPart( TensorArray tensor, Dimension_Index dim, SymmetricTensor symmetricTensor ) ;
-void TensorArray_GetTrace( TensorArray tensor, Dimension_Index dim, double *trace );
 
 /* Define Print functions */	
 void Journal_PrintTensorArray_Unnamed( Stream* stream, TensorArray tensor, Dimension_Index dim ) ;
 void Journal_PrintSymmetricTensor_Unnamed( Stream* stream, SymmetricTensor tensor, Dimension_Index dim ) ;
 void Journal_PrintSquareArray_Unnamed( Stream* stream, double** array, Dimension_Index dim ) ;
 
+/* Define Full Tensor and Symmetric Tensor, 'trace' functions */ 
+void TensorArray_GetTrace( TensorArray tensor, Dimension_Index dim, double *trace );
+void SymmetricTensor_GetTrace( SymmetricTensor tensor, Dimension_Index dim, double *trace );
 	
 double TensorArray_2ndInvariant( TensorArray tensor, Dimension_Index dim ) ;
 double SymmetricTensor_2ndInvariant( SymmetricTensor tensor, Dimension_Index dim ) ;

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c	2006-10-11 20:47:26 UTC (rev 4857)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c	2006-10-11 20:47:32 UTC (rev 4858)
@@ -200,6 +200,29 @@
 	TensorArray_GetAntisymmetricPart( operand0, self->dim, result );
 }
 
+void Operator_SymmetricTensor_GetNegAverageTrace( void* operator, double* operand0, double* result ) {
+	Operator* self = (Operator*) operator;
+	
+	Operator_FirewallUnary( self );
+	Operator_FirewallResultDofs( self, 1 );
+	
+	SymmetricTensor_GetTrace( operand0, self->dim, result ); 
+
+	*result = -1.0 * (*result) / self->dim ;
+}
+
+void Operator_Tensor_GetNegAverageTrace( void* operator, double* operand0, double* result ) {
+	Operator* self = (Operator*) operator;
+	
+	Operator_FirewallUnary( self );
+	Operator_FirewallResultDofs( self, 1 );
+	
+	TensorArray_GetTrace( operand0, self->dim, result ); 
+
+	*result = -1.0 * (*result) / self->dim ;
+}
+	
+
 void Operator_TakeFirstComponent( void* operator, double* operand0, double* result ) {
 	Operator* self = (Operator*) operator;
 
@@ -422,6 +445,16 @@
 		numberOfOperands = 1;
 		_carryOut = Operator_SymmetricTensor_Invariant;
 	}
+	else if ( ! strcasecmp( name, "SymmetricTensor_NegAverageTrace" ) ){ 
+		resultDofs = 1;
+		numberOfOperands = 1;
+		_carryOut = Operator_SymmetricTensor_GetNegAverageTrace;
+	}
+	else if ( ! strcasecmp( name, "Tensor_NegAverageTrace" ) ){ 
+		resultDofs = 1;
+		numberOfOperands = 1;
+		_carryOut = Operator_Tensor_GetNegAverageTrace;
+	}
 	else if ( ! strcasecmp( name, "TakeFirstComponent" ) ) {
 		resultDofs = 1;
 		numberOfOperands = 1;

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h	2006-10-11 20:47:26 UTC (rev 4857)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h	2006-10-11 20:47:32 UTC (rev 4858)
@@ -88,6 +88,8 @@
 	void Operator_TensorSymmetricPart( void* operatorObject, double* operand0, double* result );
 	void Operator_SymmetricTensor_Invariant( void* operatorObject, double* operand0, double* result );
 	void Operator_TensorAntisymmetricPart( void* operatorObject, double* operand0, double* result ) ;
+	void Operator_Tensor_GetNegAverageTrace( void* operatorObject, double* operand0, double* result );
+	void Operator_SymmetricTensor_GetNegAverageTrace( void* operatorObject, double* operand0, double* result );
 	void Operator_TakeFirstComponent( void* operatorObject, double* operand0, double* result ) ;
 	void Operator_TakeSecondComponent( void* operatorObject, double* operand0, double* result ) ;
 	void Operator_TakeThirdComponent( void* operatorObject, double* operand0, double* result );



More information about the cig-commits mailing list