-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMixingIndexParallel.py
More file actions
52 lines (45 loc) · 1.25 KB
/
MixingIndexParallel.py
File metadata and controls
52 lines (45 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import numpy as np
import pandas as pd
import math
from pandas import DataFrame
from MixingIndex_functionParallel import ReadFile, CellCount, GenerateFile
from multiprocessing import Pool
N=24
NF = 400 #number of files
NP = 7382 #number of particles
r1 = 0.003
r2 = 0.003
v1=(4/3*math.pi*r1*r1*r1)
v2=(4/3*math.pi*r2*r2*r2)
ReadInput=[]
CellCountInput=[]
path='/home/rodolfo/Desktop/dados'
os.chdir(path)
#Read input list ==================================
for i in range (N):
ReadInput.append([NF,NP,N,i])
if __name__=='__main__':
Tarefas=len(ReadInput)
with Pool(Tarefas) as p:
res = p.map(ReadFile,ReadInput)
res = [sum(i) for i in zip(*res)]
posicaoX=res[0]
posicaoY=res[1]
posicaoZ=res[2]
Tipo=res[3]
#CellCount Input list ===============================
for i in range (N):
CellCountInput.append([posicaoX, posicaoY, posicaoZ,Tipo,v1,v2,NF,i,N])
if __name__=='__main__':
Tarefas=len(CellCountInput)
with Pool(Tarefas) as p:
res = p.map(CellCount,CellCountInput)
res = [sum(i) for i in zip(*res)]
Volume=res[0]
contador_tipo1=res[1]
contador_tipo2=res[2]
cout1 = GenerateFile(Volume, contador_tipo1, contador_tipo2,v1,v2,NF)
cout1 = pd.DataFrame(cout1)
indice = pd.DataFrame(cout1.std())
indice.to_csv('dados07cParallel.csv')