bjornaa / ladim1

LADIM - Lagrangian Advection and DIffusion Model
MIT License
12 stars 6 forks source link

Diffusion Equation Question #6

Open juan-park opened 3 years ago

juan-park commented 3 years ago

I see from a other papers that the diffusivity equation is for displacement. After derivation the equation I get is , but in tracker.py it is .

Am I missing something? Any guidance would be greatly appreciated!

bjornaa commented 3 years ago

Dear Juan,

I have double checked and am convinced that the formulation is correct. With a diffusion equation ct = D(c{xx} + c_{yy}) the variance in x-direction grows linearly with coefficient as 2D. With random walk, X[n+1] = X[n] + R, the variance grows linearly with coefficient <R^2>/dt. LADiM uses random walk velocity u = R/dt, giving 2D = <u^2>*dt, the formula used in tracker.py

Note that the particle tracking uses the variance in x and y directions separately. The total two-dimensional variance grows like 4D (and 6D for three-dimensional isotropic diffusion). This may be the reason different factors show up in the literature.

Bjørn

gillibrandpa commented 3 years ago

Hi Juan, Bjørn The reason lies in the choice of random number generator.

Traditionally, dx = Rsqrt(2D_h*dt) was used in particle tracking models, with the random number generator being R = +/- 1. This generator has a random number distribution with a mean of zero and a standard deviation of 1. Particles then diffused according to Fickian diffusion theory, with the particle variance proportional to 2.D_h.t

The downside to that approach was that all random steps were the same size: +/- sqrt(2. D_h. dt) in the x- and y-directions.

Choosing a random number generator of -1 <= R <= 1 (i.e. R = 2rnd -1) gives a range of random displacement steps. This generator has a mean of zero, but a standard deviation of 1/sqrt(3). The correction to get a standard deviation of 1 involves multiplying by sqrt(3). So dx = Rsqrt(3)*sqrt(2. D_h. dt) = Rsqrt(6.D_h.dt). We then have the correct representation of Fickian diffusion, such that particle location variance grows as 2.D_h.t again.

Hope that helps. Best wishes Phil Gillibrand


Dr Philip Gillibrand Oceanographer/Modeller

Mowi Scotland Limited

Mobile: +44 7825 618 922 DDI: +44 1397 715 021 Mail: philip.gillibrand@mowi.commailto:philip.gillibrand@mowi.com

Office: Mowi Farms Office Glen Nevis Business Park Fort William PH33 6RX

[cid:image001.jpg@01D6D783.F8885460]

From: Bjørn Ådlandsvik notifications@github.com Sent: 21 December 2020 10:15 To: bjornaa/ladim ladim@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [bjornaa/ladim] Diffusion Equation Question (#6)

CAUTION: This email is from outside the Mowi network. You should only click links or open attachments if you recognize the sender and know the content is safe! If you have a doubt, Click 'Report Phishing - Mowi IT' in Outlook.

Dear Juan,

I have double checked and am convinced that the formulation is correct. With a diffusion equation ct = D(c{xx} + c_{yy}) the variance in x-direction grows linearly with coefficient as 2D. With random walk, X[n+1] = X[n] + R, the variance grows linearly with coefficient <R^2>/dt. LADiM uses random walk velocity u = R/dt, giving 2D = <u^2>*dt, the formula used in tracker.py

Note that the particle tracking uses the variance in x and y directions separately. The total two-dimensional variance grows like 4D (and 6D for three-dimensional isotropic diffusion). This may be the reason different factors show up in the literature.

Bjørn

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbjornaa%2Fladim%2Fissues%2F6%23issuecomment-748892772&data=04%7C01%7CPhilip.Gillibrand%40mowi.com%7Cbfd7df63ba73461ad7c508d8a5993bb3%7C84659319c8cc4302a6cf508dde8aaefe%7C0%7C0%7C637441424833962339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2j11GoHdErIbk9GQp2Of4x0p40GeBuLRyRUN5c9fvT0%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAC67ZVF2UPWCHTHQVGWLNV3SV4NY5ANCNFSM4VBUH2FA&data=04%7C01%7CPhilip.Gillibrand%40mowi.com%7Cbfd7df63ba73461ad7c508d8a5993bb3%7C84659319c8cc4302a6cf508dde8aaefe%7C0%7C0%7C637441424833962339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=N733jQxbyaaw%2BzwJuRwPNKZ21TI7JoSqlndEQA2qPK4%3D&reserved=0.

bjornaa commented 3 years ago

Thanks Phil,

I may have misinterpreted the Juan's R.

Attached is a pdf file that describes more closely how LADiM is handling horizontal diffusjon. random_walk_diffusion.pdf

Bjørn