[cig-commits] r7664 - in long/3D/Gale/trunk: . src/Gale/Utils/src

walter at geodynamics.org walter at geodynamics.org
Fri Jul 13 16:15:10 PDT 2007


Author: walter
Date: 2007-07-13 16:15:10 -0700 (Fri, 13 Jul 2007)
New Revision: 7664

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
   long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
Log:
 r1871 at earth:  boo | 2007-07-13 16:10:59 -0700
 Make FrictionVC get the Stress and Pressure fields from the input file instead of hardcoding a name.



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

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c	2007-07-13 23:15:07 UTC (rev 7663)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c	2007-07-13 23:15:10 UTC (rev 7664)
@@ -261,8 +261,8 @@
 	self->_entryTbl = 0;
 	self->_entryCount = 0;
         self->context=NULL;
-        self->pressure=NULL;
-        self->deviatoric_stress=NULL;
+        self->pressure_name=NULL;
+        self->deviatoric_stress_name=NULL;
         for(i=0;i<3;++i)
           {
             self->include_lower_boundary[i]=True;
@@ -320,6 +320,9 @@
 		self->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, self->_entryCount, "FrictionVC->_entryTbl" );
 		varsVal = Dictionary_Entry_Value_GetMember(vcDictVal, "variables");
 
+                self->deviatoric_stress_name=Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "StressField"));
+                self->pressure_name=Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "PressureField"));
+
                 self->include_lower_boundary[I_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeLowerX"),True);
                 self->include_lower_boundary[J_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeLowerY"),True);
                 self->include_lower_boundary[K_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeLowerZ"),True);
@@ -419,8 +422,8 @@
 		self->_entryCount = 0;
 		self->_entryTbl = NULL;
                 self->context=NULL;
-                self->pressure=NULL;
-                self->deviatoric_stress=NULL;
+                self->pressure_name=NULL;
+                self->deviatoric_stress_name=NULL;
                 for(i=0;i<3;++i)
                   {
                     self->include_lower_boundary[i]=True;
@@ -544,8 +547,8 @@
 	newFrictionVC->_wall = self->_wall;
 	newFrictionVC->_entryCount = self->_entryCount;
 	newFrictionVC->context = self->context;
-	newFrictionVC->pressure = self->pressure;
-	newFrictionVC->deviatoric_stress = self->deviatoric_stress;
+	newFrictionVC->pressure_name = self->pressure_name;
+	newFrictionVC->deviatoric_stress_name = self->deviatoric_stress_name;
         for(i=0;i<3;++i)
           {
             newFrictionVC->include_lower_boundary[i]=self->include_lower_boundary[i];
@@ -612,30 +615,32 @@
 {
 	FrictionVC*		self = (FrictionVC*)variableCondition;
 	IndexSet	*set = NULL;
-	Stream*     warningStr = Journal_Register( Error_Type, self->type );
+	Stream*     errorStr = Journal_Register( Error_Type, self->type );
 	unsigned	nDims;
 	Grid*		grid;
+        FeVariable *deviatoric_stress, *pressure;
 
 	nDims = Mesh_GetDimSize( self->_mesh );
 	grid = *(Grid**)ExtensionManager_Get( self->_mesh->info, self->_mesh, 
                                               ExtensionManager_GetHandle( self->_mesh->info, 
                                                                           "vertexGrid" ) );
-        /* We get the stress and pressure here.  It requires that you
-           name your pressure and stress as PressureField and
-           StressField.  I could not figure out how to get it to work
-           by reading the dictionary, because things are not built
-           when the dictionary is read. */
-        if(!self->deviatoric_stress)
-          self->deviatoric_stress = (FeVariable*)FieldVariable_Register_GetByName
-            ( self->context->fieldVariable_Register, "StressField" );
-        if(!self->pressure)
-          self->pressure = (FeVariable*)FieldVariable_Register_GetByName
-            ( self->context->fieldVariable_Register, "PressureField" );
+        deviatoric_stress = (FeVariable*)FieldVariable_Register_GetByName
+          ( self->context->fieldVariable_Register, self->deviatoric_stress_name );
+        pressure = (FeVariable*)FieldVariable_Register_GetByName
+          ( self->context->fieldVariable_Register, self->pressure_name );
 
+	Journal_Firewall( ( pressure!=NULL ), errorStr,
+                          "Error: In FrictionVC, the name provided for the pressure field \"%s\" does not exist\n",
+			  self->pressure_name);
+	Journal_Firewall( ( deviatoric_stress!=NULL ), errorStr,
+                          "Error: In FrictionVC, the name provided for the stress field \"%s\" does not exist\n",
+			  self->deviatoric_stress_name);
+          
+
         /* If this is the first time this routine is called, the
            stress may not have been initialized yet.  In that case,
            make everything stick. */
-        if(self->deviatoric_stress!=NULL && self->deviatoric_stress->dofLayout!=NULL)
+        if(deviatoric_stress!=NULL && deviatoric_stress->dofLayout!=NULL)
           {
             Node_LocalIndex n_i;
             unsigned	nNodes, direction, boundary, basis[2];
@@ -695,8 +700,8 @@
               if(ijk[direction]==boundary)
                 {
                   double str[6], p, normal_stress, tangential_norm;
-                  FeVariable_GetValueAtNode(self->deviatoric_stress,n_i,str);
-                  FeVariable_GetValueAtNode(self->pressure,n_i,&p);
+                  FeVariable_GetValueAtNode(deviatoric_stress,n_i,str);
+                  FeVariable_GetValueAtNode(pressure,n_i,&p);
                   
                   if(nDims==2)
                     {

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h	2007-07-13 23:15:07 UTC (rev 7663)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h	2007-07-13 23:15:10 UTC (rev 7664)
@@ -61,7 +61,7 @@
                 /* then there are problems compiling because this is in */ \
                 /* StGermain, and we do not have access to StgFEM yet. */ \
                 FiniteElementContext*           context; \
-                FeVariable *deviatoric_stress, *pressure; \
+                char *deviatoric_stress_name, *pressure_name; \
                 Bool include_lower_boundary[3]; \
                 Bool include_upper_boundary[3]; \
                 double friction;



More information about the cig-commits mailing list