[CIG-LONG] Adaptive Time-step in Gale

Walter Landry walter at geodynamics.org
Wed Feb 27 13:41:39 PST 2008


"Mark Fleharty" <mark.fleharty at gmail.com> wrote:
> Hello,
> 
> Is it possible to turn off the adaptive time-step in gale and use a
> fixed sized time step?

This is something that I had always thought about, so I just modified
the code to do it.  I only had to modify 

  src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/UpdateDt.c

If you are running the version from subversion, you can just update
your code.  I have also attached it to this email.

To set the timestep, just add something like

  <param name="dt">0.01</param>

to the parameters around the other parameters (e.g. minX, maxX, ...).

Cheers,
Walter Landry
walter at geodynamics.org
-------------- next part --------------
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**
** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
**	Melbourne, 3053, Australia.
**
** Primary Contributing Organisations:
**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
**	Monash Cluster Computing - http://www.mcc.monash.edu.au
**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
**
** Contributors:
**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library 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
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
**
** $Id: /cig/src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/UpdateDt.c 2012 2008-02-27T21:40:52.390088Z boo  $
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include <mpi.h>
#include <StGermain/StGermain.h>
#include "StgFEM/Discretisation/Discretisation.h"
#include "StgFEM/SLE/LinearAlgebra/LinearAlgebra.h"
#include "StgFEM/SLE/SystemSetup/SystemSetup.h"
#include "types.h"
#include "Stokes_SLE.h"

#include <stdio.h>
#include <stdlib.h>

double Stokes_SLE_UpdateDt( Stokes_SLE* self, FiniteElementContext* context ) {
	double                  velMax        = 0;
	double                  minSeparation = 0;
	double                  minSeparationEachDim[3] = { 0, 0, 0 };
	FeVariable*             velFeVar      = NULL;
	double			localDt;
	double			globalDt;
        Dictionary*             dictionary = context->dictionary;
        double factor;
	
        globalDt=Dictionary_GetDouble_WithDefault(dictionary,"dt",0.0);
        
        if(globalDt==0.0)
          {
            velFeVar = self->uSolnVec->feVariable;
            velMax = FieldVariable_GetMaxGlobalFieldMagnitude( velFeVar );
            
            Journal_DPrintf( self->debug, "In func %s for SLE '%s' - Maximum global magnitude for field '%s' = %g.\n",
                             __func__, self->name, velFeVar->name, velMax );
            
            FeVariable_GetMinimumSeparation( velFeVar, &minSeparation, minSeparationEachDim );
            
            factor=Dictionary_GetDouble_WithDefault(dictionary,"dtFactor",1.0);
            localDt = factor*0.5 * minSeparation / velMax;
            MPI_Allreduce( &localDt, &globalDt, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
          }
	return globalDt;
}


More information about the CIG-LONG mailing list