| 27 | self._lin_solver_args = lin_solver_args |
| 28 | |
| 29 | def Integrate(self, u_start: ngs.GridFunction, |
| 30 | end_time: float, |
| 31 | start_time: Optional[float] = None, |
| 32 | newton_args: Optional[dict] = None, |
| 33 | callback: Optional[Callable] = None): |
| 34 | u = u_start |
| 35 | if start_time is not None: |
| 36 | self.time.Set(start_time) |
| 37 | while self.time.Get() < end_time * (1-1e-10): |
| 38 | dt = min(self.dt.Get(), end_time - self.time.Get()) |
| 39 | self.time.Set(self.time.Get() + dt) |
| 40 | self.Step(u, dt=dt, newton_args=newton_args) |
| 41 | if callback is not None: |
| 42 | callback(self.time.Get(), u) |
| 43 | return u |
| 44 | |
| 45 | def Step(self, u: ngs.GridFunction, dt: Optional[float] = None, |
| 46 | newton_args: Optional[dict] = None): |