[cig-commits] r5157 - in long/3D/Gale/trunk/src/Underworld: . plugins/Output plugins/Output/AverageTemperature

walter at geodynamics.org walter at geodynamics.org
Tue Oct 31 13:33:14 PST 2006


Author: walter
Date: 2006-10-31 13:33:13 -0800 (Tue, 31 Oct 2006)
New Revision: 5157

Added:
   long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/
   long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/AverageTemperature.c
   long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/makefile
Modified:
   long/3D/Gale/trunk/src/Underworld/
Log:
 r695 at earth:  boo | 2006-10-31 13:32:07 -0800
  r685 at earth (orig r362):  JulianGiordani | 2006-10-22 22:36:43 -0700
  
  A new output plugin for Catherine. This simply calculates the average temperature in the the simulation, outputing the number into the FrequentOutput.dat file.
  
  
 



Property changes on: long/3D/Gale/trunk/src/Underworld
___________________________________________________________________
Name: svk:merge
   - 9570c393-cf10-0410-b476-9a651db1e55a:/cig:694
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:361
   + 9570c393-cf10-0410-b476-9a651db1e55a:/cig:695
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:362

Added: long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/AverageTemperature.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/AverageTemperature.c	2006-10-31 21:33:09 UTC (rev 5156)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/AverageTemperature.c	2006-10-31 21:33:13 UTC (rev 5157)
@@ -0,0 +1,101 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Louis Moresi - Louis.Moresi at sci.monash.edu.au
+*%
+** Contributors:
+*+		Robert Turnbull
+*+		Vincent Lemiale
+*+		Louis Moresi
+*+		David May
+*+		David Stegman
+*+		Mirko Velic
+*+		Patrick Sunter
+*+		Julian Giordani
+*+
+** $Id:  $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#include <Underworld/Underworld.h>
+#include <StgFEM/FrequentOutput/FrequentOutput.h>
+
+const Type Underworld_AverageTemperature_Type = "Underworld_AverageTemperature";
+void Underworld_AverageTemperature_PrintHeaderToFile( void* context );
+void Underworld_AverageTemperature_Output( void* _context );
+
+void _Underworld_AverageTemperature_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
+	UnderworldContext*  context;
+
+	context = Stg_ComponentFactory_ConstructByName( cf, "context", UnderworldContext, True, data );
+
+	Underworld_AverageTemperature_PrintHeaderToFile( context );
+	ContextEP_Append( context, AbstractContext_EP_FrequentOutput, Underworld_AverageTemperature_Output );
+}
+
+void* _Underworld_AverageTemperature_DefaultNew( Name name ) {
+	return Codelet_New(
+		Underworld_AverageTemperature_Type,
+		_Underworld_AverageTemperature_DefaultNew,
+		_Underworld_AverageTemperature_Construct,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
+}
+
+Index Underworld_AverageTemperature_Register( PluginsManager* pluginsManager ) {
+	return PluginsManager_Submit( pluginsManager, Underworld_AverageTemperature_Type, "0", _Underworld_AverageTemperature_DefaultNew );
+}
+
+void Underworld_AverageTemperature_Output( void* _context ) {
+	UnderworldContext* context       = (UnderworldContext*) _context;
+	FeVariable*        temperatureFe = context->temperatureField;
+	FiniteElement_Mesh* mesh         = temperatureFe->feMesh;
+	Node_LocalIndex    lNode_I;
+	double             processorAvg = 0;
+	double             simulationAvg = 0;
+
+	for( lNode_I = 0 ; lNode_I < mesh->nodeLocalCount ; lNode_I++ ) {
+		processorAvg += FeVariable_GetScalarAtNode( temperatureFe, lNode_I );;
+	}
+	processorAvg = processorAvg / (mesh->nodeLocalCount) ;
+	
+	MPI_Reduce( &processorAvg, &simulationAvg, 1, MPI_DOUBLE, MPI_SUM, 0, context->communicator );
+	simulationAvg = simulationAvg / context->nproc;
+	StgFEM_FrequentOutput_PrintValue( context, simulationAvg );
+}
+
+void Underworld_AverageTemperature_PrintHeaderToFile( void* context ) {
+	StgFEM_FrequentOutput_PrintString( context, "AvgTemp" );
+}
+

Added: long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/makefile
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/makefile	2006-10-31 21:33:09 UTC (rev 5156)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/AverageTemperature/makefile	2006-10-31 21:33:13 UTC (rev 5157)
@@ -0,0 +1,24 @@
+
+#Finds the Absolute path to the Project Root directory
+SHELL := /bin/bash
+PROJ_ROOT := $(shell until test -r ./Makefile.system ; do cd .. ; done ; echo `pwd`)
+include ${PROJ_ROOT}/Makefile.system
+
+# Subdirectories
+subdirs := $(shell find * -type d -prune ! -name .svn ) 
+
+# Source Code and Header files
+SRCS := $(wildcard *.c)
+HDRS := $(wildcard *.h)
+
+# What to call the plugin
+modName := $(shell basename `pwd`)
+mod = ${PROJECT}_${modName}
+
+# Where to put header files
+includes = ${PROJECT}/${modName}
+
+# External Libraries and Headers
+packages = PICELLERATOR STG_FEM STGERMAIN PETSC MPI XML PYTHON
+
+include ${PROJ_ROOT}/Makefile.vmake



More information about the cig-commits mailing list