How to partition heterogeneous elastic properties vectors in different processes? #2469
-
Hello all, My objective is to determine effective elastic properties of heterogenous 3D materials. I have successfully adapted Example 2 to handle the elastic deformation of an arbitrary 3D cartesian mesh with heterogeneous elastic property fields (i.e. one mu and lambda for each cell). The serial version of this code works fine. It uses PWConstCoefficient to define the elastic properties. I'm now working on the parallel version of this code, but I cannot figure out how to populate the lambda and mu coefficient vectors for each process: For instance if my volume is 30 x 30 x 30 and I have 3 processes:
Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @rafaelmarch3, If I understand correctly, you read from your input file an array If this is the case, then I believe that on each MPI rank, you can construct the Vector localLambda(pmesh->attributes.Max());
Vector localMu(pmesh->attributes.Max());
localLambda = 0.0;
localMu = 0.0; // Initialize to zero: not strictly necessary, but makes sure these arrays have no un-initialized values
for (int attribute : pmesh->attributes)
{
localLambda[attribute - 1] = globalLambda[attribute - 1];
localMu[attribute - 1] = globalMu[attribute - 1];
} |
Beta Was this translation helpful? Give feedback.
Hi @rafaelmarch3,
If I understand correctly, you read from your input file an array
globalLambda
of size 27,000, whereglobalLambda[i-1]
is the lambda value corresponding to thei
th attribute, and similarly forglobalMu
.If this is the case, then I believe that on each MPI rank, you can construct the
localLambda
andlocalMu
arrays as follows