# Tag Info

10

The best way to do this is (as you said) to just use the definition of periodic boundary conditions and set up your equations correctly from the start using the fact that $u(0)=u(1)$. In fact, even more strongly, periodic boundary conditions identify $x=0$ with $x=1$. For this reason, you should only have one of these points in your solution domain. An open ...

10

This phenomenon is often called "ringing" and plagues methods that are not $L$-stable. This can be seen in this motivating example from Hairer & Wanner (1999) "Stiff differential equations solved by Radau methods". Consider the equation $$\dot y = -50 (y - \cos t)$$ and apply explicit Euler with time step near the stability limit, implicit midpoint ...

8

This makes no sense. Let us assume that $g(z)=0$ has exactly one solution $z=z^\ast$, then your boundary condition $g(u|_\Gamma)=0$ is equivalent to $u|_\Gamma=z^\ast$, i.e., a linear Dirichlet condition. On the other hand, if there are multiple solutions of $g(z)=0$, then you are saying that the value $u|_\Gamma$ could have multiple values, but this does ...

6

I'm going to write this as an answer although it doesn't directly answer the question. Plugging the second equation and the third equation into the first, and plugging the third into the second, together give: \begin{align} \frac{\partial^2 c}{\partial t^2} &= \frac{\partial^2}{\partial x^2}\frac{\partial c}{\partial t} + \frac{\partial b}{\partial ... 6 A two-point flux like this is not convergent if the mesh is not "orthogonal", in the sense that the edge/face between two cells is orthogonal to the line segment joining the cell centroids. If your mesh is orthogonal, you would use the distance between centroids for h_{ij} above. If you would like a method to work on more general meshes within the cell-... 6 The solutions for the equation are in\psi \in \mathbb{C}^{3M}\times\mathbb{R}^+ \enspace .$$If the number of electrons is small enough you can just use any traditional method. Like a domain discretization method (Finite Difference, Finite Element, Boundary Element), or a pseudospectral method. Since solving this equation is not more difficult than ... 6 Such problems (sometimes called lateral Cauchy problems) are in general not well-posed (meaning they either lack a solution, or there are infinitely many of them, or the solution is unstable under perturbations of the boundary conditions). For parabolic (or dissipative) equations, it makes sense to study the stationary limit (simply omit the term u_t in ... 5 A nice reference for this is Chapter 10 of LeVeque's finite difference book. Of course, it only covers basic finite difference approaches, and there are plenty of others (all within the method of lines framework). The method of lines is indeed applicable in multiple dimensions, and two-dimensional problems are discussed in the reference just given. Most ... 5 As Jed says, limiters are not usually an efficient approach for parabolic/elliptic problems. WENO is much more expensive than simple piecewise-polynomial interpolation, so I would first try vanilla interpolation and see if you actually have oscillations. WENO is really designed for situations in which the solution is discontinuous; yours is not. In case ... 5 The sources you are looking at are all looking at hyperbolic problems. The issues are different for elliptic problems and "limiters" are generally not the preferred tool. I outlined some of the methods and tradeoffs in this answer. As for time integration, L-stability is the important property to prevent bad overshoots for parabolic systems. ... 5 Parabolic PDE's such as those in the book can usually be solved using the Method of Lines. First you create some mesh for the x direciton. I will assume that you used some uniform spacing since the plots don't show any characteristics that show the need of non-uniformity. Next you recast your equations with only the time derviative on the left hand side ... 5 Don't worry about programming skills, everyone's a beginner at some point. It's a good start actually. I'm just going to give some hints assuming that this is an exercise. Actually, choward's answer is complete, this is just a rephrasing of his suggestions in, I hope, a more beginner friendly language. So, if you do accept an answer it should be his ;) Your ... 5 First off, the PDE can be rewritten instead as$$\frac{\partial C}{\partial t} = \frac{\partial}{\partial x}C\frac{\partial C}{\partial x}$$or, by applying the product rule in reverse again, as$$\frac{\partial C}{\partial t} = \frac{1}{2}\frac{\partial^2}{\partial x^2}C^2.$$This equation is often referred to as the porous medium equation or the slow ... 4 Let$$A = \left(\begin{array}{ccccc} -2 & 1 \\ 1 & -2 & 1 \\ &&\ddots\\ &&1 & -2 & 1\\&&&1&-2\end{array}\right)$$be the standard Laplacian matrix. Your system can be written in traditional time-stepping form as$$u^{n+1} = \left(I + \frac{h}{(h')^2}A\right)u^n \doteq Mu^n,$$where$$u^n = \left(\begin{...

4

As Hui pointed out above, to apply Neumann boundary conditions correctly you should utilize ghost points and extend your $n^{th}$ order discretisation stencil to your domain boundaries. Utilising forward/backward difference or extrapolation at the boundary will degrade your solution. Assuming a $2^{nd}$ order central difference scheme the Neuman boundary ...

4

The two problems you mention indeed have different roots. The first one is a consequence of numerical dispersion and the other one of numerical instability. Let me elaborate a little: Problem #1: The PDE in question is non-dispersive, i.e. waves of any frequency and wavenumber will travel equally fast - at speed $a$. However, after discretisation, this is ...

4

You would need to linearize the problem. I prefer to do it before discretization but it's possible to do also after discretization. (I'm a bit skeptical of linearization after discretization because I have never looked into the details. In general, discretization and linearization steps do not commute.) In the following I assume that the equation is actually ...

4

And just a few minutes after asking I found an answer. The procedure above is called "updating LU". This question has a nice generic answer with links to other more specific questions. full rank update to cholesky decomposition So the short answer is no, in my case. You cannot update LU decomposition with a full rank matrix in less than $O(n^3)$, ...

3

The confusion was the misleading variables $F_{j-1/2}$ and $F_{j+1/2}$ with f_left and f_right, which are completely different. f_left and f_right are the interpolated fluxes at a one single face. They must be then upwinded using the advection speed to compute the Flux at a specific cell face. Which means if $C>0$ we take f_left, otherwise we take ...

3

I think that one key point to understand the answers is that, with the parabolic PDE that you wrote, we have some control on the "quantity of $u$", i.e. $\int_{\Omega} u$: If you integrate the PDE, you have $$\int_{\Omega} u_t = \int_{\Omega} \Delta u + \int_{\Omega} f(x,t) = \int_{\Omega} f(x,t)$$ because $\int_{\Omega} \Delta u = \int_{\partial \Omega} \... 3 Providing a whole detailed solution is out of the scope of this site, but asking for references is on-topic, so here is what I would suggest to get started: There are many good books on finite difference methods (for instance, "Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems" by LeVeque, or ... 3 You want to solve for 3 to 10 particle systems (3D per particle)? As far as I am aware, mean field theories do not work especially well for so few particles, but it seems there has been DFT work on diatomic molecules. Is this a system where Born-Oppenheimer is valid? If so, I might be inclined to expand the electronic wavefunction using a linear combination ... 3 The Crank-Nicolson discretization of this equation will read $$\frac{T^n-T^{n-1}}{\Delta t} = \frac 12 \left[ \partial_x \left((T^n)^{5/2} \partial_x T^n\right) + \partial_x \left((T^{n-1})^{5/2} \partial_x T^{n-1}\right) \right]$$ which is a nonlinear, time-independent, elliptic partial differential equation in$T^n$. The way to solve such ... 3 Yes, with Dirichlet boundary conditions you always have exponential convergence to the staedy state. Any PDE book will have a proof. For a nice explanation from a numerical perspective, see chapter 2 of LeVeque's FDM book. 3 So after browsing the paper a bit, I think that the answer is essentially what Christian Clason stated in his comment. It seems that the original question refers to the statement just above Equation (3) in the article linked by kwesi : There, the authors say that the advection-diffusion equation (Equation (1) in the paper)$\frac{\partial c}{\partial t} + \...

3

You really don't want to solve the heat equation with an explicit time stepping scheme. You need to choose the time step so incredibly small that you won't make any progress towards the end time. (Explanation in lecture 27: http://www.math.tamu.edu/~bangerth/videos.html .)

3

While i agree with Wolfgang that its best to choose Crank-Nicolson time stepping, i think it is incorrect to assert explicit time stepping results in 'incredibly small' time steps or even to suggest your script is not functioning because of explicit time stepping. You can make it work just fine, but you need to get your discretization correct and to ...

3

So you can solve this problem with an Explicit time stepping scheme, as nluigi mentioned, but it comes at a cost just as Wolfgang stated. In the problem statement, the problem is formulated using an Explicit Euler time stepping scheme with (arguably) a second order central difference. The stability region of Explicit Euler can be found to be: \Delta t \...

3

So your first big issue is one you bring up in point (4), where you say you get the error 'u(0, t[m]) = 0 "can't assign to function call"'. You're trying to store data by assigning data to a function. That won't work. The way you're implementing this code, you actually should make u(x,t) be represented by a 2-D array that can be accessed via u[m][j], where m ...

3

No, you did not overlook anything. You actually have to know specific $g_L(t)$ - boundary condition at the left boundary ($x=-1$) $g_R(t)$ - boundary condition at the right boundary ($x=1$) $\eta(x)$ - initial condition at $t=0$ So, depending on what those functions are, you will get different solutions. The assignment is just given in general terms. When ...

Only top voted, non community-wiki answers of a minimum length are eligible