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

walter at geodynamics.org walter at geodynamics.org
Tue Dec 9 12:43:39 PST 2008


Author: walter
Date: 2008-12-09 12:43:37 -0800 (Tue, 09 Dec 2008)
New Revision: 13476

Added:
   long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.c
   long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.h
   long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.meta
Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/Gale/Utils/src/Init.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:
 r2396 at dante:  boo | 2008-12-08 15:50:10 -0800
 Added a HydrostaticCorrection component.  It sort of works, but is very difficult to get exactly right.



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

Added: long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.c	                        (rev 0)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.c	2008-12-09 20:43:37 UTC (rev 13476)
@@ -0,0 +1,407 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+** Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+**	Victoria, 3800, Australia
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**
+** Contributors:
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+**	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+**
+** Copyright (C) 2008, California Institute of Technology
+** Modified for HydrostaticCorrection by Walter Landry
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: /cig/src/Gale/Utils/src/HydrostaticCorrection.c 1691 2007-03-13T18:13:42.248551Z boo  $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#include <Underworld/Underworld.h>
+
+#include "types.h"
+#include "HydrostaticCorrection.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type HydrostaticCorrection_Type = "HydrostaticCorrection";
+
+HydrostaticCorrection* HydrostaticCorrection_New(Name name,
+                                                 ForceVector* forceVector,
+                                                 Swarm* integrationSwarm,
+                                                 Swarm* picSwarm,
+                                                 StoreVisc* storeVisc,
+                                                 StressBC_Entry force,
+                                                 FiniteElementContext* context)
+{
+	HydrostaticCorrection* self = (HydrostaticCorrection*) _HydrostaticCorrection_DefaultNew( name );
+
+	HydrostaticCorrection_InitAll( 
+			self,
+			forceVector,
+			integrationSwarm,
+                        picSwarm,
+                        storeVisc,
+                        force,
+                        context);
+
+	return self;
+}
+
+/* Creation implementation / Virtual constructor */
+HydrostaticCorrection* _HydrostaticCorrection_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,
+		ForceTerm_AssembleElementFunction*                  _assembleElement,		
+		Name                                                name,
+                Swarm* picSwarm,
+                StoreVisc* storeVisc,
+                FiniteElementContext*                               context)
+{
+	HydrostaticCorrection* self;
+	
+	/* Allocate memory */
+	assert( sizeOfSelf >= sizeof(HydrostaticCorrection) );
+	self = (HydrostaticCorrection*) _ForceTerm_New( 
+		sizeOfSelf, 
+		type, 
+		_delete, 
+		_print, 
+		_copy,
+		_defaultConstructor,
+		_construct,
+		_build, 
+		_initialise,
+		_execute,
+		_destroy,
+		_assembleElement,
+		name );
+        self->picSwarm=picSwarm;
+        self->storeVisc=storeVisc;
+        self->context=context;
+	
+	return self;
+}
+
+void _HydrostaticCorrection_Init(HydrostaticCorrection* self,
+                                 Swarm* picSwarm,
+                                 StoreVisc* storeVisc,
+                                 StressBC_Entry force,
+                                 FiniteElementContext* context)
+{
+        self->picSwarm=picSwarm;
+        self->storeVisc=storeVisc;
+        self->force=force;
+        self->context=context;
+}
+
+void HydrostaticCorrection_InitAll( 
+		void*                                               forceTerm,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+                Swarm* picSwarm,
+                StoreVisc* storeVisc,
+                StressBC_Entry force,
+                FiniteElementContext* context)
+{
+	HydrostaticCorrection* self = (HydrostaticCorrection*) forceTerm;
+
+	ForceTerm_InitAll( self, forceVector, integrationSwarm, NULL );
+	_HydrostaticCorrection_Init( self, picSwarm, storeVisc, force, context);
+}
+
+void _HydrostaticCorrection_Delete( void* forceTerm ) {
+	HydrostaticCorrection* self = (HydrostaticCorrection*)forceTerm;
+
+	_ForceTerm_Delete( self );
+}
+
+void _HydrostaticCorrection_Print( void* forceTerm, Stream* stream ) {
+	HydrostaticCorrection* self = (HydrostaticCorrection*)forceTerm;
+	
+	_ForceTerm_Print( self, stream );
+
+	/* General info */
+}
+
+void* _HydrostaticCorrection_DefaultNew( Name name ) {
+	return (void*)_HydrostaticCorrection_New( 
+		sizeof(HydrostaticCorrection), 
+		HydrostaticCorrection_Type,
+		_HydrostaticCorrection_Delete,
+		_HydrostaticCorrection_Print,
+		NULL,
+		_HydrostaticCorrection_DefaultNew,
+		_HydrostaticCorrection_Construct,
+		_HydrostaticCorrection_Build,
+		_HydrostaticCorrection_Initialise,
+		_HydrostaticCorrection_Execute,
+		_HydrostaticCorrection_Destroy,
+		_HydrostaticCorrection_AssembleElement,
+		name,
+                NULL,
+                NULL,
+                NULL);
+}
+
+void _HydrostaticCorrection_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
+	HydrostaticCorrection*          self             = (HydrostaticCorrection*)forceTerm;
+	Dictionary*		dict;
+        StressBC_Entry force;
+        char *type;
+        FiniteElementContext* context;
+        StoreVisc *storeVisc;
+        IntegrationPointsSwarm* picSwarm;
+
+	/* Construct Parent */
+	_ForceTerm_Construct( self, cf, data );
+
+        picSwarm = 
+          Stg_ComponentFactory_ConstructByKey(cf, self->name, "picSwarm",
+                                              IntegrationPointsSwarm,True,data);
+        storeVisc =
+          Stg_ComponentFactory_ConstructByKey(cf, self->name, "storeVisc",
+                                              StoreVisc, True, data );
+        context = (FiniteElementContext*)Stg_ComponentFactory_ConstructByName
+          ( cf, "context", FiniteElementContext, True, data ) ;
+
+	dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) );
+        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 HydrostaticCorrection, 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 HydrostaticCorrection, 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 HydrostaticCorrection, the type of condition \"%s\"\nis not supported.  Supported types are \"double\" and \"function\".\n",
+                            __func__, type );
+            assert(0);
+          }
+        
+	_HydrostaticCorrection_Init( self, picSwarm, storeVisc, force, context);
+}
+
+void _HydrostaticCorrection_Build( void* forceTerm, void* data ) {
+	HydrostaticCorrection*               self               = (HydrostaticCorrection*)forceTerm;
+	_ForceTerm_Build( self, data );
+}
+
+void _HydrostaticCorrection_Initialise( void* forceTerm, void* data ) {
+	HydrostaticCorrection*             self             = (HydrostaticCorrection*)forceTerm;
+	_ForceTerm_Initialise( self, data );
+}
+
+void _HydrostaticCorrection_Execute( void* forceTerm, void* data ) {
+	_ForceTerm_Execute( forceTerm, data );
+}
+
+void _HydrostaticCorrection_Destroy( void* forceTerm, void* data ) {
+	_ForceTerm_Destroy( forceTerm, data );
+}
+
+
+void _HydrostaticCorrection_AssembleElement( void* forceTerm,
+                                       ForceVector* forceVector, 
+                                       Element_LocalIndex elementIndex, 
+                                       double* elForceVec ) {
+  HydrostaticCorrection* self=(HydrostaticCorrection*) forceTerm;
+  FeMesh* mesh=forceVector->feVariable->feMesh;
+  Element_NodeIndex                elementNodeCount;
+  Node_DomainIndex *elementNodes=NULL;
+
+  ElementType* elementType;
+  double Ni[8],**GNx,localElStiffMat[8][8], *xi, weight, weightJacDet,
+    cellArea, jacDet, p[8], viscFac, sumVisc;
+  int ii, jj, kk, nParticles, nElNodes, cellIndex;
+  IntegrationPointsSwarm* swarm;
+  IntegrationPoint* integrationPoint;
+  int nDims = Mesh_GetDimSize( mesh );
+
+  elementType=FeMesh_GetElementType(mesh,elementIndex);
+  Mesh_GetIncidence(mesh, nDims, elementIndex,
+                    MT_VERTEX,&nElNodes, &elementNodes);
+
+  GNx = Memory_Alloc_2DArray(double,nDims,nElNodes,HydrostaticCorrection_Type);
+
+  for( ii = 0; ii < nElNodes; ii++ )
+    for( jj = 0; jj < nElNodes; jj++ )
+      localElStiffMat[ii][jj]=0;
+
+  /* Assemble the mass matrix part */
+
+  swarm=self->integrationSwarm;
+  cellIndex = CellLayout_MapElementIdToCellId( swarm->cellLayout,
+                                               elementIndex );
+  nParticles = swarm->cellParticleCountTbl[cellIndex];
+  for( ii = 0; ii < nParticles; ii++ ) {
+    /* Cache information from the current integration point. */
+    integrationPoint =
+      (IntegrationPoint*)Swarm_ParticleInCellAt(swarm, cellIndex, ii );
+    xi = integrationPoint->xi;
+    weight = integrationPoint->weight;
+    ElementType_EvaluateShapeFunctionsAt( elementType, xi, Ni );
+    ElementType_ShapeFunctionsGlobalDerivs(elementType, mesh, elementIndex,
+                                           xi, nDims, &jacDet, GNx );
+    weightJacDet = weight * jacDet;
+    
+    /* Loop over element nodes. */
+    for( jj = 0 ; jj < nElNodes; jj++ ) {
+      for ( kk = 0 ; kk < nElNodes ; kk++ ) {
+        localElStiffMat[jj][kk] += weightJacDet * Ni[jj] * Ni[kk];
+      }
+    }
+  }
+
+  /* Calculate the cell's area and viscosity. */
+  swarm = self->picSwarm;
+  cellIndex = CellLayout_MapElementIdToCellId( swarm->cellLayout, elementIndex);
+  nParticles = swarm->cellParticleCountTbl[cellIndex];
+  for( ii = 0; ii < nParticles; ii++ ) {
+    StoreVisc_ParticleExt*            particleExt;
+    MaterialPointsSwarm*    mSwarm;
+    MaterialPoint*          materialparticle;
+    double visc;
+
+    /* Cache information from the current integration point. */
+    integrationPoint =
+      (IntegrationPoint*)Swarm_ParticleInCellAt(swarm, cellIndex, ii );
+    ElementType_ShapeFunctionsGlobalDerivs(elementType, mesh, elementIndex,
+                                           integrationPoint->xi,
+                                           nDims, &jacDet, GNx );
+    
+    /* Add this particle's value to the area. */
+    cellArea += integrationPoint->weight * jacDet;
+    
+    materialparticle =
+      OneToOneMapper_GetMaterialPoint(swarm->mapper,integrationPoint,&mSwarm);
+    
+    particleExt=
+      ExtensionManager_Get( mSwarm->particleExtensionMgr,
+                            materialparticle,
+                            self->storeVisc->particleExtHandle );
+    
+    visc=particleExt->effVisc;
+    sumVisc += visc*integrationPoint->weight * jacDet;
+  }
+  
+  /* Normalize the viscosity factor by dividing by cell area. */
+  viscFac = cellArea / sumVisc;
+  
+  /* Adjust the calculated mass matrix by the 'special operator'. The
+     nElNodes term comes from an averaging operator applied twice. */
+  
+  for( ii = 0; ii < nElNodes; ii++ )
+    for( jj = 0; jj < nElNodes; jj++ )
+      localElStiffMat[ii][jj] -= cellArea/(nElNodes*nElNodes);
+  
+  
+  /* Get the background pressure */
+  for( ii = 0; ii < nElNodes; ii++ )
+    {
+      double force;
+      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[ii],0,self->context,&force);
+          break;
+        }
+      p[ii]=force;
+    }
+  
+  /* Apply the correction */
+  for( ii = 0; ii < nElNodes; ii++ )
+    for( jj = 0; jj < nElNodes; jj++ )
+      elForceVec[ii] -= p[jj]*localElStiffMat[ii][jj]*viscFac;
+
+  Memory_Free(GNx);
+}

Added: long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.h	                        (rev 0)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.h	2008-12-09 20:43:37 UTC (rev 13476)
@@ -0,0 +1,112 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+** Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+**	Victoria, 3800, Australia
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**
+** Contributors:
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+**	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+**
+** Copyright (C) 2008, California Institute of Technology
+** Modified for HydrostaticCorrection by Walter Landry
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+
+
+#ifndef __Gale_Utils_HydrostaticCorrection_h__
+#define __Gale_Utils_HydrostaticCorrection_h__
+
+	/** Textual name of this class */
+	extern const Type HydrostaticCorrection_Type;
+
+	/** HydrostaticCorrection class contents */
+	#define __HydrostaticCorrection \
+		/* General info */ \
+		__ForceTerm \
+                IntegrationPointsSwarm* picSwarm;       \
+                StoreVisc* storeVisc;                             \
+                StressBC_Entry                             force; \
+                FiniteElementContext*                      context; \
+
+	struct HydrostaticCorrection { __HydrostaticCorrection };
+
+	HydrostaticCorrection* HydrostaticCorrection_New( 
+		Name                                                name,
+		ForceVector*                                        forceVector,
+                Swarm* integrationSwarm,
+                Swarm* picSwarm,
+                StoreVisc* storeVisc,
+                StressBC_Entry force,
+                FiniteElementContext* context);
+
+	HydrostaticCorrection* _HydrostaticCorrection_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,
+		ForceTerm_AssembleElementFunction*                  _assembleElement,		
+		Name                                                name,
+                Swarm* picSwarm,
+                StoreVisc* storeVisc,
+                FiniteElementContext*                               context);
+	
+	void HydrostaticCorrection_InitAll( 
+		void*                                               forceTerm,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+                Swarm* picSwarm,
+                StoreVisc* storeVisc,
+                StressBC_Entry force,
+                FiniteElementContext* context);
+
+	void _HydrostaticCorrection_Delete( void* forceTerm );
+	void _HydrostaticCorrection_Print( void* forceTerm, Stream* stream );
+
+	void* _HydrostaticCorrection_DefaultNew( Name name ) ;
+void _HydrostaticCorrection_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) ;
+	void _HydrostaticCorrection_Build( void* forceTerm, void* data ) ;
+	void _HydrostaticCorrection_Initialise( void* forceTerm, void* data ) ;
+	void _HydrostaticCorrection_Execute( void* forceTerm, void* data ) ;
+	void _HydrostaticCorrection_Destroy( void* forceTerm, void* data ) ;
+
+	void _HydrostaticCorrection_AssembleElement( void* forceTerm, ForceVector* forceVector, Element_LocalIndex lElement_I, double* elForceVec ) ;
+
+#endif

Added: long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.meta
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.meta	                        (rev 0)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/HydrostaticCorrection.meta	2008-12-09 20:43:37 UTC (rev 13476)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">HydrostaticCorrection</param>
+<param name="Author">...</param>
+<param name="Organisation">CIG</param>
+<param name="Project">Gale</param>
+<param name="Location">./Gale/Utils/src/</param>
+<param name="Project Web">http://geodynamics.org</param>
+<param name="Copyright">Copyright (C) 2005 VPAC and Monash Cluster Computing, Copyright 2008 California Institute of Technology</param>
+<param name="Parent">ForceTerm</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">This adds a force to correct the stabilisation term so that it only uses the dynamic, not hydrostatic pressure.</param>
+
+<!--Now the interesting stuff-->
+
+<list name="Params">
+</list>
+
+<list name="Dependencies">
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">
+		<struct name="divergenceForce">
+			<param name="Type">HydrostaticCorrection</param>
+			<param name="ForceVector">cont_force</param>
+			<param name="Swarm">materialPoints</param>
+			<param name="gravity">1.0</param>
+		</struct>
+</param>
+
+</StGermainData>

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Init.c	2008-12-09 16:18:55 UTC (rev 13475)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Init.c	2008-12-09 20:43:37 UTC (rev 13476)
@@ -80,7 +80,12 @@
 
 	Stg_ComponentRegister_Add( componentRegister, MixedStabiliserTerm_Type,
                                    "0", _MixedStabiliserTerm_DefaultNew );
-	RegisterParent( MixedStabiliserTerm_Type,     StiffnessMatrixTerm_Type );
+	RegisterParent( MixedStabiliserTerm_Type, StiffnessMatrixTerm_Type );
 
+	Stg_ComponentRegister_Add(componentRegister,HydrostaticCorrection_Type,
+                                  "0", _HydrostaticCorrection_DefaultNew );
+	RegisterParent( HydrostaticCorrection_Type, ForceTerm_Type );
+
+
 	return True;
 }

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/SConscript	2008-12-09 16:18:55 UTC (rev 13475)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/SConscript	2008-12-09 20:43:37 UTC (rev 13476)
@@ -23,6 +23,7 @@
 DivergenceForce.h
 Finalise.h
 MixedStabiliserTerm.h
+HydrostaticCorrection.h
 StaticFrictionVC.h
 Init.h
 KineticFriction.h
@@ -35,6 +36,7 @@
 DivergenceForce.c
 Finalise.c
 MixedStabiliserTerm.c
+HydrostaticCorrection.c
 StaticFrictionVC.c
 Init.c
 KineticFriction.c
@@ -46,6 +48,7 @@
 meta_files=Split("""GaleContext.meta
 DivergenceForce.meta
 MixedStabiliserTerm.meta
+HydrostaticCorrection.meta
 StaticFrictionVC.meta
 KineticFriction.meta
 StressBC.meta""")

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h	2008-12-09 16:18:55 UTC (rev 13475)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h	2008-12-09 20:43:37 UTC (rev 13476)
@@ -55,5 +55,5 @@
 	#include "StressBC.h"
         #include "DivergenceForce.h"
         #include "MixedStabiliserTerm.h"
-	
+        #include "HydrostaticCorrection.h"
 #endif 

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/types.h	2008-12-09 16:18:55 UTC (rev 13475)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/types.h	2008-12-09 20:43:37 UTC (rev 13476)
@@ -52,6 +52,7 @@
 typedef struct StressBC                         StressBC;
 typedef struct DivergenceForce DivergenceForce;
 typedef struct MixedStabiliserTerm MixedStabiliserTerm;
+typedef struct HydrostaticCorrection HydrostaticCorrection;
 
 typedef enum
   {



More information about the CIG-COMMITS mailing list