Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

2

If you can solve the linear system with a direct solver, then that's exactly what you should be doing. Multigrid is a method that can be used if you don't have the time or memory resources to use a direct solver (because direct solvers have a complexity that grows faster than $O(N)$ with the size of a linear system). If you use a direct solver as a sub-step ...


2

Based on the image that you provided in your comment, I believe you formulate your problem as a system of PDEs for each branch in your network and make sure at each connecting node mass is conserved. Let's say you have $N$ branches, so you need to solve the system of advection-diffusion equations for each branch ($1 \leqslant i \leqslant N$): $$\frac{\...


1

I think you are using a downwind- instead of an upwind finite difference. This leads to your code imposing a boundary condition where it is not allowed. The solution to your convection equation is basically (ignoring the left BC for the moment) $$ C(x,t) = C_0(x - v t) $$ where $C_0$ is your initial value. Thus, if $v > 0$, it is a rightward travelling ...


1

I think that the second boundary condition equation is incorrect. The first one should be right for both ends. Following your notation, the flux of mass in the domain should be: $$N = vC - D \frac{\partial C}{\partial x}$$ everywhere including the boundary points. Keep in mind that the sign of the boundary condition value is positive if the direction of ...


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