[cig-commits] r7762 - in long/3D/Gale/trunk: . input
src/Gale/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Sat Jul 28 23:57:32 PDT 2007
Author: walter
Date: 2007-07-28 23:57:31 -0700 (Sat, 28 Jul 2007)
New Revision: 7762
Added:
long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.c
long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.h
long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.meta
Removed:
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/input/extension.xml
long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
long/3D/Gale/trunk/src/Gale/Utils/src/KineticFriction.c
long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
long/3D/Gale/trunk/src/Gale/Utils/src/types.h
Log:
r1910 at earth: boo | 2007-07-28 00:28:47 -0700
Rename FrictionVC to StaticFrictionVC
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1908
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1910
Modified: long/3D/Gale/trunk/input/extension.xml
===================================================================
--- long/3D/Gale/trunk/input/extension.xml 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/input/extension.xml 2007-07-29 06:57:31 UTC (rev 7762)
@@ -551,7 +551,7 @@
</struct>
<struct>
- <param name="type">FrictionVC</param>
+ <param name="type">StaticFrictionVC</param>
<param name="wall">bottom</param>
<param name="StaticFriction">0.33</param>
<param name="includeUpperX">False</param>
Deleted: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c 2007-07-29 06:57:31 UTC (rev 7762)
@@ -1,1080 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-** This file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** $Id: FrictionVC.c 3310 2005-10-26 07:10:18Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Friction VC's */
-
-#include <mpi.h>
-
-#include <StGermain/StGermain.h>
-#include <StgFEM/StgFEM.h>
-
-#include "types.h"
-#include "FrictionVC.h"
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type FrictionVC_Type = "FrictionVC";
-const Name defaultFrictionVCName = "defaultFrictionVCName";
-
-extern const char* WallEnumToStr[Wall_Size];
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* FrictionVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data )
-{
- return (VariableCondition*)FrictionVC_New( defaultFrictionVCName, NULL, variable_Register, conFunc_Register, dictionary, (FeMesh*)data );
-}
-
-
-void* FrictionVC_DefaultNew( Name name )
-{
- return _FrictionVC_New(
- sizeof(FrictionVC),
- FrictionVC_Type,
- _FrictionVC_Delete,
- _FrictionVC_Print,
- _FrictionVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
- _FrictionVC_Construct,
- _FrictionVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- False,
- _FrictionVC_BuildSelf,
- _FrictionVC_PrintConcise,
- _FrictionVC_ReadDictionary,
- _FrictionVC_GetSet,
- _FrictionVC_GetVariableCount,
- _FrictionVC_GetVariableIndex,
- _FrictionVC_GetValueIndex,
- _FrictionVC_GetValueCount,
- _FrictionVC_GetValue,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
-}
-
-FrictionVC* FrictionVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- return _FrictionVC_New(
- sizeof(FrictionVC),
- FrictionVC_Type,
- _FrictionVC_Delete,
- _FrictionVC_Print,
- _FrictionVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
- _FrictionVC_Construct,
- _FrictionVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- True,
- _FrictionVC_BuildSelf,
- _FrictionVC_PrintConcise,
- _FrictionVC_ReadDictionary,
- _FrictionVC_GetSet,
- _FrictionVC_GetVariableCount,
- _FrictionVC_GetVariableIndex,
- _FrictionVC_GetValueIndex,
- _FrictionVC_GetValueCount,
- _FrictionVC_GetValue,
- _dictionaryEntryName,
- variable_Register,
- conFunc_Register,
- dictionary,
- _mesh );
-}
-
-
-void FrictionVC_Init(
- FrictionVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- /* General info */
- self->type = FrictionVC_Type;
- self->_sizeOfSelf = sizeof(FrictionVC);
- self->_deleteSelf = False;
-
- /* Virtual info */
- self->_delete = _FrictionVC_Delete;
- self->_print = _FrictionVC_Print;
- self->_copy = _FrictionVC_Copy;
- self->_defaultConstructor = (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew;
- self->_construct = _FrictionVC_Construct;
- self->_build = _FrictionVC_Build;
- self->_initialise = _VariableCondition_Initialise;
- self->_execute = _VariableCondition_Execute;
- self->_destroy = _VariableCondition_Destroy;
- self->_buildSelf = _FrictionVC_BuildSelf;
- self->_printConcise = _FrictionVC_PrintConcise;
- self->_readDictionary = _FrictionVC_ReadDictionary;
- self->_getSet = _FrictionVC_GetSet;
- self->_getVariableCount = _FrictionVC_GetVariableCount;
- self->_getVariableIndex = _FrictionVC_GetVariableIndex;
- self->_getValueIndex = _FrictionVC_GetValueIndex;
- self->_getValueCount = _FrictionVC_GetValueCount;
- self->_getValue = _FrictionVC_GetValue;
-
- _Stg_Class_Init( (Stg_Class*)self );
- _Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
- _Stg_Component_Init( (Stg_Component*)self );
- _VariableCondition_Init( (VariableCondition*)self, variable_Register, conFunc_Register, dictionary );
-
- /* Stg_Class info */
- _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
-}
-
-
-FrictionVC* _FrictionVC_New(
- SizeT _sizeOfSelf,
- Type type,
- Stg_Class_DeleteFunction* _delete,
- Stg_Class_PrintFunction* _print,
- Stg_Class_CopyFunction* _copy,
- Stg_Component_DefaultConstructorFunction* _defaultConstructor,
- Stg_Component_ConstructFunction* _construct,
- Stg_Component_BuildFunction* _build,
- Stg_Component_InitialiseFunction* _initialise,
- Stg_Component_ExecuteFunction* _execute,
- Stg_Component_DestroyFunction* _destroy,
- Name name,
- Bool initFlag,
- VariableCondition_BuildSelfFunc* _buildSelf,
- VariableCondition_PrintConciseFunc* _printConcise,
- VariableCondition_ReadDictionaryFunc* _readDictionary,
- VariableCondition_GetSetFunc* _getSet,
- VariableCondition_GetVariableCountFunc* _getVariableCount,
- VariableCondition_GetVariableIndexFunc* _getVariableIndex,
- VariableCondition_GetValueIndexFunc* _getValueIndex,
- VariableCondition_GetValueCountFunc* _getValueCount,
- VariableCondition_GetValueFunc* _getValue,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh)
-{
- FrictionVC* self;
-
- /* Allocate memory/General info */
- assert(_sizeOfSelf >= sizeof(FrictionVC));
- self = (FrictionVC*)_VariableCondition_New(
- _sizeOfSelf,
- type,
- _delete,
- _print,
- _copy,
- _defaultConstructor,
- _construct,
- _build,
- _initialise,
- _execute,
- _destroy,
- name,
- initFlag,
- _buildSelf,
- _printConcise,
- _readDictionary,
- _getSet,
- _getVariableCount,
- _getVariableIndex,
- _getValueIndex,
- _getValueCount,
- _getValue,
- variable_Register,
- conFunc_Register,
- dictionary );
-
- /* Virtual info */
-
- /* Stg_Class info */
- if( initFlag ){
- _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
- }
-
- return self;
-}
-
-
-void _FrictionVC_Init(
- void* frictionVC,
- Name _dictionaryEntryName,
- void* _mesh )
-{
- FrictionVC* self = (FrictionVC*)frictionVC;
- int i;
-
- self->isConstructed = True;
- self->_dictionaryEntryName = _dictionaryEntryName;
- self->_mesh = (FeMesh*)_mesh;
- self->_wall = Wall_Size;
- self->_entryTbl = 0;
- self->_entryCount = 0;
- self->context=NULL;
- self->pressure_name=NULL;
- self->deviatoric_stress_name=NULL;
- for(i=0;i<3;++i)
- {
- self->include_lower_boundary[i]=True;
- self->include_upper_boundary[i]=True;
- }
- self->friction=0;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary ) {
- FrictionVC* self = (FrictionVC*)variableCondition;
- Dictionary_Entry_Value* vcDictVal;
- Dictionary_Entry_Value _vcDictVal;
- Dictionary_Entry_Value* varsVal;
- FrictionVC_Entry_Index entry_I;
-
- /* Find dictionary entry */
- if (self->_dictionaryEntryName)
- vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
- else
- {
- vcDictVal = &_vcDictVal;
- Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
- }
-
- if (vcDictVal)
- {
- char* wallStr;
-
- /* Obtain which wall */
- wallStr = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "wall" ));
- if (!strcasecmp(wallStr, "back"))
- self->_wall = Wall_Back;
- else if (!strcasecmp(wallStr, "left"))
- self->_wall = Wall_Left;
- else if (!strcasecmp(wallStr, "bottom"))
- self->_wall = Wall_Bottom;
- else if (!strcasecmp(wallStr, "right"))
- self->_wall = Wall_Right;
- else if (!strcasecmp(wallStr, "top"))
- self->_wall = Wall_Top;
- else if (!strcasecmp(wallStr, "front"))
- self->_wall = Wall_Front;
- else {
- assert( 0 );
- self->_wall = Wall_Size; /* invalid entry */
- }
-
- /* Obtain the variable entries */
- self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember(vcDictVal, "variables"));
- 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);
- self->include_upper_boundary[I_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperX"),True);
- self->include_upper_boundary[J_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperY"),True);
- self->include_upper_boundary[K_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperZ"),True);
- self->friction = Dictionary_Entry_Value_AsDouble(Dictionary_Entry_Value_GetMember(vcDictVal, "StaticFriction"));
-
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- char* valType;
- Dictionary_Entry_Value* valueEntry;
- Dictionary_Entry_Value* varDictListVal;
-
- varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
- valueEntry = Dictionary_Entry_Value_GetMember(varDictListVal, "value");
-
- self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
- Dictionary_Entry_Value_GetMember(varDictListVal, "name"));
-
- valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(varDictListVal, "type"));
- if (0 == strcasecmp(valType, "func"))
- {
- char* funcName = Dictionary_Entry_Value_AsString(valueEntry);
- Index cfIndex;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
- cfIndex = ConditionFunction_Register_GetIndex( self->conFunc_Register, funcName);
- if ( cfIndex == (unsigned)-1 ) {
- Stream* errorStr = Journal_Register( Error_Type, self->type );
-
- Journal_Printf( errorStr, "Error- in %s: While parsing "
- "definition of frictionVC \"%s\" (applies to wall \"%s\"), the cond. func. applied to "
- "variable \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
- __func__, self->_dictionaryEntryName, WallEnumToStr[self->_wall],
- self->_entryTbl[entry_I].varName, 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[entry_I].value.as.typeCFIndex = cfIndex;
- }
- else if (0 == strcasecmp(valType, "array"))
- {
- Dictionary_Entry_Value* valueElement;
- Index i;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
- self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
- self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
- self->_entryTbl[entry_I].value.as.typeArray.size, "FrictionVC->_entryTbl[].value.as.typeArray.array" );
-
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- {
- valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
- self->_entryTbl[entry_I].value.as.typeArray.array[i] =
- Dictionary_Entry_Value_AsDouble(valueElement);
- }
- }
- else if( 0 == strcasecmp( valType, "double" ) || 0 == strcasecmp( valType, "d" ) ||
- 0 == strcasecmp( valType, "float" ) || 0 == strcasecmp( valType, "f" ) )
- {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "integer" ) || 0 == strcasecmp( valType, "int" ) || 0 == strcasecmp( valType, "i" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
- self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "short" ) || 0 == strcasecmp( valType, "s" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
- self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "char" ) || 0 == strcasecmp( valType, "c" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
- self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "pointer" ) || 0 == strcasecmp( valType, "ptr" ) || 0 == strcasecmp( valType, "p" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
- self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
- }
- else {
- /* Assume double */
- Journal_DPrintf(
- Journal_Register( InfoStream_Type, "myStream" ),
- "Type to variable on variable condition not given, assuming double\n" );
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- }
- }
- else
- {
- int i;
- self->_wall = Wall_Size;
- self->_entryCount = 0;
- self->_entryTbl = NULL;
- self->context=NULL;
- self->pressure_name=NULL;
- self->deviatoric_stress_name=NULL;
- for(i=0;i<3;++i)
- {
- self->include_lower_boundary[i]=True;
- self->include_upper_boundary[i]=True;
- }
- self->friction=0;
- }
-}
-
-
-void _FrictionVC_Delete(void* frictionVC)
-{
- FrictionVC* self = (FrictionVC*)frictionVC;
-
- if (self->_entryTbl) Memory_Free(self->_entryTbl);
-
- /* Stg_Class_Delete parent */
- _VariableCondition_Delete(self);
-}
-
-
-void _FrictionVC_Print(void* frictionVC, Stream* stream)
-{
- FrictionVC* self = (FrictionVC*)frictionVC;
- FrictionVC_Entry_Index entry_I;
- Index i;
-
- /* Set the Journal for printing informations */
- Stream* info = stream;
-
- /* General info */
- Journal_Printf( info, "FrictionVC (ptr): %p\n", self);
-
- /* Virtual info */
-
- /* Stg_Class info */
- Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
- Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
- if (self->_dictionaryEntryName)
- Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
- Journal_Printf( info, "\t_wall: %s\n", self->_wall == Wall_Front ? "Front" :
- self->_wall == Wall_Back ? "Back" : self->_wall == Wall_Left ? "Left" :
- self->_wall == Wall_Right ? "Right" : self->_wall == Wall_Top ? "Top" :
- self->_wall == Wall_Bottom ? "Bottom" : "None");
- Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
- Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
- if (self->_entryTbl)
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
- Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
- if (self->_entryTbl[entry_I].varName)
- Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
- Journal_Printf( info, "\t\t\tvalue:\n");
- switch (self->_entryTbl[entry_I].value.type)
- {
- case VC_ValueType_Double:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
- Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
- break;
-
- case VC_ValueType_Int:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
- Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
- break;
-
- case VC_ValueType_Short:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
- Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
- break;
-
- case VC_ValueType_Char:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
- Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
- break;
-
- case VC_ValueType_Ptr:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
- Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
- break;
-
- case VC_ValueType_DoubleArray:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
- Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
- Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n",
- self->_entryTbl[entry_I].value.as.typeArray.array);
- if (self->_entryTbl[entry_I].value.as.typeArray.array)
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
- self->_entryTbl[entry_I].value.as.typeArray.array[i]);
- break;
-
- case VC_ValueType_CFIndex:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
- Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
- break;
- }
- }
- Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
-
- /* Print parent */
- _VariableCondition_Print(self);
-}
-
-
-void* _FrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
- FrictionVC* self = (FrictionVC*)frictionVC;
- FrictionVC* newFrictionVC;
- PtrMap* map = ptrMap;
- Bool ownMap = False;
- int i;
-
- if( !map ) {
- map = PtrMap_New( 10 );
- ownMap = True;
- }
-
- newFrictionVC = (FrictionVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-
- newFrictionVC->_dictionaryEntryName = self->_dictionaryEntryName;
- newFrictionVC->_wall = self->_wall;
- newFrictionVC->_entryCount = self->_entryCount;
- newFrictionVC->context = self->context;
- 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];
- newFrictionVC->include_upper_boundary[i]=self->include_upper_boundary[i];
- }
- newFrictionVC->friction = self->friction;
-
- if( deep ) {
- newFrictionVC->_mesh = (FeMesh*)Stg_Class_Copy( self->_mesh, NULL, deep, nameExt, map );
-
- if( (newFrictionVC->_entryTbl = PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
- newFrictionVC->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, newFrictionVC->_entryCount, "FrictionVC->_entryTbl");
- memcpy( newFrictionVC->_entryTbl, self->_entryTbl, sizeof(FrictionVC_Entry) * newFrictionVC->_entryCount );
- PtrMap_Append( map, newFrictionVC->_entryTbl, self->_entryTbl );
- }
- }
- else {
- newFrictionVC->_mesh = self->_mesh;
- newFrictionVC->_entryTbl = self->_entryTbl;
- }
-
- if( ownMap ) {
- Stg_Class_Delete( map );
- }
-
- return (void*)newFrictionVC;
-}
-
-
-void _FrictionVC_Build( void* frictionVC, void* data ) {
- FrictionVC* self = (FrictionVC*)frictionVC;
-
- _FrictionVC_BuildSelf( self, data );
-
- _VariableCondition_Build( self, data );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _FrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data )
-{
-
-}
-
-void _FrictionVC_BuildSelf( void* frictionVC, void* data ) {
- FrictionVC* self = (FrictionVC*)frictionVC;
-
- self->context=(FiniteElementContext *)data;
- if( self->_mesh ) {
- Build( self->_mesh, data, False );
- }
-}
-
-
-IndexSet* _FrictionVC_GetSet(void* variableCondition)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
- IndexSet *set = NULL;
- 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" ) );
- 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(deviatoric_stress!=NULL && deviatoric_stress->dofLayout!=NULL)
- {
- Node_LocalIndex n_i;
- unsigned nNodes, direction, boundary, basis[2];
- IJK ijk;
-
- FrictionVC_get_basis_vectors(self->_wall,grid->sizes,
- &direction,&boundary,basis);
- nNodes = FeMesh_GetNodeLocalSize( self->_mesh);
- set = IndexSet_New( nNodes );
- for( n_i = 0; n_i < nNodes; n_i++ ) {
- RegularMeshUtils_Node_1DTo3D
- ( self->_mesh, Mesh_DomainToGlobal
- ( self->_mesh, MT_VERTEX, n_i ), ijk );
- if(ijk[direction]==boundary)
- {
- double normal_stress, tangential_norm, n[3];
-
- /* Finally, add in the point if the frictional force
- keeps the material pinned to the boundary. */
- if(FrictionVC_get_interface_stresses
- (pressure,deviatoric_stress,self->_mesh,
- grid->sizes, n_i, ijk, nDims, basis,
- self->include_lower_boundary,
- self->include_upper_boundary,
- &normal_stress,&tangential_norm,n)
- && self->friction*normal_stress>=tangential_norm)
- {
- IndexSet_Add(set,n_i);
- }
- }
- }
- }
- else
- {
- switch (self->_wall) {
- case Wall_Front:
- if ( nDims < 3 || !grid->sizes[2] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalFrontSet( self->_mesh );
- }
- break;
-
- case Wall_Back:
- if ( nDims < 3 || !grid->sizes[2] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalBackSet( self->_mesh );
- }
- break;
-
- case Wall_Top:
- if ( nDims < 2 || !grid->sizes[1] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalTopSet(self->_mesh);
- }
- break;
-
- case Wall_Bottom:
- if ( nDims < 2 || !grid->sizes[1] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalBottomSet(self->_mesh);
- }
- break;
-
- case Wall_Left:
- if ( nDims < 1 ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalLeftSet(self->_mesh);
- }
- break;
-
- case Wall_Right:
- if( nDims < 1 ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalRightSet(self->_mesh);
- }
- break;
-
- case Wall_Size:
- default:
- assert(0);
- break;
- }
- }
- return set;
-}
-
-
-VariableCondition_VariableIndex _FrictionVC_GetVariableCount(void* variableCondition, Index globalIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-Variable_Index _FrictionVC_GetVariableIndex(void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
- Variable_Index searchedIndex = 0;
- Stream* errorStr = Journal_Register( Error_Type, self->type );
- Name varName;
-
- varName = self->_entryTbl[varIndex].varName;
- searchedIndex = Variable_Register_GetIndex(self->variable_Register, varName );
-
- Journal_Firewall( ( searchedIndex < self->variable_Register->count ), errorStr, "Error- in %s: searching for index of "
- "varIndex %u (\"%s\") at global node number %u failed - register returned index %u, greater than "
- "count %u.\n", __func__, varIndex, varName, globalIndex, searchedIndex, self->variable_Register->count );
-
- return searchedIndex;
-}
-
-
-VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex)
-{
- return varIndex;
-}
-
-
-VariableCondition_ValueIndex _FrictionVC_GetValueCount(void* variableCondition)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-VariableCondition_Value _FrictionVC_GetValue(void* variableCondition, VariableCondition_ValueIndex valIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryTbl[valIndex].value;
-}
-
-void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream ) {
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- Journal_Printf( stream, "\ttype: %s, set: ", self->type );
- Journal_Printf( stream, "%s\n",
- self->_wall == Wall_Front ? "Front" :
- self->_wall == Wall_Back ? "Back" :
- self->_wall == Wall_Left ? "Left" :
- self->_wall == Wall_Right ? "Right" :
- self->_wall == Wall_Top ? "Top" :
- self->_wall == Wall_Bottom ? "Bottom" : "None" );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
-
-void FrictionVC_get_basis_vectors(Wall wall, unsigned int sizes[],
- unsigned *direction, unsigned *boundary,
- unsigned basis[])
-{
- /* Note that we select the order of the basis vectors to
- point inwards */
- switch (wall) {
- case Wall_Front:
- *direction=K_AXIS;
- *boundary=sizes[*direction]-1;
- basis[0]=J_AXIS;
- basis[1]=I_AXIS;
- break;
- case Wall_Back:
- *direction=K_AXIS;
- *boundary=0;
- basis[0]=I_AXIS;
- basis[1]=J_AXIS;
- break;
- case Wall_Top:
- *direction=J_AXIS;
- *boundary=sizes[*direction]-1;
- basis[0]=I_AXIS;
- basis[1]=K_AXIS;
- break;
- case Wall_Bottom:
- *direction=J_AXIS;
- *boundary=0;
- basis[0]=K_AXIS;
- basis[1]=I_AXIS;
- break;
- case Wall_Left:
- *direction=I_AXIS;
- *boundary=0;
- basis[0]=K_AXIS;
- basis[1]=J_AXIS;
- break;
- case Wall_Right:
- *direction=I_AXIS;
- *boundary=sizes[*direction]-1;
- basis[0]=J_AXIS;
- basis[1]=K_AXIS;
- break;
- case Wall_Size:
- default:
- assert(0);
- break;
- }
-}
-
-/* This function returns the normal to the surface and the magnitude
- of the normal and tangential stresses. The exit status tells if
- the point is on a non-included boundary. */
-
-Bool FrictionVC_get_interface_stresses(FeVariable *pressure,
- FeVariable *deviatoric_stress,
- FeMesh *mesh,
- unsigned sizes[],
- Node_LocalIndex n_i,
- IJK ijk,
- unsigned nDims,
- unsigned basis[],
- Bool include_lower_boundary[],
- Bool include_upper_boundary[],
- double *normal_stress,
- double *tangential_norm,
- double n[])
-{
- double str[6], p;
- FeVariable_GetValueAtNode(deviatoric_stress,n_i,str);
- FeVariable_GetValueAtNode(pressure,n_i,&p);
-
- if(nDims==2)
- {
- double x1[2],x2[2],surface[2],tangential_stress[2];
- int sign;
- unsigned n_temp, ijk_temp[3];
- sign=1;
- /* If the first direction is z, then use the
- second direction and reverse it. This is
- only for 2D. */
- if(basis[0]==K_AXIS)
- {
- basis[0]=basis[1];
- sign=-1;
- }
- /* Get x1 */
- if(ijk[basis[0]]==0)
- {
- if(include_lower_boundary[basis[0]]==True)
- {
- x1[0]=mesh->verts[n_i][0];
- x1[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[0]]-=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x1[0]=mesh->verts[n_temp][0];
- x1[1]=mesh->verts[n_temp][1];
- }
- /* Get x2 */
- if(ijk[basis[0]]==sizes[basis[0]]-1)
- {
- if(include_upper_boundary[basis[0]]==True)
- {
- x2[0]=mesh->verts[n_i][0];
- x2[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[0]]+=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x2[0]=mesh->verts[n_temp][0];
- x2[1]=mesh->verts[n_temp][1];
- }
- /* Get the surface */
- Vec_Sub2D(surface,x2,x1);
- n[0]=sign*surface[1];
- n[1]=sign*surface[0];
- Vec_Norm2D(n,n);
-
- /* Normal stress = n . stress . n */
-
- /* The ordering for components of stress is: xx,
- yy, xy */
-
- *normal_stress=n[0]*n[0]*str[0]
- + n[1]*n[1]*str[1]
- + 2*n[1]*n[0]*str[2];
-
- /* Tangential stress = sigma . n - n * normal_stress
- Note that it is a vector */
-
- tangential_stress[0]=str[0]*n[0]
- + str[2]*n[1]
- - n[0]*(*normal_stress);
- tangential_stress[1]=str[1]*n[1]
- + str[2]*n[0]
- - n[1]*(*normal_stress);
-
- *tangential_norm=Vec_Mag2D(tangential_stress);
- }
- else
- {
- double x1[3],x2[3],x3[3],x4[3],line1[3],line2[3],tangential_stress[3];
- unsigned n_temp, ijk_temp[3];
-
- /* Get x1 */
- if(ijk[basis[0]]==0)
- {
- if(include_lower_boundary[basis[0]]==True)
- {
- x1[0]=mesh->verts[n_i][0];
- x1[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[0]]-=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x1[0]=mesh->verts[n_temp][0];
- x1[1]=mesh->verts[n_temp][1];
- }
- /* Get x2 */
- if(ijk[basis[0]]==sizes[basis[0]]-1)
- {
- if(include_upper_boundary[basis[0]]==True)
- {
- x2[0]=mesh->verts[n_i][0];
- x2[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[0]]+=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x2[0]=mesh->verts[n_temp][0];
- x2[1]=mesh->verts[n_temp][1];
- }
-
- /* Get x3 */
- if(ijk[basis[1]]==0)
- {
- if(include_lower_boundary[basis[1]]==True)
- {
- x3[0]=mesh->verts[n_i][0];
- x3[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[1]]-=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x3[0]=mesh->verts[n_temp][0];
- x3[1]=mesh->verts[n_temp][1];
- }
- /* Get x4 */
- if(ijk[basis[1]]==sizes[basis[1]]-1)
- {
- if(include_upper_boundary[basis[1]]==True)
- {
- x4[0]=mesh->verts[n_i][0];
- x4[1]=mesh->verts[n_i][1];
- }
- else
- return False;
- }
- else
- {
- Vec_Set2D(ijk_temp,ijk);
- ijk_temp[basis[1]]+=1;
- n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
- x4[0]=mesh->verts[n_temp][0];
- x4[1]=mesh->verts[n_temp][1];
- }
-
- /* Compute the normal. */
- Vec_Sub2D(line1,x2,x1);
- Vec_Sub2D(line2,x4,x3);
- Vec_Cross3D(n,line1,line2);
- Vec_Norm3D(n,n);
-
- /* Normal stress = n . stress . n */
-
- /* The ordering for components of stress is: xx,
- yy, zz, xy, xz, yz */
-
- *normal_stress=n[0]*n[0]*str[0]
- + n[1]*n[1]*str[1]
- + n[2]*n[2]*str[2]
- + 2*n[1]*n[0]*str[3]
- + 2*n[2]*n[0]*str[4]
- + 2*n[2]*n[1]*str[5];
-
- /* Tangential stress = sigma . n - n * normal_stress
- Note that it is a vector */
-
- tangential_stress[0]=str[0]*n[0]
- + str[3]*n[1] + str[4]*n[2]
- - n[0]*(*normal_stress);
- tangential_stress[1]=str[3]*n[0]
- + str[1]*n[1] + str[5]*n[2]
- - n[1]*(*normal_stress);
- tangential_stress[2]=str[4]*n[0]
- + str[5]*n[1] + str[2]*n[2]
- - n[2]*(*normal_stress);
-
- *tangential_norm=Vec_Mag3D(tangential_stress);
- }
- /* Add in the pressure. The sign convention switches the direction
- of stress from the deviatoric stress. */
- *normal_stress=p-(*normal_stress);
- return True;
-}
Deleted: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h 2007-07-29 06:57:31 UTC (rev 7762)
@@ -1,217 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
-**
-** Authors:
-** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
-** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
-** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
-** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
-** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
-** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
-**
-** This file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-*/
-/** \file
-** Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: FrictionVC.h 3291 2005-10-18 00:05:33Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Friction VC's */
-
-#ifndef __Gale_BoundaryConditions_FrictionVC_h__
-#define __Gale_BoundaryConditions_FrictionVC_h__
-
-
- extern const Type FrictionVC_Type;
-
- extern const char* WallEnumToStr[Wall_Size];
-
- #define __FrictionVC_Entry \
- Name varName; \
- VariableCondition_Value value; \
-
- struct _FrictionVC_Entry { __FrictionVC_Entry };
-
-
- #define __FrictionVC \
- /* General info */ \
- __VariableCondition \
- \
- /* Virtual info */ \
- \
- /* Stg_Class info */ \
- Name _dictionaryEntryName; \
- Wall _wall; \
- FrictionVC_Entry_Index _entryCount; \
- FrictionVC_Entry* _entryTbl; \
- FeMesh* _mesh; \
- /* I would like to make this a FiniteElementContext*, but */ \
- /* then there are problems compiling because this is in */ \
- /* StGermain, and we do not have access to StgFEM yet. */ \
- FiniteElementContext* context; \
- char *deviatoric_stress_name, *pressure_name; \
- Bool include_lower_boundary[3]; \
- Bool include_upper_boundary[3]; \
- double friction;
-
- struct _FrictionVC { __FrictionVC };
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Constructor
- */
-
- VariableCondition* FrictionVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data );
-
- void* FrictionVC_DefaultNew( Name name );
-
- FrictionVC* FrictionVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void FrictionVC_Init(
- FrictionVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- FrictionVC* _FrictionVC_New(
- SizeT _sizeOfSelf,
- Type type,
- Stg_Class_DeleteFunction* _delete,
- Stg_Class_PrintFunction* _print,
- Stg_Class_CopyFunction* _copy,
- Stg_Component_DefaultConstructorFunction* _defaultConstructor,
- Stg_Component_ConstructFunction* _construct,
- Stg_Component_BuildFunction* _build,
- Stg_Component_InitialiseFunction* _initialise,
- Stg_Component_ExecuteFunction* _execute,
- Stg_Component_DestroyFunction* _destroy,
- Name name,
- Bool initFlag,
- VariableCondition_BuildSelfFunc* _buildSelf,
- VariableCondition_PrintConciseFunc* _printConcise,
- VariableCondition_ReadDictionaryFunc* _readDictionary,
- VariableCondition_GetSetFunc* _getSet,
- VariableCondition_GetVariableCountFunc* _getVariableCount,
- VariableCondition_GetVariableIndexFunc* _getVariableIndex,
- VariableCondition_GetValueIndexFunc* _getValueIndex,
- VariableCondition_GetValueCountFunc* _getValueCount,
- VariableCondition_GetValueFunc* _getValue,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void _FrictionVC_Init(
- void* frictionVC,
- Name _dictionaryEntryName,
- void* _mesh );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** General virtual functions
- */
-
- void _FrictionVC_Delete( void* frictionVC );
-
- void _FrictionVC_Print( void* frictionVC, Stream* stream );
-
- /* Copy */
- #define FrictionVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
- #define FrictionVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
-
- void* _FrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
-
- void _FrictionVC_Build( void* frictionVC, void* data );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Macros
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Virtual functions
- */
-
- void _FrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data );
-
- void _FrictionVC_BuildSelf( void* frictionVC, void* data );
-
- void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary );
-
- IndexSet* _FrictionVC_GetSet( void* variableCondition );
-
- VariableCondition_VariableIndex _FrictionVC_GetVariableCount( void* variableCondition, Index globalIndex );
-
- Variable_Index _FrictionVC_GetVariableIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _FrictionVC_GetValueCount( void* variableCondition );
-
- VariableCondition_Value _FrictionVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex );
-
- void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream );
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Build functions
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Functions
- */
-
-Bool FrictionVC_get_interface_stresses(FeVariable *pressure,
- FeVariable *deviatoric_stress,
- FeMesh *mesh,
- unsigned sizes[],
- Node_LocalIndex n_i,
- IJK ijk,
- unsigned nDims,
- unsigned basis[],
- Bool include_lower_boundary[],
- Bool include_upper_boundary[],
- double *normal_stress,
- double *tangential_norm,
- double n[]);
-
-void FrictionVC_get_basis_vectors(Wall wall, unsigned int sizes[],
- unsigned *direction, unsigned *boundary,
- unsigned basis[]);
-
-#endif /* __Discretisation_Utils_FrictionVC_h__ */
Deleted: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta 2007-07-29 06:57:31 UTC (rev 7762)
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
-<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
-
-<param name="Name">FrictionVC</param>
-<param name="Author">...</param>
-<param name="Organisation">CIG</param>
-<param name="Project">Gale</param>
-<param name="Location">./Gale/BoundaryConditions/src/</param>
-<param name="Project Web">http://geodynamics.org</param>
-<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC. Copyright (c) 2006 California Institute of Technology</param>
-<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense</param>
-<param name="Parent">VariableCondition</param>
-<param name="Reference">...</param>
-<param name="Summary">...</param>
-<param name="Description">...</param>
-
-<!--Now the interesting stuff-->
-
-
-<list name="Params">
-
-</list>
-
-<list name="Dependencies">
- <struct>
- <param name="Essential">True</param>
- <param name="Type">RheologyMaterial</param>
- <param name="Description">Determines the frictional parameters of the wall.</param>
- </struct>
-
-
-</list>
-<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
-
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Init.c 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Init.c 2007-07-29 06:57:31 UTC (rev 7762)
@@ -62,10 +62,10 @@
RegisterParent( GaleContext_Type, UnderworldContext_Type );
- VariableCondition_Register_Add( variableCondition_Register, FrictionVC_Type, FrictionVC_Factory );
- Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), FrictionVC_Type,
- "0", FrictionVC_DefaultNew );
- RegisterParent( FrictionVC_Type, VariableCondition_Type );
+ VariableCondition_Register_Add( variableCondition_Register, StaticFrictionVC_Type, StaticFrictionVC_Factory );
+ Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), StaticFrictionVC_Type,
+ "0", StaticFrictionVC_DefaultNew );
+ RegisterParent( StaticFrictionVC_Type, VariableCondition_Type );
Stg_ComponentRegister_Add( componentRegister, StressBC_Type, "0", _StressBC_DefaultNew );
RegisterParent( StressBC_Type, ForceTerm_Type );
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/KineticFriction.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/KineticFriction.c 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/KineticFriction.c 2007-07-29 06:57:31 UTC (rev 7762)
@@ -59,7 +59,7 @@
#include "types.h"
#include "KineticFriction.h"
-#include "FrictionVC.h"
+#include "StaticFrictionVC.h"
#include <assert.h>
#include <string.h>
@@ -355,7 +355,7 @@
&elementNodeCount,dim,&elementNodes);
/* Get the basis vectors for the boundary */
- FrictionVC_get_basis_vectors(self->_wall,grid->sizes,
+ StaticFrictionVC_get_basis_vectors(self->_wall,grid->sizes,
&direction,&boundary,basis);
/* Apply the stress */
@@ -422,10 +422,10 @@
/* We always include the boundaries when calculating norms and
stresses. The include_boundary argument is really for
- FrictionVC's. */
+ StaticFrictionVC's. */
for(d=0;d<dim;d++)
include_boundary[d]=True;
- FrictionVC_get_interface_stresses
+ StaticFrictionVC_get_interface_stresses
(pressure,deviatoric_stress,mesh,grid->sizes,elementNodes[eNode_I],
ijk,dim,basis,include_boundary,
include_boundary,&normal_stress,&tangential_norm,n);
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/SConscript 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/SConscript 2007-07-29 06:57:31 UTC (rev 7762)
@@ -21,7 +21,7 @@
header_groups['Gale/Utils']=Split("""GaleContext.h
Finalise.h
-FrictionVC.h
+StaticFrictionVC.h
Init.h
KineticFriction.h
StressBC.h
@@ -31,7 +31,7 @@
c_files=Split("""GaleContext.c
Finalise.c
-FrictionVC.c
+StaticFrictionVC.c
Init.c
KineticFriction.c
StressBC.c
@@ -40,7 +40,7 @@
meta_files=Split("""GaleContext.meta
-FrictionVC.meta
+StaticFrictionVC.meta
KineticFriction.meta
StressBC.meta""")
Copied: long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.c (from rev 7760, long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c)
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c 2007-07-28 06:26:01 UTC (rev 7760)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.c 2007-07-29 06:57:31 UTC (rev 7762)
@@ -0,0 +1,1080 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+** This file may be distributed under the terms of the VPAC Public License
+** as defined by VPAC of Australia and appearing in the file
+** LICENSE.VPL included in the packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** $Id: StaticFrictionVC.c 3310 2005-10-26 07:10:18Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Modified 2006 Walter Landry to implement StaticFriction VC's */
+
+#include <mpi.h>
+
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+
+#include "types.h"
+#include "StaticFrictionVC.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type StaticFrictionVC_Type = "StaticFrictionVC";
+const Name defaultStaticFrictionVCName = "defaultStaticFrictionVCName";
+
+extern const char* WallEnumToStr[Wall_Size];
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* StaticFrictionVC_Factory(
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* data )
+{
+ return (VariableCondition*)StaticFrictionVC_New( defaultStaticFrictionVCName, NULL, variable_Register, conFunc_Register, dictionary, (FeMesh*)data );
+}
+
+
+void* StaticFrictionVC_DefaultNew( Name name )
+{
+ return _StaticFrictionVC_New(
+ sizeof(StaticFrictionVC),
+ StaticFrictionVC_Type,
+ _StaticFrictionVC_Delete,
+ _StaticFrictionVC_Print,
+ _StaticFrictionVC_Copy,
+ (Stg_Component_DefaultConstructorFunction*)StaticFrictionVC_DefaultNew,
+ _StaticFrictionVC_Construct,
+ _StaticFrictionVC_Build,
+ _VariableCondition_Initialise,
+ _VariableCondition_Execute,
+ _VariableCondition_Destroy,
+ name,
+ False,
+ _StaticFrictionVC_BuildSelf,
+ _StaticFrictionVC_PrintConcise,
+ _StaticFrictionVC_ReadDictionary,
+ _StaticFrictionVC_GetSet,
+ _StaticFrictionVC_GetVariableCount,
+ _StaticFrictionVC_GetVariableIndex,
+ _StaticFrictionVC_GetValueIndex,
+ _StaticFrictionVC_GetValueCount,
+ _StaticFrictionVC_GetValue,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+}
+
+StaticFrictionVC* StaticFrictionVC_New(
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh )
+{
+ return _StaticFrictionVC_New(
+ sizeof(StaticFrictionVC),
+ StaticFrictionVC_Type,
+ _StaticFrictionVC_Delete,
+ _StaticFrictionVC_Print,
+ _StaticFrictionVC_Copy,
+ (Stg_Component_DefaultConstructorFunction*)StaticFrictionVC_DefaultNew,
+ _StaticFrictionVC_Construct,
+ _StaticFrictionVC_Build,
+ _VariableCondition_Initialise,
+ _VariableCondition_Execute,
+ _VariableCondition_Destroy,
+ name,
+ True,
+ _StaticFrictionVC_BuildSelf,
+ _StaticFrictionVC_PrintConcise,
+ _StaticFrictionVC_ReadDictionary,
+ _StaticFrictionVC_GetSet,
+ _StaticFrictionVC_GetVariableCount,
+ _StaticFrictionVC_GetVariableIndex,
+ _StaticFrictionVC_GetValueIndex,
+ _StaticFrictionVC_GetValueCount,
+ _StaticFrictionVC_GetValue,
+ _dictionaryEntryName,
+ variable_Register,
+ conFunc_Register,
+ dictionary,
+ _mesh );
+}
+
+
+void StaticFrictionVC_Init(
+ StaticFrictionVC* self,
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh )
+{
+ /* General info */
+ self->type = StaticFrictionVC_Type;
+ self->_sizeOfSelf = sizeof(StaticFrictionVC);
+ self->_deleteSelf = False;
+
+ /* Virtual info */
+ self->_delete = _StaticFrictionVC_Delete;
+ self->_print = _StaticFrictionVC_Print;
+ self->_copy = _StaticFrictionVC_Copy;
+ self->_defaultConstructor = (Stg_Component_DefaultConstructorFunction*)StaticFrictionVC_DefaultNew;
+ self->_construct = _StaticFrictionVC_Construct;
+ self->_build = _StaticFrictionVC_Build;
+ self->_initialise = _VariableCondition_Initialise;
+ self->_execute = _VariableCondition_Execute;
+ self->_destroy = _VariableCondition_Destroy;
+ self->_buildSelf = _StaticFrictionVC_BuildSelf;
+ self->_printConcise = _StaticFrictionVC_PrintConcise;
+ self->_readDictionary = _StaticFrictionVC_ReadDictionary;
+ self->_getSet = _StaticFrictionVC_GetSet;
+ self->_getVariableCount = _StaticFrictionVC_GetVariableCount;
+ self->_getVariableIndex = _StaticFrictionVC_GetVariableIndex;
+ self->_getValueIndex = _StaticFrictionVC_GetValueIndex;
+ self->_getValueCount = _StaticFrictionVC_GetValueCount;
+ self->_getValue = _StaticFrictionVC_GetValue;
+
+ _Stg_Class_Init( (Stg_Class*)self );
+ _Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+ _Stg_Component_Init( (Stg_Component*)self );
+ _VariableCondition_Init( (VariableCondition*)self, variable_Register, conFunc_Register, dictionary );
+
+ /* Stg_Class info */
+ _StaticFrictionVC_Init( self, _dictionaryEntryName, _mesh );
+}
+
+
+StaticFrictionVC* _StaticFrictionVC_New(
+ SizeT _sizeOfSelf,
+ Type type,
+ Stg_Class_DeleteFunction* _delete,
+ Stg_Class_PrintFunction* _print,
+ Stg_Class_CopyFunction* _copy,
+ Stg_Component_DefaultConstructorFunction* _defaultConstructor,
+ Stg_Component_ConstructFunction* _construct,
+ Stg_Component_BuildFunction* _build,
+ Stg_Component_InitialiseFunction* _initialise,
+ Stg_Component_ExecuteFunction* _execute,
+ Stg_Component_DestroyFunction* _destroy,
+ Name name,
+ Bool initFlag,
+ VariableCondition_BuildSelfFunc* _buildSelf,
+ VariableCondition_PrintConciseFunc* _printConcise,
+ VariableCondition_ReadDictionaryFunc* _readDictionary,
+ VariableCondition_GetSetFunc* _getSet,
+ VariableCondition_GetVariableCountFunc* _getVariableCount,
+ VariableCondition_GetVariableIndexFunc* _getVariableIndex,
+ VariableCondition_GetValueIndexFunc* _getValueIndex,
+ VariableCondition_GetValueCountFunc* _getValueCount,
+ VariableCondition_GetValueFunc* _getValue,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh)
+{
+ StaticFrictionVC* self;
+
+ /* Allocate memory/General info */
+ assert(_sizeOfSelf >= sizeof(StaticFrictionVC));
+ self = (StaticFrictionVC*)_VariableCondition_New(
+ _sizeOfSelf,
+ type,
+ _delete,
+ _print,
+ _copy,
+ _defaultConstructor,
+ _construct,
+ _build,
+ _initialise,
+ _execute,
+ _destroy,
+ name,
+ initFlag,
+ _buildSelf,
+ _printConcise,
+ _readDictionary,
+ _getSet,
+ _getVariableCount,
+ _getVariableIndex,
+ _getValueIndex,
+ _getValueCount,
+ _getValue,
+ variable_Register,
+ conFunc_Register,
+ dictionary );
+
+ /* Virtual info */
+
+ /* Stg_Class info */
+ if( initFlag ){
+ _StaticFrictionVC_Init( self, _dictionaryEntryName, _mesh );
+ }
+
+ return self;
+}
+
+
+void _StaticFrictionVC_Init(
+ void* frictionVC,
+ Name _dictionaryEntryName,
+ void* _mesh )
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+ int i;
+
+ self->isConstructed = True;
+ self->_dictionaryEntryName = _dictionaryEntryName;
+ self->_mesh = (FeMesh*)_mesh;
+ self->_wall = Wall_Size;
+ self->_entryTbl = 0;
+ self->_entryCount = 0;
+ self->context=NULL;
+ self->pressure_name=NULL;
+ self->deviatoric_stress_name=NULL;
+ for(i=0;i<3;++i)
+ {
+ self->include_lower_boundary[i]=True;
+ self->include_upper_boundary[i]=True;
+ }
+ self->friction=0;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _StaticFrictionVC_ReadDictionary( void* variableCondition, void* dictionary ) {
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+ Dictionary_Entry_Value* vcDictVal;
+ Dictionary_Entry_Value _vcDictVal;
+ Dictionary_Entry_Value* varsVal;
+ StaticFrictionVC_Entry_Index entry_I;
+
+ /* Find dictionary entry */
+ if (self->_dictionaryEntryName)
+ vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
+ else
+ {
+ vcDictVal = &_vcDictVal;
+ Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
+ }
+
+ if (vcDictVal)
+ {
+ char* wallStr;
+
+ /* Obtain which wall */
+ wallStr = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "wall" ));
+ if (!strcasecmp(wallStr, "back"))
+ self->_wall = Wall_Back;
+ else if (!strcasecmp(wallStr, "left"))
+ self->_wall = Wall_Left;
+ else if (!strcasecmp(wallStr, "bottom"))
+ self->_wall = Wall_Bottom;
+ else if (!strcasecmp(wallStr, "right"))
+ self->_wall = Wall_Right;
+ else if (!strcasecmp(wallStr, "top"))
+ self->_wall = Wall_Top;
+ else if (!strcasecmp(wallStr, "front"))
+ self->_wall = Wall_Front;
+ else {
+ assert( 0 );
+ self->_wall = Wall_Size; /* invalid entry */
+ }
+
+ /* Obtain the variable entries */
+ self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember(vcDictVal, "variables"));
+ self->_entryTbl = Memory_Alloc_Array( StaticFrictionVC_Entry, self->_entryCount, "StaticFrictionVC->_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);
+ self->include_upper_boundary[I_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperX"),True);
+ self->include_upper_boundary[J_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperY"),True);
+ self->include_upper_boundary[K_AXIS]=Dictionary_Entry_Value_AsBool_with_Default(Dictionary_Entry_Value_GetMember(vcDictVal, "includeUpperZ"),True);
+ self->friction = Dictionary_Entry_Value_AsDouble(Dictionary_Entry_Value_GetMember(vcDictVal, "StaticStaticFriction"));
+
+ for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+ {
+ char* valType;
+ Dictionary_Entry_Value* valueEntry;
+ Dictionary_Entry_Value* varDictListVal;
+
+ varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
+ valueEntry = Dictionary_Entry_Value_GetMember(varDictListVal, "value");
+
+ self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
+ Dictionary_Entry_Value_GetMember(varDictListVal, "name"));
+
+ valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(varDictListVal, "type"));
+ if (0 == strcasecmp(valType, "func"))
+ {
+ char* funcName = Dictionary_Entry_Value_AsString(valueEntry);
+ Index cfIndex;
+
+ self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
+ cfIndex = ConditionFunction_Register_GetIndex( self->conFunc_Register, funcName);
+ if ( cfIndex == (unsigned)-1 ) {
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+
+ Journal_Printf( errorStr, "Error- in %s: While parsing "
+ "definition of frictionVC \"%s\" (applies to wall \"%s\"), the cond. func. applied to "
+ "variable \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
+ __func__, self->_dictionaryEntryName, WallEnumToStr[self->_wall],
+ self->_entryTbl[entry_I].varName, 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[entry_I].value.as.typeCFIndex = cfIndex;
+ }
+ else if (0 == strcasecmp(valType, "array"))
+ {
+ Dictionary_Entry_Value* valueElement;
+ Index i;
+
+ self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
+ self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
+ self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
+ self->_entryTbl[entry_I].value.as.typeArray.size, "StaticFrictionVC->_entryTbl[].value.as.typeArray.array" );
+
+ for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+ {
+ valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
+ self->_entryTbl[entry_I].value.as.typeArray.array[i] =
+ Dictionary_Entry_Value_AsDouble(valueElement);
+ }
+ }
+ else if( 0 == strcasecmp( valType, "double" ) || 0 == strcasecmp( valType, "d" ) ||
+ 0 == strcasecmp( valType, "float" ) || 0 == strcasecmp( valType, "f" ) )
+ {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+ self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "integer" ) || 0 == strcasecmp( valType, "int" ) || 0 == strcasecmp( valType, "i" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
+ self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "short" ) || 0 == strcasecmp( valType, "s" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
+ self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "char" ) || 0 == strcasecmp( valType, "c" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
+ self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "pointer" ) || 0 == strcasecmp( valType, "ptr" ) || 0 == strcasecmp( valType, "p" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
+ self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
+ }
+ else {
+ /* Assume double */
+ Journal_DPrintf(
+ Journal_Register( InfoStream_Type, "myStream" ),
+ "Type to variable on variable condition not given, assuming double\n" );
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+ self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+ }
+ }
+ }
+ else
+ {
+ int i;
+ self->_wall = Wall_Size;
+ self->_entryCount = 0;
+ self->_entryTbl = NULL;
+ self->context=NULL;
+ self->pressure_name=NULL;
+ self->deviatoric_stress_name=NULL;
+ for(i=0;i<3;++i)
+ {
+ self->include_lower_boundary[i]=True;
+ self->include_upper_boundary[i]=True;
+ }
+ self->friction=0;
+ }
+}
+
+
+void _StaticFrictionVC_Delete(void* frictionVC)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+
+ if (self->_entryTbl) Memory_Free(self->_entryTbl);
+
+ /* Stg_Class_Delete parent */
+ _VariableCondition_Delete(self);
+}
+
+
+void _StaticFrictionVC_Print(void* frictionVC, Stream* stream)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+ StaticFrictionVC_Entry_Index entry_I;
+ Index i;
+
+ /* Set the Journal for printing informations */
+ Stream* info = stream;
+
+ /* General info */
+ Journal_Printf( info, "StaticFrictionVC (ptr): %p\n", self);
+
+ /* Virtual info */
+
+ /* Stg_Class info */
+ Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
+ Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
+ if (self->_dictionaryEntryName)
+ Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
+ Journal_Printf( info, "\t_wall: %s\n", self->_wall == Wall_Front ? "Front" :
+ self->_wall == Wall_Back ? "Back" : self->_wall == Wall_Left ? "Left" :
+ self->_wall == Wall_Right ? "Right" : self->_wall == Wall_Top ? "Top" :
+ self->_wall == Wall_Bottom ? "Bottom" : "None");
+ Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
+ Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
+ if (self->_entryTbl)
+ for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+ {
+ Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
+ Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
+ if (self->_entryTbl[entry_I].varName)
+ Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
+ Journal_Printf( info, "\t\t\tvalue:\n");
+ switch (self->_entryTbl[entry_I].value.type)
+ {
+ case VC_ValueType_Double:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
+ Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
+ break;
+
+ case VC_ValueType_Int:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
+ Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
+ break;
+
+ case VC_ValueType_Short:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
+ Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
+ break;
+
+ case VC_ValueType_Char:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
+ Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
+ break;
+
+ case VC_ValueType_Ptr:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
+ Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
+ break;
+
+ case VC_ValueType_DoubleArray:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
+ Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
+ Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n",
+ self->_entryTbl[entry_I].value.as.typeArray.array);
+ if (self->_entryTbl[entry_I].value.as.typeArray.array)
+ for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+ Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
+ self->_entryTbl[entry_I].value.as.typeArray.array[i]);
+ break;
+
+ case VC_ValueType_CFIndex:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
+ Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
+ break;
+ }
+ }
+ Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
+
+ /* Print parent */
+ _VariableCondition_Print(self);
+}
+
+
+void* _StaticFrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+ StaticFrictionVC* newStaticFrictionVC;
+ PtrMap* map = ptrMap;
+ Bool ownMap = False;
+ int i;
+
+ if( !map ) {
+ map = PtrMap_New( 10 );
+ ownMap = True;
+ }
+
+ newStaticFrictionVC = (StaticFrictionVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
+
+ newStaticFrictionVC->_dictionaryEntryName = self->_dictionaryEntryName;
+ newStaticFrictionVC->_wall = self->_wall;
+ newStaticFrictionVC->_entryCount = self->_entryCount;
+ newStaticFrictionVC->context = self->context;
+ newStaticFrictionVC->pressure_name = self->pressure_name;
+ newStaticFrictionVC->deviatoric_stress_name = self->deviatoric_stress_name;
+ for(i=0;i<3;++i)
+ {
+ newStaticFrictionVC->include_lower_boundary[i]=self->include_lower_boundary[i];
+ newStaticFrictionVC->include_upper_boundary[i]=self->include_upper_boundary[i];
+ }
+ newStaticFrictionVC->friction = self->friction;
+
+ if( deep ) {
+ newStaticFrictionVC->_mesh = (FeMesh*)Stg_Class_Copy( self->_mesh, NULL, deep, nameExt, map );
+
+ if( (newStaticFrictionVC->_entryTbl = PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
+ newStaticFrictionVC->_entryTbl = Memory_Alloc_Array( StaticFrictionVC_Entry, newStaticFrictionVC->_entryCount, "StaticFrictionVC->_entryTbl");
+ memcpy( newStaticFrictionVC->_entryTbl, self->_entryTbl, sizeof(StaticFrictionVC_Entry) * newStaticFrictionVC->_entryCount );
+ PtrMap_Append( map, newStaticFrictionVC->_entryTbl, self->_entryTbl );
+ }
+ }
+ else {
+ newStaticFrictionVC->_mesh = self->_mesh;
+ newStaticFrictionVC->_entryTbl = self->_entryTbl;
+ }
+
+ if( ownMap ) {
+ Stg_Class_Delete( map );
+ }
+
+ return (void*)newStaticFrictionVC;
+}
+
+
+void _StaticFrictionVC_Build( void* frictionVC, void* data ) {
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+
+ _StaticFrictionVC_BuildSelf( self, data );
+
+ _VariableCondition_Build( self, data );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _StaticFrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data )
+{
+
+}
+
+void _StaticFrictionVC_BuildSelf( void* frictionVC, void* data ) {
+ StaticFrictionVC* self = (StaticFrictionVC*)frictionVC;
+
+ self->context=(FiniteElementContext *)data;
+ if( self->_mesh ) {
+ Build( self->_mesh, data, False );
+ }
+}
+
+
+IndexSet* _StaticFrictionVC_GetSet(void* variableCondition)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+ IndexSet *set = NULL;
+ 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" ) );
+ 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 StaticFrictionVC, the name provided for the pressure field \"%s\" does not exist\n",
+ self->pressure_name);
+ Journal_Firewall( ( deviatoric_stress!=NULL ), errorStr,
+ "Error: In StaticFrictionVC, 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(deviatoric_stress!=NULL && deviatoric_stress->dofLayout!=NULL)
+ {
+ Node_LocalIndex n_i;
+ unsigned nNodes, direction, boundary, basis[2];
+ IJK ijk;
+
+ StaticFrictionVC_get_basis_vectors(self->_wall,grid->sizes,
+ &direction,&boundary,basis);
+ nNodes = FeMesh_GetNodeLocalSize( self->_mesh);
+ set = IndexSet_New( nNodes );
+ for( n_i = 0; n_i < nNodes; n_i++ ) {
+ RegularMeshUtils_Node_1DTo3D
+ ( self->_mesh, Mesh_DomainToGlobal
+ ( self->_mesh, MT_VERTEX, n_i ), ijk );
+ if(ijk[direction]==boundary)
+ {
+ double normal_stress, tangential_norm, n[3];
+
+ /* Finally, add in the point if the frictional force
+ keeps the material pinned to the boundary. */
+ if(StaticFrictionVC_get_interface_stresses
+ (pressure,deviatoric_stress,self->_mesh,
+ grid->sizes, n_i, ijk, nDims, basis,
+ self->include_lower_boundary,
+ self->include_upper_boundary,
+ &normal_stress,&tangential_norm,n)
+ && self->friction*normal_stress>=tangential_norm)
+ {
+ IndexSet_Add(set,n_i);
+ }
+ }
+ }
+ }
+ else
+ {
+ switch (self->_wall) {
+ case Wall_Front:
+ if ( nDims < 3 || !grid->sizes[2] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalFrontSet( self->_mesh );
+ }
+ break;
+
+ case Wall_Back:
+ if ( nDims < 3 || !grid->sizes[2] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalBackSet( self->_mesh );
+ }
+ break;
+
+ case Wall_Top:
+ if ( nDims < 2 || !grid->sizes[1] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalTopSet(self->_mesh);
+ }
+ break;
+
+ case Wall_Bottom:
+ if ( nDims < 2 || !grid->sizes[1] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalBottomSet(self->_mesh);
+ }
+ break;
+
+ case Wall_Left:
+ if ( nDims < 1 ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalLeftSet(self->_mesh);
+ }
+ break;
+
+ case Wall_Right:
+ if( nDims < 1 ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalRightSet(self->_mesh);
+ }
+ break;
+
+ case Wall_Size:
+ default:
+ assert(0);
+ break;
+ }
+ }
+ return set;
+}
+
+
+VariableCondition_VariableIndex _StaticFrictionVC_GetVariableCount(void* variableCondition, Index globalIndex)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+
+ return self->_entryCount;
+}
+
+
+Variable_Index _StaticFrictionVC_GetVariableIndex(void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+ Variable_Index searchedIndex = 0;
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+ Name varName;
+
+ varName = self->_entryTbl[varIndex].varName;
+ searchedIndex = Variable_Register_GetIndex(self->variable_Register, varName );
+
+ Journal_Firewall( ( searchedIndex < self->variable_Register->count ), errorStr, "Error- in %s: searching for index of "
+ "varIndex %u (\"%s\") at global node number %u failed - register returned index %u, greater than "
+ "count %u.\n", __func__, varIndex, varName, globalIndex, searchedIndex, self->variable_Register->count );
+
+ return searchedIndex;
+}
+
+
+VariableCondition_ValueIndex _StaticFrictionVC_GetValueIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex)
+{
+ return varIndex;
+}
+
+
+VariableCondition_ValueIndex _StaticFrictionVC_GetValueCount(void* variableCondition)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+
+ return self->_entryCount;
+}
+
+
+VariableCondition_Value _StaticFrictionVC_GetValue(void* variableCondition, VariableCondition_ValueIndex valIndex)
+{
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+
+ return self->_entryTbl[valIndex].value;
+}
+
+void _StaticFrictionVC_PrintConcise( void* variableCondition, Stream* stream ) {
+ StaticFrictionVC* self = (StaticFrictionVC*)variableCondition;
+
+ Journal_Printf( stream, "\ttype: %s, set: ", self->type );
+ Journal_Printf( stream, "%s\n",
+ self->_wall == Wall_Front ? "Front" :
+ self->_wall == Wall_Back ? "Back" :
+ self->_wall == Wall_Left ? "Left" :
+ self->_wall == Wall_Right ? "Right" :
+ self->_wall == Wall_Top ? "Top" :
+ self->_wall == Wall_Bottom ? "Bottom" : "None" );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
+
+void StaticFrictionVC_get_basis_vectors(Wall wall, unsigned int sizes[],
+ unsigned *direction, unsigned *boundary,
+ unsigned basis[])
+{
+ /* Note that we select the order of the basis vectors to
+ point inwards */
+ switch (wall) {
+ case Wall_Front:
+ *direction=K_AXIS;
+ *boundary=sizes[*direction]-1;
+ basis[0]=J_AXIS;
+ basis[1]=I_AXIS;
+ break;
+ case Wall_Back:
+ *direction=K_AXIS;
+ *boundary=0;
+ basis[0]=I_AXIS;
+ basis[1]=J_AXIS;
+ break;
+ case Wall_Top:
+ *direction=J_AXIS;
+ *boundary=sizes[*direction]-1;
+ basis[0]=I_AXIS;
+ basis[1]=K_AXIS;
+ break;
+ case Wall_Bottom:
+ *direction=J_AXIS;
+ *boundary=0;
+ basis[0]=K_AXIS;
+ basis[1]=I_AXIS;
+ break;
+ case Wall_Left:
+ *direction=I_AXIS;
+ *boundary=0;
+ basis[0]=K_AXIS;
+ basis[1]=J_AXIS;
+ break;
+ case Wall_Right:
+ *direction=I_AXIS;
+ *boundary=sizes[*direction]-1;
+ basis[0]=J_AXIS;
+ basis[1]=K_AXIS;
+ break;
+ case Wall_Size:
+ default:
+ assert(0);
+ break;
+ }
+}
+
+/* This function returns the normal to the surface and the magnitude
+ of the normal and tangential stresses. The exit status tells if
+ the point is on a non-included boundary. */
+
+Bool StaticFrictionVC_get_interface_stresses(FeVariable *pressure,
+ FeVariable *deviatoric_stress,
+ FeMesh *mesh,
+ unsigned sizes[],
+ Node_LocalIndex n_i,
+ IJK ijk,
+ unsigned nDims,
+ unsigned basis[],
+ Bool include_lower_boundary[],
+ Bool include_upper_boundary[],
+ double *normal_stress,
+ double *tangential_norm,
+ double n[])
+{
+ double str[6], p;
+ FeVariable_GetValueAtNode(deviatoric_stress,n_i,str);
+ FeVariable_GetValueAtNode(pressure,n_i,&p);
+
+ if(nDims==2)
+ {
+ double x1[2],x2[2],surface[2],tangential_stress[2];
+ int sign;
+ unsigned n_temp, ijk_temp[3];
+ sign=1;
+ /* If the first direction is z, then use the
+ second direction and reverse it. This is
+ only for 2D. */
+ if(basis[0]==K_AXIS)
+ {
+ basis[0]=basis[1];
+ sign=-1;
+ }
+ /* Get x1 */
+ if(ijk[basis[0]]==0)
+ {
+ if(include_lower_boundary[basis[0]]==True)
+ {
+ x1[0]=mesh->verts[n_i][0];
+ x1[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[0]]-=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x1[0]=mesh->verts[n_temp][0];
+ x1[1]=mesh->verts[n_temp][1];
+ }
+ /* Get x2 */
+ if(ijk[basis[0]]==sizes[basis[0]]-1)
+ {
+ if(include_upper_boundary[basis[0]]==True)
+ {
+ x2[0]=mesh->verts[n_i][0];
+ x2[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[0]]+=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x2[0]=mesh->verts[n_temp][0];
+ x2[1]=mesh->verts[n_temp][1];
+ }
+ /* Get the surface */
+ Vec_Sub2D(surface,x2,x1);
+ n[0]=sign*surface[1];
+ n[1]=sign*surface[0];
+ Vec_Norm2D(n,n);
+
+ /* Normal stress = n . stress . n */
+
+ /* The ordering for components of stress is: xx,
+ yy, xy */
+
+ *normal_stress=n[0]*n[0]*str[0]
+ + n[1]*n[1]*str[1]
+ + 2*n[1]*n[0]*str[2];
+
+ /* Tangential stress = sigma . n - n * normal_stress
+ Note that it is a vector */
+
+ tangential_stress[0]=str[0]*n[0]
+ + str[2]*n[1]
+ - n[0]*(*normal_stress);
+ tangential_stress[1]=str[1]*n[1]
+ + str[2]*n[0]
+ - n[1]*(*normal_stress);
+
+ *tangential_norm=Vec_Mag2D(tangential_stress);
+ }
+ else
+ {
+ double x1[3],x2[3],x3[3],x4[3],line1[3],line2[3],tangential_stress[3];
+ unsigned n_temp, ijk_temp[3];
+
+ /* Get x1 */
+ if(ijk[basis[0]]==0)
+ {
+ if(include_lower_boundary[basis[0]]==True)
+ {
+ x1[0]=mesh->verts[n_i][0];
+ x1[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[0]]-=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x1[0]=mesh->verts[n_temp][0];
+ x1[1]=mesh->verts[n_temp][1];
+ }
+ /* Get x2 */
+ if(ijk[basis[0]]==sizes[basis[0]]-1)
+ {
+ if(include_upper_boundary[basis[0]]==True)
+ {
+ x2[0]=mesh->verts[n_i][0];
+ x2[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[0]]+=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x2[0]=mesh->verts[n_temp][0];
+ x2[1]=mesh->verts[n_temp][1];
+ }
+
+ /* Get x3 */
+ if(ijk[basis[1]]==0)
+ {
+ if(include_lower_boundary[basis[1]]==True)
+ {
+ x3[0]=mesh->verts[n_i][0];
+ x3[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[1]]-=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x3[0]=mesh->verts[n_temp][0];
+ x3[1]=mesh->verts[n_temp][1];
+ }
+ /* Get x4 */
+ if(ijk[basis[1]]==sizes[basis[1]]-1)
+ {
+ if(include_upper_boundary[basis[1]]==True)
+ {
+ x4[0]=mesh->verts[n_i][0];
+ x4[1]=mesh->verts[n_i][1];
+ }
+ else
+ return False;
+ }
+ else
+ {
+ Vec_Set2D(ijk_temp,ijk);
+ ijk_temp[basis[1]]+=1;
+ n_temp=RegularMeshUtils_Node_3DTo1D(mesh,ijk_temp);
+ x4[0]=mesh->verts[n_temp][0];
+ x4[1]=mesh->verts[n_temp][1];
+ }
+
+ /* Compute the normal. */
+ Vec_Sub2D(line1,x2,x1);
+ Vec_Sub2D(line2,x4,x3);
+ Vec_Cross3D(n,line1,line2);
+ Vec_Norm3D(n,n);
+
+ /* Normal stress = n . stress . n */
+
+ /* The ordering for components of stress is: xx,
+ yy, zz, xy, xz, yz */
+
+ *normal_stress=n[0]*n[0]*str[0]
+ + n[1]*n[1]*str[1]
+ + n[2]*n[2]*str[2]
+ + 2*n[1]*n[0]*str[3]
+ + 2*n[2]*n[0]*str[4]
+ + 2*n[2]*n[1]*str[5];
+
+ /* Tangential stress = sigma . n - n * normal_stress
+ Note that it is a vector */
+
+ tangential_stress[0]=str[0]*n[0]
+ + str[3]*n[1] + str[4]*n[2]
+ - n[0]*(*normal_stress);
+ tangential_stress[1]=str[3]*n[0]
+ + str[1]*n[1] + str[5]*n[2]
+ - n[1]*(*normal_stress);
+ tangential_stress[2]=str[4]*n[0]
+ + str[5]*n[1] + str[2]*n[2]
+ - n[2]*(*normal_stress);
+
+ *tangential_norm=Vec_Mag3D(tangential_stress);
+ }
+ /* Add in the pressure. The sign convention switches the direction
+ of stress from the deviatoric stress. */
+ *normal_stress=p-(*normal_stress);
+ return True;
+}
Copied: long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.h (from rev 7734, long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h)
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h 2007-07-21 06:08:19 UTC (rev 7734)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.h 2007-07-29 06:57:31 UTC (rev 7762)
@@ -0,0 +1,217 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+** This file may be distributed under the terms of the VPAC Public License
+** as defined by VPAC of Australia and appearing in the file
+** LICENSE.VPL included in the packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: StaticFrictionVC.h 3291 2005-10-18 00:05:33Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Modified 2006 Walter Landry to implement StaticFriction VC's */
+
+#ifndef __Gale_BoundaryConditions_StaticFrictionVC_h__
+#define __Gale_BoundaryConditions_StaticFrictionVC_h__
+
+
+ extern const Type StaticFrictionVC_Type;
+
+ extern const char* WallEnumToStr[Wall_Size];
+
+ #define __StaticFrictionVC_Entry \
+ Name varName; \
+ VariableCondition_Value value; \
+
+ struct _StaticFrictionVC_Entry { __StaticFrictionVC_Entry };
+
+
+ #define __StaticFrictionVC \
+ /* General info */ \
+ __VariableCondition \
+ \
+ /* Virtual info */ \
+ \
+ /* Stg_Class info */ \
+ Name _dictionaryEntryName; \
+ Wall _wall; \
+ StaticFrictionVC_Entry_Index _entryCount; \
+ StaticFrictionVC_Entry* _entryTbl; \
+ FeMesh* _mesh; \
+ /* I would like to make this a FiniteElementContext*, but */ \
+ /* then there are problems compiling because this is in */ \
+ /* StGermain, and we do not have access to StgFEM yet. */ \
+ FiniteElementContext* context; \
+ char *deviatoric_stress_name, *pressure_name; \
+ Bool include_lower_boundary[3]; \
+ Bool include_upper_boundary[3]; \
+ double friction;
+
+ struct _StaticFrictionVC { __StaticFrictionVC };
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Constructor
+ */
+
+ VariableCondition* StaticFrictionVC_Factory(
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* data );
+
+ void* StaticFrictionVC_DefaultNew( Name name );
+
+ StaticFrictionVC* StaticFrictionVC_New(
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ void StaticFrictionVC_Init(
+ StaticFrictionVC* self,
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ StaticFrictionVC* _StaticFrictionVC_New(
+ SizeT _sizeOfSelf,
+ Type type,
+ Stg_Class_DeleteFunction* _delete,
+ Stg_Class_PrintFunction* _print,
+ Stg_Class_CopyFunction* _copy,
+ Stg_Component_DefaultConstructorFunction* _defaultConstructor,
+ Stg_Component_ConstructFunction* _construct,
+ Stg_Component_BuildFunction* _build,
+ Stg_Component_InitialiseFunction* _initialise,
+ Stg_Component_ExecuteFunction* _execute,
+ Stg_Component_DestroyFunction* _destroy,
+ Name name,
+ Bool initFlag,
+ VariableCondition_BuildSelfFunc* _buildSelf,
+ VariableCondition_PrintConciseFunc* _printConcise,
+ VariableCondition_ReadDictionaryFunc* _readDictionary,
+ VariableCondition_GetSetFunc* _getSet,
+ VariableCondition_GetVariableCountFunc* _getVariableCount,
+ VariableCondition_GetVariableIndexFunc* _getVariableIndex,
+ VariableCondition_GetValueIndexFunc* _getValueIndex,
+ VariableCondition_GetValueCountFunc* _getValueCount,
+ VariableCondition_GetValueFunc* _getValue,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ void _StaticFrictionVC_Init(
+ void* frictionVC,
+ Name _dictionaryEntryName,
+ void* _mesh );
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** General virtual functions
+ */
+
+ void _StaticFrictionVC_Delete( void* frictionVC );
+
+ void _StaticFrictionVC_Print( void* frictionVC, Stream* stream );
+
+ /* Copy */
+ #define StaticFrictionVC_Copy( self ) \
+ (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+ #define StaticFrictionVC_Copy( self ) \
+ (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+
+ void* _StaticFrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
+
+ void _StaticFrictionVC_Build( void* frictionVC, void* data );
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Macros
+ */
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Virtual functions
+ */
+
+ void _StaticFrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data );
+
+ void _StaticFrictionVC_BuildSelf( void* frictionVC, void* data );
+
+ void _StaticFrictionVC_ReadDictionary( void* variableCondition, void* dictionary );
+
+ IndexSet* _StaticFrictionVC_GetSet( void* variableCondition );
+
+ VariableCondition_VariableIndex _StaticFrictionVC_GetVariableCount( void* variableCondition, Index globalIndex );
+
+ Variable_Index _StaticFrictionVC_GetVariableIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex );
+
+ VariableCondition_ValueIndex _StaticFrictionVC_GetValueIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex );
+
+ VariableCondition_ValueIndex _StaticFrictionVC_GetValueCount( void* variableCondition );
+
+ VariableCondition_Value _StaticFrictionVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex );
+
+ void _StaticFrictionVC_PrintConcise( void* variableCondition, Stream* stream );
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Build functions
+ */
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Functions
+ */
+
+Bool StaticFrictionVC_get_interface_stresses(FeVariable *pressure,
+ FeVariable *deviatoric_stress,
+ FeMesh *mesh,
+ unsigned sizes[],
+ Node_LocalIndex n_i,
+ IJK ijk,
+ unsigned nDims,
+ unsigned basis[],
+ Bool include_lower_boundary[],
+ Bool include_upper_boundary[],
+ double *normal_stress,
+ double *tangential_norm,
+ double n[]);
+
+void StaticFrictionVC_get_basis_vectors(Wall wall, unsigned int sizes[],
+ unsigned *direction, unsigned *boundary,
+ unsigned basis[]);
+
+#endif /* __Discretisation_Utils_StaticFrictionVC_h__ */
Copied: long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.meta (from rev 7670, long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta)
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta 2007-07-14 08:50:56 UTC (rev 7670)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/StaticFrictionVC.meta 2007-07-29 06:57:31 UTC (rev 7762)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">StaticFrictionVC</param>
+<param name="Author">...</param>
+<param name="Organisation">CIG</param>
+<param name="Project">Gale</param>
+<param name="Location">./Gale/BoundaryConditions/src/</param>
+<param name="Project Web">http://geodynamics.org</param>
+<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC. Copyright (c) 2006 California Institute of Technology</param>
+<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense</param>
+<param name="Parent">VariableCondition</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">...</param>
+
+<!--Now the interesting stuff-->
+
+
+<list name="Params">
+
+</list>
+
+<list name="Dependencies">
+ <struct>
+ <param name="Essential">True</param>
+ <param name="Type">RheologyMaterial</param>
+ <param name="Description">Determines the frictional parameters of the wall.</param>
+ </struct>
+
+
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">...</param>
+
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h 2007-07-29 06:57:31 UTC (rev 7762)
@@ -50,7 +50,7 @@
#include "GaleContext.h"
#include "Init.h"
#include "Finalise.h"
- #include "FrictionVC.h"
+ #include "StaticFrictionVC.h"
#include "KineticFriction.h"
#include "StressBC.h"
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/types.h 2007-07-28 15:58:32 UTC (rev 7761)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/types.h 2007-07-29 06:57:31 UTC (rev 7762)
@@ -47,7 +47,7 @@
#define __Gale_Utils_types_h__
typedef struct GaleContext GaleContext;
-typedef struct _FrictionVC FrictionVC;
+typedef struct _StaticFrictionVC StaticFrictionVC;
typedef struct KineticFriction KineticFriction;
typedef struct StressBC StressBC;
@@ -77,7 +77,7 @@
Wall_Size
} Wall;
-typedef struct _FrictionVC_Entry FrictionVC_Entry;
-typedef Index FrictionVC_Entry_Index;
+typedef struct _StaticFrictionVC_Entry StaticFrictionVC_Entry;
+typedef Index StaticFrictionVC_Entry_Index;
#endif
More information about the cig-commits
mailing list