routine works only for certain numbers of processors

Hallo,

I am looking for the steady state of a two-dimensional flow. The routine I have written computes the maximal relative change of the velocity profile in a specified domain. Everything works fine as long as I run the program on 1, 2 or 4 processors. If I use a different number, something breaks down and I get meaningless results. The code is below, any ideas? Thanks a lot.

Simon


bool steadyState2Dc ( MultiBlockLattice2D<T,DESCRIPTOR>& lattice, Box2D domain, T threshold, plint component, T& diff) {
    static MultiTensorField2D<T,2> uOld(domain.x1+1, domain.y1+1);
    MultiTensorField2D<T,2> uNew(domain.x1+1, domain.y1+1);
    computeVelocity(lattice, uNew, domain);
    subtractInPlace(uOld, uNew, domain);
    divideInPlace(uOld, uNew, domain);

    T diffmax = fabs(computeMax(*extractComponent(uOld, domain, component)));
    T diffmin = fabs(computeMin(*extractComponent(uOld, domain, component)));

    uOld = uNew;
    
    diff = (diffmax <= diffmin) ? diffmin : diffmax;

    return (diff < threshold);
}