diff --git a/HySoP/hysop/operator/adapt_timestep.py b/HySoP/hysop/operator/adapt_timestep.py index 8be591f91162d9b8f28e9405266e664e1f2f697d..b3c545633d10e02d4c9b924f98da0d79aa62f085 100755 --- a/HySoP/hysop/operator/adapt_timestep.py +++ b/HySoP/hysop/operator/adapt_timestep.py @@ -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() diff --git a/HySoP/hysop/operator/discrete/adapt_timestep.py b/HySoP/hysop/operator/discrete/adapt_timestep.py index 93cb81ff72095935ba8b5e840132c776d365a62e..3804b7c881fa77b2614840adcd0e7a6a8e789d41 100755 --- a/HySoP/hysop/operator/discrete/adapt_timestep.py +++ b/HySoP/hysop/operator/discrete/adapt_timestep.py @@ -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)