<jupyter_start><jupyter_text>20210326, verify Eq 4.7<jupyter_code>importlib.reload(slb)

ph = 1
rt1 = 1
rt2 = 0.1
theta = 0
uz, wz = 0, 1

phi_list = np.linspace(0, 2 * np.pi, 10, endpoint=False)
t_fra = slb.T1_fun(theta, ph, rt1, rt2)
n_fra = slb.N1_fun(theta, ph, rt1, rt2)
b_fra = slb.B1_fun(theta, ph, rt1, rt2)
ep = np.array([n_fra * ti for ti in np.cos(phi_list)]) + np.array([b_fra * ti for ti in np.sin(phi_list)])
x0 = slb.x1_fun(theta, ph, rt1, rt2)
x1 = x0 + ep * rt2
u1 = np.array((0, 0, uz)) + np.cross(np.array((0, 0, wz)), x1)
fft_u = np.fft.fft(2 * np.pi * u1, axis=0) / phi_list.size
# fft_u = np.fft.rfft(u1[:, 0]) * 2 / phi_list.size
usin = -fft_u.imag
ucos = fft_u.real
# print(u1[:, 0])
# print()
print(usin[:5])
# print()
print(ucos[:5])
# print()
# print(np.fft.irfft(fft_u))

# Eq 4.7 in Koens2018
t1 = 2 * (np.eye(3) + np.outer(t_fra, t_fra)) - np.outer(n_fra, n_fra) + np.outer(b_fra, b_fra)
t2 = -(np.outer(n_fra, b_fra) + np.outer(b_fra, n_fra))
t3 = 2 * (np.eye(3) + np.outer(t_fra, t_fra)) + np.outer(n_fra, n_fra) - np.outer(b_fra, b_fra)
t4 = -(np.outer(n_fra, b_fra) + np.outer(b_fra, n_fra))
tA = np.vstack((np.hstack((t1, t2)), np.hstack((t3, t4))))
tb = np.hstack((8 * ucos[1], 8 * usin[1]))
n = 1
t1 = np.eye(3) + np.outer(t_fra, t_fra)
fs, exitCode = gmres(t1, 2 * n * usin[1] / (2 * np.pi))
fc, exitCode = gmres(t1, 2 * n * ucos[1] / (2 * np.pi))
assert exitCode == 0
print(fs, np.dot(fs, t_fra), np.dot(fs, n_fra), np.dot(fs, b_fra))
print(fc, np.dot(fc, t_fra), np.dot(fc, n_fra), np.dot(fc, b_fra))
S = np.sqrt(ph ** 2 + 4 * np.pi ** 2 * rt1)
print(ph / S * (np.dot(fc, b_fra) - np.dot(fs, n_fra)) * np.pi, 2 * np.pi * rt1 / S * np.dot(fs, t_fra) * np.pi)
rt1 = 1
ph_list = np.linspace(0, 10, 100)
figsize = np.array((16, 9)) * 0.3
dpi = 500

fig, axi = plt.subplots(nrows=1, ncols=1, figsize=figsize, dpi=dpi, constrained_layout=True)
fig.patch.set_facecolor('white')
kappa = rt1 / (rt1 ** 2 + (ph_list / (2 * np.pi)) ** 2)
axi.plot(ph_list, kappa)
axi.set_xlabel('$\lambda / r_t$')
axi.set_ylabel('$\kappa$')

#################################################

figsize = np.array((16, 9)) * 0.15
dpi = 500
ph_list = 10 ** np.linspace(-1, 2, 100)

fig, axi = plt.subplots(nrows=1, ncols=1, figsize=figsize, dpi=dpi, constrained_layout=True)
# fig.patch.set_facecolor('white')
kappa = rt1 / (rt1 ** 2 + (ph_list / (2 * np.pi)) ** 2)
axi.loglog(ph_list, kappa)
axi.set_xlabel('$\lambda / r_t$')
axi.set_ylabel('$\kappa$')

33.26 / 19.05, 16 / 9<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23499005964214711, 'fraction_numerical': 0.060437375745526836, 'mean_word_length': 4.103448275862069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '332843', 'license': 'MIT', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1252, 'n_words': 261, 'path': 'infhelix/Koens2018Fourier.ipynb', 'repo_name': 'pcmagic/stokes_flow', 'size': '2515'}