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

walter at geodynamics.org walter at geodynamics.org
Sat Nov 29 22:50:45 PST 2008


Author: walter
Date: 2008-11-29 22:50:45 -0800 (Sat, 29 Nov 2008)
New Revision: 13424

Added:
   long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.meta
Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
   long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.c
   long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.h
   long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
   long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
Log:
 r2375 at dante:  boo | 2008-11-29 11:53:28 -0800
 The MixedStabiliserTerm seems to work, but has lots of cruft



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

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Init.c	2008-11-30 06:50:41 UTC (rev 13423)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Init.c	2008-11-30 06:50:45 UTC (rev 13424)
@@ -66,17 +66,21 @@
 	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 );
 
-	RegisterParent( StressBC_Type,     ForceTerm_Type );
 	Stg_ComponentRegister_Add( componentRegister, KineticFriction_Type,
                                    "0", _KineticFriction_DefaultNew );
+	RegisterParent( KineticFriction_Type,     ForceTerm_Type );
 
-	RegisterParent( KineticFriction_Type,     ForceTerm_Type );
 	Stg_ComponentRegister_Add( componentRegister, DivergenceForce_Type,
                                    "0", _DivergenceForce_DefaultNew );
-
 	RegisterParent( DivergenceForce_Type,     ForceTerm_Type );
 
+	Stg_ComponentRegister_Add( componentRegister, MixedStabiliserTerm_Type,
+                                   "0", _MixedStabiliserTerm_DefaultNew );
+	RegisterParent( MixedStabiliserTerm_Type,     StiffnessMatrixTerm_Type );
+
 	return True;
 }

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.c	2008-11-30 06:50:41 UTC (rev 13423)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.c	2008-11-30 06:50:45 UTC (rev 13424)
@@ -45,14 +45,14 @@
 const Type MixedStabiliserTerm_Type = "MixedStabiliserTerm";
 
 
-void* MixedStabiliserTerm_New( Name name ) {
+void* _MixedStabiliserTerm_DefaultNew( Name name ) {
    return (void*)_MixedStabiliserTerm_New(
       sizeof(MixedStabiliserTerm), 
       MixedStabiliserTerm_Type,
       _MixedStabiliserTerm_Delete,
       _StiffnessMatrixTerm_Print,
       NULL,
-      MixedStabiliserTerm_New,
+      _MixedStabiliserTerm_DefaultNew,
       MixedStabiliserTerm_Construct,
       MixedStabiliserTerm_Build,
       MixedStabiliserTerm_Initialise,
@@ -103,9 +103,8 @@
 }
 
 void _MixedStabiliserTerm_Init( MixedStabiliserTerm* self ) {
-   self->materialSwarm = NULL;
-   self->constitutiveMatrix = NULL;
-   self->viscosityVar = NULL;
+   self->picSwarm = NULL;
+   self->storeVisc = NULL;
    self->Ni = NULL;
    self->GNx = NULL;
    self->elStiffMat = NULL;
@@ -130,16 +129,12 @@
    _MixedStabiliserTerm_Init( self );
    _StiffnessMatrixTerm_Construct( self, cf, data );
 
-   self->materialSwarm = Stg_ComponentFactory_ConstructByKey(
-      cf, self->name, "materialSwarm", MaterialPointsSwarm, False, data );
-   if( self->materialSwarm ) {
-      self->constitutiveMatrix = Stg_ComponentFactory_ConstructByKey(
-         cf, self->name, "constitutiveMatrix", ConstitutiveMatrix, True, data );
-   }
-   else {
-      self->viscosity = Stg_ComponentFactory_GetDouble(
-         cf, self->name, "viscosity", 1.0 );
-   }
+   self->picSwarm = Stg_ComponentFactory_ConstructByKey(
+      cf, self->name, "picSwarm", IntegrationPointsSwarm,
+      True, data );
+   self->storeVisc =
+     Stg_ComponentFactory_ConstructByKey(cf, self->name, "storeVisc",
+                                         StoreVisc, True, data );
 }
 
 void MixedStabiliserTerm_Build( void* _self, void* data ) {
@@ -150,16 +145,6 @@
 
 void MixedStabiliserTerm_Initialise( void* _self, void* data ) {
    MixedStabiliserTerm* self = (MixedStabiliserTerm*)_self;
-
-   if( self->materialSwarm ) {
-      char* varName;
-
-      asprintf( &varName, "%s-Viscosity", self->materialSwarm->name );
-      self->viscosityVar = SwarmVariable_Register_GetByName(
-         self->materialSwarm->swarmVariable_Register, varName );
-      assert( self->viscosityVar );
-   }
-
    _StiffnessMatrixTerm_Initialise( self, data );
 }
 
@@ -188,11 +173,12 @@
    double *Ni, **GNx, viscFac;
    int nParticles, nElNodes, cellIndex;
    ElementType* elementType;
-   Swarm* swarm;
+   IntegrationPointsSwarm* swarm;
    IntegrationPoint* integrationPoint;
    const double oneOnSixteen = 0.0625;
    double** localElStiffMat;
    int ii, jj, kk;
+   double sumVisc = 0.0, visc;
 
    /* Get the current element's type and cache the number
       of nodes. */
@@ -217,7 +203,8 @@
 
    /* Assemble the mass matrix portion. */
    swarm = self->integrationSwarm;
-   cellIndex = CellLayout_MapElementIdToCellId( swarm->cellLayout, elementIndex );
+   cellIndex = CellLayout_MapElementIdToCellId( swarm->cellLayout,
+                                                elementIndex );
    nParticles = swarm->cellParticleCountTbl[cellIndex];
    for( ii = 0; ii < nParticles; ii++ ) {
 
@@ -239,11 +226,14 @@
       }
    }
 
-   /* Calculate the cell's area. */
-   swarm = self->integrationSwarm;
+   /* 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;
 
       /* Cache information from the current integration point. */
       integrationPoint = (IntegrationPoint*)Swarm_ParticleInCellAt(
@@ -254,40 +244,76 @@
 
       /* 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;
+
+      printf("v %d %d %g %g %g %g\n",elementIndex,ii,visc,integrationPoint->weight * jacDet,integrationPoint->weight,jacDet);
    }
 
-   /* Sum the viscosity over this element. */
-   if( self->materialSwarm ) {
-      double sumVisc = 0.0, visc;
-      SwarmVariable* viscVar;
-      MaterialPointsSwarm* materialSwarm;
+   /* Normalize the viscosity factor by dividing by cell area. */
+   viscFac = cellArea / sumVisc;
 
-      /* With a material swarm we need to get the stored viscosity from
-         a swarm variable. */
-      viscVar = self->viscosityVar;
-      materialSwarm = self->materialSwarm;
-      cellIndex = CellLayout_MapElementIdToCellId( materialSwarm->cellLayout, elementIndex );
-      nParticles = materialSwarm->cellParticleCountTbl[cellIndex];
-      for( ii = 0; ii < nParticles; ii++ ) {
+   printf("viscosity %d %g %g %g\n",elementIndex,viscFac,cellArea,sumVisc);
 
-         /* Get the stored viscosity value. */
-         SwarmVariable_ValueAt( viscVar, materialSwarm->cellParticleTbl[cellIndex][ii], &visc );
 
-         /* Add value to sum. */
-         sumVisc += visc;
-      }
+/*    /\* Sum the viscosity over this element. *\/ */
+/*    if( self->materialSwarm ) { */
+/*       MaterialPointsSwarm* materialSwarm; */
 
-      /* Divide the number of particles be the summation to get the
-         final factor. */
-      viscFac = (double)nParticles / sumVisc;
-   }
-   else {
+/*       /\* With a material swarm we need to get the stored viscosity from */
+/*          a swarm variable. *\/ */
+/*       materialSwarm = self->materialSwarm; */
+/*       cellIndex = CellLayout_MapElementIdToCellId( materialSwarm->cellLayout, elementIndex ); */
+/*       nParticles = materialSwarm->cellParticleCountTbl[cellIndex]; */
+/*       for( ii = 0; ii < nParticles; ii++ ) { */
+/*          /\* Get the stored viscosity value. *\/ */
+/* 	StoreVisc_ParticleExt*            particleExt; */
+/*         MaterialPoint *materialParticle=(MaterialPoint*)Swarm_ParticleAt */
+/*           (materialSwarm,materialSwarm->cellParticleTbl[cellIndex][ii]); */
+/*         particleExt= */
+/*           ExtensionManager_Get( materialSwarm->particleExtensionMgr, */
+/*                                 materialParticle, */
+/*                                 self->storeVisc->particleExtHandle ); */
+/*         visc=particleExt->effVisc; */
 
-      /* Without a material swarm we just use a single viscosity value,
-         so we can just invert it to get the viscosity factor. */
-      viscFac = 1.0 / self->viscosity;
-   }
+/* /\*         /\\* Add value to sum. *\\/ *\/ */
+/* /\*         sumVisc += visc; *\/ */
 
+/*         integrationPoint = */
+/*           (IntegrationPoint*)Swarm_ParticleAt(swarm, materialSwarm->cellParticleTbl[cellIndex][ii]); */
+                                                    
+/*         ElementType_ShapeFunctionsGlobalDerivs(elementType, mesh, elementIndex, */
+/*                                                integrationPoint->xi, */
+/*                                                nDims, &jacDet, GNx ); */
+/*         /\* Add value to sum. *\/ */
+/*         sumVisc += visc*integrationPoint->weight * jacDet; */
+/*         printf("vpart %d %d %g %g %g\n",elementIndex,ii,visc, */
+/*                integrationPoint->weight,jacDet); */
+/*       } */
+
+/*       /\* Divide the number of particles be the summation to get the */
+/*          final factor. *\/ */
+/*       viscFac = cellArea / sumVisc; */
+/* /\*       viscFac = nParticles / sumVisc; *\/ */
+
+/*       printf("viscosity %d %g %g %g\n",elementIndex,viscFac,cellArea,sumVisc); */
+/*    } */
+/*    else { */
+
+/*       /\* Without a material swarm we just use a single viscosity value, */
+/*          so we can just invert it to get the viscosity factor. *\/ */
+/*       viscFac = 1.0 / self->viscosity; */
+/*    } */
+
    /* Adjust the calculated mass matrix by the 'special operator'. */
    for( ii = 0; ii < nElNodes; ii++ ) {
       for( jj = 0; jj < nElNodes; jj++ )

Modified: long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.h	2008-11-30 06:50:41 UTC (rev 13423)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.h	2008-11-30 06:50:45 UTC (rev 13424)
@@ -44,18 +44,14 @@
 
 #define __MixedStabiliserTerm			\
    __StiffnessMatrixTerm                        \
-   MaterialPointsSwarm* materialSwarm;          \
-   ConstitutiveMatrix* constitutiveMatrix;      \
-   SwarmVariable* viscosityVar;                 \
-   double viscosity;                            \
+   IntegrationPointsSwarm* picSwarm;          \
+   StoreVisc* storeVisc;                 \
    double* Ni;                                  \
    double** GNx;                                \
    double** elStiffMat;
 
 struct MixedStabiliserTerm { __MixedStabiliserTerm };
 
-void* MixedStabiliserTerm_New( Name name );
-
 MixedStabiliserTerm* _MixedStabiliserTerm_New( 
    SizeT                                               sizeOfSelf,  
    Type                                                type,
@@ -81,6 +77,8 @@
 void MixedStabiliserTerm_Execute( void* _self, void* data );
 void MixedStabiliserTerm_Destroy( void* _self, void* data );
 
+void* _MixedStabiliserTerm_DefaultNew( Name name );
+
 void MixedStabiliserTerm_AssembleElement( void* _self,
 					  StiffnessMatrix* stiffMat,
 					  int elementIndex,

Added: long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.meta
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.meta	                        (rev 0)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/MixedStabiliserTerm.meta	2008-11-30 06:50:45 UTC (rev 13424)
@@ -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">MixedStabiliserTerm</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">StiffnessMatrixTerm</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">This adds a force to allow a divergence in the velocity.</param>
+
+<!--Now the interesting stuff-->
+
+<list name="Params">
+</list>
+
+<list name="Dependencies">
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">
+		<struct name="mixedStabiliserTerm">
+			<param name="Type">MixedStabiliserTerm</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/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/SConscript	2008-11-30 06:50:41 UTC (rev 13423)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/SConscript	2008-11-30 06:50:45 UTC (rev 13424)
@@ -45,6 +45,7 @@
 
 meta_files=Split("""GaleContext.meta
 DivergenceForce.meta
+MixedStabiliserTerm.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-11-30 06:50:41 UTC (rev 13423)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h	2008-11-30 06:50:45 UTC (rev 13424)
@@ -54,5 +54,6 @@
 	#include "KineticFriction.h"
 	#include "StressBC.h"
         #include "DivergenceForce.h"
+        #include "MixedStabiliserTerm.h"
 	
 #endif 



More information about the CIG-COMMITS mailing list