[cig-commits] r5033 - in long/3D/Gale/trunk/src/Underworld: .
plugins/EulerDeform
walter at geodynamics.org
walter at geodynamics.org
Sat Oct 14 11:40:07 PDT 2006
Author: walter
Date: 2006-10-14 11:40:06 -0700 (Sat, 14 Oct 2006)
New Revision: 5033
Modified:
long/3D/Gale/trunk/src/Underworld/
long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h
long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c
Log:
r665 at earth: boo | 2006-10-14 11:34:13 -0700
r659 at earth (orig r356): LukeHodkinson | 2006-10-14 10:34:03 -0700
Adding an option to allow EulerDeform to keep the
side walls stationary.
Property changes on: long/3D/Gale/trunk/src/Underworld
___________________________________________________________________
Name: svk:merge
- 9570c393-cf10-0410-b476-9a651db1e55a:/cig:664
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:355
+ 9570c393-cf10-0410-b476-9a651db1e55a:/cig:665
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:356
Modified: long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h 2006-10-14 18:40:03 UTC (rev 5032)
+++ long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h 2006-10-14 18:40:06 UTC (rev 5033)
@@ -41,6 +41,9 @@
Bool wrapTop;
Bool wrapBottom;
Bool wrapLeft;
+
+ Bool staticSides;
+ Coord* sideCoords;
};
#endif
Modified: long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c 2006-10-14 18:40:03 UTC (rev 5032)
+++ long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c 2006-10-14 18:40:06 UTC (rev 5033)
@@ -144,6 +144,8 @@
sys->mesh = Stg_ComponentFactory_ConstructByName( cf, meshName, Mesh, True, data );
sys->velField = Stg_ComponentFactory_ConstructByName( cf, velFieldName, FieldVariable, True, data );
+ sys->staticSides = Dictionary_GetBool_WithDefault( sysDict, "staticSides", False );
+
/* Read the list of variables to interpolate. */
varLst = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetElement( sysLst, sys_i ), "fields" );
if( varLst ) {
@@ -196,17 +198,32 @@
LiveComponentRegister_Add( uwCtx->CF->LCRegister, (Stg_Component*)crdAdvector );
}
}
+}
+
+void _Underworld_EulerDeform_Build( void* component, void* data ) {
+ UnderworldContext* uwCtx = (UnderworldContext*)data;
+ EulerDeform_Context* edCtx;
+
+ assert( component );
+ assert( uwCtx );
+
+ edCtx = ExtensionManager_Get( uwCtx->extensionMgr,
+ uwCtx,
+ EulerDeform_ContextHandle );
+
if( edCtx->nSystems > 0 ) {
/* Insert the sync step. */
TimeIntegrator_PrependSetupEP( uwCtx->timeIntegrator,
"EulerDeform_IntegrationSetup",
EulerDeform_IntegrationSetup,
"EulerDeform",
- edCtx->systems[0].velField );
+ edCtx );
}
- /* Insert the remesh step. */
+ /* Insert the remesh step. Note that this should look for the surface process
+ plugin's time integrator finish routine and ensure we enter the remesh step
+ after that one but before the particle updating routines. */
TimeIntegrator_PrependFinishEP( uwCtx->timeIntegrator,
"EulerDeform_Execute",
EulerDeform_Remesh,
@@ -215,14 +232,6 @@
}
-void _Underworld_EulerDeform_Build( void* component, void* data ) {
- UnderworldContext* uwCtx = (UnderworldContext*)data;
-
- assert( component );
- assert( uwCtx );
-}
-
-
void _Underworld_EulerDeform_Destroy( void* component, void* data ) {
UnderworldContext* uwCtx = (UnderworldContext*)data;
@@ -234,11 +243,51 @@
}
-void EulerDeform_IntegrationSetup( void* _timeIntegrator, void* _velField ) {
- TimeIntegrator* timeIntegrator = (TimeIntegrator*)_timeIntegrator;
- FeVariable* velField = (FeVariable*)_velField;
+void EulerDeform_IntegrationSetup( void* _timeIntegrator, void* context ) {
+ TimeIntegrator* timeIntegrator = (TimeIntegrator*)_timeIntegrator;
+ EulerDeform_Context* edCtx = (EulerDeform_Context*)context;
+ unsigned sys_i;
- FeVariable_SyncShadowValues( velField );
+ FeVariable_SyncShadowValues( edCtx->systems[0].velField );
+
+ /*
+ ** We'll need to store side values that we require to be static here, for later
+ ** return to the mesh.
+ */
+
+ for( sys_i = 0; sys_i < edCtx->nSystems; sys_i++ ) {
+ EulerDeform_System* sys = edCtx->systems + sys_i;
+
+ if( sys->staticSides ) {
+ IndexSet *sideSet, *tmpSet;
+ unsigned nInds, *inds;
+ unsigned ind_i;
+
+ /* Collect indices of all sides except top surface. */
+ sideSet = RegularMeshUtils_CreateGlobalLeftSet( sys->mesh );
+ tmpSet = RegularMeshUtils_CreateGlobalRightSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ tmpSet = RegularMeshUtils_CreateGlobalBottomSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ if( sys->mesh->topo->nDims == 3 ) {
+ tmpSet = RegularMeshUtils_CreateGlobalFrontSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ tmpSet = RegularMeshUtils_CreateGlobalBackSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ }
+ IndexSet_GetMembers( sideSet, &nInds, &inds );
+ FreeObject( sideSet );
+
+ /* Copy coords to temporary array. */
+ sys->sideCoords = Memory_Alloc_Array_Unnamed( Coord, nInds );
+ for( ind_i = 0; ind_i < nInds; ind_i++ )
+ memcpy( sys->sideCoords + ind_i, sys->mesh->nodeCoord + inds[ind_i], sizeof(Coord) );
+ }
+ }
}
@@ -279,6 +328,45 @@
Coord* newCrds;
unsigned var_i;
+ /* Revert side coordinates if required. */
+ if( sys->staticSides ) {
+ IndexSet *sideSet, *tmpSet;
+ unsigned nInds, *inds;
+ unsigned ind_i;
+
+ /* Collect indices of all sides except top surface. */
+ sideSet = RegularMeshUtils_CreateGlobalLeftSet( sys->mesh );
+ tmpSet = RegularMeshUtils_CreateGlobalRightSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ tmpSet = RegularMeshUtils_CreateGlobalBottomSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ if( sys->mesh->topo->nDims == 3 ) {
+ tmpSet = RegularMeshUtils_CreateGlobalFrontSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ tmpSet = RegularMeshUtils_CreateGlobalBackSet( sys->mesh );
+ IndexSet_Merge_AND( sideSet, tmpSet );
+ FreeObject( tmpSet );
+ }
+ IndexSet_GetMembers( sideSet, &nInds, &inds );
+ FreeObject( sideSet );
+
+ /* Copy back coords. */
+ for( ind_i = 0; ind_i < nInds; ind_i++ )
+ memcpy( sys->mesh->nodeCoord + inds[ind_i], sys->sideCoords + ind_i, sizeof(Coord) );
+ FreeArray( sys->sideCoords );
+ }
+
+ /* If we're in 2D we need to clear out the third coordinate. */
+ if( sys->mesh->nSpaceDims == 2 ) {
+ unsigned n_i;
+
+ for( n_i = 0; n_i < sys->mesh->nodeDomainCount; n_i++ )
+ sys->mesh->nodeCoord[n_i][2] = 0.0;
+ }
+
/* Every system should synchronise the mesh coordinates. */
Mesh_Sync( sys->mesh );
More information about the cig-commits
mailing list