Problem: I know that set parameters["allow_extrapolation"] = True
from using MPI.My output data seems to be incorrect from using MPI.Can anyone give me the python script about how to output data in one processor while using MPI? or another method can output correctly from using MPI?
Thank you for your suggestion!
code.min:
parameters["allow_extrapolation"] = True
for step in range(0,N_STEPS):
print("======= Time step "+str(step+1)+"/"+str(N_STEPS)+" =======")
solve(F==0,up,bcs=bcs)
up_old.assign(up)
u,p = up_old.split()
#compute x,y,z component of velocity
u_point1_x = u(650, 150, 150)[0]
u_point1_y = u(650, 150, 150)[1]
u_point1_z = u(650, 150, 150)[2]
Velocity1 = [ step, u_point1_x, u_point1_y, u_point1_z]
print("u_point1_x, u_point1_y, u_point1_z:", u(650, 150, 150)[0], u(650, 150, 150)[1], u(650, 150, 150)[2])
# storing solution @each time-step in csv file format
with open("Velocity1.csv",mode="a") as csv_file:
writer = csv.writer(csv_file)
writer.writerow(Velocity1)
results: (mpirun -np 4 python3 file.py
)
0,9442.98128698,-9.57470522809,-15.5618726895
0,-70139.4015959,-161.911577817,-454.750747581
0,9482.99962293,-21.6988573253,25.7209847679
0,-151112.581877,24379.4870772,6189.27384262
1,9019.90503307,-63.7211151549,85.6542662338
1,8919.52793571,-46.7762030759,2.43417804393
1,-177605.249207,17158.543328,9308.3154166
1,-76247.5790232,-2070.55989755,1348.78406106
2,9379.29699214,-0.676432936352,41.1716508946
2,9273.79852168,-2.80345293864,-11.4994788386
2,-65820.9207047,-4023.78831757,2352.63825372
2,-151948.204079,-3383.53006652,3015.0902057
3,-70928.2790046,-3296.97558866,1657.86949135
3,8958.76094991,-36.7671586119,-9.96266986168
3,9057.29021448,-42.6890251019,65.3378482801
3,-159970.618939,745.678226874,2792.51868907
4,9289.37787257,0.334099569508,32.8912304198
4,9188.10752432,-2.53795648284,-13.0119765237
4,-63696.847716,-3884.7989317,1613.0957129
4,-145370.295653,-3808.20569082,1478.54965484