[cig-commits] r5437 - in long/3D/Gale/trunk: . src/PICellerator/Utils/src src/StgFEM/libStG_FEM/src src/StgFEM/plugins/StandardConditionFunctions

walter at geodynamics.org walter at geodynamics.org
Mon Dec 4 12:37:54 PST 2006


Author: walter
Date: 2006-12-04 12:37:53 -0800 (Mon, 04 Dec 2006)
New Revision: 5437

Added:
   long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.meta
Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/extension.xml
   long/3D/Gale/trunk/fountain.xml
   long/3D/Gale/trunk/shortening.xml
   long/3D/Gale/trunk/sinusoid.xml
   long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.h
   long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h
   long/3D/Gale/trunk/src/StgFEM/libStG_FEM/src/Init.c
   long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/SConscript
   long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c
   long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.h
   long/3D/Gale/trunk/subduction.xml
Log:
 r1128 at earth:  boo | 2006-12-04 12:37:14 -0800
 Make StressBC use StandardConditionFunctions.  This also means making StandardConditionFunctions a component rather than a plugin, because otherwise StressBC can not find it.  This required updating the example xml files.



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1127
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1128

Modified: long/3D/Gale/trunk/extension.xml
===================================================================
--- long/3D/Gale/trunk/extension.xml	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/extension.xml	2006-12-04 20:37:53 UTC (rev 5437)
@@ -448,9 +448,11 @@
       <param name="dims">3</param>
       <param name="cellMesh">mesh-linear</param>
     </struct>
+    <struct name="conditionFunctions">
+      <param name="Type">StgFEM_StandardConditionFunctions</param>
+    </struct>
   </struct>
   <list name="plugins">
-    <param>StgFEM_StandardConditionFunctions</param>
     <param>Underworld_EulerDeform</param>
     <param>Underworld_DumpSwarm</param>
   </list>
@@ -576,4 +578,10 @@
   <param name="StepFunctionDim">0</param>
   <param name="StepFunctionLessThan">False</param>
   <param name="checkpointEvery">1</param>
+
+
+  <param name="journal.info">True</param>
+  <param name="journal.debug">True</param>
+  <param name="journal-level.info">2</param>
+  <param name="journal-level.debug">2</param>
 </StGermainData>

Modified: long/3D/Gale/trunk/fountain.xml
===================================================================
--- long/3D/Gale/trunk/fountain.xml	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/fountain.xml	2006-12-04 20:37:53 UTC (rev 5437)
@@ -1,6 +1,9 @@
 <?xml version="1.0"?>
 <StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
   <struct name="components">
+    <struct name="conditionFunctions">
+      <param name="Type">StgFEM_StandardConditionFunctions</param>
+    </struct>
     <struct name="geometry">
       <param name="Type">MeshGeometry</param>
       <param name="mesh">mesh-linear</param>
@@ -368,7 +371,11 @@
       <param name="Type">StressBC</param>
       <param name="ForceVector">mom_force</param>
       <param name="Swarm">picIntegrationPoints</param>
-      <param name="force">-1.0</param>
+      <param name="wall">bottom</param>
+<!--       <param name="x_type">double</param> -->
+<!--       <param name="x_value">1.0</param> -->
+      <param name="y_type">function</param>
+      <param name="y_value">Gaussian</param>
     </struct>
     <struct name="background">
       <param name="Type">Everywhere</param>
@@ -425,7 +432,6 @@
     </struct>
   </struct>
   <list name="plugins">
-    <param>StgFEM_StandardConditionFunctions</param>
     <param>Underworld_EulerDeform</param>
   </list>
   <param name="maxTimeSteps">500</param>
@@ -441,8 +447,8 @@
   <param name="maxX">1.0f</param>
   <param name="maxY">0.5f</param>
   <param name="maxZ">0.3f</param>
-  <param name="elementResI">64</param>
-  <param name="elementResJ">32</param>
+  <param name="elementResI">32</param>
+  <param name="elementResJ">16</param>
   <param name="elementResK">3</param>
   <param name="allowUnbalancing">True</param>
   <param name="buildNodeNeighbourTbl">True</param>
@@ -527,20 +533,28 @@
           </struct>
         </list>
       </struct>
-      <struct>
-        <param name="type">WallVC</param>
-        <param name="wall">bottom</param>
-        <list name="variables">
-          <struct>
-            <param name="name">vy</param>
-            <param name="type">double</param>
-            <param name="value">0.0</param>
-          </struct>
-        </list>
-      </struct>
+<!--       <struct> -->
+<!--         <param name="type">WallVC</param> -->
+<!--         <param name="wall">bottom</param> -->
+<!--         <list name="variables"> -->
+<!--           <struct> -->
+<!--             <param name="name">vy</param> -->
+<!--             <param name="type">double</param> -->
+<!--             <param name="value">0.0</param> -->
+<!--           </struct> -->
+<!--         </list> -->
+<!--       </struct> -->
     </list>
   </struct>
   <param name="checkpointEvery">1</param>
   <param name="gravity">1.</param>
+  <param name="GaussianHeight">1.0</param>
+  <param name="GaussianWidth">0.1</param>
+  <param name="GaussianCenter">0.5</param>
+
 <!--   <param name="journal.info">True</param> -->
+<!--   <param name="journal.debug">True</param> -->
+<!--   <param name="journal-level.info">2</param> -->
+<!--   <param name="journal-level.debug">2</param> -->
+
 </StGermainData>

Modified: long/3D/Gale/trunk/shortening.xml
===================================================================
--- long/3D/Gale/trunk/shortening.xml	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/shortening.xml	2006-12-04 20:37:53 UTC (rev 5437)
@@ -467,9 +467,11 @@
       <param name="dims">3</param>
       <param name="cellMesh">mesh-linear</param>
     </struct>
+    <struct name="conditionFunctions">
+      <param name="Type">StgFEM_StandardConditionFunctions</param>
+    </struct>
   </struct>
   <list name="plugins">
-    <param>StgFEM_StandardConditionFunctions</param>
     <param>Underworld_EulerDeform</param>
     <param>Underworld_DumpSwarm</param>
   </list>

Modified: long/3D/Gale/trunk/sinusoid.xml
===================================================================
--- long/3D/Gale/trunk/sinusoid.xml	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/sinusoid.xml	2006-12-04 20:37:53 UTC (rev 5437)
@@ -428,9 +428,11 @@
       <param name="dims">2</param>
       <param name="cellMesh">mesh-linear</param>
     </struct>
+    <struct name="conditionFunctions">
+      <param name="Type">StgFEM_StandardConditionFunctions</param>
+    </struct>
   </struct>
   <list name="plugins">
-    <param>StgFEM_StandardConditionFunctions</param>
     <param>Underworld_EulerDeform</param>
   </list>
   <param name="maxTimeSteps">500</param>

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.c	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.c	2006-12-04 20:37:53 UTC (rev 5437)
@@ -65,11 +65,20 @@
 /* Textual name of this class */
 const Type StressBC_Type = "StressBC";
 
+const char* StressBC_WallEnumToStr[StressBC_Wall_Size] = {
+	"back",
+	"left",
+	"bottom",
+	"right",
+	"top",
+	"front" };
+
 StressBC* StressBC_New( 
-		Name                                                name,
-		ForceVector*                                        forceVector,
-		Swarm*                                              integrationSwarm,
-		double                                              force )
+		Name                                      name,
+		ForceVector*                              forceVector,
+		Swarm*                                    integrationSwarm,
+                ConditionFunction_Register*               conFunc_Register,
+                FiniteElementContext*                     context)
 {
 	StressBC* self = (StressBC*) _StressBC_DefaultNew( name );
 
@@ -77,7 +86,8 @@
 			self,
 			forceVector,
 			integrationSwarm,
-			force );
+                        conFunc_Register,
+                        context);
 
 	return self;
 }
@@ -96,8 +106,9 @@
 		Stg_Component_ExecuteFunction*                      _execute,
 		Stg_Component_DestroyFunction*                      _destroy,
 		ForceTerm_AssembleElementFunction*                  _assembleElement,		
-		StressBC_CalcForceFunction*              _calcForce,
-		Name                                                name )
+                ConditionFunction_Register*			    conFunc_Register,
+		Name                                                name,
+                FiniteElementContext*                               context)
 {
 	StressBC* self;
 	
@@ -118,35 +129,37 @@
 		_assembleElement,
 		name );
 	
-	/* Virtual info */
-	self->_calcForce = _calcForce;
+        self->conFunc_Register=conFunc_Register;
+        self->context=context;
 	
 	return self;
 }
 
 void _StressBC_Init( 
 		StressBC*                                  self, 
-		double                                              force )
+                ConditionFunction_Register*		   conFunc_Register,
+                FiniteElementContext*                      context)
 {
-	self->force             = force;
-
+        self->numEntries        = 0;
+        self->conFunc_Register=conFunc_Register;
+        self->context=context;
 }
 
 void StressBC_InitAll( 
 		void*                                               forceTerm,
 		ForceVector*                                        forceVector,
 		Swarm*                                              integrationSwarm,
-		double                                              force )
+                ConditionFunction_Register*			    conFunc_Register,
+                FiniteElementContext*                      context)
 {
 	StressBC* self = (StressBC*) forceTerm;
 
 	ForceTerm_InitAll( self, forceVector, integrationSwarm, NULL );
-	_StressBC_Init( self, force );
+	_StressBC_Init( self, conFunc_Register, context );
 }
 
 void _StressBC_Delete( void* forceTerm ) {
 	StressBC* self = (StressBC*)forceTerm;
-	Index i;
 
 	_ForceTerm_Delete( self );
 }
@@ -155,9 +168,6 @@
 	StressBC* self = (StressBC*)forceTerm;
 	
 	_ForceTerm_Print( self, stream );
-
-	/* General info */
-	Journal_PrintDouble( stream, self->force );
 }
 
 void* _StressBC_DefaultNew( Name name ) {
@@ -174,22 +184,121 @@
 		_StressBC_Execute,
 		_StressBC_Destroy,
 		_StressBC_AssembleElement,
-		_StressBC_CalcForce,
-		name );
+                NULL,
+		name,
+                NULL);
 }
 
 void _StressBC_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
 	StressBC*          self             = (StressBC*)forceTerm;
-	double                      force;
+        FiniteElementContext* context;
 
 	/* Construct Parent */
 	_ForceTerm_Construct( self, cf, data );
 
-	force          = Stg_ComponentFactory_GetDouble( cf, self->name, "force", 0.0 );
+        context = (FiniteElementContext*)Stg_ComponentFactory_ConstructByName
+          ( cf, "context", FiniteElementContext, True, data ) ;
 
-	_StressBC_Init( self, force );
+	_StressBC_Init( self, context->condFunc_Register, context );
+        {
+          char*	wallStr;
+		
+          /* Obtain which wall */
+          wallStr = Stg_ComponentFactory_GetString( cf, self->name,
+                                                    "wall", "");
+          if (!strcasecmp(wallStr, "back"))
+            self->_wall = StressBC_Wall_Back;
+          else if (!strcasecmp(wallStr, "left"))
+            self->_wall = StressBC_Wall_Left;
+          else if (!strcasecmp(wallStr, "bottom"))
+            self->_wall = StressBC_Wall_Bottom;
+          else if (!strcasecmp(wallStr, "right"))
+            self->_wall = StressBC_Wall_Right;
+          else if (!strcasecmp(wallStr, "top"))
+            self->_wall = StressBC_Wall_Top;
+          else if (!strcasecmp(wallStr, "front"))
+            self->_wall = StressBC_Wall_Front;
+          else {
+            assert( 0 );
+            self->_wall = StressBC_Wall_Size; /* invalid entry */
+          }
+        }
+        _StressBC_GetValues(cf,self,"x");
+        _StressBC_GetValues(cf,self,"y");
+        _StressBC_GetValues(cf,self,"z");
+          
 }
 
+/* Gets the actual values used by the StressBC (e.g. a float or a function). */
+void _StressBC_GetValues(Stg_ComponentFactory* cf, void *stressBC,
+                         char *direction)
+{
+          StressBC*          self             = (StressBC*)stressBC;
+          char temp_str[20];
+          char *type;
+
+          switch(*direction)
+            {
+            case 'x':
+              self->_entryTbl[self->numEntries].axis=I_AXIS;
+              break;
+            case 'y':
+              self->_entryTbl[self->numEntries].axis=J_AXIS;
+              break;
+            case 'z':
+              self->_entryTbl[self->numEntries].axis=K_AXIS;
+              break;
+            }
+
+          strcat(strcpy(temp_str,direction),"_type");
+          type=Stg_ComponentFactory_GetString( cf, self->name, temp_str, "");
+          strcat(strcpy(temp_str,direction),"_value");
+
+          if(!strcasecmp(type,"double") || !strcasecmp(type,"float"))
+            {
+              self->_entryTbl[self->numEntries].type = StressBC_Double;
+              self->_entryTbl[self->numEntries].DoubleValue =
+                Stg_ComponentFactory_GetDouble( cf, self->name, temp_str, 0.0);
+              (self->numEntries)++;
+            }
+          else if(!strcasecmp(type,"function"))
+            {
+              char *funcName =
+                Stg_ComponentFactory_GetString( cf, self->name, temp_str, "");
+              Index	cfIndex;
+
+              cfIndex = ConditionFunction_Register_GetIndex
+                ( self->conFunc_Register, funcName);
+              self->_entryTbl[self->numEntries].type =
+                StressBC_ConditionFunction;
+              if ( cfIndex == (unsigned)-1 ) {	
+                Stream*	errorStr = Journal_Register( Error_Type, self->type );
+                
+                Journal_Printf( errorStr, "Error- in %s: While parsing "
+                                "definition of StressBC (applies to wall \"%s\"), the cond. func. applied to "
+                                "direction \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
+                                __func__, StressBC_WallEnumToStr[self->_wall],
+                                direction, funcName );
+                Journal_Printf( errorStr, "(Available functions in the C.F. register are: ");	
+                ConditionFunction_Register_PrintNameOfEachFunc
+                  ( self->conFunc_Register, errorStr );
+                Journal_Printf( errorStr, ")\n");	
+                assert(0);
+              }	
+              self->_entryTbl[self->numEntries].CFIndex = cfIndex;
+              (self->numEntries)++;
+            }
+          else if(strlen(type)!=0)
+            {
+              Stream* errorStr = Journal_Register( Error_Type, self->type );
+              Journal_Printf( errorStr, "Error- in %s: While parsing "
+                              "definition of StressBC (applies to wall \"%s\"), the type of condition \"%s\"\nis not supported.  Supported types are \"double\" and \"function\".",
+                                __func__, StressBC_WallEnumToStr[self->_wall],
+                                type );
+              assert(0);
+            }
+}
+
 void _StressBC_Build( void* forceTerm, void* data ) {
 	StressBC*               self               = (StressBC*)forceTerm;
 	Name                             name;
@@ -233,13 +342,50 @@
         
         IJK			ijk;
 
+        /* Compute the area of the face. */
         if(dim==2)
           {
             Coord *coord1, *coord2;
-            
-            coord1=&(Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][0]));
-            coord2=&(Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][1]));
-            area=(*coord2)[0]-(*coord1)[0];
+            int lower,upper,direction;
+            switch(self->_wall)
+              {
+              case StressBC_Wall_Left:
+                lower=0;
+                upper=3;
+                direction=1;
+                break;
+              case StressBC_Wall_Right:
+                lower=1;
+                upper=2;
+                direction=1;
+                break;
+              case StressBC_Wall_Bottom:
+                lower=0;
+                upper=1;
+                direction=0;
+                break;
+              case StressBC_Wall_Top:
+                lower=3;
+                upper=2;
+                direction=0;
+                break;
+              }
+
+            coord1=&(Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][lower]));
+            coord2=&(Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][upper]));
+            area=(*coord2)[direction]-(*coord1)[direction];
+
+/*             printf("area %d %d %d %d %lf %lf %lf %lf %lf %lf %lf %lf\n",lElement_I, lower, upper, direction, */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][0])[0], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][0])[1], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][1])[0], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][1])[1], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][2])[0], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][2])[1], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][3])[0], */
+/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][3])[1], */
+/*                  area); */
+
           }
         else
           {
@@ -247,33 +393,61 @@
             assert(0);
           }
 
-        /* Apply force in verticle direction */
+        /* Apply the stress */
         for( eNode_I = 0 ; eNode_I < elementNodeCount; eNode_I++ ) { 		
           /* Make sure that we are on the boundary */
+          int condition, entry_I;
+          ConditionFunction* cf;
           RegularMeshUtils_Node_1DTo3D( decomp, mesh->elementNodeTbl[lElement_I][eNode_I],
                                         &ijk[0], &ijk[1], &ijk[2] );      
-          if( ijk[1] == 0 ) {
-            stress = StressBC_CalcForce(self,mesh,lElement_I,eNode_I);
+          switch(self->_wall)
+            {
+            case StressBC_Wall_Left:
+              condition=(ijk[0] == 0);
+              break;
+            case StressBC_Wall_Right:
+              condition=(ijk[0] == ( decomp->nodeGlobal3DCounts[0] - 1 ));
+              break;
+            case StressBC_Wall_Bottom:
+              condition=(ijk[1] == 0);
+              break;
+            case StressBC_Wall_Top:
+              condition=(ijk[1] == ( decomp->nodeGlobal3DCounts[1] - 1 ));
+              break;
+            case StressBC_Wall_Front:
+              condition=(ijk[2] == 0);
+              break;
+            case StressBC_Wall_Back:
+              condition=(ijk[2] == ( decomp->nodeGlobal3DCounts[2] - 1 ));
+              break;
+            }
 
-            elForceVec[ eNode_I * nodeDofCount + I_AXIS ] += stress*area;
-/*           elForceVec[ eNode_I * nodeDofCount + J_AXIS ] += force; */
+          if(condition)
+            {
+              for(entry_I=0; entry_I<self->numEntries; ++entry_I)
+                {
+                  switch(self->_entryTbl[entry_I].type)
+                    {
+                    case StressBC_Double:
+                      stress=self->_entryTbl[entry_I].DoubleValue;
+                      break;
+                    case StressBC_ConditionFunction:
+                      cf=self->conFunc_Register->
+                        _cf[self->_entryTbl[entry_I].CFIndex];
 
+                      /* We use a variable number of zero "0", because
+                         we don't use the variable number and that one
+                         is always going to exist. */
+                      ConditionFunction_Apply
+                        (cf,mesh->elementNodeTbl[lElement_I][eNode_I],
+                         0,self->context,&stress);
+                      break;
+                    }
+                  elForceVec[ eNode_I * nodeDofCount
+                              + self->_entryTbl[entry_I].axis ] += stress*area;
 
-/*           printf("force %d %d %lf %lf %lf %lf %lf\n",eNode_I,lElement_I, */
-/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][eNode_I])[0], */
-/*                  Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][eNode_I])[1], */
-/*                  stress,area,elForceVec[ eNode_I * nodeDofCount + I_AXIS ]); */
-
-          }
+                }
+            }
         }
 }
 
-
-double _StressBC_CalcForce( void* forceTerm, Mesh* mesh, Element_DomainIndex lElement_I, Index node_I ) {
-	StressBC*               self               = (StressBC*) forceTerm;
-		
-/*             return self->force; */
-        Coord *coord;
-        coord=&(Mesh_CoordAt(mesh,mesh->elementNodeTbl[lElement_I][node_I]));
-        return exp(-(0.5-(*coord)[0])*(0.5-(*coord)[0])/0.01)*self->force;
-}

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.h	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/StressBC.h	2006-12-04 20:37:53 UTC (rev 5437)
@@ -46,12 +46,6 @@
 #ifndef __Gale_Utils_StressBC_h__
 #define __Gale_Utils_StressBC_h__
 
-	typedef double (StressBC_CalcForceFunction) (
-				void* forceTerm, 
-                                Mesh* mesh,
-				Element_LocalIndex lElement_I, 
-				Index node_I );
-
 	/** Textual name of this class */
 	extern const Type StressBC_Type;
 
@@ -60,20 +54,21 @@
 		/* General info */ \
 		__ForceTerm \
 		\
-		/* Virtual info */ \
-		StressBC_CalcForceFunction*              _calcForce;                          \
-		\
 		/* StressBC info */ \
-		double                                              force;                           \
+		StressBC_Wall			         _wall; \
+                StressBC_Entry                           _entryTbl[3]; \
+                int                                      numEntries; \
+		ConditionFunction_Register*		 conFunc_Register; \
+                FiniteElementContext*                    context; \
 
-
 	struct StressBC { __StressBC };
 
 	StressBC* StressBC_New( 
 		Name                                                name,
 		ForceVector*                                        forceVector,
 		Swarm*                                              integrationSwarm,
-		double                                              force );
+                ConditionFunction_Register*			    conFunc_Register,
+                FiniteElementContext*                     context);
 
 	StressBC* _StressBC_New( 
 		SizeT                                               sizeOfSelf,  
@@ -88,29 +83,28 @@
 		Stg_Component_ExecuteFunction*                      _execute,
 		Stg_Component_DestroyFunction*                      _destroy,
 		ForceTerm_AssembleElementFunction*                  _assembleElement,		
-		StressBC_CalcForceFunction*              _calcForce,
-		Name                                                name );
+                ConditionFunction_Register*			    conFunc_Register,
+		Name                                                name,
+                FiniteElementContext*                     context);
 	
 	void StressBC_InitAll( 
 		void*                                               forceTerm,
 		ForceVector*                                        forceVector,
 		Swarm*                                              integrationSwarm,
-		double                                              force );
+                ConditionFunction_Register*			    conFunc_Register,
+                FiniteElementContext*                     context);
 
 	void _StressBC_Delete( void* forceTerm );
 	void _StressBC_Print( void* forceTerm, Stream* stream );
 
 	void* _StressBC_DefaultNew( Name name ) ;
-void _StressBC_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) ;
+        void _StressBC_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) ;
 	void _StressBC_Build( void* forceTerm, void* data ) ;
 	void _StressBC_Initialise( void* forceTerm, void* data ) ;
 	void _StressBC_Execute( void* forceTerm, void* data ) ;
 	void _StressBC_Destroy( void* forceTerm, void* data ) ;
 
 	void _StressBC_AssembleElement( void* forceTerm, ForceVector* forceVector, Element_LocalIndex lElement_I, double* elForceVec ) ;
-        double _StressBC_CalcForce( void* forceTerm, Mesh* mesh, Element_DomainIndex dElement_I, Index node_I ) ;
+        void _StressBC_GetValues(Stg_ComponentFactory* cf, void *stressBC, char *direction);
 
-	#define StressBC_CalcForce( forceTerm, mesh, lElement_I, node_I )\
-		(( (StressBC*) forceTerm )->_calcForce( forceTerm, mesh, lElement_I, node_I ) )
-
 #endif

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h	2006-12-04 20:37:53 UTC (rev 5437)
@@ -58,4 +58,30 @@
 	typedef struct StressBC                         StressBC;
 	typedef struct MaterialSwarmVariable            MaterialSwarmVariable;
 
+/* StressBC types */
+typedef enum
+  {
+    StressBC_Wall_Back,
+    StressBC_Wall_Left,
+    StressBC_Wall_Bottom,
+    StressBC_Wall_Right,
+    StressBC_Wall_Top,
+    StressBC_Wall_Front,
+    StressBC_Wall_Size
+  } StressBC_Wall;
+
+typedef enum
+  {
+    StressBC_Double,
+    StressBC_ConditionFunction
+  } StressBC_Types;
+
+typedef struct
+{
+  StressBC_Types type;
+  double DoubleValue;
+  Index CFIndex;
+  Axis axis;
+} StressBC_Entry;
+
 #endif 

Modified: long/3D/Gale/trunk/src/StgFEM/libStG_FEM/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/libStG_FEM/src/Init.c	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/StgFEM/libStG_FEM/src/Init.c	2006-12-04 20:37:53 UTC (rev 5437)
@@ -65,6 +65,7 @@
 	StgFEM_Discretisation_Init( argc, argv );
 	StgFEM_SLE_Init( argc, argv );
 	StgFEM_Assembly_Init( argc, argv );
-	
+        StgFEM_StandardConditionFunctions_Init( argc, argv );
+
 	return True;
 }

Modified: long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/SConscript
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/SConscript	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/SConscript	2006-12-04 20:37:53 UTC (rev 5437)
@@ -24,6 +24,10 @@
 
 c_files=Split("""StandardConditionFunctions.c""")
 
+meta_files=Split("""StandardConditionFunctions.meta""")
+
+c_files+=[local_env.Meta(meta_files)]
+
 shared_lib_objects+=[local_env.SharedLibrary('StgFEM_StandardConditionFunctionsmodule',
                                              c_files,SHLIBPREFIX='')]
 StgFEM_static_objects+=[local_env.StaticObject(c_files)]    

Modified: long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c	2006-12-04 20:37:53 UTC (rev 5437)
@@ -112,6 +112,9 @@
 
 	condFunc = ConditionFunction_New( StG_FEM_StandardConditionFunctions_StepFunctionProduct4, "StepFunctionProduct4");
 	ConditionFunction_Register_Add( context->condFunc_Register, condFunc );
+
+	condFunc = ConditionFunction_New( StG_FEM_StandardConditionFunctions_Gaussian, "Gaussian");
+	ConditionFunction_Register_Add( context->condFunc_Register, condFunc );
 }
 
 void* _StgFEM_StandardConditionFunctions_DefaultNew( Name name ) {
@@ -839,3 +842,42 @@
           *result = 0;
         }
 }
+
+/* A Gaussian GaussianHeight*exp(-((GaussianCenter-x)/GaussianWidth)^2) */
+
+void StG_FEM_StandardConditionFunctions_Gaussian
+( Node_LocalIndex node_lI, Variable_Index var_I, void* _context,
+  void* _result ) {
+	FiniteElementContext *	context            = (FiniteElementContext*)_context;
+	FeVariable*             feVariable         = NULL;
+	FiniteElement_Mesh*     mesh               = NULL;
+	Dictionary*             dictionary         = context->dictionary;
+	double*                 result             = (double*) _result;
+        double*                 coord;
+	double                  center, width, height;
+	unsigned		dim;
+
+	feVariable = (FeVariable*)FieldVariable_Register_GetByName( context->fieldVariable_Register, "VelocityField" );
+	mesh       = feVariable->feMesh;
+	coord      = Mesh_CoordAt( mesh, node_lI );
+
+        center = Dictionary_GetDouble_WithDefault( dictionary,
+                                                   "GaussianCenter", 0.0 );
+	width = Dictionary_GetDouble_WithDefault( dictionary,
+                                                  "GaussianWidth", 1.0 );
+	height = Dictionary_GetDouble_WithDefault( dictionary,
+                                                   "GaussianHeight", 1.0 );
+	dim = Dictionary_GetUnsignedInt_WithDefault( dictionary,
+                                                     "GaussianDim", 0 );
+
+        *result=height*exp(-(center-coord[dim])*(center-coord[dim])
+                           /(width*width));
+}
+
+
+Bool StgFEM_StandardConditionFunctions_Init( int* argc, char** argv[] ) {
+  Stg_ComponentRegister* componentsRegister = Stg_ComponentRegister_Get_ComponentRegister();
+  Stg_ComponentRegister_Add(componentsRegister,
+                            StgFEM_StandardConditionFunctions_Type, "0",
+                            _StgFEM_StandardConditionFunctions_DefaultNew );
+}

Modified: long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.h	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.h	2006-12-04 20:37:53 UTC (rev 5437)
@@ -84,6 +84,7 @@
 void StG_FEM_StandardConditionFunctions_StepFunctionProduct2( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) ;
 void StG_FEM_StandardConditionFunctions_StepFunctionProduct3( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) ;
 void StG_FEM_StandardConditionFunctions_StepFunctionProduct4( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) ;
+void StG_FEM_StandardConditionFunctions_Gaussian( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) ;
 
 
 

Added: long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.meta
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.meta	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.meta	2006-12-04 20:37:53 UTC (rev 5437)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">StgFEM_StandardConditionFunctions</param>
+<param name="Organisation">VPAC and MCC</param>
+<param name="Project">Gale</param>
+<param name="Location">./Gale/Utils/src/</param>
+<param name="Project Web">https://csd.vpac.org/twiki/bin/view/PICellerator/WebHome</param>
+<param name="Copyright">Copyright (C) 2005 VPAC and Monash Cluster Computing.</param>
+<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense http://www.opensource.org/licenses/bsd-license.php</param>
+<param name="Parent">Codelet</param>
+<param name="Description">This implements a number of useful functions.</param>
+
+<!--Now the interesting stuff-->
+
+
+<list name="Params">
+	<struct>
+	</struct>
+
+</list>
+
+<!-- Add an exmaple XML if possible -->
+<param name="Example">
+		<struct name="buoyancyForceTerm">
+			<param name="Type">StressBC</param>
+			<param name="ForceVector">mom_force</param>
+			<param name="Swarm">materialPoints</param>
+			<param name="force">1.0</param>
+		</struct>
+</param>
+
+</StGermainData>

Modified: long/3D/Gale/trunk/subduction.xml
===================================================================
--- long/3D/Gale/trunk/subduction.xml	2006-12-04 20:37:48 UTC (rev 5436)
+++ long/3D/Gale/trunk/subduction.xml	2006-12-04 20:37:53 UTC (rev 5437)
@@ -510,9 +510,11 @@
       <param name="dims">3</param>
       <param name="cellMesh">mesh-linear</param>
     </struct>
+    <struct name="conditionFunctions">
+      <param name="Type">StgFEM_StandardConditionFunctions</param>
+    </struct>
   </struct>
   <list name="plugins">
-    <param>StgFEM_StandardConditionFunctions</param>
     <param>Underworld_EulerDeform</param>
     <param>Underworld_DumpSwarm</param>
   </list>



More information about the cig-commits mailing list