Beispiel #1
0
void _SnacPlastic_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;
	EntryPoint* 	interpolateElementEP;

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 

	#ifdef DEBUG
		printf( "In: _SnacPlastic_Register( void*, void* )\n" );
	#endif
	
	/* Add extensions to nodes, elements and the context */
	SnacPlastic_ElementHandle = ExtensionManager_Add( context->mesh->elementExtensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Element) );
	SnacPlastic_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Context) );
	
	#ifdef DEBUG
		printf( "\tcontext extension handle: %u\n", SnacPlastic_ContextHandle );
		printf( "\telement extension handle: %u\n", SnacPlastic_ElementHandle );
	#endif
	
	/* Add extensions to the entry points */
	EntryPoint_Append( 
		Context_GetEntryPoint( context,	Snac_EP_Constitutive ),
		SnacPlastic_Type, 
		SnacPlastic_Constitutive, 
		SnacPlastic_Type );
	EntryPoint_InsertBefore( 
		Context_GetEntryPoint( context,	AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacPlastic_Type, 
		SnacPlastic_InitialConditions,
		SnacPlastic_Type );
	EntryPoint_Prepend( /* Dump the initial plastic strain */
		Context_GetEntryPoint( context, AbstractContext_EP_Execute ),
		"SnacPlastic_Write",
		_SnacPlastic_WritePlasticStrain,
		SnacPlastic_Type );
	EntryPoint_Append( /* and dump each loop */
		Context_GetEntryPoint( context, Snac_EP_CalcStresses ),
		"SnacPlastic_Write",
		_SnacPlastic_WritePlasticStrain,
		SnacPlastic_Type );
	
	/* Add extensions to the interpolate element entry point, but it will only exist if the remesher is loaded. */
	interpolateElementEP = Context_GetEntryPoint( context,	"SnacRemesher_EP_InterpolateElement" );
	if( interpolateElementEP ) {
		EntryPoint_Append( 
			interpolateElementEP,
			SnacPlastic_Type, 
			_SnacPlastic_InterpolateElement, 
			SnacPlastic_Type );
	}


	/* Construct. */
	_SnacPlastic_ConstructExtensions( context, data );
}
ExtensionInfo_Index Materials_Register_AddMaterialExtension( void* materialsRegister, Type type, SizeT extensionSize ) {
	Materials_Register*     self         = (Materials_Register*) materialsRegister;
	Material*               material;
	ExtensionInfo_Index     firstResult  = 0;
	ExtensionInfo_Index     result       = 0;
	Material_Index          material_I   = 0;

	for ( material_I = 0 ; material_I < Materials_Register_GetCount( self ) ; material_I++) {
		material = Materials_Register_GetByIndex( self, material_I );

		result = ExtensionManager_Add( material->extensionMgr, (Name)type, extensionSize );

		if ( material_I == 0  )
			firstResult = result;
		else {
			Journal_Firewall( 
				firstResult == result, 
				Journal_Register( Error_Type, (Name)self->type  ),
				"Material '%s' has a different number of extensions than eariler materials.\n", 
				material->name );
		}
	}

	return result;
}
Beispiel #3
0
void _SnacHillSlope_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;

	#ifdef DEBUG
	fprintf(stderr, "Entering Register.c...\n");
	#endif

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
	
	Journal_Printf( context->debug, "In: %s\n", __func__ );
	
	
	/* Add extensions to nodes, elements and the context */
	SnacHillSlope_ContextHandle = ExtensionManager_Add(
		context->extensionMgr,
		SnacHillSlope_Type,
		sizeof(SnacHillSlope_Context) );
	
	/* Add extensions to the entry points */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Build ),
		SnacHillSlope_Type,
		_SnacHillSlope_Build,
		SnacHillSlope_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		SnacHillSlope_Type,
		_SnacHillSlope_InitialConditions,
		SnacHillSlope_Type );

/* 	EntryPoint_Append( */
/* 		Context_GetEntryPoint( context, Snac_EP_Constitutive ), */
/* 		SnacHillSlope_Type, */
/* 		_SnacHillSlope_Constitutive, */
/* 		SnacHillSlope_Type ); */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ),
		SnacHillSlope_Type,
		_SnacHillSlope_DeleteExtensions,
		SnacHillSlope_Type );


	/* Construct. */
	_SnacHillSlope_ConstructExtensions( context, data );

	#ifdef DEBUG
	fprintf(stderr, "In Register.c\n");
	#endif

	#ifdef DEBUG
	fprintf(stderr, "...leaving Register.c\n");
	#endif


}
void _OneToOneMapper_Init( void* mapper, MaterialPointsSwarm* materialSwarm ) {
	OneToOneMapper* self = (OneToOneMapper*)mapper;
	
	self->errorStream = Journal_MyStream( Error_Type, self );
	self->materialSwarm = materialSwarm;

	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, False );
	self->materialRefHandle = ExtensionManager_Add( self->integrationSwarm->particleExtensionMgr, (Name)materialSwarm->name, sizeof(MaterialPointRef)  );
	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, True );
}
void _DruckerPrager_Init(
		DruckerPrager*                                     self,
		int                                                pressure_id,
		int                                                velocityGradients_id,
		double                                             minimumYieldStress,
		double                                             frictionCoefficient,
		double                                             frictionCoefficientAfterSoftening )
{
   MaterialPointsSwarm*      materialPointsSwarm;
	DruckerPrager_Particle*   particleExt;
	StandardParticle          materialPoint;
	Dimension_Index          dim = 0;
	
	/* Assign Pointers */
	self->frictionCoefficient = frictionCoefficient;
	self->minimumYieldStress  = minimumYieldStress;
	
	self->pressureTag         = pressure_id;
	self->velocityGradientsTag = velocityGradients_id;
   materialPointsSwarm = self->mgr->materialSwarm;
   dim = materialPointsSwarm->dim;	
    /* Strain softening of Friction - (linear weakening is assumed ) */
	/* needs a softening factor between +0 and 1 and a reference strain > 0 */
	self->frictionCoefficientAfterSoftening = frictionCoefficientAfterSoftening;

   /* get the particle extension */
   self->particleExtHandle = ExtensionManager_GetHandle( materialPointsSwarm->particleExtensionMgr, (Name)DruckerPrager_Type );

   if( self->particleExtHandle == (unsigned)-1 ) {
      /* if no particles extension add it and add Update hook */
      self->particleExtHandle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, (Name)DruckerPrager_Type, sizeof(DruckerPrager_Particle) );

      particleExt = (double*)ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &materialPoint, self->particleExtHandle );
      
      /* The tensileFailure variable allows to check whether a materialPoint has failed in tensile mode or not */
      self->tensileFailure = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"DruckerPragerTensileFailure", (ArithPointer) &particleExt->tensileFailure - (ArithPointer) &materialPoint, Variable_DataType_Char );
      LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->tensileFailure->variable );
      LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->tensileFailure );
	   
   } else {
      /* get references to all swarm variables */
      Name var_name = Stg_Object_AppendSuffix( materialPointsSwarm, (Name)"DruckerPragerTensileFailure"  );
      self->tensileFailure = SwarmVariable_Register_GetByName( materialPointsSwarm->swarmVariable_Register, var_name );
      Memory_Free( var_name );
	   
   }

   self->curFrictionCoef = 0.0;

}
void _ParticleMelting_Init( 
   ParticleMelting* self,
   Bool extractMelt,
   FeVariable* temperatureField,
   FeVariable* pressureField,
   MaterialPointsSwarm* materialSwarm,
   Scaling* scaling ) {

	ParticleMelting_ParExt *parExt = NULL;
	StandardParticle particle;

   /* extractMelt:
    * For mantle set to true, according to de Smet, 98
    * For lithosphere set to false according to Patrice Rey
    */
   self->extractMelt              = extractMelt;
   self->temperatureField         = temperatureField;
   self->pressureField            = pressureField;
   self->materialSwarm = materialSwarm;
   self->scaling = scaling;

   /* add to EP, post time step, to save the previous value of melting depletion */
	/*   EntryPoint_AppendClassHook( 
      AbstractContext_GetEntryPoint(self->context, AbstractContext_EP_UpdateClass), 
      "MeltDepletionUpdate", 
      ParticleMelting_MeltFrationUpdate, 
      self->name, 
      self );
	*/

   /*
   EntryPoint_Append
   AbstractContext_EP_UpdateClass
   */

	/* now we extend the particles with 3 doubles: F, prevF and maxTheta */	
	self->particleExtHandle = ExtensionManager_Add( self->materialSwarm->particleExtensionMgr, (Name)self->type, sizeof(ParticleMelting_ParExt) );
	parExt = ExtensionManager_Get( self->materialSwarm->particleExtensionMgr, &particle, self->particleExtHandle );

	self->meltVariable = Swarm_NewScalarVariable( self->materialSwarm, (Name)"Melt", (ArithPointer) &parExt->melt - (ArithPointer) &particle, Variable_DataType_Double );

	self->FVariable = Swarm_NewScalarVariable( self->materialSwarm, (Name)"Depletion", (ArithPointer) &parExt->F - (ArithPointer) &particle, Variable_DataType_Double );
	  
	self->prevFVariable = Swarm_NewScalarVariable( self->materialSwarm, (Name)"PrevDepletion", (ArithPointer) &parExt->prevF - (ArithPointer) &particle, Variable_DataType_Double );

	self->maxThetaVariable = Swarm_NewScalarVariable( self->materialSwarm, (Name)"MaxDegreeOfMelting", (ArithPointer) &parExt->maxTheta - (ArithPointer) &particle, Variable_DataType_Double );

}
void _StoreVisc_Init(
	StoreVisc*				self,
	MaterialPointsSwarm*	materialPointsSwarm )
{
	StandardParticle           particle;
	StoreVisc_ParticleExt*     particleExt;
		
	/* Assign Pointers */
	self->materialPointsSwarm = materialPointsSwarm;

	self->particleExtHandle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, (Name)self->type, sizeof( StoreVisc_ParticleExt )  );
	
	/* Add SwarmVariables for plotting */
	particleExt = (StoreVisc_ParticleExt*)ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &particle, self->particleExtHandle );
	
	self->swarmVariable = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"Viscosity", (ArithPointer) &particleExt->effVisc - (ArithPointer) &particle, Variable_DataType_Double );

}
void _RateFieldTimeIntegrator_Build( void* rateFieldTimeIntegrator, void* data ) {
   RateFieldTimeIntegrator*  self = (RateFieldTimeIntegrator*) rateFieldTimeIntegrator;
   ExtensionInfo_Index   handle;

   Stg_Component_Build( self->swarm, data, False );
   Stg_Component_Build( self->rateField, data, False );

   handle = ExtensionManager_GetHandle( self->swarm->particleExtensionMgr, (Name)self->name );

   if ( handle == (ExtensionInfo_Index) -1 ) {
      ArithPointer offset;
      handle = ExtensionManager_Add( self->swarm->particleExtensionMgr, (Name)RateFieldTimeIntegrator_Type, self->rateField->fieldComponentCount*sizeof(double)  );

      /* Adding required increment variable */
      offset = (ArithPointer ) ExtensionManager_Get( self->swarm->particleExtensionMgr, NULL, handle );

      /* Add variables for vizualization / analysis purposes */
      self->particleTimeIntegral = Swarm_NewVectorVariable( self->swarm, self->name, offset, Variable_DataType_Double, self->rateField->fieldComponentCount, "STG_AUTONAME"  );
      LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->particleTimeIntegral->variable );
      LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->particleTimeIntegral );

      /* The RateFieldTimeIntegrator class inherits from the TimeIntegrand class - this class needs a 'Variable' to
       * integrate through time. */
      self->variable = self->particleTimeIntegral->variable;
   } else
      Journal_Firewall(False, Journal_Register( Error_Type, (Name)"RateFieldTimeIntegrator"  ),
                       "\n\nError in '%s' - Extension with name %s should not already exists.\n"
                       "An error has occurred.  Please contact developers.", __func__, self->name);


   /* Build parent.  Note that this needs to go last because it assumes that a variable has been set, which only just happens above */
   /* Another example where the build/init/etc phases don't work */

   _TimeIntegrand_Build( self, data );
   Stg_Component_Build( self->particleTimeIntegral, data, False );

}
void _GALEDruckerPrager_Init(
		GALEDruckerPrager*                                     self,
		FeVariable*                                        pressureField,
		SwarmVariable*                                     swarmPressure,
		MaterialPointsSwarm*                               materialPointsSwarm,
		double                                             frictionCoefficient,
		double                                             frictionCoefficientAfterSoftening,
                double                    boundaryCohesion,
                double                    boundaryCohesionAfterSoftening,
                double                    boundaryFrictionCoefficient,
                double                    boundaryFrictionCoefficientAfterSoftening,
                Bool                      boundaryBottom,
                Bool                      boundaryTop,
                Bool                      boundaryLeft,
                Bool                      boundaryRight,
                Bool                      boundaryFront,
                Bool                      boundaryBack,
                double                    minimumYieldStress,
                double                    minimumViscosity,
                HydrostaticTerm*          hydrostaticTerm )
{
	GALEDruckerPrager_Particle*   particleExt;
	StandardParticle          materialPoint;
	
	self->particleExtHandle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, (Name)GALEDruckerPrager_Type, sizeof(GALEDruckerPrager_Particle) );
		
	/* Assign Pointers */
	self->pressureField       = pressureField;
	self->frictionCoefficient = frictionCoefficient;
	self->minimumYieldStress  = minimumYieldStress;
	self->minimumViscosity    = minimumViscosity;
	self->swarmPressure       = swarmPressure;
	
	/* Strain softening of Cohesion and friction - (linear
           weakening is assumed) needs a softening factor between +0
           and 1 and a reference strain > 0 */
	self->frictionCoefficientAfterSoftening = frictionCoefficientAfterSoftening;
	self->boundaryCohesion = boundaryCohesion;
	self->boundaryFrictionCoefficient = boundaryFrictionCoefficient;
	self->boundaryCohesionAfterSoftening = boundaryCohesionAfterSoftening;
	self->boundaryFrictionCoefficientAfterSoftening = boundaryFrictionCoefficientAfterSoftening;
        self->boundaryBottom=boundaryBottom;
        self->boundaryTop=boundaryTop;
        self->boundaryLeft=boundaryLeft;
        self->boundaryRight=boundaryRight;
        self->boundaryFront=boundaryFront;
        self->boundaryBack=boundaryBack;

	self->minimumYieldStress = minimumYieldStress;
	self->minimumViscosity = minimumViscosity;
        self->hydrostaticTerm=hydrostaticTerm;

	/* Update Drawing Parameters */
	EP_PrependClassHook( Context_GetEntryPoint( self->context, AbstractContext_EP_DumpClass ),
								_GALEDruckerPrager_UpdateDrawParameters, self );
	
	particleExt = (GALEDruckerPrager_Particle*)ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &materialPoint, self->particleExtHandle );
	
	/* Setup Variables for Visualisation */
	self->brightness = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"GALEDruckerPragerBrightness", (ArithPointer) &particleExt->brightness - (ArithPointer) &materialPoint, Variable_DataType_Float  );
	
	self->opacity = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"GALEDruckerPragerOpacity", (ArithPointer) &particleExt->opacity - (ArithPointer) &materialPoint, Variable_DataType_Float  );
	
	self->diameter = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"GALEDruckerPragerDiameter", (ArithPointer) &particleExt->diameter - (ArithPointer) &materialPoint, Variable_DataType_Float  );

	/* The tensileFailure variable allows to check whether a materialPoint has failed in tensile mode or not */
	self->tensileFailure = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"GALEDruckerPragerTensileFailure", (ArithPointer) &particleExt->tensileFailure - (ArithPointer) &materialPoint, Variable_DataType_Char );

        self->curFrictionCoef = 0.0;
}
Beispiel #10
0
void _SnacTemperature_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;
	EntryPoint* 	interpolateNodeEP;

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 

	#ifdef DEBUG
		printf( "In: _SnacTemperature_Register( void*, void* )\n" );
	#endif

	/* Add extensions to nodes, elements and the context */
	SnacTemperature_NodeHandle = ExtensionManager_Add( context->mesh->nodeExtensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Node) );
	SnacTemperature_ElementHandle = ExtensionManager_Add( context->mesh->elementExtensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Element) );
	SnacTemperature_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Context) );

	#ifdef DEBUG
		printf( "\tcontext extension handle: %u\n", SnacTemperature_ContextHandle );
		printf( "\telement extension handle: %u\n", SnacTemperature_ElementHandle );
		printf( "\tnode extension handle: %u\n", SnacTemperature_NodeHandle );
	#endif


	/* Add extensions to the entry points */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Build ),
		SnacTemperature_Type,
		_SnacTemperature_Build,
		SnacTemperature_Type );
	EntryPoint_InsertBefore(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		"SnacTimeStepZero",
		SnacTemperature_Type,
		_SnacTemperature_InitialConditions,
		SnacTemperature_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, Snac_EP_LoopNodesEnergy ),
		SnacTemperature_Type,
		SnacTemperature_LoopNodes,
		SnacTemperature_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, Snac_EP_LoopElementsEnergy ),
		SnacTemperature_Type,
		SnacTemperature_LoopElements,
		SnacTemperature_Type );
	EntryPoint_Prepend( /* Dump the initial temperature */
		Context_GetEntryPoint( context, AbstractContext_EP_Execute ),
		"SnacTemperature_Write",
		_SnacTemperature_WriteTemp,
		SnacTemperature_Type );
	EntryPoint_Append( /* and dump each loop */
		Context_GetEntryPoint( context, Snac_EP_LoopNodesEnergy ),
		"SnacTemperature_Write",
		_SnacTemperature_WriteTemp,
		SnacTemperature_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ),
		SnacTemperature_Type,
		_SnacTemperature_DeleteExtensions,
		SnacTemperature_Type );

	/* Add extensions to the interpolate element entry point, but it will only exist if the remesher is loaded. */
	interpolateNodeEP = Context_GetEntryPoint( context, "SnacRemesher_EP_InterpolateNode" );
	if( interpolateNodeEP ) {
		EntryPoint_Append(
			interpolateNodeEP,
			SnacTemperature_Type,
			_SnacTemperature_InterpolateNode,
			SnacTemperature_Type );
	}

	/* Construct. */
	_SnacTemperature_ConstructExtensions( context, data );
}
Beispiel #11
0
void _SnacRemesher_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
	Snac_Context*	context;

	/* Retrieve context. */
	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
	
	Journal_Printf( context->debug, "In: %s\n", __func__ );

	/* Add extensions to nodes, elements and the context */
	SnacRemesher_ContextHandle = ExtensionManager_Add(
		context->extensionMgr,
		SnacRemesher_Type,
		sizeof(SnacRemesher_Context) );
	SnacRemesher_MeshHandle = ExtensionManager_Add(
		context->meshExtensionMgr,
		SnacRemesher_Type,
		sizeof(SnacRemesher_Mesh) );

	Journal_Printf( context->debug, "\tcontext extension handle: %u\n", SnacRemesher_ContextHandle );
	Journal_Printf( context->debug, "\tmesh extension handle: %u\n", SnacRemesher_MeshHandle );

	/* Register new entry points to the context (which manages them) */
	Context_AddEntryPoint(
		context,
		SnacRemesher_EntryPoint_New( SnacRemesher_EP_InterpolateNode, SnacRemesher_InterpolateNode_CastType ) );
	Context_AddEntryPoint(
		context,
		SnacRemesher_EntryPoint_New( SnacRemesher_EP_InterpolateElement, SnacRemesher_InterpolateElement_CastType ) );
	Context_AddEntryPoint(
		context,
		SnacRemesher_EntryPoint_New( SnacRemesher_EP_CopyElement, SnacRemesher_CopyElement_CastType ) );

	/* Add extensions to the entry points */
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Build ),
		SnacRemesher_Type,
		_SnacRemesher_Build,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
		SnacRemesher_Type,
		_SnacRemesher_InitialConditions,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_Sync ),
		SnacRemesher_Type,
		_SnacRemesher_Remesh,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, SnacRemesher_EP_InterpolateNode ),
		SnacRemesher_Type,
		_SnacRemesher_InterpolateNode,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, SnacRemesher_EP_InterpolateElement ),
		SnacRemesher_Type,
		_SnacRemesher_InterpolateElement,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, SnacRemesher_EP_CopyElement ),
		SnacRemesher_Type,
		_SnacRemesher_CopyElement,
		SnacRemesher_Type );
	EntryPoint_Append(
		Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ),
		SnacRemesher_Type,
		_SnacRemesher_DeleteExtensions,
		SnacRemesher_Type );

	/* Construct. */
	_SnacRemesher_ConstructExtensions( context, data );
}
void _Pouliquen_etal_Init(
		Pouliquen_etal*                                     self,
		FeVariable*                                        pressureField,
		FeVariable*                                        strainRateInvField,
		MaterialPointsSwarm*                               materialPointsSwarm,
		double                                             minimumYieldStress,
		double                                             frictionCoefficient,
		double                                             frictionCoefficientAfterSoftening,
		double                                             grainDiameter,
		double                                             Io,
		double                                             rho_s,
		double                                             mu_2,
		double                                             mu_s,
		double                                             mu_2_afterSoftening,
		double                                             mu_s_afterSoftening,
		double                                             maxViscosity,
		double                                             minViscosity )
{
	Pouliquen_etal_Particle*   particleExt;
	StandardParticle          materialPoint;
	
	self->particleExtHandle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, (Name)Pouliquen_etal_Type, sizeof(Pouliquen_etal_Particle) );
		
	/* Assign Pointers */
	self->pressureField       = pressureField;
	self->strainRateInvField    = strainRateInvField;

	self->frictionCoefficient = frictionCoefficient;
	self->minimumYieldStress  = minimumYieldStress;
	
	/* Strain softening of Friction - (linear weakening is assumed ) */
	/* needs a softening factor between +0 and 1 and a reference strain > 0 */
	self->frictionCoefficientAfterSoftening = frictionCoefficientAfterSoftening;

	self->grainDiameter = grainDiameter;
	self->Io = Io;
	self->rho_s = rho_s;
	self->mu_2 = mu_2;
	self->mu_s = mu_s;
	self->mu_2_afterSoftening = mu_2_afterSoftening;
	self->mu_s_afterSoftening = mu_s_afterSoftening;
	self->maxViscosity = maxViscosity;
	self->minViscosity = minViscosity;

	/* Update Drawing Parameters */
	EP_PrependClassHook( Context_GetEntryPoint( self->context, AbstractContext_EP_DumpClass ),
								_Pouliquen_etal_UpdateDrawParameters, self );
	
	particleExt = (Pouliquen_etal_Particle*)ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &materialPoint, self->particleExtHandle );
	
	/* Setup Variables for Visualisation */
	self->brightness = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"Pouliquen_etalBrightness", (ArithPointer) &particleExt->brightness - (ArithPointer) &materialPoint, Variable_DataType_Float  );
	
	self->opacity = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"Pouliquen_etalOpacity", (ArithPointer) &particleExt->opacity - (ArithPointer) &materialPoint, Variable_DataType_Float  );
	
	self->diameter = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"Pouliquen_etalDiameter", (ArithPointer) &particleExt->diameter - (ArithPointer) &materialPoint, Variable_DataType_Float  );

	/* The tensileFailure variable allows to check whether a materialPoint has failed in tensile mode or not */
	self->tensileFailure = Swarm_NewScalarVariable( materialPointsSwarm, (Name)"Pouliquen_etalTensileFailure", (ArithPointer) &particleExt->tensileFailure - (ArithPointer) &materialPoint, Variable_DataType_Char );

}