# HG changeset patch # User calpe <miguel.calpe.linares@gmail.com> # Date 1537268577 -7200 # Tue Sep 18 13:02:57 2018 +0200 # Node ID 670c4abb49dcf2e34c2a961b71f2ea7c92419892 # Parent 3194c26bc6baaf2fbaf02ac6d134c8bde14c1b56 Add parameter cfl_coef_group. diff --git a/fluidsim/solvers/ns2d/strat/time_stepping.py b/fluidsim/solvers/ns2d/strat/time_stepping.py --- a/fluidsim/solvers/ns2d/strat/time_stepping.py +++ b/fluidsim/solvers/ns2d/strat/time_stepping.py @@ -25,6 +25,13 @@ """ + @classmethod + def _complete_params_with_default(cls, params): + super(TimeSteppingPseudoSpectralStrat, cls)._complete_params_with_default(params) + + # Add parameter coefficient CFL GROUP VELOCITY + params.time_stepping._set_attrib("cfl_coef_group", None) + def _init_compute_time_step(self): """ Initialization compute time step solver ns2d.strat. @@ -33,7 +40,12 @@ # Coefficients dt self.coef_deltat_dispersion_relation = 1.0 - self.coef_group = 1.0 + + if self.params.time_stepping.cfl_coef_group: + self.coef_group = self.params.time_stepping.cfl_coef_group + else: + self.coef_group = 1.0 + self.coef_phase = 1.0 has_vars = self.sim.state.has_vars @@ -141,14 +153,23 @@ else: deltat_CFL = self.deltat_max + # maybe_new_dt = min( + # deltat_CFL, + # self.deltat_dispersion_relation, + # self.deltat_group_vel, + # self.deltat_phase_vel, + # self.deltat_max, + # ) + + # Removed phase velocity (considered not relevant) maybe_new_dt = min( deltat_CFL, self.deltat_dispersion_relation, self.deltat_group_vel, - self.deltat_phase_vel, self.deltat_max, ) + if self.params.forcing.enable: maybe_new_dt = min(maybe_new_dt, self.deltat_f)