Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rotational diffusion pdf #97

Merged
merged 3 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MicrobeAgents"
uuid = "b17a4bac-8667-4a2d-84f7-1883ae0b8dbb"
authors = ["Riccardo Foffi <rfoffi@ethz.ch> and contributors"]
version = "0.5.1"
version = "0.5.2"

[deps]
Agents = "46ada45e-f475-11e8-01d0-f70cc89e6671"
Expand Down
13 changes: 10 additions & 3 deletions src/rotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ Reorient `microbe` due to brownian rotational diffusion.
In 1-dimensional models, this functions does nothing.
"""
rotational_diffusion!(microbe::AbstractMicrobe{1}, model) = nothing
function rotational_diffusion!(microbe::AbstractMicrobe, model)
function rotational_diffusion!(microbe::AbstractMicrobe{2}, model)
dt = model.timestep
D_rot = rotational_diffusivity(microbe)
σ = sqrt(2*D_rot*dt)
θ = rand(abmrng(model), Normal(0, σ))
microbe.vel = rotate(direction(microbe), θ)
end
function rotational_diffusion!(microbe::AbstractMicrobe{3}, model)
dt = model.timestep
D_rot = rotational_diffusivity(microbe)
σ = sqrt(2*D_rot*dt)
θ = rand(abmrng(model), Normal(0,σ))
ϕ = rand(abmrng(model), Arccos())
microbe.vel = rotate(direction(microbe), θ, ϕ)
φ = rand(abmrng(model), Uniform(-π, +π))
microbe.vel = rotate(direction(microbe), θ, φ)
nothing
end

Expand Down
Loading