-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_uniaxial_data.py
64 lines (50 loc) · 1.77 KB
/
plot_uniaxial_data.py
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
53
54
55
56
57
58
59
60
61
62
63
64
print("start")
import pyvista as pv
print("import pv")
import numpy as np
print("import np")
import matplotlib.pyplot as plt
print("import plt")
stress_comp = 4
E_comp = 4
E_name = "E11__E12__E13__E21__E22__E23__E31__E32__E33"
S_name = "S11__S12__S13__S21__S22__S23__S31__S32__S33"
def plot(file_name, label):
x = []
y = []
# file_name = f'viscoplasticity-{name}/viscoplasticity-{name}.pvd'
print(file_name)
reader = pv.get_reader(file_name)
for i_time in range(len(reader.time_values) - 1):
print(f"{i_time + 1} / {len(reader.time_values) - 1}")
reader.set_active_time_point(i_time)
mesh = reader.read()[0]
stress = np.mean(mesh[S_name], axis=0)
E = np.mean(mesh[E_name], axis=0)
x.append(E[E_comp])
y.append(stress[stress_comp])
plt.plot(x, y, marker='s', mfc='none', label=label)
def plot_f(file_name, label):
x = []
y = []
# file_name = f'viscoplasticity-{name}/viscoplasticity-{name}.pvd'
print(file_name)
reader = pv.get_reader(file_name)
for i_time in range(len(reader.time_values) - 1):
print(f"{i_time + 1} / {len(reader.time_values) - 1}")
reader.set_active_time_point(i_time)
mesh = reader.read()[0]
stress = np.mean(mesh["f"], axis=0)
E = np.mean(mesh[E_name], axis=0)
x.append(E[E_comp])
y.append(stress)
plt.plot(x, y, marker='s', mfc='none', label=label)
# plot("./cmake-build-debug-wsl/ale-elastoplastic-ut.pvd", "Voce")
# plot_f("./cmake-build-debug-wsl/ale-elastoplastic-ut.pvd", "f")
plot("./cmake-build-debug-remote-host/ale-elastoplastic-ut.pvd", "Voce")
plot_f("./cmake-build-debug-remote-host/ale-elastoplastic-ut.pvd", "f")
plt.xlabel('$E_{22}$')
plt.ylabel(r'$\tau_{22}$')
plt.grid()
plt.legend()
plt.show()