SPModel: plugins/tectonicUplift/TectonicUplift.c Source File
VPAC - Computational Software Development
Main | SPModel | StGermain FrameWork |
Main Page | Alphabetical List | Class List | Directories | File List | Class Members | File Members

TectonicUplift.c

Go to the documentation of this file.
00001 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00002 **
00003 ** Copyright (C), 2004, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
00004 **
00005 ** Authors:
00006 **  Ogar R. Widjaja, Computational Scientist, VPAC.
00007 **  Raquibul Hassan, Software Engineer, VPAC. (raq@vpac.org)
00008 **  Keith Hsuan, Computational Scientist, VPAC (keith@vpac.org)
00009 **  William F. Appelbe, Director, VPAC. (bill@vpac.org)
00010 **  Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org)
00011 **  Patrick D. Sunter, Software Engineer, VPAC. (patrick@vpac.org)
00012 **
00013 ** This file may be distributed under the terms of the VPAC Public License
00014 ** as defined by VPAC of Australia and appearing in the file
00015 ** LICENSE.VPL included in the packaging of this file.
00016 **
00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00019 **
00020 ** $Id: TectonicUplift.c 225 2005-12-22 00:01:19Z AlanLo $
00021 **
00022 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
00023 
00024 
00025 #include <mpi.h>
00026 #include <StGermain/StGermain.h>
00027 #include "SPModel/SPModel.h"
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <assert.h>
00031 
00032 
00033 #include "TectonicUplift.h"
00034 
00035 /* Textual name of this module */
00036 const Type SPModelTectonicUplift_Type = "SPModelTectonicUplift";
00037 
00038 void* _SPModelTectonicUplift_DefaultNew( Name name ) {
00039     return Codelet_New(
00040             SPModelTectonicUplift_Type,
00041             _SPModelTectonicUplift_DefaultNew,
00042             _SPModelTectonicUplift_Construct,
00043             _Codelet_Build,
00044             _Codelet_Initialise,
00045             _Codelet_Execute,
00046             _Codelet_Destroy,
00047             name );
00048 }
00049 
00050 void _SPModelTectonicUplift_Construct( void* component, Stg_ComponentFactory* data ) {  
00051     SPModel_Context*                context;
00052 
00053     context = (SPModel_Context*)Stg_ComponentFactory_ConstructByName( data, "context", SPModel_Context, True );
00054     
00055     _SPModelTectonicUplift_Init( context );
00056     
00057     Journal_DPrintf( context->debug, "In %s():\n", __func__ );
00058     ContextEP_Append( context, AbstractContext_EP_Solve, SPModelTectonicUplift_Solve );
00059 }   
00060 
00061 void _SPModelTectonicUplift_Init( void* _context ) {
00062 
00063 }
00064 
00065 void SPModelTectonicUplift_Solve( void *_context ) {
00066     float dh = 0;
00067     int i = 0;
00068 
00069     SPModel_Context *context = NULL;
00070     SurfaceMesh *mesh;
00071     
00072     context = (SPModel_Context*)_context;
00073     assert( context );
00074 
00075     mesh = context->localMesh; 
00076 
00077     if (context->currentTime < 100000) {
00078 
00079         for (i=0; i<mesh->myLoad; i++) {
00080             dh = context->upliftRate*context->dt;
00081             mesh->h[i] += dh;
00082             mesh->h0[i] += dh;
00083             mesh->hi[i] += dh;
00084         }
00085     }
00086 }
00087 
00088 Index SPModelTectonicUplift_Register( PluginsManager* pluginsManager ) {
00089     return PluginsManager_Submit( pluginsManager, SPModelTectonicUplift_Type, "0", _SPModelTectonicUplift_DefaultNew );
00090 }
00091