You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a 1D cellVariable 'X' of 100 elements, with uniformGrid1D mesh type. During execution, on every single time step I need to take the first value X[0] and the last value X[-1] and subtract them (for some purpose) : X[0] - X[-1]
When I run in parallel, I use a conditional statement with procID=0 and procID=Nproc-1 to locate the values I need as follows:
if parallel.procID == 0:
Xi=X[0]
if parallel.procID == (parallel.Nproc - 1):
Xf=X[-1]
Subtraction= Xi-Xf
However, Xi and Xf are empty, it seems that outside the conditional the variables are reset.
I tried to broadcast the value of X[0] in the first core but it does not work. It seems that sometimes the last core is executed before the first core so X[0] is not there yet.
Is there a workaround or a way to do it?
Thanks
The text was updated successfully, but these errors were encountered:
I have a 1D cellVariable 'X' of 100 elements, with uniformGrid1D mesh type. During execution, on every single time step I need to take the first value X[0] and the last value X[-1] and subtract them (for some purpose) : X[0] - X[-1]
When I run in parallel, I use a conditional statement with procID=0 and procID=Nproc-1 to locate the values I need as follows:
if parallel.procID == 0:
Xi=X[0]
if parallel.procID == (parallel.Nproc - 1):
Xf=X[-1]
Subtraction= Xi-Xf
However, Xi and Xf are empty, it seems that outside the conditional the variables are reset.
I tried to broadcast the value of X[0] in the first core but it does not work. It seems that sometimes the last core is executed before the first core so X[0] is not there yet.
Is there a workaround or a way to do it?
Thanks
The text was updated successfully, but these errors were encountered: