Skip to content

Commit

Permalink
Run Fokker-Planck on sphere
Browse files Browse the repository at this point in the history
  • Loading branch information
lukem12345 committed May 13, 2024
1 parent fa2468d commit 662bcc0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions examples/chemistry/fokker_planck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ infer_types!(Fokker_Planck)
resolve_overloads!(Fokker_Planck)

# Specify domain.
include("../grid_meshes.jl")
include("examples/grid_meshes.jl")
s′ = triangulated_grid(1,1,0.05,0.05,Point3D)
s′ = loadmesh(Icosphere(4))
s = EmbeddedDeltaDualComplex2D{Bool, Float64, Point3D}(s′)
subdivide_duals!(s, Barycenter())

# Specify initial conditions.
Ψ = map(p -> (2)/2 - ((p[1]-.5)^2 + (p[2]-.5)^2) , point(s))
ρ = fill(1 / sum(s[:area]), nv(s))
constants_and_parameters = (β⁻¹ = 0.001,)
Ψ = map(point(s)) do (x,y,z)
abs(y)
end
ρ = fill(1/nv(s), nv(s))
constants_and_parameters = (β⁻¹ = -0.001,)
u₀ = construct(PhysicsState, [VectorForm(Ψ), VectorForm(ρ)], Float64[], [, ])

# Compile.
Expand All @@ -47,15 +47,18 @@ tₑ = 1.0
prob = ODEProblem(fₘ, u₀, (0, tₑ), constants_and_parameters)
soln = solve(prob, Tsit5())

findnode(soln(0), )
findnode(soln(tₑ), )

# Save solution data.
@save "fokker_planck.jld2" soln

# Create GIF
begin
frames = 800
# Initial frame
fig = CairoMakie.Figure(resolution = (800, 800))
p1 = CairoMakie.mesh(fig[1,1], s′, color=findnode(soln(0), ), colormap=:jet, colorrange=extrema(findnode(soln(0), )))
fig = GLMakie.Figure(resolution = (800, 800))
p1 = GLMakie.mesh(fig[1,1], s′, color=findnode(soln(0), ), colormap=:jet, colorrange=extrema(findnode(soln(0), )))
Colorbar(fig[1,2], colormap=:jet, colorrange=extrema(findnode(soln(0), :U)))

# Animation
Expand Down

0 comments on commit 662bcc0

Please sign in to comment.