Broadcast fespace in MPI

Hi everybody,

I would like to be able to broadcast an fespace of the processor(0) to all the other processors. However, the broadcast function does not seem to take fespace into account.

I would like a single processor to calculate the boundary condition on the global mesh (which is a Blasius profile in my case) then broadcast it to everyone.

I would like a single processor to calculate the entry limit condition on the global mesh (which is a Blasius profile in my case) then broadcast it to everyone.

Here is the snippet of my code that calculates the input boundary condition:

/* Import de la solution de l'equation de Blasius 2f'''+ff''=0' */
    int mbl, nbl;
    ifstream Input(".../Profil_Blasius_RK4.txt");
        Input >> mbl >> nbl;					// Nbr lignes & Nbr colonnes
        real[int,int] fblasius(mbl,nbl);
        for(int i=0; i<mbl; i++){
            for(int j=0; j<nbl; j++){
                Input >> fblasius(i,j);			// Tableau [eta f f' f"]
            }
        }
    real etamax = fblasius(mbl-1,0);  // Eta max (derniere entree du tableau)

/* Interpolation du profil de similitude */
    int  nbs = fblasius.n-1;
    mesh Thb = square(1,nbs/2,[x,y*etamax]);
    fespace Vhb(Thb,P2);
    Vhb fbx, fby, xx = x, yy = y*(nbs)/etamax;
    for(int i=0; i< fbx[].n; ++i){
        int k = yy[][i];
        if(xx[][i] < 0.1)
            fbx[][i] = fblasius(k,2);  // u/Uinf = f'(eta)
            fby[][i] = (fblasius(k,0)*fblasius(k,2))-fblasius(k,1);		// v/sqrt(nu*Uinf/2x) = eta*f'(eta)-f(eta)
    }
    fbx = fbx(0,y)*Uinf;
    fby = fby(0,y)*sqrt(nu*Uinf/(2*xentree));

/* Adaptation du profil au maillage pour le bon delta1 */
    fespace Uhglobal(Thglobal, Pu);
    Uhglobal Ublasius, Vblasius;
    Ublasius = fbx(x,y/delta1*1.7208);
    Vblasius = fby(x,y/delta1*1.7208);

/* CL d'entree */
    func uIn = Ublasius(0,y);  // Condition limite d'entree selon x
    func vIn = Vblasius(0,y);  // Condition limite d'entree selon y

Thanks !

It doesn’t make sense to broadcast a fespace, just broadcast the underlying mesh, or broadcast whatever your compute on it, e.g., matrix or function.

But a function can’t be broadcast either, can it?

I would like to be able to broadcast either the uIn function or the Ublasius field because I noticed that when I calculate the boundary condition with several processors, it is not well calculated.

Sure, you can broadcast Ublasius[] no problem (or any vector for that matter). What do you mean by “not well calculated”?

I don’t quite understand where the error came from. I have put below images of my velocity fields. The first shows the boundary layer calculated with 1 single processor (same result as in sequential) and the 2nd image shows the same field calculated with 50 processors. The calculation of the input boundary condition is done by the code I published in my first post above.


The calculation of the input boundary condition is done by the code I published in my first post above.

No, I don’t see any parallelism in the above snippet, so I guess that’s not how you compute it with 50 processes (unless you compute it redundantly, in which case it means one of the input data is not synchronized among processes).