Now it is uses the text mesh format. All output files are now included as they are simple csv files easy to understand.
18 lines
356 B
Python
18 lines
356 B
Python
import numpy as np
|
|
import csv
|
|
|
|
x0 = 0.0
|
|
Dx = 4.0e-5
|
|
xF = x0 + 50.0*Dx
|
|
|
|
x = np.arange(x0,xF + Dx,Dx)
|
|
p = np.zeros_like(x)
|
|
p[ 0] = 1
|
|
p[-1] = 2
|
|
p = np.int32(p)
|
|
|
|
with open('mesh.csv', 'w') as csvfile:
|
|
csvwriter = csv.writer(csvfile)
|
|
csvwriter.writerow(['Position(m)','Physical ID'])
|
|
for x_i, p_i in zip(x, p):
|
|
csvwriter.writerow([x_i,p_i])
|