[cig-commits] r4924 - in long/3D/Gale/trunk/src/Underworld: . Rheology/src Rheology/tests Rheology/tests/expected Rheology/tests/testDirectorPerMaterial

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:53:56 PDT 2006


Author: walter
Date: 2006-10-11 13:53:55 -0700 (Wed, 11 Oct 2006)
New Revision: 4924

Added:
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_PerMaterial.0of1.testDirectorPerMaterial.dat.expected
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirector2D_PerMaterial.0of1.sh
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial.xml
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/makefile
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/testDirectorPerMaterial.c
Modified:
   long/3D/Gale/trunk/src/Underworld/
   long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.c
   long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.h
   long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.meta
   long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandom.xml
Log:
 r584 at earth:  boo | 2006-10-11 13:52:07 -0700
  r546 at earth (orig r323):  KathleenHumble | 2006-09-05 00:59:58 -0700
  Changed the Director so that it can now
  have 3 different options for specifying the
  initialDirection of swarm particles:
  'global' - is the default, and sets the initial Direction
  of all particles to a global value
  'random' - sets the initial Direction of every particle to 
  a random direction
  'perMaterial' - allows the user to set the direction of the
  particle per material, specified in the material struct 
  section of the xml.
  see the meta file or testDirectorPerMaterial.xml to
  see how to use the new feature.
  
  Added the appropriate tests and plugins for the tests as well.
  
  altered testDirectorRandom.xml so it uses the new
  referencing scheme.
  
 



Property changes on: long/3D/Gale/trunk/src/Underworld
___________________________________________________________________
Name: svk:merge
   - 9570c393-cf10-0410-b476-9a651db1e55a:/cig:583
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:322
   + 9570c393-cf10-0410-b476-9a651db1e55a:/cig:584
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:323

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.c	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.c	2006-10-11 20:53:55 UTC (rev 4924)
@@ -37,6 +37,7 @@
 *+		Mirko Velic
 *+		Patrick Sunter
 *+		Julian Giordani
+*+		Kathleen Humble
 *+
 ** $Id$
 ** 
@@ -58,6 +59,12 @@
 #include <assert.h>
 #include <string.h>
 
+/* Define the default initial direction for particles */ 
+#define DIRECTOR_DEFAULT_DIR_X 0.0
+#define DIRECTOR_DEFAULT_DIR_Y 1.0
+#define DIRECTOR_DEFAULT_DIR_Z 0.0
+
+
 /* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
 const Type Director_Type = "Director";
 
@@ -107,10 +114,10 @@
 		Director*                                          self,
 		FeVariable*                                        velGradField,
 		MaterialPointsSwarm*                               materialPointsSwarm,
-		double                                             initialDirectionX,
-		double                                             initialDirectionY,
-		double                                             initialDirectionZ,
-		Bool                                               randomInitialDirection,
+		InitialDirectionType                               initialDirectionType,
+		double                                             globalInitialDirectionX,
+		double                                             globalInitialDirectionY,
+		double                                             globalInitialDirectionZ,
 		int                                                randomInitialDirectionSeed,
 		Bool                                               dontUpdate )
 {
@@ -118,13 +125,12 @@
 	self->velGradField               = velGradField;
 	self->materialPointsSwarm        = materialPointsSwarm;
 	self->dontUpdate                 = dontUpdate;
-	self->initialDirection[ I_AXIS ] = initialDirectionX;
-	self->initialDirection[ J_AXIS ] = initialDirectionY;
-	self->initialDirection[ K_AXIS ] = initialDirectionZ;
-	self->randomInitialDirection     = randomInitialDirection;
+	self->globalInitialDirection[ I_AXIS ] = globalInitialDirectionX;
+	self->globalInitialDirection[ J_AXIS ] = globalInitialDirectionY;
+	self->globalInitialDirection[ K_AXIS ] = globalInitialDirectionZ;
 	self->randomInitialDirectionSeed = randomInitialDirectionSeed;
-	StGermain_VectorNormalise( self->initialDirection, materialPointsSwarm->dim );
-	
+	StGermain_VectorNormalise( self->globalInitialDirection, materialPointsSwarm->dim );
+	self->initialDirectionType = initialDirectionType;
 	/****** Setup Variables *****/
 
 	/* First check to see if a particle extension has already been created for this swarm */
@@ -189,7 +195,8 @@
 	Director*               self           = (Director*)director;
 	MaterialPointsSwarm*    materialPointsSwarm;
 	FeVariable*             velGradField;
-
+	char*                   initialDirectionTypeName;
+	InitialDirectionType    initialDirectionType;
 	/* Construct Parent */
 	_TimeIntegratee_Construct( self, cf );
 	
@@ -203,17 +210,42 @@
 	*/		
 	materialPointsSwarm = Stg_ComponentFactory_ConstructByKey( 
 			cf, self->name, "MaterialPointsSwarm", MaterialPointsSwarm, True );
-
+	
+	
+	/* Define the initial Direction type for the problem
+		The options are: global definition of direction,
+		Random direction,
+		a different direction per material.
+	*/
+	initialDirectionTypeName = Stg_ComponentFactory_GetString(cf, self->name, "initialDirectionType", "global");
+	if (0 == strcasecmp(initialDirectionTypeName, "global")) {
+		initialDirectionType = INIT_DIR_GLOBAL;
+	}
+	else if (0 == strcasecmp(initialDirectionTypeName, "random")) {
+		initialDirectionType = INIT_DIR_RANDOM;
+	}
+	else if (0 == strcasecmp(initialDirectionTypeName,"perMaterial")) {
+		initialDirectionType = INIT_DIR_PER_MAT;
+	}
+	else {
+			Journal_Firewall(False, Journal_Register(Error_Type, "Director" ), 
+			"Error in '%s', do not understand initialDirectionType = %s\n."
+			" Options are: \"global\", \"random\" or \"perMaterial\" ", __func__, 
+			initialDirectionTypeName);		
+	}
+	
 	_Director_Init(
 			self, 
 			velGradField,
 			materialPointsSwarm,
-			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionX",    0.0 ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionY",    1.0 ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionZ",    0.0 ),
-			Stg_ComponentFactory_GetBool( cf, self->name, "randomInitialDirection",    False ),
+			initialDirectionType,
+			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionX",    DIRECTOR_DEFAULT_DIR_X ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionY",    DIRECTOR_DEFAULT_DIR_Y ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, "initialDirectionZ",    DIRECTOR_DEFAULT_DIR_Z ),
 			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "randomInitialDirectionSeed",  1 ),
 			Stg_ComponentFactory_GetBool( cf, self->name, "dontUpdate", False ) );
+			
+			
 }
 
 void _Director_Build( void* director, void* data ) {
@@ -239,26 +271,25 @@
 	Stg_Component_Initialise( self->materialPointsSwarm, data, False );
 	Stg_Component_Initialise( self->directorSwarmVariable, data, False );
 
-	if ( True == self->randomInitialDirection ) {
-		srand( self->randomInitialDirectionSeed );
-	}
-
 	/* Update variables */
 	Variable_Update( self->variable );
 
 	/* We should only set initial directors if in regular non-restart mode. If in restart mode, then
-	the directors will be set correcty when we re-load the Swarm. */
+	the directors will be set correctly when we re-load the Swarm. */
 	if ( !(context && (True == context->loadFromCheckPoint)) ) {
 		particleLocalCount = self->variable->arraySize;
-		if ( False == self->randomInitialDirection ) {
+		if ( self->initialDirectionType == INIT_DIR_GLOBAL ) {
 			for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) {
 				/* Initialise the norm of each director */
 				normal = Variable_GetPtrDouble( self->variable, lParticle_I );
 
-				memcpy( normal, self->initialDirection, sizeof(XYZ) );
+				memcpy( normal, self->globalInitialDirection, sizeof(XYZ) );
 			}	
 		}
-		else {
+		else if (self->initialDirectionType == INIT_DIR_RANDOM){
+			/* create random directions for each particle */
+			srand( self->randomInitialDirectionSeed );
+			
 			for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) {
 				normal = Variable_GetPtrDouble( self->variable, lParticle_I );
 				for ( dim_I = 0; dim_I < self->materialPointsSwarm->dim; dim_I++ ) {
@@ -267,6 +298,52 @@
 				StGermain_VectorNormalise( normal, self->materialPointsSwarm->dim );
 			}	
 		}
+		else if (self->initialDirectionType == INIT_DIR_PER_MAT) {
+			/* Assign initial direction based on material */
+			Material_Index       materialsCount = Materials_Register_GetCount( self->materialPointsSwarm->materials_Register);
+			XYZ*              materialDirectionVectors;
+			int 				 material_I;
+			Material*            material;
+			
+			materialDirectionVectors = Memory_Alloc_Array(XYZ, materialsCount, "materialDirectionVectors");
+
+			/* Loop over materials and get material properties from dictionary */
+			for ( material_I = 0 ; material_I < materialsCount ; material_I++ ) {
+				material = Materials_Register_GetByIndex( self->materialPointsSwarm->materials_Register, material_I );
+				materialDirectionVectors[ material_I ][0] = 
+					Dictionary_GetDouble_WithDefault( material->dictionary, 
+						"initialDirectionX", DIRECTOR_DEFAULT_DIR_X );
+				
+				materialDirectionVectors[ material_I ][1] = 
+					Dictionary_GetDouble_WithDefault( material->dictionary, 
+						"initialDirectionY", DIRECTOR_DEFAULT_DIR_Y );				   		
+				
+				materialDirectionVectors[ material_I ][2] = 
+					Dictionary_GetDouble_WithDefault( material->dictionary, 
+						"initialDirectionZ", DIRECTOR_DEFAULT_DIR_Z );
+			}
+			
+			/* Assign value to particle */
+			for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ) {
+				/* Initialise the norm of each director */
+				normal = Variable_GetPtrDouble(self->variable,lParticle_I);
+				material_I = MaterialPointsSwarm_GetMaterialIndexAt(
+						self->materialPointsSwarm, 
+						lParticle_I );
+	
+				memcpy(normal, materialDirectionVectors[material_I], sizeof(XYZ));
+				StGermain_VectorNormalise( normal, self->materialPointsSwarm->dim );			
+			}	
+			Memory_Free(materialDirectionVectors);		
+			
+		}
+		else {
+			Journal_Firewall(False, Journal_Register(Error_Type, "Director" ), 
+			"Error in '%s', do not understand self->initialDirectionType = %u\n"
+			"initialDirectionType must match enumerated type, 'InitialDirectionType'"
+			"in Director.h\n", __func__, 
+			self->initialDirectionType);
+		}
 		/* We don't need to initialise the 'dontUpdate' flag on the particle because
 		 * all the memory is initialised to zero when the particles are allocated */
 	}

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.h	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.h	2006-10-11 20:53:55 UTC (rev 4924)
@@ -37,6 +37,7 @@
 *+		Mirko Velic
 *+		Patrick Sunter
 *+		Julian Giordani
+*+      Kathleen Humble
 *+
 ** $Id$
 ** 
@@ -48,7 +49,8 @@
 
 	/** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
 	extern const Type Director_Type;
-
+    typedef enum InitialDirectionType { INIT_DIR_GLOBAL=0, INIT_DIR_RANDOM=1, INIT_DIR_PER_MAT=2 } InitialDirectionType;
+	
 	typedef struct {
 		XYZ            director;
 		Particle_Bool  dontUpdate;
@@ -65,8 +67,9 @@
 		/* Param passed in */ \
 		FeVariable*                                         velGradField;                          \
 		MaterialPointsSwarm*                                materialPointsSwarm;                  \
-		XYZ                                                 initialDirection;                      \
-		Bool                                                randomInitialDirection;                \
+		Materials_Register*                                 materialsRegister;                  \
+		InitialDirectionType                                initialDirectionType;               \
+		XYZ                                                 globalInitialDirection;                      \
 		unsigned int                                        randomInitialDirectionSeed;             \
 		Bool                                                dontUpdate; 
 				

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.meta
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.meta	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/src/Director.meta	2006-10-11 20:53:55 UTC (rev 4924)
@@ -38,8 +38,26 @@
 		<param name="Type">Bool</param>
 		<param name="Default">False</param>
 		<param name="Description">If set to True, then the vector is still created but its update is inactive</param>
+	<struct>
+		<param name="Essential">True</param>
+		<param name="Name">initialDirectionType</param>
+		<param name="Type">char*</param>
+		<param name="Default">global</param>
+		<param name="Description">This parameter is used to specify how the particles initial directions will be set up. The three options are: 'global', 'random' and 'perMaterial'. 
+		'global' sets the initial direction of each particle to the same direction, specified by the initialDirection parameters.
+		'random' sets all particles to a random initial direction, based on a 'randomInitialDirectionSeed'.
+		'perMaterial' allows the user to specify initialDirection parameters for each different material. The initialDirection is specified in the material definition.</param>
 	</struct>
+	<struct>
+		<param name="Essential">True</param>
+		<param name="Name">randomInitialDirectionSeed</param>
+		<param name="Type">int</param>
+		<param name="Default">1</param>
+		<param name="Description">Used when initialDirectionType='random'. Specifies the random seed to generate the initial random directions of particles.</param>
+	</struct>	
 
+	</struct>
+
 </list>
 
 <list name="Dependencies">
@@ -62,9 +80,3 @@
 		<param name="Description">This is the swarm that you want to add the director to.</param>
 	</struct>	
 </list>
-<!-- Add an example XML if possible -->
-<param name="Example">Underworld/InputFiles/Anisotropic.xml</param>
-<param name="Example">Underworld/InputFiles/ExtensionFMM.xml</param>
-<param name="Example">Underworld/InputFiles/ExtensionFMM3D.xml</param>
-
-</StGermainData>

Added: long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_PerMaterial.0of1.testDirectorPerMaterial.dat.expected
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_PerMaterial.0of1.testDirectorPerMaterial.dat.expected	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_PerMaterial.0of1.testDirectorPerMaterial.dat.expected	2006-10-11 20:53:55 UTC (rev 4924)
@@ -0,0 +1,3 @@
+Angles for material 0 within tolerance 1e-15
+Angles for material 1 within tolerance 1e-15
+Angles for material 2 within tolerance 1e-15

Added: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirector2D_PerMaterial.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirector2D_PerMaterial.0of1.sh	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirector2D_PerMaterial.0of1.sh	2006-10-11 20:53:55 UTC (rev 4924)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTestStdLocations "Underworld testDirectorPerMaterial.xml" "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirector2D_PerMaterial.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/makefile
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/makefile	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/makefile	2006-10-11 20:53:55 UTC (rev 4924)
@@ -0,0 +1,22 @@
+
+#Finds the Absolute path to the Project Root directory
+SHELL := /bin/bash
+PROJ_ROOT := $(shell until test -r ./Makefile.system ; do cd .. ; done ; echo `pwd`)
+include ${PROJ_ROOT}/Makefile.system
+
+
+# Source Code and Header files
+SRCS := $(wildcard *.c)
+HDRS := $(wildcard *.h)
+
+# What to call the plugin
+modName := $(shell basename `pwd`)
+mod = ${PROJECT}_${modName}
+
+# Where to put header files
+includes = ${PROJECT}/${modName}
+
+# External Libraries and Headers
+packages = PICELLERATOR STG_FEM STGERMAIN PETSC MPI XML PYTHON
+
+include ${PROJ_ROOT}/Makefile.vmake

Added: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/testDirectorPerMaterial.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/testDirectorPerMaterial.c	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial/testDirectorPerMaterial.c	2006-10-11 20:53:55 UTC (rev 4924)
@@ -0,0 +1,136 @@
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StG_FEM/StG_FEM.h>
+#include <PICellerator/PICellerator.h>
+#include <Underworld/Rheology/Rheology.h>
+
+#include <assert.h>
+
+#define DIR_TEST_NUM_MAT 3
+#define DIR_X_AXIS 0
+#define DIR_Y_AXIS 1
+#define DIR_Z_AXIS 2
+#define ANGLE_ERROR 1e-15
+
+void Underworld_testDirectorPerMaterial_Function( PICelleratorContext* context ) {
+	AlignmentSwarmVariable* alignment              = (AlignmentSwarmVariable*) LiveComponentRegister_Get( context->CF->LCRegister, "alignment" );
+	Materials_Register*     materials_Register     = context->materials_Register;
+	Director*               director;
+	Particle_Index          lParticle_I;
+	Swarm*                  swarm;
+	XYZ                     testVector;
+	Stream*                 stream                 = Journal_Register( Info_Type, CURR_MODULE_NAME );
+	Material_Index          materialsCount;
+	int                     material_I;
+	XYZ*                    matDirectionVectors;
+	double                  angle;
+	XYZI                    materialErrorCounts;
+	XYZ                     accumulatedErrors;
+	
+	assert( alignment );
+
+	swarm = alignment->swarm;
+	director = alignment->director;
+	materialsCount = Materials_Register_GetCount( materials_Register);
+	
+	// construct test for testDirectorPerMaterial.xml 
+	//assume a direction for each material and check that
+	//each particle has the same direction for it's material type.
+	//and that it's equal to the default value for each material.
+	/* get materials and their initial directions */
+	
+	/* check that there are at least 3 materials */
+	/* check that the initialDirections are == certain defaults */
+	if (materialsCount != DIR_TEST_NUM_MAT ) {
+		Journal_Printf(stream, "Amount of materials does not match default of %d\n", DIR_TEST_NUM_MAT);
+	}
+	matDirectionVectors = Memory_Alloc_Array(XYZ, DIR_TEST_NUM_MAT, "materialDirectionVectors");
+
+	/* Define vectors */
+	
+	matDirectionVectors[0][DIR_X_AXIS] = 1.0;
+	matDirectionVectors[0][DIR_Y_AXIS] = 0.0;
+	matDirectionVectors[0][DIR_Z_AXIS] = 0.0;
+	
+	matDirectionVectors[1][DIR_X_AXIS] = 0.0;
+	matDirectionVectors[1][DIR_Y_AXIS] = 1.0;
+	matDirectionVectors[1][DIR_Z_AXIS] = 0.0;
+	
+	matDirectionVectors[2][DIR_X_AXIS] = 1.0;
+	matDirectionVectors[2][DIR_Y_AXIS] = 1.0;
+	matDirectionVectors[2][DIR_Z_AXIS] = 0.0;
+	
+	//set error counters
+	for (material_I=0; material_I < DIR_TEST_NUM_MAT; material_I++) {
+		materialErrorCounts[material_I] = 0;
+		accumulatedErrors[material_I] = 0;
+	}		
+
+	for ( lParticle_I = 0 ; lParticle_I < swarm->particleLocalCount ; lParticle_I++ ) {
+
+		/* get particle's material type */
+		material_I = MaterialPointsSwarm_GetMaterialIndexAt(
+						swarm, 
+						lParticle_I );
+		/* get particle's initialDirection */
+		SwarmVariable_ValueAt( director->directorSwarmVariable, lParticle_I, testVector );
+	
+		/* check that angle is within error bar of correct value */
+		angle = StGermain_AngleBetweenVectors(matDirectionVectors[material_I],testVector, swarm->dim);
+		
+		if (fabs(angle) > ANGLE_ERROR) {
+			materialErrorCounts[material_I] = materialErrorCounts[material_I] + 1;
+			accumulatedErrors[material_I] = accumulatedErrors[material_I] + 1;
+		}	
+		
+	}
+	
+	/* if all particles within tolerance, then print out a 'pass' message */
+	for (material_I = 0; material_I < DIR_TEST_NUM_MAT; material_I++) {
+		if (materialErrorCounts[material_I] == 0 ) {		
+			Journal_Printf(stream, "Angles for material %d within tolerance %g\n", 
+				material_I, ANGLE_ERROR);
+		}
+		else {
+			Journal_Printf(stream, "Angles for material %d not within tolerance %g\n", 
+				material_I, ANGLE_ERROR);
+			Journal_Printf(stream, "%d particles outside tolerance, with accumulated error = %f\n", 
+				materialErrorCounts[material_I], accumulatedErrors[material_I]);
+		}
+	}
+	Stream_Flush( stream );
+}
+
+const Type Underworld_testDirectorPerMaterial_Type = "Underworld_testDirectorPerMaterial";
+typedef struct {
+	__Codelet
+} Underworld_testDirectorPerMaterial;
+
+void _Underworld_testDirectorPerMaterial_Construct( void* component, Stg_ComponentFactory* cf ) {
+	FiniteElementContext*   context;
+	Stream*                 stream                 = Journal_Register( Info_Type, CURR_MODULE_NAME );
+
+	context = Stg_ComponentFactory_ConstructByName( cf, "context", FiniteElementContext, True );
+
+	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "testDirectorPerMaterial.dat" );
+	
+	ContextEP_Append_AlwaysLast( context, AbstractContext_EP_FrequentOutput,
+		Underworld_testDirectorPerMaterial_Function );
+}
+
+void* _Underworld_testDirectorPerMaterial_DefaultNew( Name name ) {
+	return Codelet_New(
+			Underworld_testDirectorPerMaterial_Type,
+			_Underworld_testDirectorPerMaterial_DefaultNew,
+			_Underworld_testDirectorPerMaterial_Construct,
+			_Codelet_Build,
+			_Codelet_Initialise,
+			_Codelet_Execute,
+			_Codelet_Destroy,
+			name );
+	}
+
+Index Underworld_testDirectorPerMaterial_Register( PluginsManager* pluginsManager ) {
+	return PluginsManager_Submit( pluginsManager, Underworld_testDirectorPerMaterial_Type, "0", _Underworld_testDirectorPerMaterial_DefaultNew );
+}

Added: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial.xml
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial.xml	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorPerMaterial.xml	2006-10-11 20:53:55 UTC (rev 4924)
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+	
+	<!-- Component Stuff -->
+	<searchPath>../../InputFiles/</searchPath>
+	<include>./StgFEM_Components/LinearMesh.xml             </include>
+	<include>./StgFEM_Components/ElementLayout.xml          </include>
+	<include>./StgFEM_Components/VelocityField.xml          </include>
+	<include>./StgFEM_Components/TimeIntegrator.xml         </include>
+	<include>./PIC_Components/MaterialPointSwarm.xml        </include>
+	
+	<list name="plugins" mergeType="merge">
+		<param>StG_FEM_StandardConditionFunctions</param>
+		<!-- testDirector plugin has to be here to standardise dt calculations -->
+		<param>Underworld_testDirectorPerMaterial</param>
+	</list>
+
+	<!-- Rheology Components -->
+	<struct name="components" mergeType="merge">
+		<!-- Periodic boundary conditions -->
+		<struct name="periodicBCsManager">
+			<param name="Type">PeriodicBoundariesManager</param>
+			<param name="Geometry">geometry</param>
+			<param name="Swarm">materialSwarm</param>
+			<param name="TimeIntegrator">timeIntegrator</param>
+			
+			<list name="PeriodicBoundaries">
+				<param>I_AXIS</param>
+			</list>	
+		</struct>
+
+		<!-- Create Alignment Swarm Variable - for the sake of plotting -->
+		<struct name="director">
+			<param name="Type">Director</param>
+			<param name="MaterialPointsSwarm">materialSwarm</param>
+			<param name="TimeIntegrator">timeIntegrator</param>
+			<param name="VelocityGradientsField">VelocityGradientsField</param>
+			<param name="initialDirectionType">perMaterial</param>
+		</struct>	
+		<struct name="alignment">
+			<param name="Type">AlignmentSwarmVariable</param>
+			<param name="Swarm">materialSwarm</param>
+			<param name="Director">director</param>
+			<param name="VelocityField">VelocityField</param>
+		</struct>	
+	</struct>
+	
+	<!-- Create different materials -->
+	<struct name="components" mergeType="merge">
+		<struct name="backgroundViscosity">
+			<param name="Type">MaterialViscosity</param>
+			<param name="eta0">1.0</param>
+		</struct>
+		<struct name="backgroundShape">
+			<param name="Type">Everywhere</param>
+		</struct>	
+		<struct name="background">
+			<param name="Type">Material</param>
+			<param name="Shape">backgroundShape</param>
+			<param name="initialDirectionX">1.0</param>
+			<param name="initialDirectionY">0.0</param>
+			<param name="initialDirectionZ">0.0</param>
+		</struct>
+
+		<struct name="ballShape1">
+			<param name="Type">Sphere</param>
+			<param name="CentreX">0.5</param>
+			<param name="CentreY">0.7</param>
+			<param name="CentreZ">0.1</param>
+			<param name="radius"> 0.10 </param>
+		</struct>
+		<struct name="ballShape2">
+			<param name="Type">Sphere</param>
+			<param name="CentreX">0.2</param>
+			<param name="CentreY">0.5</param>
+			<param name="CentreZ">0.5</param>
+			<param name="radius"> 0.10 </param>
+		</struct>		
+		<struct name="ball1">
+			<param name="Type">Material</param>
+			<param name="Shape">ballShape1</param>
+			<param name="initialDirectionX">0.0</param>
+			<param name="initialDirectionY">1.0</param>
+			<param name="initialDirectionZ">0.0</param>
+			
+		</struct>
+		<struct name="ball2">
+			<param name="Type">Material</param>
+			<param name="Shape">ballShape2</param>
+			<param name="initialDirectionX">1.0</param>
+			<param name="initialDirectionY">1.0</param>
+			<param name="initialDirectionZ">0.0</param>
+			
+		</struct>		
+	</struct>
+	<!-- Simulation control -->
+	<param name="maxTimeSteps"> 1      </param>
+	<param name="outputPath">./output</param>
+	<param name="dumpEvery"> 1 </param>	
+
+	<param name="particlesPerCell">  2    </param>
+	<param name="SimpleShearFactor">  2    </param>
+
+	<!-- Journal Control -->
+	<param name="journal.info.Context-verbose">True</param>
+	<param name="journal-level.info.Stg_ComponentFactory">2</param>
+	<param name="journal.debug">f</param>
+	<param name="journal-enable-branch.debug.StG_FEM">t</param>
+	<param name="journal-level-branch.debug.StG_FEM"> 1 </param>	
+	
+	<!-- Geometry & Mesh setup -->
+	<param name="dim">        2 </param>
+	<param name="elementResI">10 </param>
+	<param name="elementResJ">10 </param>
+	<param name="elementResK">1 </param>
+	<param name="shadowDepth">1 </param>
+	<param name="minX">       0.0 </param>
+	<param name="minY">       0.0 </param>
+	<param name="minZ">       0.0 </param>
+	<param name="maxX">       1.0 </param>
+	<param name="maxY">       1.0 </param>
+	<param name="maxZ">       1.0 </param>
+	<param name="allowUnbalancing"> True </param>
+
+	<!-- Set up BCs and ICs -->
+	<include> VariableConditions/velocityBCs.simpleShear.xml </include>
+	<include> VariableConditions/velocityICs.simpleShear.xml </include>
+
+	<!-- Integration Scheme configuration -->
+	<param name="gaussParticlesX"> 2 </param>
+	<param name="gaussParticlesY"> 2 </param>
+	<param name="gaussParticlesZ"> 2 </param>
+
+
+	<include> Viewports/StrainRateInvariantVP.xml </include>
+	<include> Viewports/VelocityMagnitudeVP.xml </include>
+	<include> window.xml </include>
+	<struct name="components" mergeType="merge">
+		<struct name="alignmentColourMap">
+			<param name="Type">lucColourMap</param>
+			<param name="colours">Orange Red Black</param>
+		</struct>
+		<struct name="alignmentDrawingObject">
+			<param name="Type">lucSwarmVectors</param>
+			<param name="Swarm">materialSwarm</param>
+			<param name="ColourVariable">alignment</param>
+			<param name="ColourMap"> alignmentColourMap</param>
+			<param name="DirectionVariable">materialSwarm-Director</param>
+			<param name="arrowHeadSize">0.2</param>
+			<param name="length">0.05</param>
+		</struct>	
+		<struct name="AlignmentVP">
+			<param name="Type">lucViewport</param>
+			<param name="Camera">camera</param>
+			<list name="DrawingObject">
+				<param>alignmentDrawingObject</param>
+				<param>border</param>
+			</list>
+		</struct>		
+		<struct name="window" mergeType="merge">
+			<param name="Viewport">VelocityMagnitudeVP AlignmentVP </param>
+		</struct>
+	</struct>
+
+ 
+</StGermainData>

Modified: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandom.xml
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandom.xml	2006-10-11 20:53:53 UTC (rev 4923)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandom.xml	2006-10-11 20:53:55 UTC (rev 4924)
@@ -13,7 +13,8 @@
 	
 	<list name="plugins" mergeType="merge">
 		<param>StG_FEM_StandardConditionFunctions</param>
-		<param>Underworld_testDirector</param>
+		<!-- testDirector plugin has to be here to standardise dt calculations -->
+		<param>Underworld_testDirector</param>		
 		<param>Underworld_testDirectorRandomness</param>
 	</list>
 
@@ -37,10 +38,10 @@
 			<param name="MaterialPointsSwarm">materialSwarm</param>
 			<param name="TimeIntegrator">timeIntegrator</param>
 			<param name="VelocityGradientsField">VelocityGradientsField</param>
+			<param name="initialDirectionType">random</param>
 			<param name="initialDirectionX">1.0</param>
 			<param name="initialDirectionY">0.0</param>
 			<param name="initialDirectionZ">0.0</param>
-			<param name="randomInitialDirection">True</param>
 			<param name="randomInitialDirectionSeed">1</param>
 		</struct>	
 		<struct name="alignment">



More information about the cig-commits mailing list