28

The equation you're solving does not permit right-going solutions, so there is no such thing as a reflecting boundary condition for this equation. If you consider the characteristics, you'll realize that you can only impose a boundary condition at the right boundary. You are trying to impose a homogeneous Dirichlet boundary condition at the left boundary, ...


19

Starting with the advection equation is conservative form, $$ \frac{\partial u}{\partial t} = -\frac{\partial (\boldsymbol{v} u)}{\partial x} + s(x,t) $$ The Crank-Nicolson method consists of a time averaged centered difference. $$\frac{u_{j}^{n+1} - u_{j}^{n}}{\Delta t} = -\boldsymbol{v} \left[ \frac{1-\beta}{2\Delta x} \left( u_{j+1}^{n} - u_{j-1}^{n} \...


16

I think that one of your problems is that (as you observed in your comments) Neumann conditions are not the conditions you are looking for, in the sense that they do not imply the conservation of your quantity. To find the correct condition, rewrite your PDE as $$ \frac{\partial \phi}{\partial t} = \frac{\partial}{\partial x}\left( D\frac{\partial \phi}{\...


16

The fundamental quantity in transport is the flux, $\mathbf v u$ for advection. The divergence theorem states that $$\int_\Omega \nabla\cdot (\mathbf v u) = \int_{\partial \Omega} (\mathbf v u) \cdot \mathbf n . $$ An equation is conservative when it is preserves this equality. Dropping to 1D with $\Omega = (a,b)$ and using the equation $u_t + (\mathbf v ...


15

This is a well-framed question and a very useful thing to understand. Korrok is correct to refer you to von Neumann analysis and LeVeque's book. I can add a bit more to that. I'd like to write a detailed answer, but at the moment I only have time for a short one: With $\alpha=\beta=1/2$, you get a method that is absolutely stable for arbitrarily large ...


12

Sloede's response is very thorough and correct. I just wanted to add a few points to make it easier to grasp. Basically, any wave equation has an inherent wave speed and direction. For a one-dimensional wave equation: $$ u_t + a u_x = 0 $$ the wave speed is the constant $a$ which determines not only the speed at which the information is propagating in the ...


10

Generally speaking, you'll want to use an implicit method for parabolic equations (the diffusion part) -- explicit schemes for parabolic PDE need to have a very short timestep to be stable. Conversely, for the hyperbolic part (advection) you'll want an explicit method as it's cheaper and doesn't disrupt the symmetry of the linear system you have to solve by ...


8

I see several issues: The DFT computed with fft puts the zero mode at the beginning of the array, and if you want to compute the derivative, it is necessary to apply fftshift/ifftshift to the array N to make sure the derivative is correct. It is easy to see for yourself what the correct expression is by working it out with pen and paper, and see also the ...


6

Numerical diffusion arises from a first-order finite difference approximation to the spatial derivative $\partial u/\partial x$. To see how this is the case, examine the Taylor series expansion for $u_{i+1}$: $$ u(x_{i+1}) = u(x_{i}) + \left.\frac{\partial u}{\partial x}\right|_{x_i} (\Delta x) + \frac{1}{2} \left. \frac{\partial^2 u}{\partial x^2}\right|_{...


6

Let me give a part of your answer, I would need some more indications from your side to answer you fully. So please read, and write some comments so that I can complete my answer. About notations in numerical methods There are a few mistakes in the way you write your equations. These are only details, but for someone who is used to it, it can a bit ...


6

One way or the other, you need to stabilize every discretization for this equation. Traditionally, this was done using methods such as artificial viscosity or its slightly smarter sibling SUPG. But there are many other alternatives to make things work if you'd like to stick with the FEM framework -- e.g., discontinuous Galerkin methods. My summary of this ...


6

The stationary equation you show transports information from the right to the left via the advection term; it also diffuses slightly. If you switch off the diffusion term altogether, then you only have transport from the right to the left, and you need to also drop the boundary condition at the left: because information is from the right to the left, nothing ...


6

Okay. Let's begin with the first situation. Your equation is: $$ \frac{\partial f}{\partial t}+v\frac{\partial f}{\partial x}=0\tag{1}$$ $\textbf{Previous comments}$ There are plenty of webs that can explain you what happens with the error when you does not choose properly the values of your mesh to approximate the derivatives in an equation (Von Neumann ...


5

Level set methods are really only one particular case of advection PDEs which you can solve with any of the modern PDE toolboxes such as deal.II (disclaimer: that's my own library), fenics, libmesh, ... What makes it a level set method is that you the evaluate the solution function to find that surface where, for example, the solution equals zero. I'd try to ...


5

General answer Your problem is that you do not set (or even specify) the boundary conditions at all - your numerical problem is ill-defined. Generally, there are two possible ways to specify the boundary conditions: Set the boundary conditions by specifying $u_{0}$ and $u_{101}$ externally, e.g. through the exact solution. Change the numerical stencil so ...


5

Bluntly speaking, SUPG and alike and RANS are different approaches to different problems that, however, have the same name - instability - and the same phenomenology - the failure of numerical routines. RANS is used to cope with turbulence as an instability of the equation. If a flow is or becomes turbulent the describing equations are instable, e.g. ...


5

Look at the cell PĂ©clet number $$\mathrm{Pe}_h = h v / K$$ where $h$ is mesh size, $v$ is the magnitude of velocity, and $K$ is diffusivity. It is analogous to cell Reynolds number for the momentum equation and is small when "thermal diffusivity is large compared to advection". It is common common in macro-scale fluid dynamics that thermal diffusivity $K$...


5

Eigenvalues with zero eigenvalue correspond to purely oscillatory modes. You can see it by diagonalising the system. Your matrix $A$ can be written as \begin{equation} A = P \Sigma P^{-1} \end{equation} where $\Sigma$ is a diagonal matrix with entries $\lambda_n$ corresponding to the eigenvalues of $Q$. You can now transform your ODE to \begin{equation} dQ/...


5

Your image of the numerical domain of dependence is correct. But try to also draw the analytical domain of dependence, maybe this could help you to better understand what is going on. Note that the analytic solution of $u_t+au_x=0$ is $u(t,x)=u_0(x-at)$. So the slope of the actual dependence is $a$. The CFL condition just says that the numerical dependence ...


5

You solve the 1D-advection equation with c a constant velocity : $$ \frac{\partial u}{\partial t} + c\frac{\partial u}{\partial x}=0~~~~~~~~(1) $$ When you discretize this equation (with an explicit scheme in time and an upwind scheme in space for instance), you get : $$ \frac{u_i^{n+1} - u_i^n}{\Delta t}+\frac{u_i^n-u_{i-1}^{n}}{\Delta x} = 0 ~~~~~~~~(2) $$ ...


5

Your equation can be written in the following fashion (any spatial derivative approximation is valid), once space is discretised: $$\frac{1}{c}\frac{du_i}{dt}=-\left(\frac{\partial u}{\partial x}\right)_i(t) + v_i(t) \tag{*}$$ Keep in mind that $v_i(t) = v(x_i,t)$. Now the system of equations depends only on time $t$ you can apply Crack Nicholson method to ...


4

In 1-D, the first discretization you've presented is correct. The matrix equation does not look right, though. For starters, it's not clear what your boundary conditions would be or how you would incorporate them. In $N$ dimensions, the advection equation looks like \begin{align} \frac{\partial{u}}{\partial{t}} + \sum_{i=1}^{N}\frac{\partial}{\partial{x^{i}...


4

The answer is yes. Drift diffusion = advection-diffusion. You will find this rather frequently: different disciplines, trying to describe the phenomena in their field, assign names to the equations they derive that have meaning for this discipline. Other disciplines come up with the same equations, in different contexts, and name them differently. It's still ...


4

That's not a simple question in my opinion. It is like if you were doing an experiment in a box and you just want to simulate the center of it. But obviously, the solution in the center of the box depends on what happens in the rest of the box. That is probably why it is a difficult problem to state. I have no definite answer to this question, but I still ...


4

This is actually a standard modeling problem if you consider the medium that flows through the network to be incompressible (e.g., liquids, or gases at low velocity). Then, you formulate everything in terms of fluxes (liters or kg per second) rather than in discrete parcels. The key realization is that the flux that goes into one end of the pipe equals the ...


4

You stumbled across something very fundamental that is important to understand. For any PDE we can define for each point its "domain of dependence" This is the region of space/time that is able to have an effect on the solution at that point. For your advection problem, it is just the characteristic line through that point. If the point of interest is $x_0,...


4

The difficulty is relative to something, in this case it is relative to diffusion dominated problems. Diffusion dominated aren't "easy" either, they have their own set of problems. I'll start with some favorable qualities of diffusion problems, and then mention why they are not present for advection problems: Discretizations are often symmetric and ...


3

In the 2-D case, this corresponds to an elliptic fixed point (an orbital, I believe). You might look into Lyapunov stability, hopefully someone will be able to recommend a good resource on that. I'll try to have another look later to see if I can find resources on this. UPDATE For related material, you might look into limit cycles, or the Poincaré-...


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

There are multiple questions here, but let's start with the basics. You have written two hyperbolic PDEs; (1) is the continuity equation, which is conservative and (2) is the color equation, which is not conservative. What are the characteristic speeds for these equations? For (1), you have stated correctly that the characteristic speed is $u(x,t)$. ...


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