File:Drude Model.gif
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Drude_Model.gif (487 × 90 pixels, file size: 1.14 MB, MIME type: image/gif, looped, 176 frames, 18 s)
File information
Structured data
Captions
Summary
[edit]DescriptionDrude Model.gif |
English: Drude model: electrons in a metal are accelerated by an electric field, but they keep bouncing on the metal defects/impurities. The resulting diffusion-like motion produces a roughly steady current. |
Date | |
Source | https://mathstodon.xyz/@j_bertolotti/112325484583109559 |
Author | Berto |
Permission (Reusing this file) |
https://mathstodon.xyz/@j_bertolotti/111363365323269417 |
Mathematica 14.0 code
[edit](*WARNING: Highly unoptimized code!!!*)
Clear[evo, pos, posold, posoldold, accelerations, oldaccelerations, velocities, halfvelocities, tableForces];
Lx = 10; Ly = 3; (*(Half) Size of the box*)
\[Sigma] = 0.5; (*particle radius*) \[Sigma]plot = 0.55 \[Sigma];(*particle radius for graphing*)
dt = 0.002;
nelectrons = 300;
LJforce[p1_, p2_] := 10*2 (12 \[Sigma]^12/Max[Norm[p1 - p2], \[Sigma]]^13(*-6 \[Sigma]^6/Max[Norm[p1-p2],\[Sigma]]^7*)) Normalize[p1 - p2];
externalForce = {10, 0};
poselectrons = RandomVariate[ UniformDistribution[{{-Lx - 100, -Lx + 1}, {-Ly, Ly}}], nelectrons];
posscatterers = Select[Flatten[ Table[N[i {1, 0} + j {Cos[\[Pi]/3], Sin[\[Pi]/3]}], {i, -Lx + 2, Lx + 2, Lx/6}, {j, -Ly, Ly, Ly/2}], 1], (#[[1]] < Lx + 1 && #[[1]] > -Lx + 2) &];
nscatterers = Dimensions[posscatterers][[1]];
posscatterers = posscatterers + RandomReal[{-\[Sigma], \[Sigma]}/3, {nscatterers, 2}];
initialvelocities = Table[{5, 0}, {j, 1, nelectrons}];
tableForces = Chop@Table[ LJforce[poselectrons[[i]], posscatterers[[j]]], {i, 1, nelectrons}, {j, 1, nscatterers}]; (*electrons do not interact with each other*)
accelerations = Total@Transpose@tableForces + Threaded@externalForce;
posold = poselectrons;
oldaccelerations = accelerations;
poselectrons = posold + initialvelocities*dt + accelerations/2 dt^2;
velocities = initialvelocities + (accelerations + oldaccelerations)/2 dt;
nsteps = 2000;
evo1 = Reap[Do[
tableForces = Chop@Table[ LJforce[poselectrons[[i]], posscatterers[[j]]], {i, 1, nelectrons}, {j, 1, nscatterers}];
oldaccelerations = accelerations;
posold = poselectrons;
halfvelocities = velocities + accelerations/2 dt;
For[j = 1, j <= nelectrons, j++,
If[poselectrons[[j, 2]] >= Ly,
halfvelocities[[j, 2]] = -Abs[halfvelocities[[j, 2]] ] ];
If[poselectrons[[j, 2]] <= -Ly,
halfvelocities[[j, 2]] = Abs[halfvelocities[[j, 2]] ] ];
];
poselectrons = posold + halfvelocities dt;
accelerations = Total@Transpose@tableForces + Threaded@externalForce;
velocities = halfvelocities + (accelerations + oldaccelerations)/2 dt;
Sow[poselectrons];
, nsteps];][[2, 1]];
current = Reverse@GaussianFilter[ Dimensions[Select[#, (#[[1]] > Lx + 1 && #[[1]] < Lx + 3) &]][[1]] & /@ evo1, 10];
start = 800; length = 700;
frames = Table[
Grid[{{Graphics[{
Gray, Disk[#, \[Sigma]plot] & /@ posscatterers,
Black, Disk[#, \[Sigma]plot] & /@ evo1[[j]]
,
Line[{{-Lx - 5, -Ly - \[Sigma]plot}, {Lx + 5, -Ly - \[Sigma]plot}}],
Line[{{-Lx - 5, Ly + \[Sigma]plot}, {Lx + 5, Ly + \[Sigma]plot}}]
}, PlotRange -> {{-Lx - 1, Lx + 1}, {-Ly - 1, Ly + 1}}]
,
ListPlot[current, Joined -> True , PlotRange -> {{0, length} + {nsteps - j, nsteps - j}, {0, 15}}, AspectRatio -> 1/3, Ticks -> None, Epilog -> {Text["Current", Scaled[{0.5, 0.8}] ]} ]
}}]
, {j, start, start + length}];
ListAnimate[frames]
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 08:59, 29 April 2024 | 487 × 90 (1.14 MB) | Berto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.