[cig-commits] r4053 - in long/3D/Gale/trunk/src/StgFEM: . plugins/StandardConditionFunctions

walter at geodynamics.org walter at geodynamics.org
Thu Jul 20 20:06:37 PDT 2006


Author: walter
Date: 2006-07-20 20:06:36 -0700 (Thu, 20 Jul 2006)
New Revision: 4053

Modified:
   long/3D/Gale/trunk/src/StgFEM/
   long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c
Log:
 r701 at earth:  boo | 2006-07-20 20:03:00 -0700
  r694 at earth (orig r612):  LukeHodkinson | 2006-07-19 19:58:58 -0700
  Modified the step function condition funciton to be a
  bit more flexible.
  
 



Property changes on: long/3D/Gale/trunk/src/StgFEM
___________________________________________________________________
Name: svk:merge
   - 38867592-cf10-0410-9e16-a142ea72ac34:/cig:700
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:611
   + 38867592-cf10-0410-9e16-a142ea72ac34:/cig:701
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:612

Modified: long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c	2006-07-21 03:06:02 UTC (rev 4052)
+++ long/3D/Gale/trunk/src/StgFEM/plugins/StandardConditionFunctions/StandardConditionFunctions.c	2006-07-21 03:06:36 UTC (rev 4053)
@@ -104,14 +104,14 @@
 
 void* _StG_FEM_StandardConditionFunctions_DefaultNew( Name name ) {
 	return Codelet_New(
-			StG_FEM_StandardConditionFunctions_Type,
-			_StG_FEM_StandardConditionFunctions_DefaultNew,
-			_StG_FEM_StandardConditionFunctions_Construct,
-			_Codelet_Build,
-			_Codelet_Initialise,
-			_Codelet_Execute,
-			_Codelet_Destroy,
-			name );
+		StG_FEM_StandardConditionFunctions_Type,
+		_StG_FEM_StandardConditionFunctions_DefaultNew,
+		_StG_FEM_StandardConditionFunctions_Construct,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
 }
 
 Index StG_FEM_StandardConditionFunctions_Register( PluginsManager* pluginsManager ) {
@@ -181,7 +181,7 @@
 	StGermain_VectorSubtraction( vector, coord, centre, 2 );
 
 	/*if (context->currentTime > 1.33e-6)
-		omega=0.0;*/
+	  omega=0.0;*/
 	
 	if ((vector[ I_AXIS ]*vector[ I_AXIS ]+vector[ J_AXIS ]*vector[ J_AXIS ])<=size*size)
 		*result = -omega * vector[ J_AXIS ];
@@ -219,7 +219,7 @@
 	StGermain_VectorSubtraction( vector, coord, centre, 2 );
 
 	/*if (context->currentTime > 1.33e-6)
-		omega=0.0;*/
+	  omega=0.0;*/
 	
 	if ((vector[ I_AXIS ]*vector[ I_AXIS ]+vector[ J_AXIS ]*vector[ J_AXIS ])<=size*size)
 		*result =  omega * vector[ I_AXIS ];
@@ -291,7 +291,7 @@
 	
 	margin = boxEL->elementLengthEachDim[I_AXIS] * 1.1;
 	if ( (mesh->nodeCoord[node_lI][I_AXIS] < (geometry->max[I_AXIS] - margin )) && 
-			(mesh->nodeCoord[node_lI][I_AXIS] > (geometry->min[I_AXIS] + margin ))) {
+	     (mesh->nodeCoord[node_lI][I_AXIS] > (geometry->min[I_AXIS] + margin ))) {
 		(*velResult) = 1;
 	}
 	else {
@@ -485,8 +485,8 @@
 
 	/* Note: ok to use the 1.0 below since we've already scaled the coord to somewhere between 0 to 1 */
 	*result = topLayerBC + scaleFactor * ( 1.0 - relScaledCoord[ J_AXIS ] )
-			+ perturbationAmplitude * ( cos( horizontalWaveNumber * M_PI * coord[ I_AXIS ] )
-							* sin( verticalWaveNumber * M_PI * coord[ J_AXIS ] ) );
+		+ perturbationAmplitude * ( cos( horizontalWaveNumber * M_PI * coord[ I_AXIS ] )
+					    * sin( verticalWaveNumber * M_PI * coord[ J_AXIS ] ) );
 }
 
 void StG_FEM_StandardConditionFunctions_Trigonometry( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) {
@@ -589,7 +589,7 @@
 
 
 /* Initial Condition derived from Boundary Layer theory -
-taken from P. E. van Keken, S. D. King, U. R. Schmeling, U. R. Christensen, D. Neumeister, and M.-P. Doin. A comparison of methods for the modeling of thermochemical convection. Journal of Geophysical Research, 102(B10):22477-22496, october 1997. */
+   taken from P. E. van Keken, S. D. King, U. R. Schmeling, U. R. Christensen, D. Neumeister, and M.-P. Doin. A comparison of methods for the modeling of thermochemical convection. Journal of Geophysical Research, 102(B10):22477-22496, october 1997. */
 void StG_FEM_StandardConditionFunctions_AnalyticalTemperatureIC( Node_LocalIndex node_lI, Variable_Index var_I, void* _context, void* _result ) {
 	DiscretisationContext*	context            = (DiscretisationContext*)_context;
 	FeVariable*             feVariable         = NULL;
@@ -672,22 +672,42 @@
         double*                 coord;
 	double                  offset;
 	double                  value;
+	unsigned		dim;
+	Bool			less;
+	double			grad;
+	Bool			useGrad;
 
 	feVariable = (FeVariable*)FieldVariable_Register_GetByName( context->fieldVariable_Register, "VelocityField" );
 	mesh       = feVariable->feMesh;
 	coord      = Mesh_CoordAt( mesh, node_lI );
 
-	offset  = Dictionary_GetDouble_WithDefault( dictionary, "StepFunctionOffset", 0.0 );
-	value       = Dictionary_GetDouble_WithDefault( dictionary, "StepFunctionValue", 0.0 );
+	offset = Dictionary_GetDouble_WithDefault( dictionary, "StepFunctionOffset", 0.0 );
+	value = Dictionary_GetDouble_WithDefault( dictionary, "StepFunctionValue", 0.0 );
+	dim = Dictionary_GetUnsignedInt_WithDefault( dictionary, "StepFunctionDim", 0 );
+	less = Dictionary_GetBool_WithDefault( dictionary, "StepFunctionLessThan", True );
+	grad = Dictionary_GetDouble_WithDefault( dictionary, "StepFunctionGradient", 0.0 );
+	useGrad = Dictionary_GetBool_WithDefault( dictionary, "StepFunctionUseGradient", False );
 
-        if(coord[0] < offset)
-          {
-            *result=0;
-          }
-        else
-          {
-            *result=value;
-          }
+	if( less ) {
+		if( coord[dim] < offset ) {
+			if( useGrad )
+				*result = (offset - coord[dim])*grad;
+			else
+				*result = value;
+		}
+		else
+			*result = 0;
+	}
+	else {
+		if( coord[dim] > offset ) {
+			if( useGrad )
+				*result = (coord[dim] - offset)*grad;
+			else
+				*result = value;
+		}
+		else
+			*result = 0;
+	}
 
 /*         if(coord[0] < 5.0) */
 /*           { */
@@ -702,5 +722,3 @@
 /*             *result=value; */
 /*           } */
 }
-
-



More information about the cig-commits mailing list