I am writing to ask how to correctly use setValue with the where argument when 
running fipy in parallel. For example, to set the value of a cellVariable in a 
hemispherical region on the bottom boundary of a mesh, I can do the following:

x, y = myMesh.cellCenters
myCellVar.setValue(1, where=((x - nx * dx / 2)**2 + y**2) < radius**2)

This works fine in serial, however, in parallel, this sets the value in a 
hemispherical region on the bottom boundary of the domain allocated to each 
processor. In other words, if I specify 3 processors, I get 3 hemispheres 
stacked on top of each other.

I tried shifting the coordinates of non rank 0 processes to the global 
reference frame prior to executing the setValue command by using

if rank is not 0:
        y = y + rank * ny * dy / numberOfProcs - 2 * dy   ## -2 * dy I thought 
would account for 2 cell overlap between processor meshes

This nearly fixed the issue, but I still see differences depending on how many 
processors I specify.

What is the correct way to set the value of a cell variable in a spatial region 
when running in parallel?

Thanks,
Dave
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to