New answers tagged

0

Let's try some alternative avoiding the forward and backward differentiation of the np.gradient function. You need to apply the boundary conditions in each computation of the time derivative, as that determines the derivative at the boundary points. Thus you have to use there either $$ \rho_{zz}(x_0,t)\approx 2\rho[x_{-1},x_0,x_1]=\frac{ρ(x_{-1},t)-2ρ(x_0,t)+...


0

I'm not gonna edit your code to make it work but based on your code, I think you have some misunderstanding about finite difference method. Your PDE equation is: $$\frac{\partial \rho}{\partial t} = D \frac{\partial^{2} \rho}{\partial z^{2}} + G - B(N_{D} \rho + \rho^{2})$$ Your boundary conditions are: $$-D \frac{\partial \rho}{\partial z} \Bigg |_{z=0} =...


3

Obviously from the picture it seems the variation of concentration in the junction itself might be considerable that lead the authors to consider a spherical control volume at the junction. When you ignore the volume of the junction and consider it as a point and write the mass balance equation as an algebraic equation of balance of incoming and outcoming ...


2

For complicated geometries, you probably need some kind of a devoted CAD tool rather than a built-in Matlab functionality. GMSH is a nice open-source tool, and this is my weapon of choice for such problems. Now, there is nothing specific about nested geometries in GMSH that should be reflected in the documentation. You might want to get familiar with basic ...


2

Every model is only as good as the approximations that are made in deriving it. Sometimes the approximations that reduce a PDE model to an ODE model are so good that the resulting ODE model is accurate enough to describe everything we want to know about the object. Here's an example: Think about a spacecraft traveling through the solar system. A complete ...


3

There is absolutely nothing wrong with converting the second-order system to first-order form and then using appropriate numerical methods to solve it. Both implicit and explicit Euler methods can be used. However, both have only first-order accuracy, i.e. the error is proportional to the time step size. And, of course, explicit Euler is not stable unless ...


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 ...


Top 50 recent answers are included