zwicker-group/py-pde

Add static fields to mpi execution

yohad opened this issue · 3 comments

yohad commented

Hi,

I want to be able to add a scalar field that is unchange during simulation (like a forcing field).
Currently, I add the field to the problem variables and make the time rate 0 always, to be able to use MPI as it splice the fields.

Is there currently a way to do that splicing myself?

Thanks for the report. You're correct that the splicing is not done automatically for constants so far. Do you use the PDE class with expressions or do you inherit from PDEBase to write your own implementation? I guess the solutions in the two cases will look different.

yohad commented

I implement my own class inheriting PDEBase

I just updated the master branch of the package to fix the problem you described for the PDE class and to also give you a more convenient way to split the field onto the sub grids in an MPI simulation. Given a field field on the full grid, you should now be able to run subfield = field.split_mpi(decomposition=...) to split the full field into subfields. Here, the decomposition needs to be the same as the one that you're later using when running the simulation. Let me know if anything is unclear!