Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [diffusion]

The tag has no usage guidance.

1
vote
1answer
33 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
51 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
220 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
52 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
80 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
206 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
23 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
37 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
39 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
99 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 ...
5
votes
2answers
165 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 ...
4
votes
0answers
98 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
148 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
294 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
206 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 ...
4
votes
1answer
106 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
95 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
128 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
2k 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
318 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
45 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 ...
2
votes
0answers
151 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
56 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
236 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
286 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
57 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
167 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
164 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} ...
3
votes
1answer
123 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 ...
1
vote
0answers
260 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
488 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
232 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
122 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
102 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
977 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
170 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
636 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
212 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
72 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
119 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}=...
2
votes
2answers
219 views

Model of heat sink problem with fan

I am trying to solve this problem using advection-diffusion model and finite element method for the solution, due to the complex geometry. Basically the problem i'm trying to solve using OpenFOAM is ...
0
votes
1answer
238 views

Numerical Solution of non-linear diffusion equation using Finite Differencing

I'm trying to solve the following non-linear diffusion equation: $$ \frac{\partial}{\partial t} u(x,t)= \frac{\partial^{2}}{\partial x^{2}}u(x,t)^{3}$$ $$ -1\leq x \leq1, t \geq 0 $$ with the boundary ...
4
votes
1answer
446 views

Two approaches to solving diffusion equation in Fourier space

I want to numerically solve the diffusion equation $\partial_t u = D \partial_x^2 u$ in Fourier space, and can think of multiple ways to do it. Setup Option 1 Differentiating $u$ twice in Fourier ...
3
votes
2answers
735 views

Molecular Dynamics: Diffusion with PBC

How can I implement the computation of the diffusion coefficient $D$ using periodic boundary conditions (PBC)? I use molecular dynamics of a set of $nboby$ particles with positions $pos(3,nbody)$ in ...
1
vote
0answers
190 views

advection diffusion equation

Would you know what is the condition for stability for the advection-diffusion equation where we treat the diffusion part using Crank-Nicholson and the advection part using FCTS (forward in time ...
2
votes
2answers
306 views

Computing element stiffness matrices with variable coefficients

I am trying to implement a simple FEM approach, using p1 triangular elements, for solving the diffusion equation with variable nodal diffusivities and I was wondering how to incorporate the variable ...
3
votes
1answer
217 views

High frequency noise at solving diffusion equation

I'm trying to simulate a simple diffusion based on Fick's 2nd law. ...
4
votes
1answer
193 views

The most efficient way to solve diffusion equation with concentrated initial condition

I want to solve the diffusion equation, i.e. $$ \dot{f} - f'' = 0 $$ with a boundary condition $f(0) = f(1) = 0$ and with an initial condition that $f$ is a boxcar function concentrated over some ...
1
vote
0answers
49 views

Calculating the number of molecules diffusing out of a volume

I have a system of reactions that are governed by differential equations. They are reacting inside of a volume with known dimensions i.e lbh. I don't have any other information on their position ...
0
votes
1answer
112 views

max speed <--> time discretization

I'm working on a heat diffusion problem, $$ \frac{\partial T}{\partial t}=\vec{\nabla}\cdot\left(\kappa T^{5/2}\,\vec{\nabla}T\right) $$ I know that, after discretization, the time step for the 1D ...