- #1

hkcool

- 11

- 0

Preface: just want to start by saying that I'm 99% sure I'm having a stability issue here in the way I'm implementing the time step since if I set [itex]\Delta t \ge 1[/itex] then for any stopping time > 1, the algorithm works as it should. For time steps smaller than 1, as the time step gets smaller and smaller the DG solution diverges to the point where the system is singular. This seems REALLY weird to me since I always thought that the method becomes unstable if you take the time step too large.I'm doing a small undergrad research project for a professor and the goal is to implement the DG method for a time-dependent 1D problem:

[tex]

\frac{\partial u(x,t)}{\partial t} - \frac{\partial}{\partial x}\left(\alpha(u) \frac{\partial u(x,t)}{\partial x}\right) = f(x,t)

[/tex]

My code works for the non-time dependent case for all cases I could think to test for. Anyway, I'm only supposed to modify the code to add on the time-dependent term:

[tex]

\frac{\partial u}{\partial t} \approx \frac{u^{i} - u^{i-1}}{\Delta t}

[/tex]

Multiply by the test function [itex]\phi(x)[/itex] and integrate:

[tex]

\frac{1}{\Delta t}\left( \int_{\Omega}{u^{i}\phi(x)} - \int_{\Omega}{u^{i-1}\phi(x)} \right)

[/tex]

Anyway I add these terms to the Jacobian as necessary ([itex]u^{i-1}[/itex] is a known constant so it doesn't contribute?). If we call [itex]\int_{\Omega}{u^{i}\phi(x)}[/itex] the mass matrix M, then essentially what I'm doing is adding [itex]\frac{1}{\Delta t}M[/itex] to the Jacobian and then both terms to the F(u) in the system.

Now, the weird part is that my code works if [itex]\Delta t \ge 1[/itex] and gives me the correct solution every time, but as soon as [itex]\Delta t < 1[/itex] then the solution gets a bit odd (BC's are still correct but the 'curvature' is not). And if I make the time step small enough then I just get the error that my Jacobian is singular/close to singular.

I know it's hard to say without looking at the code (and I don't want anyone to do that -- I genuinely want to figure this out on my own) but is the process I described above for time modification correct?

[tex]

\frac{\partial u(x,t)}{\partial t} - \frac{\partial}{\partial x}\left(\alpha(u) \frac{\partial u(x,t)}{\partial x}\right) = f(x,t)

[/tex]

My code works for the non-time dependent case for all cases I could think to test for. Anyway, I'm only supposed to modify the code to add on the time-dependent term:

[tex]

\frac{\partial u}{\partial t} \approx \frac{u^{i} - u^{i-1}}{\Delta t}

[/tex]

Multiply by the test function [itex]\phi(x)[/itex] and integrate:

[tex]

\frac{1}{\Delta t}\left( \int_{\Omega}{u^{i}\phi(x)} - \int_{\Omega}{u^{i-1}\phi(x)} \right)

[/tex]

Anyway I add these terms to the Jacobian as necessary ([itex]u^{i-1}[/itex] is a known constant so it doesn't contribute?). If we call [itex]\int_{\Omega}{u^{i}\phi(x)}[/itex] the mass matrix M, then essentially what I'm doing is adding [itex]\frac{1}{\Delta t}M[/itex] to the Jacobian and then both terms to the F(u) in the system.

Now, the weird part is that my code works if [itex]\Delta t \ge 1[/itex] and gives me the correct solution every time, but as soon as [itex]\Delta t < 1[/itex] then the solution gets a bit odd (BC's are still correct but the 'curvature' is not). And if I make the time step small enough then I just get the error that my Jacobian is singular/close to singular.

I know it's hard to say without looking at the code (and I don't want anyone to do that -- I genuinely want to figure this out on my own) but is the process I described above for time modification correct?

Last edited: