[cig-commits] r13667 - in long/3D/SNAC/trunk/Snac/plugins: . winkler

echoi at geodynamics.org echoi at geodynamics.org
Fri Dec 12 12:29:28 PST 2008


Author: echoi
Date: 2008-12-12 12:29:28 -0800 (Fri, 12 Dec 2008)
New Revision: 13667

Added:
   long/3D/SNAC/trunk/Snac/plugins/winkler/
   long/3D/SNAC/trunk/Snac/plugins/winkler/Force.c
   long/3D/SNAC/trunk/Snac/plugins/winkler/Force.h
   long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.c
   long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.h
   long/3D/SNAC/trunk/Snac/plugins/winkler/Make.mm
   long/3D/SNAC/trunk/Snac/plugins/winkler/Makefile.def
   long/3D/SNAC/trunk/Snac/plugins/winkler/Output.c
   long/3D/SNAC/trunk/Snac/plugins/winkler/Output.h
   long/3D/SNAC/trunk/Snac/plugins/winkler/Register.c
   long/3D/SNAC/trunk/Snac/plugins/winkler/Register.h
   long/3D/SNAC/trunk/Snac/plugins/winkler/make.log
   long/3D/SNAC/trunk/Snac/plugins/winkler/make.warning
   long/3D/SNAC/trunk/Snac/plugins/winkler/makefile
   long/3D/SNAC/trunk/Snac/plugins/winkler/types.h
Modified:
   long/3D/SNAC/trunk/Snac/plugins/Makefile.def
Log:
1. winkler_G3_* has been renamed to winkler. The official plugin name is "SnacWinklerForce".
2. Makefile.def has been modified accordingly.



Modified: long/3D/SNAC/trunk/Snac/plugins/Makefile.def
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/Makefile.def	2008-12-12 20:27:26 UTC (rev 13666)
+++ long/3D/SNAC/trunk/Snac/plugins/Makefile.def	2008-12-12 20:29:28 UTC (rev 13667)
@@ -29,4 +29,4 @@
 ##
 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-def_sub = temperature elastic plastic maxwell maxwelldruckerprager maxwellmohrcoulomb creepmohrcoulomb viscoplastic spherical exchanger remesher hydroStaticIC cylindrical cylinder_quadrant customCartesianMesh plSeeds vpSeeds winkler_G3_case3 restarter heterogeneities
+def_sub = temperature elastic plastic maxwell maxwelldruckerprager maxwellmohrcoulomb creepmohrcoulomb viscoplastic spherical exchanger remesher hydroStaticIC cylindrical cylinder_quadrant customCartesianMesh plSeeds vpSeeds winkler restarter heterogeneities

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Force.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Force.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Force.c	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,764 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: VariableConditions.c 1410 2004-05-17 00:49:44Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "types.h"
+#include "Force.h"
+#include "Register.h"
+#include "InitialConditions.h"
+#include "Snac/Temperature/Temperature.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+void _SnacWinklerForce_Apply_North( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+void _SnacWinklerForce_Apply_South( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+void _SnacWinklerForce_Apply_East( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+void _SnacWinklerForce_Apply_West( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+void _SnacWinklerForce_Apply_Spherical_North( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+void _SnacWinklerForce_Apply_Spherical_South( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance );
+double getRadius( Coord coord );
+
+/*==========================================================================================*/
+/*  Bottom support force ( a.k.a., Archimed's force, or Winkler foundation ) term is added  */
+/*==========================================================================================*/
+void _SnacWinklerForce_Apply(
+		void*				_context,
+		Node_LocalIndex			node_lI,
+		double				speedOfSound,
+		Mass*				mass,
+		Mass*				inertialMass,
+		Force*				force,
+		Force*				balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double                          normal[3];
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+    double                  Fy;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+	Coord*				coord = Snac_NodeCoord_P( context, node_lI );
+	SnacTemperature_Node* temperatureNodeExt = ExtensionManager_Get( context->mesh->nodeExtensionMgr, node, SnacTemperature_NodeHandle );
+	double          nodeT =temperatureNodeExt->temperature;
+
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		if(ijk[1]==0) {
+
+			nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+			for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+				Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+				if( element_lI < context->mesh->elementDomainCount ) {
+					Snac_Element*		element = Snac_Element_At( context, element_lI );
+					Material_Index          material_I = element->material_I;
+					Snac_Material*          material = &context->materialProperty[material_I];
+					Density                 phsDensity = material->phsDensity; /* node->density */
+					Density                 mantleDensity = 3300.0f;
+					double          alpha = material->alpha;
+					double          beta = material->beta;
+					double          drosub = 0.0f;
+
+					double p_est = context->pisos + 0.5f * ( phsDensity + drosub ) * context->gravity * ( (*coord)[1] - element->rzbo );
+					double rosubg = context->gravity * ( phsDensity + drosub ) * ( 1.0 - alpha * (nodeT-material->reftemp) + beta * p_est );
+					double press_norm = 0.0f;
+					double area=0.0f, dhE=0.0f;
+					Normal* normal1;
+					Normal* normal2;
+					Normal* normal3;
+					Normal* normal4;
+
+					Snac_Element_Tetrahedra*		tetra;
+					Snac_Element_Tetrahedra_Surface*	surface;
+
+					dhE = factor4 * ( Snac_Element_NodeCoord( context, element_lI, 0 )[1] +
+									  Snac_Element_NodeCoord( context, element_lI, 1 )[1] +
+									  Snac_Element_NodeCoord( context, element_lI, 4 )[1] +
+									  Snac_Element_NodeCoord( context, element_lI, 5 )[1] );
+
+					tetra = &element->tetra[1];
+					surface = &tetra->surface[0];
+					normal1 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[2];
+					surface = &tetra->surface[1];
+					normal2 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[6];
+					surface = &tetra->surface[2];
+					normal3 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[8];
+					surface = &tetra->surface[2];
+					normal4 = &surface->normal;
+					area += surface->area;
+
+					normal[0] = factor4 * ( (*normal1)[0] + (*normal2)[0] + (*normal3)[0] + (*normal4)[0] );
+					normal[1] = -1.0f * factor4 * ( (*normal1)[1] + (*normal2)[1] + (*normal3)[1] + (*normal4)[1] );
+					normal[2] = factor4 * ( (*normal1)[2] + (*normal2)[2] + (*normal3)[2] + (*normal4)[2] );
+					area *= 0.5f;
+
+					/* compute spring force due to the change in displacement */
+					/* if dh > 0, F < 0; dh < 0, F > 0. */
+					/* So, bottom surface goes up, Force in -y direction; down, F acts in +y direction */
+					/* Adjust all the signs to be consistent with this principle. */
+					/* Let's make isostatic pressure positive and normals to point to the direction of action, +y. */
+					/* dP should then have the same sign with dh. */
+					press_norm = context->pisos + rosubg * ( element->rzbo - dhE );
+					(*force)[0] += factor4 * ( press_norm * area * normal[0] );
+					(*force)[1] += factor4 * ( press_norm * area * normal[1] );
+					(*force)[2] += factor4 * ( press_norm * area * normal[2] );
+				}
+			}
+			if( context->restartStep == 0 ) {
+				if( context->timeStep == 1 ) {
+					Fy = (*force)[1];
+					if(Fy != 0.0)
+						node->residualFr = Fy;
+				}
+			}
+			(*force)[1] -= node->residualFr;
+		} /* end if if(ijk[1] == ) */
+	}
+/* 	_SnacWinklerForce_Apply_North( context, node_lI, force, balance ); */
+/* 	_SnacWinklerForce_Apply_South( context, node_lI, force, balance ); */
+/* 	_SnacWinklerForce_Apply_East( context, node_lI, force, balance ); */
+/* 	_SnacWinklerForce_Apply_West( context, node_lI, force, balance ); */
+}
+
+void _SnacWinklerForce_Apply_South( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				dhE, area;
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+    double                  Fz;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		/* For Tibet problem */
+        if(ijk[2]==decomp->nodeGlobal3DCounts[2]-1) {
+            double                          r1,r2,r3,r4;
+            double                          normal[3],normal1[3],normal2[3],normal3[3],normal4[3];
+            nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+            for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+                Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+                if( element_lI < context->mesh->elementDomainCount ) {
+                    if(nodeElement_I == 0 || nodeElement_I == 1 || nodeElement_I == 2 || nodeElement_I == 3) {
+                        r1 = Snac_Element_NodeCoord( context, element_lI, 4 )[1];
+                        r2 = Snac_Element_NodeCoord( context, element_lI, 5 )[1];
+                        r3 = Snac_Element_NodeCoord( context, element_lI, 6 )[1];
+                        r4 = Snac_Element_NodeCoord( context, element_lI, 7 )[1];
+
+                        dhE = factor4 * ( r1 + r2 + r3 + r4 );
+                        area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 7 ) ) +
+                            Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 6 ) );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  &normal1 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  &normal2 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  &normal3 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  &normal4 );
+                        normal[0] = factor4 * ( normal1[0] + normal2[0] + normal3[0] + normal4[0]);
+                        normal[1] = factor4 * ( normal1[1] + normal2[1] + normal3[1] + normal4[1]);
+                        normal[2] = factor4 * ( normal1[2] + normal2[2] + normal3[2] + normal4[2] );
+                        (*force)[0] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[0] );
+                        (*force)[1] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[1] );
+                        (*force)[2] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[2] );
+                    }
+                }
+            }
+            /*ccccc*/
+            if(context->timeStep==1) {
+                Fz = (*force)[2];
+                if(Fz != 0.0)
+                    node->residualFt = Fz;
+            }
+            (*force)[2] -= node->residualFt;
+            /*ccccc*/
+        } /* end of if( ijk[0] == nox ) */
+	}
+}
+
+void _SnacWinklerForce_Apply_North( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				dhE, area;
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+    double                  Fz;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		/* For Tibet problem */
+        if(ijk[2]==0) {
+            double                          r1,r2,r3,r4;
+            double                          normal[3],normal1[3],normal2[3],normal3[3],normal4[3];
+            nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+            for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+                Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+                if( element_lI < context->mesh->elementDomainCount ) {
+                    if(nodeElement_I == 4 || nodeElement_I == 5 || nodeElement_I == 6 || nodeElement_I == 7) {
+                        r1 = Snac_Element_NodeCoord( context, element_lI, 0 )[1];
+                        r2 = Snac_Element_NodeCoord( context, element_lI, 1 )[1];
+                        r3 = Snac_Element_NodeCoord( context, element_lI, 2 )[1];
+                        r4 = Snac_Element_NodeCoord( context, element_lI, 3 )[1];
+
+                        dhE = factor4 * ( r1 + r2 + r3 + r4 );
+                        area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 2 ) ) +
+                            Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 1 ) );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  &normal1 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  &normal2 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  &normal3 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  &normal4 );
+                        normal[0] = factor4 * ( normal1[0] + normal2[0] + normal3[0] + normal4[0]);
+                        normal[1] = factor4 * ( normal1[1] + normal2[1] + normal3[1] + normal4[1]);
+                        normal[2] = factor4 * ( normal1[2] + normal2[2] + normal3[2] + normal4[2] );
+                        (*force)[0] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[0] );
+                        (*force)[1] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[1] );
+                        (*force)[2] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[2] );
+                    }
+                }
+            }
+            /*ccccc*/
+            if(context->timeStep==1) {
+                Fz = (*force)[2];
+                if(Fz != 0.0)
+                    node->residualFt = Fz;
+            }
+            (*force)[2] -= node->residualFt;
+            /*ccccc*/
+        } /* end of if( ijk[0] == nox ) */
+	}
+}
+
+void _SnacWinklerForce_Apply_East( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				dhE, area;
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+    double                  Fz;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		/* For Tibet problem */
+        if(ijk[0]==decomp->nodeGlobal3DCounts[0]-1) {
+            double                          r1,r2,r3,r4;
+            double                          normal[3],normal1[3],normal2[3],normal3[3],normal4[3];
+            nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+            for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+                Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+                if( element_lI < context->mesh->elementDomainCount ) {
+                    if(nodeElement_I == 0 || nodeElement_I == 3 || nodeElement_I == 4 || nodeElement_I == 7) {
+                        r1 = Snac_Element_NodeCoord( context, element_lI, 1 )[1];
+                        r2 = Snac_Element_NodeCoord( context, element_lI, 2 )[1];
+                        r3 = Snac_Element_NodeCoord( context, element_lI, 5 )[1];
+                        r4 = Snac_Element_NodeCoord( context, element_lI, 6 )[1];
+
+                        dhE = factor4 * ( r1 + r2 + r3 + r4 );
+                        area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 6 ) ) +
+                            Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 5 ) );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  &normal1 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  &normal2 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 1 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  &normal3 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 2 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 6 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 5 ),
+                                                  &normal4 );
+                        normal[0] = factor4 * ( normal1[0] + normal2[0] + normal3[0] + normal4[0]);
+                        normal[1] = factor4 * ( normal1[1] + normal2[1] + normal3[1] + normal4[1]);
+                        normal[2] = factor4 * ( normal1[2] + normal2[2] + normal3[2] + normal4[2] );
+                        (*force)[0] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[0] );
+                        (*force)[1] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[1] );
+                        (*force)[2] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[2] );
+                    }
+                }
+            }
+            /*ccccc*/
+            if(context->timeStep==1) {
+                Fz = (*force)[0];
+                if(Fz != 0.0)
+                    node->residualFt = Fz;
+            }
+            (*force)[0] -= node->residualFt;
+            /*ccccc*/
+        } /* end of if( ijk[0] == nox ) */
+	}
+}
+
+void _SnacWinklerForce_Apply_West( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				dhE, area;
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+    double                  Fz;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		/* For Tibet problem */
+        if(ijk[0]==0) {
+            double                          r1,r2,r3,r4;
+            double                          normal[3],normal1[3],normal2[3],normal3[3],normal4[3];
+            nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+            for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+                Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+                if( element_lI < context->mesh->elementDomainCount ) {
+                    if(nodeElement_I == 1 || nodeElement_I == 2 || nodeElement_I == 5 || nodeElement_I == 6) {
+                        r1 = Snac_Element_NodeCoord( context, element_lI, 0 )[1];
+                        r2 = Snac_Element_NodeCoord( context, element_lI, 3 )[1];
+                        r3 = Snac_Element_NodeCoord( context, element_lI, 4 )[1];
+                        r4 = Snac_Element_NodeCoord( context, element_lI, 7 )[1];
+
+                        dhE = factor4 * ( r1 + r2 + r3 + r4 );
+                        area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                       Snac_Element_NodeCoord( context, element_lI, 7 ) ) +
+                            Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                    Snac_Element_NodeCoord( context, element_lI, 4 ) );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  &normal1 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  &normal2 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  &normal3 );
+                        Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 3 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 4 ),
+                                                  Snac_Element_NodeCoord( context, element_lI, 7 ),
+                                                  &normal4 );
+                        normal[0] = factor4 * ( normal1[0] + normal2[0] + normal3[0] + normal4[0]);
+                        normal[1] = factor4 * ( normal1[1] + normal2[1] + normal3[1] + normal4[1]);
+                        normal[2] = factor4 * ( normal1[2] + normal2[2] + normal3[2] + normal4[2] );
+                        (*force)[0] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[0] );
+                        (*force)[1] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[1] );
+                        (*force)[2] -= factor4 * ( context->density * context->gravity * (0.0-dhE) * area * normal[2] );
+                    }
+                }
+            }
+            /*ccccc*/
+            if(context->timeStep==1) {
+                Fz = (*force)[0];
+                if(Fz != 0.0)
+                    node->residualFt = Fz;
+            }
+            (*force)[0] -= node->residualFt;
+            /*ccccc*/
+        } /* end of if( ijk[0] == nox ) */
+	}
+}
+
+void _SnacWinklerForce_Apply_Spherical(
+		void*				_context,
+		Node_LocalIndex			node_lI,
+		double				speedOfSound,
+		Mass*				mass,
+		Mass*				inertialMass,
+		Force*				force,
+		Force*				balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor4 = 1.0f / 4.0f;
+	double				radius,theta,phi;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+	Coord*				coord = Snac_NodeCoord_P( context, node_lI );
+	SnacTemperature_Node* temperatureNodeExt = ExtensionManager_Get( context->mesh->nodeExtensionMgr, node, SnacTemperature_NodeHandle );
+	double          nodeT =temperatureNodeExt->temperature;
+	double          Fr;
+	float           sphF[3];
+	HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+	Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+	IJK			ijk;
+
+	RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+
+	radius = sqrt( (*coord)[0]*(*coord)[0] + (*coord)[1]*(*coord)[1] + (*coord)[2]*(*coord)[2] );
+	theta = acos((*coord)[2]/radius);
+	phi = atan2((*coord)[1],(*coord)[0]);
+	/* loop over all the elements surrounding node_dI */
+	if( context->gravity > 0.0 ) {
+		if(ijk[1]==0) {
+			nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+			for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+				Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+				if( element_lI < context->mesh->elementDomainCount ) {
+					Snac_Element*		element = Snac_Element_At( context, element_lI );
+					Material_Index          material_I = element->material_I;
+					Snac_Material*          material = &context->materialProperty[material_I];
+					Density                 phsDensity = material->phsDensity; /* node->density */
+					Density                 mantleDensity = 3300.0f;
+					double          alpha = material->alpha;
+					double          beta = material->beta;
+					double          drosub = 0.0f;
+
+					double p_est = context->pisos + 0.5f * ( phsDensity + drosub ) * context->gravity * ( radius - Spherical_RMin );
+					double rosubg = context->gravity * ( phsDensity + drosub ) * ( 1.0 - alpha * (nodeT-material->reftemp) + beta * p_est );
+					double press_norm = 0.0f;
+					float normal[3];
+					Normal* normal1;
+					Normal* normal2;
+					Normal* normal3;
+					Normal* normal4;
+					double r1,r2,r3,r4;
+					double dhE, area=0.0f, mag_normal;
+					Snac_Element_Tetrahedra*		tetra;
+					Snac_Element_Tetrahedra_Surface*	surface;
+
+					r1 = getRadius( Snac_Element_NodeCoord( context, element_lI, 0 ) );
+					r2 = getRadius( Snac_Element_NodeCoord( context, element_lI, 1 ) );
+					r3 = getRadius( Snac_Element_NodeCoord( context, element_lI, 5 ) );
+					r4 = getRadius( Snac_Element_NodeCoord( context, element_lI, 4 ) );
+					dhE = 0.25f * ( r1 + r2 + r3 + r4 );
+
+					tetra = &element->tetra[1];
+					surface = &tetra->surface[0];
+					normal1 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[2];
+					surface = &tetra->surface[1];
+					normal2 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[6];
+					surface = &tetra->surface[2];
+					normal3 = &surface->normal;
+					area += surface->area;
+
+					tetra = &element->tetra[8];
+					surface = &tetra->surface[2];
+					normal4 = &surface->normal;
+					area += surface->area;
+
+					normal[0] = factor4 * ( (*normal1)[0] + (*normal2)[0] + (*normal3)[0] + (*normal4)[0] );
+					normal[1] = -1.0f * factor4 * ( (*normal1)[1] + (*normal2)[1] + (*normal3)[1] + (*normal4)[1] );
+					normal[2] = factor4 * ( (*normal1)[2] + (*normal2)[2] + (*normal3)[2] + (*normal4)[2] );
+					mag_normal = sqrt( normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2] );
+					area *= 0.5f;
+
+					press_norm = context->pisos + rosubg * ( Spherical_RMin - dhE );
+					(*force)[0] += factor4 * ( press_norm * area * normal[0] );
+					(*force)[1] += factor4 * ( press_norm * area * normal[1] );
+					(*force)[2] += factor4 * ( press_norm * area * normal[2] );
+				}
+			}
+		}
+	}
+	if( context->restartStep == 0 ) {
+		if( context->timeStep == 1 ) {
+			Fr = (*force)[0]*sin(theta)*cos(phi) + (*force)[1]*sin(theta)*sin(phi) + (*force)[2]*cos(theta);
+			node->residualFr = Fr;
+		}
+	}
+
+	sphF[0] = (*force)[0]*sin(theta)*cos(phi) + (*force)[1]*sin(theta)*sin(phi) + (*force)[2]*cos(theta);
+	sphF[1] = (*force)[0]*cos(theta)*cos(phi) + (*force)[1]*cos(theta)*sin(phi) - (*force)[2]*sin(theta);
+	sphF[2] = -1.0f * (*force)[0]*sin(phi) + (*force)[1]*cos(phi);
+	sphF[0] -= node->residualFr;
+	(*force)[0] = sphF[0]*sin(theta)*cos(phi) + sphF[1]*cos(theta)*cos(phi) - sphF[2]*sin(phi);
+	(*force)[1] = sphF[0]*sin(theta)*sin(phi) + sphF[1]*cos(theta)*sin(phi) + sphF[2]*cos(phi);
+	(*force)[2] = sphF[0]*cos(theta) - sphF[1]*sin(theta);
+
+	_SnacWinklerForce_Apply_Spherical_North( context, node_lI, force, balance );
+	_SnacWinklerForce_Apply_Spherical_South( context, node_lI, force, balance );
+}
+
+void _SnacWinklerForce_Apply_Spherical_North( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				area;
+	double                          normal[3];
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor2 = 1.0f / 2.0f;
+	double				radius,theta,phi;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+	Coord*				coord = Snac_NodeCoord_P( context, node_lI );
+	double              Ft, sphF[3];
+
+	radius = sqrt( (*coord)[0]*(*coord)[0] + (*coord)[1]*(*coord)[1] + (*coord)[2]*(*coord)[2] );
+	theta = acos((*coord)[2]/radius);
+	phi = atan2((*coord)[1],(*coord)[0]);
+
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		if( ijk[2] == 0 ) {
+			nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+			for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+				Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+				if( element_lI < context->mesh->elementDomainCount ) {
+					Snac_Element*		element = Snac_Element_At( context, element_lI );
+
+					if(nodeElement_I == 4) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 1 ),
+									       Snac_Element_NodeCoord( context, element_lI, 2 ),
+									       Snac_Element_NodeCoord( context, element_lI, 3 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 1 ),
+									  Snac_Element_NodeCoord( context, element_lI, 2 ),
+									  Snac_Element_NodeCoord( context, element_lI, 3 ),
+									  &normal );
+					}
+					if(nodeElement_I == 5) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+													   Snac_Element_NodeCoord( context, element_lI, 2 ),
+													   Snac_Element_NodeCoord( context, element_lI, 3 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+									  Snac_Element_NodeCoord( context, element_lI, 2 ),
+									  Snac_Element_NodeCoord( context, element_lI, 3 ),
+									  &normal );
+					}
+					if(nodeElement_I == 6) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+									       Snac_Element_NodeCoord( context, element_lI, 1 ),
+									       Snac_Element_NodeCoord( context, element_lI, 3 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+									  Snac_Element_NodeCoord( context, element_lI, 1 ),
+									  Snac_Element_NodeCoord( context, element_lI, 3 ),
+									  &normal );
+					}
+					if(nodeElement_I == 7) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 0 ),
+									       Snac_Element_NodeCoord( context, element_lI, 1 ),
+									       Snac_Element_NodeCoord( context, element_lI, 2 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 0 ),
+									  Snac_Element_NodeCoord( context, element_lI, 1 ),
+									  Snac_Element_NodeCoord( context, element_lI, 2 ),
+									  &normal );
+					}
+					(*force)[0] -= factor2 * ( element->hydroPressure * area * normal[0] );
+					(*force)[1] -= factor2 * ( element->hydroPressure * area * normal[1] );
+					(*force)[2] -= factor2 * ( element->hydroPressure * area * normal[2] );
+				}
+			}
+            if(context->timeStep==1) {
+                Ft = (*force)[0]*cos(theta)*cos(phi) + (*force)[1]*cos(theta)*sin(phi) - (*force)[2]*sin(theta);
+                if(Ft != 0.0)
+                    node->residualFt = Ft;
+            }
+			sphF[0] = (*force)[0]*sin(theta)*cos(phi) + (*force)[1]*sin(theta)*sin(phi) + (*force)[2]*cos(theta);
+            sphF[1] = (*force)[0]*cos(theta)*cos(phi) + (*force)[1]*cos(theta)*sin(phi) - (*force)[2]*sin(theta);
+			sphF[2] = -1.0f * (*force)[0]*sin(phi) + (*force)[1]*cos(phi);
+/* 			sphF[1] -= node->residualFt; */
+			sphF[1] = 0.0f;
+            (*force)[0] = sphF[0]*sin(theta)*cos(phi) + sphF[1]*cos(theta)*cos(phi) - sphF[2]*sin(phi);
+            (*force)[1] = sphF[0]*sin(theta)*sin(phi) + sphF[1]*cos(theta)*sin(phi) + sphF[2]*cos(phi);
+            (*force)[2] = sphF[0]*cos(theta) - sphF[1]*sin(theta);
+		}
+	}
+}
+
+void _SnacWinklerForce_Apply_Spherical_South( void* _context, Node_LocalIndex	node_lI, Force* force, Force* balance )
+{
+	Snac_Context*			context = (Snac_Context*)_context;
+	MeshLayout*			meshLayout = (MeshLayout*)context->meshLayout;
+	double				area;
+	double                          normal[3];
+	Node_ElementIndex		nodeElement_I, nodeElementCount;
+	const double			factor2 = 1.0f / 2.0f;
+	double				radius,theta,phi;
+	Snac_Node*			node = Snac_Node_At( context, node_lI );
+	Coord*				coord = Snac_NodeCoord_P( context, node_lI );
+	double              Ft, sphF[3];
+
+	radius = sqrt( (*coord)[0]*(*coord)[0] + (*coord)[1]*(*coord)[1] + (*coord)[2]*(*coord)[2] );
+	theta = acos((*coord)[2]/radius);
+	phi = atan2((*coord)[1],(*coord)[0]);
+
+	if( context->gravity > 0.0 ) {
+		HexaMD*			decomp = (HexaMD*)meshLayout->decomp;
+		Node_GlobalIndex	node_gI = context->mesh->nodeL2G[node_lI];
+		IJK			ijk;
+
+		RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+		if( ijk[2] == decomp->nodeGlobal3DCounts[2]-1 ) {
+			nodeElementCount = context->mesh->nodeElementCountTbl[node_lI];
+			for( nodeElement_I = 0; nodeElement_I < nodeElementCount; nodeElement_I++ ) {
+				Element_LocalIndex		element_lI = context->mesh->nodeElementTbl[node_lI][nodeElement_I];
+				if( element_lI < context->mesh->elementDomainCount ) {
+					Snac_Element*		element = Snac_Element_At( context, element_lI );
+
+					if(nodeElement_I == 0) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 5 ),
+									       Snac_Element_NodeCoord( context, element_lI, 6 ),
+									       Snac_Element_NodeCoord( context, element_lI, 7 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 5 ),
+									  Snac_Element_NodeCoord( context, element_lI, 6 ),
+									  Snac_Element_NodeCoord( context, element_lI, 7 ),
+									  &normal );
+					}
+					if(nodeElement_I == 1) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									       Snac_Element_NodeCoord( context, element_lI, 6 ),
+									       Snac_Element_NodeCoord( context, element_lI, 7 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									  Snac_Element_NodeCoord( context, element_lI, 6 ),
+									  Snac_Element_NodeCoord( context, element_lI, 7 ),
+									  &normal );
+					}
+					if(nodeElement_I == 2) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									       Snac_Element_NodeCoord( context, element_lI, 5 ),
+									       Snac_Element_NodeCoord( context, element_lI, 7 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									  Snac_Element_NodeCoord( context, element_lI, 5 ),
+									  Snac_Element_NodeCoord( context, element_lI, 7 ),
+									  &normal );
+					}
+					if(nodeElement_I == 3) {
+						area = Tetrahedra_SurfaceArea( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									       Snac_Element_NodeCoord( context, element_lI, 5 ),
+									       Snac_Element_NodeCoord( context, element_lI, 6 ) );
+						Tetrahedra_SurfaceNormal( Snac_Element_NodeCoord( context, element_lI, 4 ),
+									  Snac_Element_NodeCoord( context, element_lI, 5 ),
+									  Snac_Element_NodeCoord( context, element_lI, 6 ),
+									  &normal );
+					}
+					(*force)[0] += factor2 * ( element->hydroPressure * area * normal[0] );
+					(*force)[1] += factor2 * ( element->hydroPressure * area * normal[1] );
+					(*force)[2] += factor2 * ( element->hydroPressure * area * normal[2] );
+				}
+			}
+            if(context->timeStep==1) {
+                Ft = (*force)[0]*cos(theta)*cos(phi) + (*force)[1]*cos(theta)*sin(phi) - (*force)[2]*sin(theta);
+                if(Ft != 0.0)
+                    node->residualFt = Ft;
+            }
+            sphF[0] = (*force)[0]*sin(theta)*cos(phi) + (*force)[1]*sin(theta)*sin(phi) + (*force)[2]*cos(theta);
+            sphF[1] = (*force)[0]*cos(theta)*cos(phi) + (*force)[1]*cos(theta)*sin(phi) - (*force)[2]*sin(theta);
+            sphF[2] = -1.0f * (*force)[0]*sin(phi) + (*force)[1]*cos(phi);
+/*             sphF[0] -= node->residualFt; */
+            sphF[1] = 0.0f;
+            (*force)[0] = sphF[0]*sin(theta)*cos(phi) + sphF[1]*cos(theta)*cos(phi) - sphF[2]*sin(phi);
+            (*force)[1] = sphF[0]*sin(theta)*sin(phi) + sphF[1]*cos(theta)*sin(phi) + sphF[2]*cos(phi);
+            (*force)[2] = sphF[0]*cos(theta) - sphF[1]*sin(theta);
+		}
+	}
+}
+
+double getRadius( Coord coord )
+{
+	return sqrt( coord[0]*coord[0] + coord[1]*coord[1] + coord[2]*coord[2] );
+}

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Force.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Force.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Force.h	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,63 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** Role:
+**	Handles the temperature initial and boundary conditions
+**
+** Assumptions:
+**	None as yet.
+**
+** Comments:
+**	None as yet.
+**
+** $Id: VariableConditions.h 1247 2004-04-20 00:40:15Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Snac_WinklerForce_VariableConditions_h__
+#define __Snac_WinklerForce_VariableConditions_h__
+
+	void _SnacWinklerForce_Apply(
+		void*				context,
+		Node_LocalIndex			node_lI,
+		double				speedOfSound,
+		Mass*				mass,
+		Mass*				inertialMass,
+		Force*				force,
+		Force*				balance );
+	void _SnacWinklerForce_Apply_Spherical(
+		void*				context,
+		Node_LocalIndex			node_lI,
+		double				speedOfSound,
+		Mass*				mass,
+		Mass*				inertialMass,
+		Force*				force,
+		Force*				balance );
+	double Spherical_RMin;
+	double Spherical_RMax;
+
+#endif /* __Snac_WinklerForce_VariableConditions_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.c	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,75 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: InitialConditions.c 3104 2005-07-14 22:16:41Z EunseoChoi $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "types.h"
+#include "InitialConditions.h"
+#include "Register.h"
+#include <assert.h>
+#include <string.h>
+#ifndef PATH_MAX
+	#define PATH_MAX 1024
+#endif
+
+void _SnacWinklerForce_InitialConditions( void* _context, void* data ) {
+
+	Snac_Context*		context = (Snac_Context*)_context;
+
+	if( context->restartStep > 0 && (context->timeStep - context->restartStep == 1) ) {
+
+		FILE* fp;
+		char path[PATH_MAX];
+		Node_LocalIndex       node_lI;
+
+		Journal_Printf( context->snacInfo, "In: %s\n", __func__ );
+
+		sprintf( path, "%s/snac.isoForce.%d.restart", context->outputPath, context->rank );
+		fprintf(stderr,"%d: reading %s\n",context->rank,path);
+		Journal_Firewall( ( ( fp = fopen( path, "r") ) == NULL ), context->snacError, "Failed to open %s!!\n", path );
+
+		for( node_lI = 0; node_lI < context->mesh->nodeLocalCount; node_lI++ ) {
+			Snac_Node*			node = Snac_Node_At( context, node_lI );
+			fscanf( fp, "%le", &(node->residualFr) );
+		}
+		fclose( fp );
+
+		sprintf( path, "%s/pisos.restart", context->outputPath );
+		fprintf(stderr,"%d: reading %s\n",context->rank,path);
+		Journal_Firewall( ( ( fp = fopen( path, "r") ) == NULL ), context->snacError, "Failed to open %s!!\n", path );
+		fscanf( fp, "%le", &(context->pisos) );
+		fclose( fp );
+
+	}
+}
+

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/InitialConditions.h	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,45 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: InitialConditions.h 1958 2004-08-26 19:08:58Z puru $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacWinklerForce_InitialConditions_h__
+#define __SnacWinklerForce_InitialConditions_h__
+
+	void _SnacWinklerForce_InitialConditions( void* _context, void* data );
+
+#endif /* __SnacWinklerForce_InitialConditions_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Make.mm
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Make.mm	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Make.mm	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,67 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003, 
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: Make.mm 1095 2004-03-28 00:51:42Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+include Makefile.def
+
+PROJECT = Snac
+PACKAGE = ${def_mod}module
+
+PROJ_LIB = $(BLD_LIBDIR)/$(PACKAGE).a
+PROJ_DLL = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_LIB) $(PROJ_DLL)
+PROJ_INCDIR = $(BLD_INCDIR)/${def_inc}
+
+PROJ_SRCS = ${def_srcs}
+PROJ_CC_FLAGS += -I$(BLD_INCDIR)/$(PROJECT) -I$(BLD_INCDIR)/Snac -I$(BLD_INCDIR)/StGermain `xml2-config --cflags`
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -lSnac -lStGermain `xml2-config --libs` $(MPI_LIBPATH) $(MPI_LIBS)
+LCCFLAGS = 
+
+# I keep file lists to build a monolith .so from a set of .a's
+PROJ_OBJS_IN_TMP = ${addprefix $(PROJECT)/$(PACKAGE)/, ${addsuffix .o, ${basename $(PROJ_SRCS)}}}
+PROJ_OBJLIST = $(BLD_TMPDIR)/$(PROJECT).$(PACKAGE).objlist
+
+all: $(PROJ_LIB) DLL createObjList export
+
+DLL: product_dirs $(PROJ_OBJS)
+	$(CC) -o $(PROJ_DLL) $(PROJ_OBJS) $(COMPILER_LCC_SOFLAGS) $(LCCFLAGS) $(PROJ_LIBRARIES) $(EXTERNAL_LIBPATH) $(EXTERNAL_LIBS)
+
+
+
+createObjList:: 
+	@echo ${PROJ_OBJS_IN_TMP} | cat > ${PROJ_OBJLIST}
+
+#export:: export-headers
+export:: export-headers export-libraries
+EXPORT_HEADERS = ${def_hdrs}
+EXPORT_LIBS = $(PROJ_LIB) $(PROJ_DLL)
+
+check::

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Makefile.def
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Makefile.def	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Makefile.def	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,48 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003,
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##	Luc Lavier, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: Makefile.def 1461 2004-05-20 16:38:30Z pds $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+def_mod = SnacWinklerForce
+def_inc = Snac/WinklerForce
+
+def_srcs = \
+	Register.c \
+	InitialConditions.c \
+	Output.c \
+	Force.c
+
+def_hdrs = \
+	types.h \
+	Force.h \
+	InitialConditions.h \
+	Output.h \
+	Register.h
+

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Output.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Output.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Output.c	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,72 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: Output.c 3104 2005-07-14 22:16:41Z EunseoChoi $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "types.h"
+#include "Output.h"
+#include "Register.h"
+#include <stdio.h>
+#include <math.h>
+#include <assert.h>
+#ifndef PATH_MAX
+    #define PATH_MAX 1024
+#endif
+
+void _SnacWinklerForce_DumpInitForce( void* _context )
+{
+
+	Snac_Context*		context = (Snac_Context*)_context;
+
+	if( context->timeStep - context->restartStep == 1 ) {
+		FILE* fp;
+		char path[PATH_MAX];
+		Node_LocalIndex       node_lI;
+
+		sprintf( path, "%s/isoForce.%d", context->outputPath, context->rank );
+		if( ( fp = fopen( path, "w") ) == NULL ) {
+			Journal_Firewall( 0, "Failed to open %s!!\n", path );
+		}
+
+		for( node_lI = 0; node_lI < context->mesh->nodeLocalCount; node_lI++ ) {
+			Snac_Node*			node = Snac_Node_At( context, node_lI );
+			float residualF;
+
+			residualF = node->residualFr;
+			fwrite( &residualF, sizeof(float), 1, fp );
+		}
+		fflush( fp );
+
+		fclose( fp );
+	}
+}

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Output.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Output.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Output.h	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,37 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: Output.h 3104 2005-07-14 22:16:41Z EunseoChoi $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef _SnacWinklerForce_Output_
+#define _SnacWinklerForce_Output_
+
+	void _SnacWinklerForce_DumpInitForce( void* _context );
+
+#endif

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Register.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Register.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Register.c	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,147 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: Register.c 1247 2004-04-20 00:40:15Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "types.h"
+#include "Register.h"
+#include "Force.h"
+#include "Output.h"
+#include "InitialConditions.h"
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type SnacWinklerForce_Type = "SnacWinklerForce";
+static char RMIN_STR[] = "rMin";
+static char RMAX_STR[] = "rMax";
+static char MESH_STR[] = "mesh";
+static double MIN[] = { -45.0f, -45.0f, 0.5f };
+static double MAX[] = { 45.0f, 45.0f, 1.0f };
+
+Index _SnacWinklerForce_Register( PluginsManager* pluginsMgr ) {
+	return PluginsManager_Submit( pluginsMgr, 
+				      SnacWinklerForce_Type, 
+				      "0", 
+				      _SnacWinklerForce_DefaultNew );
+}
+
+
+void* _SnacWinklerForce_DefaultNew( Name name ) {
+	return _Codelet_New( sizeof(Codelet), 
+			     SnacWinklerForce_Type, 
+			     _Codelet_Delete, 
+			     _Codelet_Print, 
+			     _Codelet_Copy, 
+			     _SnacWinklerForce_DefaultNew, 
+			     _SnacWinklerForce_Construct, 
+			     _Codelet_Build, 
+			     _Codelet_Initialise, 
+			     _Codelet_Execute, 
+			     _Codelet_Destroy, 
+			     name );
+}
+
+void _SnacWinklerForce_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Snac_Context*		context;
+	Dictionary*			meshDict;
+	int Spherical = 0;
+	Dictionary_Entry_Value* extensionsList;
+	Dictionary_Entry_Value* extension;
+
+	/* Retrieve context. */
+	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
+
+	#ifdef DEBUG
+		printf( "In %s()\n", __func__ );
+	#endif
+
+	/* Add extensions to nodes, elements and the context */
+
+	/* Add extensions to the entry points */
+	assert( context->dictionary );
+	extensionsList = Dictionary_Get( context->dictionary, "extensions" );
+	if(!extensionsList)
+		extensionsList = Dictionary_Get( context->dictionary, "plugins" );
+	extension = Dictionary_Entry_Value_GetFirstElement(extensionsList);
+	while ( extension ) {
+		if ( 0 == strcmp( Dictionary_Entry_Value_AsString( extension ),
+				  "SnacSpherical" ) ) {
+			Spherical = 1;
+			break;
+		}
+		extension = extension->next;
+	}
+	/*ccccc*/
+	if(Spherical) {
+		meshDict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( context->dictionary, MESH_STR ) );
+		if( meshDict ) {
+			if( !Dictionary_Get( meshDict, RMIN_STR ) ) {
+				printf( "Warning: No \"%s\" entry in \"%s\", defaulting to %g\n", RMIN_STR, MESH_STR, MIN[2] );
+			}
+			Spherical_RMin = Dictionary_Entry_Value_AsDouble( Dictionary_GetDefault( meshDict, RMIN_STR, Dictionary_Entry_Value_FromDouble( MIN[2] ) ) );
+			Spherical_RMax = Dictionary_Entry_Value_AsDouble( Dictionary_GetDefault( meshDict, RMAX_STR, Dictionary_Entry_Value_FromDouble( MAX[2] ) ) );
+		}
+		EntryPoint_InsertBefore(
+								Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+								"SnacTimeStepZero",
+								SnacWinklerForce_Type,
+								_SnacWinklerForce_InitialConditions,
+								SnacWinklerForce_Type);
+		EntryPoint_Append(
+				  Context_GetEntryPoint( context, Snac_EP_Force ),
+				  SnacWinklerForce_Type,
+				  _SnacWinklerForce_Apply_Spherical,
+				  SnacWinklerForce_Type );
+	}
+	else {
+		EntryPoint_InsertBefore(
+								Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+								"SnacTimeStepZero",
+								SnacWinklerForce_Type,
+								_SnacWinklerForce_InitialConditions,
+								SnacWinklerForce_Type);
+		EntryPoint_Append(
+				  Context_GetEntryPoint( context, Snac_EP_Force ),
+				  SnacWinklerForce_Type,
+				  _SnacWinklerForce_Apply,
+				  SnacWinklerForce_Type );
+	}
+	EntryPoint_Append(
+		Context_GetEntryPoint( context, AbstractContext_EP_Sync ),
+		"SnacWinklerForce_Dump",
+		_SnacWinklerForce_DumpInitForce,
+		SnacWinklerForce_Type );
+}

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/Register.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/Register.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/Register.h	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,52 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Register.h 1247 2004-04-20 00:40:15Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacWinklerForce_Register_h__
+#define __SnacWinklerForce_Register_h__
+
+	/* Textual name of this class */
+	extern const Type SnacWinklerForce_Type;
+
+	Index _SnacWinklerForce_Register( PluginsManager* pluginsMgr );
+
+	void* _SnacWinklerForce_DefaultNew( Name name );
+
+	void _SnacWinklerForce_Construct( void* component, Stg_ComponentFactory* cf, void* data );
+
+#endif /* __SnacWinklerForce_Register_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/make.log
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/make.log	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/make.log	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,12 @@
+make[1]: Entering directory `/home/echoi/opt/SNAC/Snac/plugins/winkler'
+/usr/bin/cc -pipe  -DVERSION=\"\" -DCURR_MODULE_NAME=\"SnacWinklerForce\" -DPLUGIN_NAME=SnacWinklerForce -Wall -g   -fPIC -c -o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Register.o -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/SNAC/build/include/StGermain -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/mpich-1.2.7p1/include   -I/usr/include/libxml2      Register.c
+/usr/bin/cc -pipe  -DVERSION=\"\" -DCURR_MODULE_NAME=\"SnacWinklerForce\" -DPLUGIN_NAME=SnacWinklerForce -Wall -g   -fPIC -c -o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/InitialConditions.o -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/SNAC/build/include/StGermain -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/mpich-1.2.7p1/include   -I/usr/include/libxml2      InitialConditions.c
+/usr/bin/cc -pipe  -DVERSION=\"\" -DCURR_MODULE_NAME=\"SnacWinklerForce\" -DPLUGIN_NAME=SnacWinklerForce -Wall -g   -fPIC -c -o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Output.o -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/SNAC/build/include/StGermain -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/mpich-1.2.7p1/include   -I/usr/include/libxml2      Output.c
+/usr/bin/cc -pipe  -DVERSION=\"\" -DCURR_MODULE_NAME=\"SnacWinklerForce\" -DPLUGIN_NAME=SnacWinklerForce -Wall -g   -fPIC -c -o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Force.o -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/SNAC/build/include/StGermain -I/home/echoi/opt/SNAC/build/include   -I/home/echoi/opt/mpich-1.2.7p1/include   -I/usr/include/libxml2      Force.c
+Force.c: In function ‘_SnacWinklerForce_Apply’:
+Force.c:93: warning: unused variable ‘mantleDensity’
+Force.c: In function ‘_SnacWinklerForce_Apply_Spherical’:
+Force.c:508: warning: unused variable ‘mantleDensity’
+/usr/bin/cc -pipe  -DVERSION=\"\" -DCURR_MODULE_NAME=\"SnacWinklerForce\" -DPLUGIN_NAME=SnacWinklerForce -Wall -g   -o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/SnacWinklerForcemodule.so /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Register.o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/InitialConditions.o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Output.o /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/Force.o  -shared  -L/home/echoi/opt/SNAC/build/lib   -L/home/echoi/opt/SNAC/build/lib  -lSnac -lStGermain   -L/home/echoi/opt/mpich-1.2.7p1/lib -lmpich -lpmpich    -lpthread  -lrt    -lxml2   -lm   -Xlinker -rpath -Xlinker /home/echoi/opt/mpich-1.2.7p1/lib         
+/bin/cp -f /home/echoi/opt/SNAC/build/tmp/mod-SnacWinklerForcemodule.so/SnacWinklerForcemodule.so /home/echoi/opt/SNAC/build/lib/SnacWinklerForcemodule.so
+make[1]: Leaving directory `/home/echoi/opt/SNAC/Snac/plugins/winkler'

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/make.warning
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/make.warning	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/make.warning	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,2 @@
+Force.c:93: warning: unused variable ‘mantleDensity’
+Force.c:508: warning: unused variable ‘mantleDensity’

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/makefile
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/makefile	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/makefile	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,53 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003, 
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: Makefile.rules 1095 2004-03-28 00:51:42Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# obtain defaults for required variables according to system and project location, and then run the build.
+ifndef PROJ_ROOT
+	PROJ_ROOT=../..
+endif
+include ${PROJ_ROOT}/Makefile.system
+
+include Makefile.def
+
+mod = ${def_mod}
+includes = ${def_inc}
+
+SRCS = ${def_srcs}
+
+HDRS = ${def_hdrs}
+
+PROJ_LIBS = ${def_libs}
+EXTERNAL_LIBS = -L${STGERMAIN_LIBDIR}  -lSnac -lStGermain 
+EXTERNAL_INCLUDES = -I${STGERMAIN_INCDIR}/StGermain -I${STGERMAIN_INCDIR} 
+
+packages = MPI XML MATH
+
+include ${PROJ_ROOT}/Makefile.vmake

Added: long/3D/SNAC/trunk/Snac/plugins/winkler/types.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/winkler/types.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/winkler/types.h	2008-12-12 20:29:28 UTC (rev 13667)
@@ -0,0 +1,45 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**	None as yet.
+**
+** Comments:
+**	None as yet.
+**
+** $Id: types.h 1247 2004-04-20 00:40:15Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacWinklerForce_types_h__
+#define __SnacWinklerForce_types_h__
+
+#endif



More information about the CIG-COMMITS mailing list