Questions tagged [diffusion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
68 views

Crank-Nicholson for diffusion-advection vs diffusion equation

Let's consider the following 1D diffusion equation: $\frac{\partial u}{\partial t} = xk \frac{\partial}{\partial x}(\frac{1}{x}\frac{\partial u}{\partial x})$ where we assume that the diffusion ...
5
votes
2answers
108 views

Is the diffusion equation with Neumann and Dirichlet BCs well-posed?

I am considering the following diffusion equation: $$\frac{\partial f}{\partial t} = \frac{\partial}{\partial x}[D(x,t)\frac{\partial f}{\partial x}]$$ over a grid ...
0
votes
0answers
24 views

Splitting coupled non-linear diffusion equations into blocks

Two coupled linear diffusion equations $$\begin{split}\partial_ta&=\nabla(\nabla a)\\ \partial_tb&=\nabla(\nabla b)\end{split}$$ can be split into blocks by putting everything onto one side, ...
1
vote
0answers
58 views

Solving diffusion equation using finite difference method

I am solving an 1-dimensional diffusion equation with Neumann boundary condition at outlet and constant concentration, C, at the inlet. In the end, I want to observe how the concentration diffuses ...
1
vote
0answers
28 views

Setting up diffusion with integral B.C. in Fenics

I'm trying to model diffusion through a cylindrical domain $D = \{ (x,y,z) : x^2 + y^2 \leq 1, \;\; 0 \leq z \leq 1\}$. The is an initial concentration of the diffusant at the upper flat surface, ...
1
vote
1answer
68 views

Numerical methods for non-linear diffusion

I have the following non-linear diffusion equation, for $\ z(x,t)$: $\ z_t = -C(\sin(\omega t))^m x^{hm}(hm x^{-1}(z_x)^n + n z_{xx} (z_x)^{n-1}) $ Any advice for numerical (or analytical) solutions?...
1
vote
1answer
56 views

What is the right way to set up two random tensor fields which have an identical average diffusivity

I want to compare some properties of traveling waves through two randomly diffusive media. The traveling waves follow the fisher equation: $$\frac{du}{dt} = \nabla(\mathbf{D}_{\gamma} \nabla u) + u(1-...
0
votes
1answer
130 views

Numerically solving a non-linear PDE

I have this non-linear partial differential equation. $$ \frac{\partial C}{\partial t}=\left(\frac{\partial C}{\partial x}\right)^2+C\frac{\partial^2 C}{\partial x^2} $$ I want to use the finite ...
0
votes
1answer
74 views

Stability of PDEs

I am currently trying to solve some PDEs with FiPy. At page 56, the manual mentions (https://www.ctcms.nist.gov/fipy/download/fipy-3.0.pdf). The largest stable timestep that can be taken for this ...
2
votes
0answers
72 views

Numerical solution to N-dimensional diffusion on simplex?

Assume I have a system of at least (but generally only) $N+1$ points in an $N$-dimensional space ($N > 3$ is possible). At each of these points $x_i, i=1,...,N+1$ I know an initial potential/...
1
vote
1answer
56 views

Minimizing the used memory in diffusion simulation using Python

I am recently dealing with a diffusion simulation project and I have come up with the following code: ...
0
votes
1answer
57 views

Simulating Brownian motion in 3-D for first hitting time?

I want to simulate Brownian motion in 3-D for the following conditions: $$p(x=0,y=0,z=0,t=0)=1$$ $$p(x,y,z=c,t)=0$$ where $p$ is the probability of finding molecules in the 3-D environment. I want to ...
0
votes
1answer
1k views

Applying neumann boundary conditions to diffusion equation solution in python [duplicate]

For the diffusion equation $$ \frac{\partial u(x,t)}{\partial t} = D \frac{\partial ^2 u(x,t)}{\partial x^2} + Cu(x,t) $$ with the boundary conditions $u(-\frac{L}{2},t)=u(\frac{L}{2},t)=0$ I've ...
2
votes
0answers
67 views

Harmonic average of Diffusion Tensors in Finite Volume Method

I want to implement a Bilinear Finite Volume discretisation of the anisotropic diffusion problem: $$\frac{du}{dt} = \nabla \cdot (\textbf{D} \nabla u)$$ Both my degrees of freedom as well as the ...
1
vote
1answer
104 views

Analytical testcase for 2D/3D anisotropic Diffusion (Heat Kernel)

I want to verify and compare different Discretizations of the anisotropic diffusion equation in 2D / 3D. In order to both test the timestepping and the spatial discretisations I had a look at using ...
8
votes
1answer
275 views

Computing geodesic distances with diffusion

I am trying to solve an APSP (All-Pair Shortest Path) problem on a weighted graph. This graph is actually a 1, 2 or 3 dimensional grid, and the weights on each edge represent the distance between its ...
0
votes
1answer
24 views

Calculating volume of a discretised diffuse interface object

Suppose I have a spherical object projected onto a discrete square mesh. The dicretised circle can be represented by filling a logical matrix such that voxels in the interior of the sphere are filled ...
1
vote
0answers
39 views

Limit to volume change in a discretized mathematical model?

I have set up a mathematical model describing the diffusion of ozone out of a gas bubble. The bubble is surrounded by a thin gas film. So actually, the model describes the diffusion of ozone through ...
0
votes
1answer
40 views

Solving the diffusion/heat equation for a randomly distributed set of points in 3D

In this problem I am trying to solve, I have a messy set of points distributed in 3D space, each with a defined temperature. If I would want to calculate the heat transfer scenario in this system, how ...
1
vote
0answers
160 views

Neumann boundary condition FD implementation for instationnary diffusion equation

I am trying to solve this diffusion equation : $\dfrac{\partial D\dfrac{\partial f}{\partial x}}{\partial x}+S = \dfrac{\partial f}{\partial t}$ ($D$ is not constant and varies according to $x$) with ...
4
votes
2answers
216 views

Mean-squared displacement in Monte Carlo studies

Is measuring mean-squared-displacement in Monte Carlo simulations uncommon? I'm very interested to find out if this has actually ever been tried. For instance, in the context of spheres, or ...
3
votes
0answers
99 views

How to account for the interface between two different phases in a discretized diffusion model?

I have tried to set up a model for the diffusion of a gas into a liquid. The two media are next to each other and the geometry is spherical because the system should simulate the diffusion out of a ...
1
vote
2answers
218 views

Conservation violation in axisymmetric Diffusion Equation

1d diffusion equation Integrating the diffusion equation, $$ \frac{\partial u}{\partial t} = D \frac{\partial^2 u}{\partial x^2}, $$ with a constant diffusion coefficient D using forward Euler for ...
2
votes
2answers
365 views

Neumann boundary conditions diffusion equations methods of lines

I want to solve the diffusion equation using the method of lines with Neumann boundary conditions $$ \frac{\partial p}{\partial t}=\frac{\partial^2p}{\partial x^2}\\ \frac{\partial p}{\partial x}(x=0)=...
-2
votes
1answer
276 views

Adding Non-Linear source term to 2d Implicit MATLAB code

I'm running out of time for this code so any help would be greatly appreciated. I am currently coding the 2D heat/diffusion equation in matlab but i'm having trouble adding in the source term. my ...
3
votes
1answer
118 views

Diffusion properties of hard spheres in Monte Carlo simulation

In standard Monte Carlo simulations, say for hard sphere systems, how should one compute the mean-squared displacement of the spheres in order to extract dynamical properties such as the diffusion ...
1
vote
0answers
105 views

Hello word in FEniCS? [closed]

I am trying to start using FEniCS, but have a problem with the simple hello world examples given in the books. Could you please give me the simplest hello world ...
1
vote
2answers
143 views

Computational Physics: Finding the Diffusion Coefficient from the Discretized Diffusion Equation

I'm pretty new to translating simulation to reality so please forgive the perhaps naive approach I'm taking here. If we have a (quasi-2D) experimental video of a certain concentration changing with ...
1
vote
1answer
3k views

How to simulate 3D diffusion in python?

I want to simulate a simple 3D diffusion (e.g., an ink released from one side of a vessel) using SciPy. There are some tutorials for one-dimensional diffusion. ...
1
vote
3answers
397 views

2D simulation of a particle with different diffusion coefficient in different directions of the particle

How can one simulate diffusion of a particle which has a natural axis and diffusion coefficient of the particle in the direction of the axis is D_1 and in perpendicular to the axis is D_2? Could ...
1
vote
0answers
47 views

How is the Gastner-Newman equation implemented to create value-by-area cartograms?

There is a paper called "Density-equalizing map projections: Diffusion-based algorithm and applications" by Michael T. Gastner and M. E. J. Newman, which explains their algorithm (which is based in ...
3
votes
0answers
187 views

Spurious oscillations in diffusion-reaction problems with finite volume

I have successfully solved the multi-species diffusion-reaction equation \begin{equation} \frac{\partial c_i}{\partial t} = \nabla \cdot (d_i(x)\nabla c_i) + s_i(x,t), \quad \quad (1) \end{equation} ...
1
vote
0answers
57 views

elliptic equation with exponential coefficient

I'm trying to solve the following equation $$\dfrac{\partial}{\partial x}\left(e^{au}\dfrac{\partial u}{\partial x}\right) = 0$$ Of course, this equation can be solved analytically. I am trying to ...
0
votes
1answer
246 views

The system matrix and the right hand side for diffusion equation with staggered grid

In the following staggered grid setting, I want to solve diffusion equation as a linear system. $$\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}$...
0
votes
2answers
321 views

Stable implicit method to solve convection-heat diffusion in 3D

The last couple of hours I have been looking for an unconditionally stable method to solve the convection-diffusion equation within a 3D inhomogeneous material. Here's the well known diffusion-...
1
vote
1answer
74 views

Transforming a 1D cartesian variable-coefficient diffusion code into a 1D adially symmetric one

So I have a code that I use which solves a 1D variable coefficient diffusion problem in cartesian coordinates: $\frac{\partial u}{\partial t}=\frac{\partial}{\partial x}\left(D(x)\frac{\partial u}{\...
1
vote
0answers
212 views

Reaction-diffusion equations

I'm simulating a biological phenomena with reaction diffusion equations. There are multiple diffusing materials and there are some complex relations about consumption and production of such materials. ...
5
votes
2answers
175 views

Is this system of diffusion equations well-posed?

I’m using a standard Crank-Nicholson algorithm to solve this system of two coupled diffusion equations: $\dot{u} - \dot{v} = \frac{\partial}{\partial x} \left( \alpha(x) \frac{\partial u}{\partial x} ...
2
votes
1answer
136 views

Problem with Richardson extrapolation method for weak convergence in SDE

I have implemented the Richardson extrapolation of the Euler-Maruyama method to 4th order, to estimate the moments of SDE. The Euler-Maruyama works, and I would expect the Richardson extrapolation to ...
0
votes
0answers
296 views

3D Diffusion Equation in Fourier space

I'm solving the 3D Diffusion equation $$u_t=k(u_{xx}+u_{yy}+u_{zz})$$ in MATLAB using Fourier techniques. I assume a 3D Fourier expansion $(e^{-ipx},e^{-imy},e^{-imz})$of the solution. Physical ...
4
votes
2answers
600 views

Diffusion coefficient when simulating in 2D

Suppose I want to simulate the well-known diffusion partial differential equation in 2D, for example with finite elements or finite differences. Can I directly take physical diffusion coefficients ...
1
vote
1answer
280 views

Unfolding folded trajectories for Diffusivity calculation - MD

I have just started using dl_poly classic to work in Molecular Dynamics simulations. It produces a HISTORY file which records the trajectory after applying boundary conditions. Now, here I don't ...
1
vote
0answers
136 views

Discontinuity at Interface

The equation at the left of the interface is \begin{equation} \displaystyle\frac{\partial C_i}{\partial t} = D_i \nabla^2 C_i - z_i \frac{D_i}{RT}F \nabla \cdot (C_i \nabla \phi_2) \end{equation} ...
1
vote
0answers
107 views

Reducing oscillations a 3D Alternating direction explicit scheme for the diffusion equation?

Hi I have made a 3D alternating direction explicit scheme for solving the diffusion equation, which will eventually replace a FTCS scheme in model of bubble dynamics in tissue. I have been testing it ...
6
votes
2answers
1k views

9-point stencil finite difference Laplacian with variable diffusion coefficients

So I'm trying to implement a 9-point stencil discretization to the 2D difussion equation. The stencil is here. However, most of the literature deals with a Laplacian that has a constant diffusion ...
2
votes
1answer
175 views

Not getting correct numerical solution for Advection-Diffusion-Reaction eqn

Objective: I am trying to numerically solve $C(x,y,t)$ from the following advection-diffusion-reaction equation in 2D space (x,y) and time. I will be testing my numerical solution with an approximate ...
2
votes
2answers
692 views

Determining if samples fit a 3D Gaussian distribution

I have a collection of sample particles, with (x,y,z) coordinates generated by a simplified Monte Carlo-like code. I expect that these particles will follow an anisotropic diffusion process, which ...
2
votes
0answers
222 views

1 D Diffusion equation FDM with different layers

I'm trying to solve this particular equation $\frac{\partial u}{\partial t} = \frac{\partial}{\partial x} \big[D_{i}(x)\frac{\partial u}{\partial x} \big] + S(x,t)$ where the $i$ index denotes ...
1
vote
1answer
74 views

Reaction-Diffusion problem A->B, solving for B

I need to solve a Reaction-Diffusion using Finite Elements, piecewise linear elements. In this problem, a reaction $A \rightarrow B$, with rate law $ r_A = - k_A \cdot u_A $, takes part, where $u_i$ ...
2
votes
1answer
130 views

Modified diffusion equation and unstabilities

I am trying to simulate the phase separation of a binary mixture. If the free energy F is known as a function of the concentration $c$, the dynamical equation is: $ \frac{\partial c(x,t)}{\partial t}=...