This site is being phased out.

Christopher Means

From Mathematics Is A Science
Jump to navigationJump to search

Week 1 Progress

I am working on the dual simulation of heat transfer, meaning the heat moves around a graph. It goes between vertices (stations) via the edges (pipes). Read about the dual grid.

With help from Zach Ahlers, I was able to construct a simulation with random k-values for each wall. For simplicity, I have set the values for the outermost group of cells to be zero on all sides. This way, the simulation will run exactly as if the lattice were 2 elements smaller, except that it will still be able to take a temperature value for the neighbor cells into account.

I've completed the dual simulation. My next step will be to add in correction factors. I've had a hurdle in my way in that no heat was being transferred. I realized after many, many hours of debugging that in calculating temp change I multiplied the sum of effects from the four neighbors by 1/4 to find the average. Unfortunately, I hadn't realized this is an integer division resulting in 0, and cancelling out the transfer.


Week 2 Progress

I will now be starting on the discrete wave equation.

My current goal is to create a multi-lattice simulation, similar to that of the heat equation that we were able to construct.

Professor Saveliev provided me with these links to give me a starting point. I'll keep everyone posted on my progress.

Wave equation

Using EXCEL Spreadsheets to Solve a 1D Wave Equation

I've looked into the physics of this project and come up with an equation I will use to model it. Each molecule in the medium transferred some of it's energy to it's neighbors. These molecules, in turn, disperse their energy in a similar fashion. An important thing to remember in any wave model is that the average depth of the medium, and the volume, is constant. That is to say that for an increase in potential energy at one point, another point has to have an equal decrease. The most simple way to ensure this is the case would be to keep the amount of energy leaving a molecule equal to the amount gained by it's neighbor. This should not be hard to keep track of.

This is how you "discretize" the PDE...

The continuous wave equation can be expressed as the second time derivative of f equal to some constant squared multiplied by the Laplacian of f. In the discrete model, I will start on a square lattice, so each index on the grid will have four neighbors in space, as well as two in time. To reconfigure the continuous equation into a discrete one, we simply translate to discrete differentials. The first order time derivative is computed discretely as the difference of $f$ at time $t$ and $t-1$, or $t+1$ and $t$. The second order derivative, which is what the wave equation uses, is a difference of differences. It can be computed by $f$ at time $t$ minus $f$ at $t-1$ subtracted from $f$ at $t+1$ minus $f$ at $t$, resulting in $f|t+1|+f|t+1|+2f|t|$... hmmm..

Apply a similar method to compute the Laplacian. $$f(x+1,y, t) + f(x-1, y, t) + f(x, y+1, t) + f(x, y-1, t) - 4*f(x, y, t).$$

The final step in finding the discrete wave equation is taking care of the constant. This will be treated the same way we treated the k values for heat. The only restriction is that c must be less than one.

Continuous:

\[ \frac{ \partial^2 \mathbf{F}}{\partial t^2} = \mathbf{c^2} \nabla^2 \mathbf{F} \]

Discrete:

\[ \mathbf{F}_{(x, y, t+1)} + \mathbf{F}_{(x, y, t-1)} - 2*\mathbf{F}_{(x, y, t)} = \mathbf{c}^2 *( \mathbf{F}_{(x+1, y, t)} + \mathbf{F}_{(x-1, y, t)} + \mathbf{F}_{(x, y+1, t)} + \mathbf{F}_{(x, y-1, t)} - 4*\mathbf{F}_{(x, y, t)} ) \]

The model will calculate the wave height for the next time step using this formula:

\[ \mathbf{F}_{(x, y, t+1)} = 2*\mathbf{F}_{(x, y, t)} - \mathbf{F}_{(x, y, t-1)} + \mathbf{c}^2 *( \mathbf{F}_{(x+1, y, t)} + \mathbf{F}_{(x-1, y, t)} + \mathbf{F}_{(x, y+1, t)} + \mathbf{F}_{(x, y-1, t)} - 4*\mathbf{F}_{(x, y, t)} ) \]


Progress through Week 5

As of now I have made the additions of dampening, both linear and non-linear, and a few obstacles. I attempted to create multiple threads to handle the simulation in order to increase speed and maneuverability. Unfortunately, this topic is a bit beyond my skill set, and I was unable to get it to work without catastrophic error. To see the dampened wave equation, please refer to my colleague's entry on the subject: Jack Goodman.


Week 6

The group has decided that it is necessary to compare the simulation's results to a known solution to the wave equation on a square membrane, to confirm that the simulation converges to the continuous case.

 The general solution to the 2D wave equation is:

\[ \ \mathbf{F} = \displaystyle\sum\limits_{m=1}^\infty \ \displaystyle\sum\limits_{n=1}^\infty \ sin(\mathbf{m \pi x}) sin(\mathbf{n \pi x}) \ (\mathbf{A}_{mn}cos(\mathbf{\omega_{mn}t}) + \ \mathbf{B}_{mn}sin(\mathbf{\omega_{mn}t})) \] \[ \omega \ is \ the \ frequency \ of \ each \ point's \ one \ \ dimensional \ oscillation \]

 The unknown coefficients are given by:

\[ \mathbf{A_{mn} = \frac{4}{n^2} \int_0^n \int_0^n \ f_{(x,y)}sin(m \pi x) sin(n \pi y) dx dy} \] \[ \mathbf{B_{mn} = \frac{4}{\omega_{mn} n^2} \int_0^n \int_0^n \ g_{(x,y)}sin(m \pi x) sin(n \pi y) dx dy} \]

 The function Omega represents the dispersion relation:

\[ \mathbf{ \omega_{mn}^2 } = \mathbf{C^2 (m^2 + n^2) \pi ^2} \]

 The boundary condition we will use is  (note: The lattice size is nxn):

\[ \mathbf{F_{(x,y,t)} = 0 } \ \ \ \ \ for \ x=0, \ x=n, \ y=0, \ y=n \]

 And the initial value is given by:

\[ \mathbf{F_{(x,y,0)} = f_{(x,y)}} \ \ \ \ \ for \ 0<x<n \ and \ 0<y<n \] \[ \frac{ \partial \mathbf{F} }{\partial t} \mathbf{_{(x,y,0)}} = \mathbf{g_{(x,y)}} \ \ \ \ \ for \ 0<x<n \ and \ 0<y<n \]