Skip to content
Snippets Groups Projects
Commit c4f1392c authored by Jean-Matthieu Etancelin's avatar Jean-Matthieu Etancelin
Browse files

Add prefix parameter for adaptative timestep

parent c46488ac
No related branches found
No related tags found
No related merge requests found
......@@ -25,12 +25,12 @@ class AdaptTimeStep(Operator):
dt_adapt=None,
method={TimeIntegrator: RK3, SpaceDiscretisation: FD_C_4,
dtAdvecCrit: 'vort'},
topo=None, ghosts=None, **other_config):
topo=None, ghosts=None, prefix='./dt.dat', **other_config):
"""
Create a timeStep-evaluation operator from given
velocity and vorticity variables.
Note : If cfl is None, the computation of the adaptative time step
Note : If cfl is None, the computation of the adaptative time step
is only based on dt_advection and dt_stretching, taking the minimum
value of the two.
......@@ -39,9 +39,9 @@ class AdaptTimeStep(Operator):
@param resolutions : grid resolution of velocity and vorticity
@param dt_adapt : adaptative timestep variable
@param method : solving method
default = finite differences, 4th order in space for gradU evaluation
default = finite differences, 4th order in space for gradU evaluation
(used in dt_advection computation)
and Runge-Kutta 3 in time (used in dt_stretching computation) and
and Runge-Kutta 3 in time (used in dt_stretching computation) and
criterion for advection time step evaluation.
@param topo : a predefined topology to discretize velocity/vorticity
@param ghosts : number of ghosts points. Default depends on the method.
......@@ -60,6 +60,7 @@ class AdaptTimeStep(Operator):
self.dt_adapt = dt_adapt
## Numerical methods for time and space discretization
self.method = method
self.prefix = prefix
assert SpaceDiscretisation in self.method.keys()
assert TimeIntegrator in self.method.keys()
if not dtAdvecCrit in self.method.keys():
......@@ -100,7 +101,7 @@ class AdaptTimeStep(Operator):
AdaptTimeStep_D(self.discreteFields[self.velocity],
self.discreteFields[self.vorticity],
self.dt_adapt,
method=self.method,
method=self.method, prefix=self.prefix,
**self.config)
self.discreteOperator.setUp()
......
......@@ -35,7 +35,7 @@ class AdaptTimeStep_D(DiscreteOperator):
dt_adapt=None,
method={TimeIntegrator: RK3, SpaceDiscretisation: FD_C_4,
dtAdvecCrit: 'vort'},
lcfl=0.125, cfl=0.5):
lcfl=0.125, cfl=0.5, prefix='./dt.dat'):
"""
@param velocity : discrete field
@param vorticity : discrete field
......@@ -77,7 +77,7 @@ class AdaptTimeStep_D(DiscreteOperator):
# Definition of criterion for dt_advec computation
self.dtAdvecCrit = self.method[dtAdvecCrit]
self.prefix = './res/dt_adaptative.dat'
self.prefix = prefix
if (main_rank == 0):
self.f = open(self.prefix, 'w')
......@@ -88,7 +88,7 @@ class AdaptTimeStep_D(DiscreteOperator):
self.velocity.nbComponents)
# gradU function
self._function = GradV(self.velocity.topology,
self._function = GradV(self.velocity.topology,
method=self.method[SpaceDiscretisation])
memshape = self.velocity.data[0].shape
worklength = self.velocity.nbComponents ** 2
......@@ -190,7 +190,7 @@ class AdaptTimeStep_D(DiscreteOperator):
self.dt_adapt.data[0] = min(dt_advec, dt_stretch, dt_cfl)
self.dt_adapt.data[0] = \
self.velocity.topology.topo.allreduce(self.dt_adapt.data[0],
self.velocity.topology.topo.allreduce(self.dt_adapt.data[0],
PARMES_MPI_REAL, op=MPI.MIN)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment