# Finite Differencing Dynamic Boundary

1. Aug 3, 2015

### joshmccraney

Hi PF!

I'm using a finite differencing scheme to solve the following $$h_t = h h_{zz} + 2h_z^2$$ where the subscripts denote partial derivatives. The difficulty I'm facing is the boundary conditions are dynamic, and move with time $t$. This makes choosing a $\Delta z$ very difficult and unintuitive for me.

I have already developed a MatLab code that works pretty well but I feel my $\Delta z$ should change in time. If anyone knows any references or has advice on this issue of dealing with the $\Delta z$ please let me know.

Thanks so much!

Josh

2. Aug 4, 2015

### soarce

Try to change the time variable in order to achieve time independent boundary conditions.

3. Aug 4, 2015

### joshmccraney

I've already performed a similarity transform, which can actually be solved analytically under certain physical situations! But I'm trying to solve before the transform, so moving boundary conditions is all I can work with.

4. Aug 4, 2015

5. Aug 4, 2015

Thanks!

6. Aug 4, 2015

### Staff: Mentor

On a problem like this, what I would do is change variables, so that the z variable is as follows:

$$z^*=\frac{(z-z_{left}(t))}{(z_{right}(t)-z_{left}(t))}$$

You would have to transform the differential equation so that the partial derivative with respect to t is at constant z* versus z. But the advantage would be that the boundary conditions could always be applied at z* = 0 and z* = 1. Basically what you are doing is taking the complexity out of the boundary conditions and putting it into the differential equation where it can be handled more easily.

Chet

7. Aug 5, 2015

### joshmccraney

Chet, this is exactly what the department chair recommended. We then have $$\frac{\partial}{\partial z} = \frac{1}{z_r(t)-z_l(t)}\frac{\partial}{\partial z^*}$$Unfortunately at the moment I need to solve this problem in the $z$ space, not the $z^*$ space. This being said, later I'll look into this method. Would you mind if I asked you for advice then if I run into any trouble?

I do have a well-prepared strategy to proceed, but I'm wondering how to use finite differencing techniques to solve for the last spacial node in my domain? Currently I'm using a forward time centered space scheme. During each time loop, I use FD to recalculate each $h$ value, which gives me something like this $$\frac{h_i^{j+1}-h_i^j}{\Delta t} \approx h_i^j \left( \frac{h_{i+1}^j-2h_i^j+h_{i-1}^j}{\Delta z^2} \right) + 2\left( \frac{h_{i+1}^j-h_{i-1}^j}{2 \Delta z} \right)^2$$

where the subscript denotes space and the superscript denotes time. To find $h^{j+1}_{right}$ should I allow $h_{right}^j=0$ since that is what the right end was at time $j$ and then use a backward space technique for the first derivative term?

Last edited: Aug 5, 2015
8. Aug 5, 2015

### Staff: Mentor

You need actual boundary conditions at the two ends. What are the boundary conditions?

chet

9. Aug 6, 2015

### Strum

I am not quite sure I understand this method. What is $z_{left}$ and $z_{right}$? What happens if the moving boundary is part of the solution to the problem, as in a Stefan problem?

10. Aug 6, 2015

### Staff: Mentor

Josh,

Do you feel like you can explain this to Strum?

Chet

11. Aug 12, 2015

### Strum

So Chet. It doesn't look like Josh wants to chip in. Would you mind explaining how this would generalize to moving boundary problems?

12. Aug 12, 2015

### Staff: Mentor

zleft(t) and zright(t) are the time-dependent locations of the left- and right boundaries of the region being analyzed. Both boundaries are assumed to be moving. To complete the problem statement, Josh would have to provide the boundary conditions on h at these locations.

We would like to convert the problem statement from h = h (z,t) to h = h(z*,t) so that, in the z* - t framework, the boundaries are not moving. The transformation that I gave in post #6 will do this. But, one has to transform the differential equation properly. We start out by writing:

$$dh=\left(\frac{\partial h}{\partial t}\right)_{z^*}dt+\left(\frac{\partial h}{\partial z^*}\right)_{t}dz^*$$
Then we evaluate the partial derivatives in the differential equation as follows:
$$\left(\frac{\partial h}{\partial z}\right)_t=\left(\frac{\partial h}{\partial z^*}\right)_{t}\left(\frac{\partial z^*}{\partial z}\right)_t=\left(\frac{\partial h}{\partial z^*}\right)_{t}\frac{1}{(z_{right}(t)-z_{left}(t))}$$
$$\left(\frac{\partial h}{\partial t}\right)_z=\left(\frac{\partial h}{\partial t}\right)_{z^*} +\left(\frac{\partial h}{\partial z^*}\right)_{t} \left(\frac{\partial z*}{\partial t}\right)_z= \left(\frac{\partial h}{\partial t}\right)_{z^*} -\frac{z^*}{(z_{right}(t)-z_{left}(t))}\left(\frac{\partial h}{\partial z^*}\right)_{t} \left(\frac{dz_{right}}{dt}-\frac{dz_{left}}{dt}\right)$$

This is then substituted into the differential equation.

Hope this makes sense.

Chet

13. Aug 19, 2015

### joshmccraney

Thanks Chet! Sorry it has taken so long for me to thank you, but thanks so much!

14. Aug 21, 2015

### joshmccraney

And sorry Strum, I recently changed my email address, and that coupled with a summer vacation meant I was scarce; I'm sorry and didn't intend to be rude.

At the risk of sounding redundant to what Chet said, $z_{left}$ is the left boundary position of $z$ in the problem. If you imagine $z$ as the length of a candle, then perhaps $z_{left}$ is the height, and since the candle is presumable burning, $z_{left}$ would be getting smaller in time. Obviously the differential equation above, while it can be re-cast as the heat equation, is definitely not a candle; in fact, it's capillary corner flow! The same logic extends to $z_{right}$.

Chet's proposed change of variables implies $z^* \in [0,1]$. This is a common substitution in non-dimentionalizing pressure terms in navier-stokes equations, if you've studies those at all.

Again, I'm terribly sorry for the late delays, and the only reason I was able to respond to Chet was via my phone, which took some work.

And Chet, $h(z_{left}) = 1$ and $h(z_{right}) = 0$. I'll work with this some and let you know what I get, although it seems in your previous post you already did the heavy lifting.