Parallel-in-Time / pySDC

pySDC is a Python implementation of the spectral deferred correction (SDC) approach and its flavors, esp. the multilevel extension MLSDC and PFASST.
http://www.parallel-in-time.org/pySDC
BSD 2-Clause "Simplified" License
32 stars 33 forks source link

Boris-SDC (iterations) #97

Closed BlackCat07 closed 6 years ago

BlackCat07 commented 6 years ago

Hello!

when setting this parameter https://github.com/Parallel-in-Time/pySDC/blob/master/pySDC/playgrounds/Boris/penningtrap_playground.py#L41 to 0 or 1, I get the same result. Is it OK?

I also set level_params['restol'] to 0.

Thanks!

pancetta commented 6 years ago

Are you using the most recent release of pySDC? On September 26, I changed quite a bit in the controllers, including the handling of the case maxiter=0. In theory, with maxiter=0 it should just check for convergence/termination (which is True right away) and get out of the step immediately. With maxiter=1 it should do exactly one fine sweep.

You could try to load the allinclusive_multigrid_nonMPI-controller instead, which is closer to the theory of PFASST and SDC.

BlackCat07 commented 6 years ago

Hello Robert,

here is short test case for classical and multi grid controllers: https://github.com/BlackCat07/PythonProjects/blob/master/penningtrap_playground.py

Both controllers are used for 1 single step. Please see the output in the end when running.

Thanks!

danielru commented 6 years ago

And try to change the time step to level_params['dt'] = 0.2 if you want to see really different results from both controllers!

pancetta commented 6 years ago

No.

pancetta commented 6 years ago

Yeah, ok, will look into this on Monday...

pancetta commented 6 years ago

OK, a quick look revealed that if I change the initial iteration count from 0 to 1 here, the difference goes away. This is a bug in the allinclusive_multigrid_nonMPI-controller, but nothing to worry about.

BlackCat07 commented 6 years ago

I changed this parameter from 0 to 1 and got

Traceback (most recent call last): File ".../pySDC_2.2/pySDC/playgrounds/Boris/penningtrap_playground.py", line 103, in main() File ".../pySDC/playgrounds/Boris/penningtrap_playground.py", line 79, in main uend_mult, stats = controller_mult.run(u0=uinit_mult, t0=t0, Tend=Tend) File ".../pySDC_2.2/pySDC/implementations/controller_classes/allinclusive_multigrid_nonMPI.py", line 94, in run MS_active = self.pfasst(MS_active) File ".../pySDC_2.2/pySDC/implementations/controller_classes/allinclusive_multigrid_nonMPI.py", line 310, in pfasst self.hooks.post_iteration(step=S, level_number=0) File ".../pySDC_2.2/pySDC/core/Hooks.py", line 152, in post_iteration type='timing_iteration', value=self.__t1_iteration - self.__t0_iteration) TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

Process finished with exit code 1

pancetta commented 6 years ago

Yeah, sorry, change the 0 to 1 here, too.

But beware, this is only a workaround. I'll have to look into this in more detail.

BlackCat07 commented 6 years ago

I changed this parameter too. Nothing happens. I get the same error as using "0".

OK, no problem! This takes time, I understand.

pancetta commented 6 years ago

Hmm.. this does work for me...

BlackCat07 commented 6 years ago

Sorry! I didn't notice that I changed 'maxiter' to 0. When I set 'maxiter'=1 and params at line 148, 309 to 1, it works for me also.

pancetta commented 6 years ago

Phew, good to know. I have a fix up and running, but testing plays tricks on me. Stay tuned for an update in a few minutes.

pancetta commented 6 years ago

Fixed by https://github.com/Parallel-in-Time/pySDC/commit/64ae80bfe42117de7b266537f8791c54fbb3da59!

pancetta commented 6 years ago

Alright, pushed a new version (tag 2.2.1, https://github.com/Parallel-in-Time/pySDC/commit/130bf7031661c4005ebb68587bc0a393c726dd5c), should run smoothly now.