Commit b1a13753 authored by s.zitz's avatar s.zitz
Browse files

Playin around with CUDA.jl

parent 955b25a7
Pipeline #23226 passed with stage
in 50 minutes and 7 seconds
......@@ -344,6 +344,16 @@ function kernel_pressure!(p, height, linear, diagonal, stats::pressurestats, len
return nothing
end
function linear(laplace, height, len, wid)
# Wuhu this seems to work properly =)
laplace .= (2/3 .* (view(height, 3:len, 2:wid-1) .+ view(height, 1:len-2, 2:wid-1) .+ view(height, 2:len-1, 3:wid) .+ view(height, 2:len-1, 1:wid-2)) .+
1/6 .* (view(height, 3:len, 3:wid) .+ view(height, 1:len-2, 3:wid) .+ view(height, 1:len-2, 1:wid-2) .+ view(height, 3:len, 1:wid-2)) .-
10/3 .* view(height,2:len-1, 2:wid-1))
return nothing
end
function cappressure2!(p, height, stats::pressurestats)
# working good! :)
len, wid = size(height)
......
......@@ -98,3 +98,66 @@ function runsimulationGPU(parameters::JuThinFilm.params, colparams::JuThinFilm.c
return mom
end
function dummyrun()
lx = 512
ly = 256
maxtime = 100000
θₑ = 1/9 # Contact angle on the substrate, expect on the patch
δ₀ = 4.0 # Slip length, larger better for geometry
T = Float64
# The center of the lattice
center = (lx÷2, ly÷2)
R₀ = 25
δᵪ = 20
# Geometric parameters for the patterns
boxside = 62
# Some structs that contain mostly default values
parameters = JuThinFilm.params{T}(lx=lx, ly=ly, mt=maxtime)
collisionparameters = JuThinFilm.collisionparams{T}(δ=δ₀)
pressureparameters = JuThinFilm.pressurestats{T}(θ=θₑ)
dists = default_distribution(T, parameters.lx, parameters.ly)
lat = JuThinFilm.lattice{T}()
# Generate the initial droplet
mom = singledroplet(T, lx, ly, R₀, θₑ, center)
energy = []
# θₙ, P = boxpattern(lx, ly, pressureparameters, δₐ=-δᵪ, side=boxside)
θₙ = fill(1/9, lx, ly)
# Forces needed for the simulation
Fpressure = default_force(T, lx, ly)
Fsum = default_force(T, lx, ly)
Fslip = default_force(T, lx, ly)
Fbody = default_force(T, lx, ly)
# Get the first equilibrium here
equilibrium!(dists.feq, mom.height, mom.velocity.x, mom.velocity.y, mom.pressure, lat.ci, lat.wi, parameters)
copy!(dists.ftemp,dists.feq)
# Start of the main time loop
for t in 1:parameters.mt
u = extrema(mom.velocity.x) # Yeah the velocity is not taken from the center of the droplet.
v = extrema(mom.velocity.y)
uₘ = maximum(abs.(u))
vₘ = maximum(abs.(v))
push!(energy,max(vₘ, uₘ))
if t%5000 == 0
# IO for progression
mass = round(sum(mom.height),digits=3)
println("time step $t and mass $mass")
end
# Compute forces
capillarypressure!(mom.pressure, padarray(mom.height, Pad(:circular, 1, 1)), θₙ, pressureparameters)
h∇p!(Fpressure.x, Fpressure.y, mom.height, padarray(mom.pressure, Pad(:circular, 1, 1)))
slippage!(Fslip.x, Fslip.y, mom.height, mom.velocity.x, mom.velocity.y, collisionparameters)
inclinedplane!(Fbody.x, Fbody.y, mom.height, t, 1e-4, true, false)
sumforces!(Fsum, Fpressure, Fslip) #, Fbody
# Get the equilibrium and then performe a collision.
equilibrium!(dists.feq, mom.height, mom.velocity.x, mom.velocity.y, mom.pressure, lat.ci, lat.wi, parameters)
BGKandStream!(dists, Fsum, collisionparameters, kind="WFM")
macroscopicmoments!(mom, dists)
end
return mom, energy
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment