[cig-commits] commit: Enhance StressBC so that it can add in a force due to a different material underneath the computational region
Mercurial
hg at geodynamics.org
Thu Oct 14 11:30:23 PDT 2010
changeset: 855:401fd458c320
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Thu Oct 14 11:26:58 2010 -0700
files: Utils/src/StressBC.c Utils/src/StressBC.h
description:
Enhance StressBC so that it can add in a force due to a different material underneath the computational region
diff -r 6dce5aef7535 -r 401fd458c320 Utils/src/StressBC.c
--- a/Utils/src/StressBC.c Tue Jul 27 18:00:11 2010 -0700
+++ b/Utils/src/StressBC.c Thu Oct 14 11:26:58 2010 -0700
@@ -189,7 +189,9 @@ void _StressBC_AssignFromXML( void* forc
_StressBC_GetValues(cf,self,"x",data);
_StressBC_GetValues(cf,self,"y",data);
_StressBC_GetValues(cf,self,"z",data);
-
+
+ self->bottom_density=
+ Stg_ComponentFactory_GetDouble(cf,self->name,"bottomDensity",0.0);
}
/* Gets the actual values used by the StressBC (e.g. a float or a function). */
@@ -308,6 +310,7 @@ void _StressBC_AssembleElement( void* fo
IArray *incidence;
int elementNodeCount;
int *elementNodes;
+ double *coord;
FeVariable* velocityField = NULL;
velocityField = (FeVariable*)FieldVariable_Register_GetByName
@@ -383,15 +386,33 @@ void _StressBC_AssembleElement( void* fo
0,self->context,&stress);
break;
case StressBC_HydrostaticTerm:
+ if(self->_wall!=Wall_Top && self->_wall!=Wall_Bottom)
+ {
+ Stream* errorStr=Journal_Register( Error_Type, self->type );
+ Journal_Firewall(0,errorStr,"You can only apply a HydrostaticTerm StressBC to the top or bottom wall.\nYou applied it to the %s wall",WallVC_WallEnumToStr[self->_wall]);
+ }
+
+ coord=Mesh_GetVertex(mesh,elementNodes[eNode_I]);
stress=
-HydrostaticTerm_Pressure(self->_entryTbl[entry_I].hydrostaticTerm,
- Mesh_GetVertex(mesh,elementNodes[eNode_I]));
- if(self->_wall!=Wall_Top)
+ coord);
+ /* For the bottom, we need to add in the effects of
+ material outside the mesh. */
+
+ if(self->_wall==Wall_Bottom)
{
- Stream* errorStr=Journal_Register( Error_Type, self->type );
- Journal_Firewall(0,errorStr,"You can only apply a HydrostaticTerm StressBC to the top wall.\nYou applied it to the %s wall",WallVC_WallEnumToStr[self->_wall]);
+ Coord bottom;
+ double dy;
+ bottom[0]=coord[0];
+ bottom[1]=0;
+ bottom[2]=coord[2];
+ dy=bottom[1] - coord[1];
+ stress+=HydrostaticTerm_Pressure(self->_entryTbl[entry_I].hydrostaticTerm,bottom);
+ stress-=self->bottom_density
+ * self->_entryTbl[entry_I].hydrostaticTerm->gravity
+ * dy;
}
-
+
if(dim==2)
{
double dx, dy, *coord0, *coord1;
diff -r 6dce5aef7535 -r 401fd458c320 Utils/src/StressBC.h
--- a/Utils/src/StressBC.h Tue Jul 27 18:00:11 2010 -0700
+++ b/Utils/src/StressBC.h Thu Oct 14 11:26:58 2010 -0700
@@ -59,6 +59,7 @@
StressBC_Entry _entryTbl[3]; \
int numEntries; \
ConditionFunction_Register* conFunc_Register; \
+ double bottom_density; \
struct StressBC { __StressBC };
More information about the CIG-COMMITS
mailing list