|
13 | 13 | N = 500
|
14 | 14 | delta = 0.6
|
15 | 15 | X = np.linspace(-1, 1, N)
|
16 |
| -plt.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles |
17 |
| - X, (X + 1)/2, # level set distance function |
18 |
| - X, (1.4 + np.tanh(4.*X/delta))/4, # composition profile |
19 |
| - X, X < 0, 'k--', # sharp interface |
20 |
| - ) |
| 16 | +plt.plot(X, (1 - np.tanh(4 * X / delta)) / 2, # phase field tanh profiles |
| 17 | + X, (X + 1) / 2, # level set distance function |
| 18 | + X, (1.4 + np.tanh(4 * X / delta)) / 4, # composition profile |
| 19 | + X, X < 0, 'k--') # sharp interface |
21 | 20 |
|
22 | 21 | # legend
|
23 |
| -plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55)) |
| 22 | +plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), |
| 23 | + shadow=True, loc=(0.01, 0.55)) |
24 | 24 |
|
25 | 25 | ltext = plt.gca().get_legend().get_texts()
|
26 | 26 | plt.setp(ltext[0], fontsize=20)
|
|
32 | 32 | height = 0.1
|
33 | 33 | offset = 0.02
|
34 | 34 | plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2)
|
35 |
| -plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2) |
36 |
| -plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2) |
37 |
| -plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2) |
38 |
| -plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2) |
| 35 | +plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), |
| 36 | + 'k', linewidth=2) |
| 37 | +plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), |
| 38 | + 'k', linewidth=2) |
| 39 | +plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), |
| 40 | + 'k', linewidth=2) |
| 41 | +plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), |
| 42 | + 'k', linewidth=2) |
39 | 43 | plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24})
|
40 | 44 |
|
41 | 45 | # X-axis label
|
42 | 46 | plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20)
|
43 | 47 |
|
44 | 48 | # Left Y-axis labels
|
45 |
| -plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b', |
46 |
| - 'fontsize': 20}) |
| 49 | +plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b', 'fontsize': 20}) |
47 | 50 | plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20)
|
48 | 51 |
|
49 | 52 | # Right Y-axis labels
|
50 | 53 | plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20},
|
51 |
| - horizontalalignment='left', |
52 |
| - verticalalignment='center', |
53 |
| - rotation=90, |
54 |
| - clip_on=False) |
| 54 | + horizontalalignment='left', |
| 55 | + verticalalignment='center', |
| 56 | + rotation=90, |
| 57 | + clip_on=False) |
55 | 58 | plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
|
56 | 59 | plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
|
57 | 60 | plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})
|
58 | 61 |
|
59 | 62 | # level set equations
|
60 | 63 | plt.text(0.1, 0.85,
|
61 |
| - r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}' |
62 |
| - r'+ U|\nabla \phi| = 0$', |
63 |
| - {'color': 'g', 'fontsize': 20}) |
| 64 | + r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}' |
| 65 | + r'+ U|\nabla \phi| = 0$', |
| 66 | + {'color': 'g', 'fontsize': 20}) |
64 | 67 |
|
65 | 68 | # phase field equations
|
66 | 69 | plt.text(0.2, 0.15,
|
67 |
| - r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline ' |
68 |
| - r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } ' |
69 |
| - r'\frac{ \delta \mathcal{F} } { \delta \phi }$', |
70 |
| - {'color': 'b', 'fontsize': 20}) |
| 70 | + r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline ' |
| 71 | + r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } ' |
| 72 | + r'\frac{ \delta \mathcal{F} } { \delta \phi }$', |
| 73 | + {'color': 'b', 'fontsize': 20}) |
71 | 74 |
|
72 | 75 | # these went wrong in pdf in a previous version
|
73 | 76 | plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20})
|
|
0 commit comments