Peano
Loading...
Searching...
No Matches
Probe_file_gene.py
Go to the documentation of this file.
1import numpy as np
2from scipy import io
3import os
4import time
5
6def tracer_seeds_generate(Type=1, a=-0.5, b=0.5 ,N_x=10, N_y=10, N_z=10):
7 x_s = np.linspace(a,b,N_x)
8 if Type==2: #slide
9 y_s = np.linspace(a,b,N_y)
10 if Type==3: #volume
11 y_s = np.linspace(a,b,N_y)
12 z_s = np.linspace(a,b,N_z)
13
14 if Type==1:
15 print("creating tracer seeds on the line of x-axis")
16 f=open('line.dat','w')
17 for i in range(N_x):
18 x=str(x_s[i]); y=str(0); z=str(0)
19 line=" "+x+" "+y+" "+z+"\n"
20 f.write(line)
21 f.close()
22
23 if Type==2:
24 print("creating tracer seeds on x-y plane")
25 f=open('slide.dat','w')
26 for i in range(N_x):
27 for j in range(N_y):
28 x=str(x_s[i]); y=str(y_s[j]); z=str(0)
29 line=" "+x+" "+y+" "+z+"\n"
30 f.write(line)
31 f.close()
32
33 if Type==3:
34 print("creating tracer seeds over domain")
35 f=open('volume.dat','w')
36 for i in range(N_x):
37 for j in range(N_y):
38 for k in range(N_z):
39 x=str(x_s[i]); y=str(y_s[j]); z=str(z_s[k])
40 line=" "+x+" "+y+" "+z+"\n"
41 f.write(line)
42 f.close()
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
tracer_seeds_generate(Type=1, a=-0.5, b=0.5, N_x=10, N_y=10, N_z=10)