[cig-commits] r13244 - in long/3D/Gale/trunk: . input/examples src/Gale/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Mon Nov 3 20:51:46 PST 2008
Author: walter
Date: 2008-11-03 20:51:46 -0800 (Mon, 03 Nov 2008)
New Revision: 13244
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/input/examples/rifting.xml
long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.c
long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.h
Log:
r2368 at earth: boo | 2008-11-03 20:47:04 -0800
Make DivergenceForce take StandardConditionFunctions
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2366
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2368
Modified: long/3D/Gale/trunk/input/examples/rifting.xml
===================================================================
--- long/3D/Gale/trunk/input/examples/rifting.xml 2008-11-04 04:21:07 UTC (rev 13243)
+++ long/3D/Gale/trunk/input/examples/rifting.xml 2008-11-04 04:51:46 UTC (rev 13244)
@@ -459,7 +459,10 @@
<param name="Swarm">picIntegrationPoints</param>
<param name="DomainShape">dikeShape</param>
<param name="GeometryMesh">mesh-linear</param>
- <param name="force">-1.4e-13</param>
+ <param name="force_type">func</param>
+ <param name="force_value">StepFunction</param>
+<!-- <param name="force_type">double</param> -->
+<!-- <param name="force_value">-1.4e-13</param> -->
</struct>
@@ -714,8 +717,6 @@
</struct>
</list>
</struct>
-
-
</list>
</struct>
@@ -824,6 +825,12 @@
<param name="linearTolerance">1e-5</param>
+ <param name="StepFunctionLowerValue">-1.4e-13</param>
+ <param name="StepFunctionUpperValue">100000000</param>
+ <param name="StepFunctionLowerOffset">-100000001</param>
+ <param name="StepFunctionUpperOffset">-100000000</param>
+
+
<!-- <param name="journal.info">True</param> -->
<!-- <param name="journal.debug">True</param> -->
<!-- <param name="journal-level.info">2</param> -->
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.c 2008-11-04 04:21:07 UTC (rev 13243)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.c 2008-11-04 04:51:46 UTC (rev 13244)
@@ -64,7 +64,8 @@
Swarm* integrationSwarm,
Stg_Shape* domainShape,
FeMesh* geometryMesh,
- double force)
+ StressBC_Entry force,
+ FiniteElementContext* context)
{
DivergenceForce* self = (DivergenceForce*) _DivergenceForce_DefaultNew( name );
@@ -74,7 +75,8 @@
integrationSwarm,
domainShape,
geometryMesh,
- force);
+ force,
+ context);
return self;
}
@@ -93,7 +95,8 @@
Stg_Component_ExecuteFunction* _execute,
Stg_Component_DestroyFunction* _destroy,
ForceTerm_AssembleElementFunction* _assembleElement,
- Name name )
+ Name name,
+ FiniteElementContext* context)
{
DivergenceForce* self;
@@ -113,17 +116,20 @@
_destroy,
_assembleElement,
name );
+ self->context=context;
return self;
}
void _DivergenceForce_Init(DivergenceForce* self,
Stg_Shape* domainShape, FeMesh *geometryMesh,
- double force)
+ StressBC_Entry force,
+ FiniteElementContext* context)
{
self->domainShape=domainShape;
self->geometryMesh=geometryMesh;
self->force=force;
+ self->context=context;
}
void DivergenceForce_InitAll(
@@ -132,12 +138,13 @@
Swarm* integrationSwarm,
Stg_Shape* domainShape,
FeMesh* geometryMesh,
- double force)
+ StressBC_Entry force,
+ FiniteElementContext* context)
{
DivergenceForce* self = (DivergenceForce*) forceTerm;
ForceTerm_InitAll( self, forceVector, integrationSwarm, NULL );
- _DivergenceForce_Init( self, domainShape, geometryMesh, force );
+ _DivergenceForce_Init( self, domainShape, geometryMesh, force, context);
}
void _DivergenceForce_Delete( void* forceTerm ) {
@@ -168,7 +175,8 @@
_DivergenceForce_Execute,
_DivergenceForce_Destroy,
_DivergenceForce_AssembleElement,
- name );
+ name,
+ NULL);
}
void _DivergenceForce_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
@@ -176,17 +184,70 @@
Dictionary* dict;
Stg_Shape* domainShape=NULL;
FeMesh* geometryMesh=NULL;
- double force;
+ StressBC_Entry force;
+ char *type;
+ FiniteElementContext* context;
/* Construct Parent */
_ForceTerm_Construct( self, cf, data );
+ context = (FiniteElementContext*)Stg_ComponentFactory_ConstructByName
+ ( cf, "context", FiniteElementContext, True, data ) ;
+
dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) );
domainShape = Stg_ComponentFactory_ConstructByKey( cf, self->name, "DomainShape", Stg_Shape, True, data ) ;
- force = Stg_ComponentFactory_GetDouble( cf, self->name, "force", 0.0);
+ type = Stg_ComponentFactory_GetString( cf, self->name, "force_type", "");
+
+ if(!strcasecmp(type,"double") || !strcasecmp(type,"float"))
+ {
+ force.type = StressBC_Double;
+ force.DoubleValue =
+ Stg_ComponentFactory_GetDouble( cf, self->name, "force_value", 0.0);
+ }
+ else if(!strcasecmp(type,"func"))
+ {
+ char *funcName = Stg_ComponentFactory_GetString
+ ( cf, self->name, "force_value", "");
+
+ Index cfIndex;
+ cfIndex = ConditionFunction_Register_GetIndex
+ ( context->condFunc_Register, funcName);
+ force.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 DivergenceForce, the cond. func. "
+ " \"%s\" - wasn't found in the c.f. register.\n",
+ __func__, funcName );
+ Journal_Printf( errorStr, "(Available functions in the C.F. register are: ");
+ ConditionFunction_Register_PrintNameOfEachFunc
+ ( context->condFunc_Register, errorStr );
+ Journal_Printf( errorStr, ")\n");
+ assert(0);
+ }
+ force.CFIndex = cfIndex;
+ }
+ else if(strlen(type)==0)
+ {
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+ Journal_Printf( errorStr, "Error- in %s: While parsing "
+ "definition of DivergenceForce, force_type is not specified.\nSupported types are \"double\" and \"function\".\n",
+ __func__);
+ assert(0);
+ }
+ else
+ {
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+ Journal_Printf( errorStr, "Error- in %s: While parsing "
+ "definition of DivergenceForce, the type of condition \"%s\"\nis not supported. Supported types are \"double\" and \"function\".\n",
+ __func__, type );
+ assert(0);
+ }
+
geometryMesh=Stg_ComponentFactory_ConstructByKey( cf, self->name, "GeometryMesh", FeMesh, True, data ) ;
-
- _DivergenceForce_Init( self, domainShape, geometryMesh, force );
+
+ _DivergenceForce_Init( self, domainShape, geometryMesh, force, context);
}
void _DivergenceForce_Build( void* forceTerm, void* data ) {
@@ -215,15 +276,12 @@
DivergenceForce* self=(DivergenceForce*) forceTerm;
FeMesh* mesh=forceVector->feVariable->feMesh;
Node_ElementLocalIndex eNode_I;
- ElementType* elementType;
Element_NodeIndex elementNodeCount;
+ Node_DomainIndex *elementNodes=NULL;
- elementType = FeMesh_GetElementType( mesh, lElement_I );
- elementNodeCount = elementType->nodeCount;
-
if(Stg_Shape_IsCoordInside(self->domainShape,Mesh_GetVertex(mesh,lElement_I)))
{
- double xi[3], factor;
+ double xi[3], force, factor;
ElementType* geometryElementType;
unsigned nInc, *inc;
@@ -241,9 +299,26 @@
/* Multiply by the local volume of the element */
factor*=pow(2.0,forceVector->dim);
+ Mesh_GetIncidence(mesh, Mesh_GetDimSize(mesh), lElement_I,
+ MT_VERTEX,&elementNodeCount, &elementNodes);
+
for( eNode_I = 0 ; eNode_I < elementNodeCount; eNode_I++ ) {
- elForceVec[ eNode_I] += self->force*factor;
+ switch(self->force.type)
+ {
+ case StressBC_Double:
+ force=self->force.DoubleValue;
+ break;
+ case StressBC_ConditionFunction:
+
+ /* 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
+ (self->context->condFunc_Register->_cf[self->force.CFIndex],
+ elementNodes[eNode_I],0,self->context,&force);
+ break;
+ }
+ elForceVec[ eNode_I] += force*factor;
}
-
}
}
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.h 2008-11-04 04:21:07 UTC (rev 13243)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/DivergenceForce.h 2008-11-04 04:51:46 UTC (rev 13244)
@@ -56,7 +56,8 @@
__ForceTerm \
Stg_Shape* domainShape; \
FeMesh* geometryMesh; \
- double force; \
+ StressBC_Entry force; \
+ FiniteElementContext* context; \
struct DivergenceForce { __DivergenceForce };
@@ -66,7 +67,8 @@
Swarm* integrationSwarm,
Stg_Shape* domainShape,
FeMesh* geometryMesh,
- double force);
+ StressBC_Entry force,
+ FiniteElementContext* context);
DivergenceForce* _DivergenceForce_New(
SizeT sizeOfSelf,
@@ -81,7 +83,8 @@
Stg_Component_ExecuteFunction* _execute,
Stg_Component_DestroyFunction* _destroy,
ForceTerm_AssembleElementFunction* _assembleElement,
- Name name );
+ Name name,
+ FiniteElementContext* context);
void DivergenceForce_InitAll(
void* forceTerm,
@@ -89,7 +92,8 @@
Swarm* integrationSwarm,
Stg_Shape* domainShape,
FeMesh* geometryMesh,
- double force);
+ StressBC_Entry force,
+ FiniteElementContext* context);
void _DivergenceForce_Delete( void* forceTerm );
void _DivergenceForce_Print( void* forceTerm, Stream* stream );
More information about the CIG-COMMITS
mailing list