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


5

Yes, the problem with mixed boundary conditions is well posed. What's not clear to me is this: Why do you approximate the derivative via the two-sides approximation? Shouldn't it be enough to just the following? $$ \frac{f_6 - f_{6-\Delta x}}{\Delta x} = 0. $$ In your animations, what is the size of $\Delta x$? Your curve looks very smooth, which can be ...


3

There is no reason to believe that two random fields with the same arithmetic mean would yield solutions that have anything to do with each other. In fact, for the case you consider, one might imagine that maybe the harmonic mean is actually a better indicator, but even that is unclear -- it could also be the geometric mean. Apart from this, you have to ...


2

In fact, your equation is a non-linear advection-diffusion. Due to the fact that your problem is time-dependent, it could be easily solved by finite-difference: $$\frac{\partial z}{\partial t} = -C (\sin(\omega t))^{m} x^{hm} n (\frac{\partial z}{\partial x})^{n-1} \frac{\partial^{2} z}{\partial x^{2}} -C (\sin(\omega t))^{m} x^{hm} h m x^{-1} (\frac{\...


1

Take the first expression and start to reduce the $x$ values to $x_i$, \begin{align} \frac{u_{i+1}^n - u_i^n}{x_{i+\frac{1}{2}}} - \frac{u_i^n - u_{i-1}^n}{x_{i-\frac{1}{2}}} &= \frac{(x_i-\frac12Δx)(u_{i+1}^n - u_i^n) - (x_i+\frac12Δx)(u_i^n - u_{i-1}^n)}{x_{i-\frac{1}{2}}x_{i+\frac{1}{2}}} \\ &=\frac{x_i}{x_i^2-\frac14Δx^2}(u_{i+1}^n - 2u_i^n + u_{...


1

Problem well posed Your problem is well posed. On the discretization with Crank-Nicholson I am not familiar with MMS, and I wonder how you got that ungeneralised form of the diffusion equation. Anyways, as I understand it, you are using the Crank-Nicholson method to discretize the following differential equation: $\frac{\partial f}{\partial t} = x^2 \...


1

This comes from von Neumann stability analysis. You discretize the partial differential equation and look at the error equation, which is the difference between the exact solution to the finite difference approximation and the actual equation. You need the error to shrink in time, and if you assume that the error behaves like a fourier series, you can ...


1

It seems that you are going from one extreme to the other: you probably want to generate all $N$ particles at once without the for-loop; however, you don't want to generate all the num_steps at once since you only need two last ones. So, I think you are looking for something like: import numpy as np import numpy.random as npr N = 10000000 dim = 3 ...


1

If the whole wall is absorbing, then you should replace: if ((Z(j)>=c) && ... (sqrt((X(j))^2+(Y(j))^2)<=e)) TotalNumberReceivedUp=TotalNumberReceivedUp+1; break end by if Z(j) >= c if sqrt(X(j)^2 + Y(j)^2) <= e TotalNumberReceivedUp = TotalNumberReceivedUp + 1; end ...


1

It is easy to see that the function \begin{equation} P(t) := \int \limits_0^1 p(x,t) \, \mathrm{d}x, \quad t \geq 0, \end{equation} is constant over time (i. e. $P(t) = P(0)$, $\forall \, t \geq 0$), if $p$ is a solution of your initial-boundary-value problem. If you discretize the problem in space as you described, then you obtain a system of linear ...


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