My History in Pattern formation in Physics

Because I’m getting back to looking at what I looked at during my PhD, I mentioned I’d take the readers along on that journey (avoiding talking about new research until a preprint is released).

What I focused on during was non-linear dynamics during both my postdoc and PhD.
For the postdoc, I dealt with topics related to biophysics and scholarpedia (link on pattern formation) is a great resource to learn from for that. Although the postdoctoral research wasn’t related to my PhD work, it broadly was related to the topic of Pattern formation.

My discipline grew out of the success of
Phase field models, models used to study various kinds of phase transitions. Phase field models were preceded by other pattern formation models to which they are related, the Cahn-Hilliard model</a and the Swift-Hohenberg Model. The former model keeps the most relevant terms for studying phase separation in binary materials and has even been used for the concentration term in alloy phase-field studies (though for quantitative as opposed to phenomenological work, more sophisticated approximations are often needed). The latter model’s connection is a little more surprising.

The Swift-Hohenberg model can be used to study Bernard Cells (fluid convection models — see previous link) and diblock polymer pattern formation. The stable phases of this model include shapes in some ways similar to some kinds of metallic crystals. New models (to be discussed later) related to classical density functional theory can be coarse-grained (averaged over in space/time) to derive phase-field models (more on that later).

Advertisements

Quick update — new approach to blog

Hi, I’ve still got to add my attempt at the last blog entry. Other than that, my focus will switch to making accessible various research topics that I would like to work towards (mainly things that are a continuation of my PhD). I hope that people from all walks of life are able to learn something from at least some of the future entries.  I would love to review some books, which might be more approachable, but working on these now will take away from finishing some projects I have in mind. Will write again soon, take care!

A little math puzzle from physics!

A couple friends of mine posted this puzzle on social media and I thought it was worth sharing:
colloding blocks related to pi example

I gave a it a try and got the relation to scale correctly, though off by a constant factor, though I was venturing into complex numbers in a way I hadn’t used them in maybe 10 years, so there could be good or bad reasons for the coincidence. Nonetheless when I have time to post my attempt I will because it illustrates a few straightforward mathematical tools which are useful in other problem.

If you are interested in the solution, see either or both of the following videos:
colliding blocks related to pi proof 1
colliding blocks related to pi proof 2

Another interlude – Introductory history session on non-Euclidean geometry

After having written my last entry, I was thinking what I could write about next. There’s the possibility of finishing what I started on Fractal landscapes or Navier-Stokes. I think I’ll read up more on the topic first before posting more (though possibly in an unrelated direction), though I might be working on some things related to my PhD in the near future in which case the topics might completely change. Regarding new topics, I was at first thinking looking at the FFT and linking to it various data structure use or some such, and then I was working on a mathematically interesting dynamics problem. The second problem involves recursion in some sense so I thinking of using induction when I remembered that it involves a system of linear equations, meaning it would be essentially solving an eigenvalue problem (search it and you’ll find good lecture notes and other interesting links). I would guess that this problem would take a few hours to solve. As it so often happens, I haven’t had a couple consecutive hours to dedicate (though that shouldn’t be discouraging for a young reader; I could see an undergrad with a solid physics and mathematics background — that includes engineering students — finishing the problem in under a half hour). Fortunately, I came across this set of videos on non-Euclidean geometry (I forget if a friend shared it or if it was an AI recommendation — note that there’s something from Khan academy on Euclid as well which piqued my interest, but I didn’t get to it):

Here are the links to the other videos in the series:
https://www.youtube.com/watch?v=vUWKMo5scKY
https://www.youtube.com/watch?v=H74AayZkpXg
https://www.youtube.com/watch?v=i5goUkT1irw
https://www.youtube.com/watch?v=RJHi7xJV7QY

This group also has a number of videos on other good topics. To the series above, there’s also a follow-up video relating to quantum computing: https://www.youtube.com/watch?v=iol5936dZho

These videos were interesting not only because of random reading done on the history of mathematics/physics (not to mention the degrees I worked on), but also because of the project I chose to do about Gauss in my first year intermediate German undergrad class about 15 years ago.  I hope it’s also enjoyable for you too.

Some thoughts about Navier-Stokes for beginners

The Navier-Stokes equation (some information also found on  Wolfram or NASA) is the fundamental equation of fluid mechanics.  Its form might be intimidating, but the terms for the inviscid, incompressible Navier Stokes are relatively easy to understand physical from applying Newton’s second law.

Imagine an infinitesmal (rectangular) “parcel” (collection of particles small compared to the scale of interest, but containing enough particles that that continuum model is well approximated — i.e., statistical fluctuations are relatively unimportant) of fluid of volume \delta V = \delta x \delta y \delta z.  Its mass is \delta m = \rho \delta V.  According to the second law (assuming that the parcel is a fixed unit), \delta m \frac{d \vec{u}}{d t} = \Sigma \vec{F}, where \Sigma \vec{F} is the sum of the forces on the fluid parcel.

What forces are acting on the parcel?  There’s gravity, other body forces (e.g., electromagnetic), there’s pressure (force of the surrounding fluid parcels on the parcel), and there’s a friction force — note that the pressure and friction forces are normal and tangentially acting surface forces respectively. Because we are dealing with an inviscid fluid, the friction forces are zero. The force of gravity on the parcel is \delta m \vec{g} (roughly 9.8 \frac{m}{s^2} [downward] on earth’s surface). For simplicity, let’s skip the other body forces, but they would be treated similarly to gravity.  The net pressure force on the particle (at position (x, y, z)) is \delta \vec{F_p} = (p(x+\delta x, y, z) - p(x, y, z))\delta y \delta z \hat{x} + (p(x, y+\delta y,z ) - p(x, y, z))\delta x \delta z \hat{y} + (p(x, y,z +\delta z) - p(x, y, z))\delta x \delta y \hat{z}.

Combining all of these equations gives:

\delta m \frac{d \vec{u}}{d t}= \delta m \vec{g} + (p(x+\delta x, y, z) - p(x, y, z))\delta y \delta z \hat{x} + (p(x, y+\delta y,z ) - p(x, y, z))\delta x \delta z \hat{y} + (p(x, y,z +\delta z) - p(x, y, z))\delta x \delta y \hat{z}

or more simply put:

\frac{d \vec{u}}{d t}= \vec{g} + \frac{p(x+\delta x, y, z) - p(x, y, z)}{\delta x \rho} \hat{x} + \frac{p(x, y+\delta y,z ) - p(x, y, z)}{\delta y \rho} \hat{y} + \frac{p(x, y,z +\delta z) - p(x, y, z)}{\delta  \rho} \hat{z}.

Now all of the terms in the simplified pressure term (assuming a small enough particle) is a derivative in the direction of the unit vector it is multiplied by:

\frac{p(x+\delta x, y, z) - p(x, y, z)}{\delta x \rho} \hat{x} = \frac{1}{\rho}\frac{\partial p}{\partial x} \hat{x}.

Summing these together gives a gradient:

\nabla p =\frac{\partial p}{\partial x} \hat{x} + \frac{\partial p}{\partial y} \hat{y} + \frac{\partial p}{\partial z} \hat{z}

Putting this all together gives:

\frac{d \vec{u}}{d t}= \vec{g}+ \frac{1}{\rho} \nabla p

Now what about the convection term?  The equation traces a fluid parcel and not the velocity at a given location.  The full derivative is separated into two parts: \frac{d \vec{u}}{d t} = \frac{\partial \vec{u}}{\partial t}+\vec{u} \dot \nabla \vec{u}.  The two terms are: the local velocity rate of change of velocity (nearby parcels will have approximately the same \frac{\partial \vec{u}}{\partial t}) plus the velocity of parcels transported into it \vec{u} \dot \nabla \vec{u} (all local parcels have approximately velocity \vec{u} and change according to the small differences in local velocity).  There will be more on the Navier-Stokes in a future post.

 

 

 

 

 

 

 

Follow-up on Considering statistics in health-related scenarios

I’ve moved this month, so I haven’t had much time to write. Here’s something a little interesting about reasoning in statistics. If you remember this post from a while ago, I had some contradiction show up at the end. Natural frequencies are easier to deal with than probabilities: see this article, for example (this problem and pedagogical considerations have been studied (and may still be studied a while)). A google search will inform you of what you need to know. I still need to try out a new approach to if the “contradiction” is there or if it’s due to “rounding errors”/”approximation” errors in various places.

A quick presentation of generating fractal landscapes

Although this code is far from complete, it can still serve as an example of starting an exploratory scientific project.  It is well-known in some parts of the geophysics community that power laws are ubiquitous in the relations.  For example, treating the altitude in a landscape as a function, the spectrum reveals a power law (the correlation function as well) (See Chapter 7 of Fractals and Chaos in Geophysics and Geology by Turcotte). One thought to generate an artificial landscape is to start with white noise and then filter its spectrum with a power law filter, thereby smoothing it (though there are some limitations which might be covered in a future blog post, which I covered during my M.Sc. ca. 10 years ago …). You can read up more on this here and here.

Here is sample code to show that power scaling of altitude in a simulated landscape is obeyed:

# pieces of code adapted from: 
# https://stackoverflow.com/questions/50314243/fourier-transform-in-python-2d
# import libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import fft2, ifft2
from mpl_toolkits.mplot3d import Axes3D
import random
N_x, N_y = 128, 128
range_x, range_y = np.arange(N_x), np.arange(N_y)

# real space grid vectors
xv, yv = (range_x - 0.5 * N_x), (range_y - 0.5 * N_y)

x, y = np.meshgrid(range_x, range_y, sparse=False, indexing='ij')

f = np.random.normal(0,1, [N_x, N_y])

F= fft2(f)

"""PLOTTING"""
fig = plt.figure()
ax = Axes3D(fig)
surf = ax.plot_surface(x,y, np.abs(f), cmap='viridis')
# for other plots I changed to
fig2 = plt.figure()
ax2 =Axes3D(fig2)
surf = ax2.plot_surface(x, y, np.abs(F), cmap='viridis')
plt.show()
Example result of white noise and corresponding spectrum

Example result of white noise and corresponding spectrum

Example corresponding spectrum of instance of white noise

Example corresponding spectrum of instance of white noise

k_x, k_y = np.roll(np.arange(-N_x/2+1, N_x/2+1), int(N_x/2+1)), np.roll(np.arange(-N_y/2+1, N_y/2+1), int(N_x/2+1))
# reformat this; it did not copy and paste as expected
def scale_Matrix(matrix, N1, N2, beta):
  new_matrix = np.array([[matrix[i,j].real if k_x[i] == 0 and k_y[j] == 0 else 
  matrix[i,j].real*(math.pow(1./math.sqrt((k_x[i]**2+k_y[j]**2)),beta))
  for j in range(0,int(N_y))] for i in range(0,int(N_x))], np.float32)
  new_matrix = new_matrix + complex(0,1) * np.array([[matrix[i,j].imag if k_x[i] == 0 and k_y[j] == 0 else 
  matrix[i,j].imag*(math.pow(1./math.sqrt((k_x[i]**2+k_y[j]**2)),beta))
  for j in range(0,int(N_y))] for i in range(0,int(N_x))], np.float32)
  return new_matrix
H = 0.25
F_scaled = scale_Matrix(F,N_x, N_y, 2 * H + 1)
f_trans = ifft2(F_scaled)
"""PLOTTING"""
fig = plt.figure()
ax = Axes3D(fig)
surf = ax.plot_surface(x,y, np.abs(f_trans), cmap='viridis')
# for other plots I changed to
fig2 = plt.figure()
ax2 =Axes3D(fig2)
surf = ax2.plot_surface(x,y, np.abs(F_scaled), cmap='viridis')
fig3 = plt.figure()
ax3 =Axes3D(fig3)
surf = ax3.plot_surface(np.log(x + 1e-2),np.log(y + 1e-2), np.log(np.abs(F_scaled)), cmap='viridis')
plt.show()
Simulated topography (coloured Gaussian noise)

Simulated topography (coloured Gaussian noise (beta = 1.5))

Spectrum of coloured white noise (little visible)

Spectrum of coloured white noise (little visible)

Coloured noise on log-log scale

Coloured noise spectrum on log-log-log scale

(Note that the plots are much smoother than the white-noise ones.)

#1d sections fourier transform
F_scaled_y = [np.sum(np.abs(F_scaled[i,1:int(N_y)])**2) for i in range(1,N_x//2)]
F_scaled_x = [np.sum(np.abs(F_scaled[1:int(N_x),i])**2) for i in range(1,N_y//2)]
# match exponents
plt.loglog(range_x[1:int(N_x/2)],F_scaled_x)
plt.loglog(range_x[1:int(N_x/2)],np.reciprocal([0.00004*math.pow(1.0*range_x[i],2.0) for i in range(1,int(N_x/2))]))
plt.show()

#and match exponents ... do a line of best fit
plt.loglog(range_y[1:int(N_y/2)],F_scaled_y)
plt.loglog(range_y[1:int(N_y/2)],np.reciprocal([0.00004*math.pow(1.0*range_y[i],2.0) for i in range(1,int(N_y/2))]))
plt.show()
Averaged spectrum along x (note the k^-1.5 power law)

Averaged spectrum along x (note the k^-1.5 power law)

Averaged spectrum along y (note the k^-1.5 power law)

Averaged spectrum along y (note the k^-1.5 power law)

The limitations of what has been outlined here (ignoring the limitations of the physical model) are as follows:

  • There is no scale indicated in the code.  This was done for simplicity.  https://stackoverflow.com/questions/50314243/fourier-transform-in-python-2d has some details about how scale can be implemented.
  • The code needs to be adapted for easy automation, so that it can be used (the scaleMatrix function is a step on the way there, but there needs to be more)
    • The coding practices leave room for improvement.  This code was written in a Jupyter notebook.   It can be adapted to *.py files/modules.  Making them work well-together, which includes concepts like “encapsulation.”  For example, k_x is defined as a global variable and only used in the scaleMatrix function.
  • An explanation of the physical meaning is lacking.  I was planning on using the concepts outlined in this post to make clear what the filtering is doing, which could follow subsequently.  As well, there is a chapter in a Delphi book whose name I’ve forgotten on generating fractals in a much more “physical” way (iteratively raise and lower elements in the topography) which I can compare with this (hopefully an upcoming post) to illustrate what’s happening on a physical level better.