-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequilibrium_profile.py
More file actions
37 lines (30 loc) · 1.17 KB
/
equilibrium_profile.py
File metadata and controls
37 lines (30 loc) · 1.17 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
# This script recreates figures 4 in Moelans et al. Phys Rev. B 78, 024113 (2008),
# which represents the equilibrium profiles of the phase field variables.
# TODO: Moelans says that she had to do a numerical integration to calculate
# the profiles for different values of gamma. Only for gamma = 1.5 will you get
# what is currently displayed.
from __future__ import division
from math import tanh, sqrt
from matplotlib.pyplot import plot, xlim, ylim, xlabel, ylabel, title, legend, show
from numpy import arange
def calcEtai(x, m = 1, kappa = 2):
return float(1 / 2 * (1 - tanh(sqrt(m / (2 * kappa)) * x)))
def calcEtaj(x, m = 1, kappa = 2):
return float(1 / 2 * (1 + tanh(sqrt(m / (2 * kappa)) * x)))
gamma = [1, 1.5, 2, 4]
eta_i = []
eta_j = []
distance = []
etai_plus_etaj = []
etas = []
distances = []
for x in arange(-10, 10, 0.01):
distance.append(float(x))
eta_i.append(calcEtai(x))
eta_j.append(calcEtaj(x))
#for i in range(0, len(eta_i)):
# etai_plus_etaj.append(eta_i[i] + eta_j[i])
plot(distance, eta_i, 'r-', label=r'$\eta_i$')
plot(distance, eta_j, 'b-', label=r'$\eta_j$') # TODO: figure out how to label two lines as the same entry
legend()
show()