Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
s.zitz
JuThinFilm
Commits
a45afc59
Commit
a45afc59
authored
Sep 15, 2020
by
s.zitz
Browse files
Difference to master
parent
0b2b86ef
Pipeline
#22933
passed with stage
in 5 minutes and 47 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docs/Manifest.toml
View file @
a45afc59
...
...
@@ -41,9 +41,9 @@ version = "0.5.10"
[[Bzip2_jll]]
deps
=
[
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"
5ccb0770e3d1c185a52e6d36e3ffb830639ed3d2
"
git-tree-sha1
=
"
03a44490020826950c68005cafb336e5ba08b7e8
"
uuid
=
"6e34b625-4abd-537c-b88f-471c36dfa7a0"
version
=
"1.0.6+
3
"
version
=
"1.0.6+
4
"
[[CEnum]]
git-tree-sha1
=
"215a9aa4a1f23fbd05b92769fdd62559488d70e9"
...
...
@@ -496,7 +496,7 @@ uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version
=
"0.21.3"
[[JuThinFilm]]
deps
=
[
"CUDA"
,
"Coverage"
,
"DataFrames"
,
"Documenter"
,
"DocumenterTools"
,
"DrWatson"
,
"Images"
,
"LazySets"
,
"LinearAlgebra"
,
"Parameters"
,
"Pkg"
,
"Pluto"
,
"Random"
,
"Revise"
,
"Statistics"
]
deps
=
[
"BenchmarkTools"
,
"CUDA"
,
"Coverage"
,
"DataFrames"
,
"Documenter"
,
"DocumenterTools"
,
"DrWatson"
,
"Images"
,
"LazySets"
,
"LinearAlgebra"
,
"Parameters"
,
"Pkg"
,
"Random"
,
"Revise"
,
"Statistics"
]
path
=
"/data/s.zitz/JuThinFilm/JuThinFilm"
uuid
=
"b0f1a2c6-cb46-11ea-3e95-255d244e314e"
version
=
"0.1.0"
...
...
@@ -587,12 +587,6 @@ git-tree-sha1 = "b483b88403ac0ac01667778cbb29462b111b1deb"
uuid
=
"e94cdb99-869f-56ef-bcf0-1ae2bcbe0389"
version
=
"0.2.2"
[[MsgPack]]
deps
=
["Serialization"]
git-tree-sha1
=
"a8cbf066b54d793b9a48c5daa5d586cf2b5bd43d"
uuid
=
"99f44e22-a591-53d1-9472-aa23ef4bd671"
version
=
"1.1.0"
[[MutableArithmetics]]
deps
=
[
"LinearAlgebra"
,
"SparseArrays"
,
"Test"
]
git-tree-sha1
=
"6cf09794783b9de2e662c4e8b60d743021e338d0"
...
...
@@ -648,12 +642,6 @@ version = "1.0.10"
deps
=
[
"Dates"
,
"LibGit2"
,
"Libdl"
,
"Logging"
,
"Markdown"
,
"Printf"
,
"REPL"
,
"Random"
,
"SHA"
,
"UUIDs"
]
uuid
=
"44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[Pluto]]
deps
=
[
"Base64"
,
"Distributed"
,
"HTTP"
,
"InteractiveUtils"
,
"Markdown"
,
"MsgPack"
,
"Pkg"
,
"REPL"
,
"Sockets"
,
"UUIDs"
]
git-tree-sha1
=
"a8903db3de489cecb2f86d0c200b6de449a054b9"
uuid
=
"c3e4b0f8-55cb-11ea-2926-15256bba5781"
version
=
"0.11.8"
[[PooledArrays]]
deps
=
["DataAPI"]
git-tree-sha1
=
"b1333d4eced1826e15adbdf01a4ecaccca9d353c"
...
...
@@ -839,6 +827,6 @@ version = "0.9.2"
[[Zlib_jll]]
deps
=
[
"Libdl"
,
"Pkg"
]
git-tree-sha1
=
"
d5bba6485811931e4b8958e2d7ca3738273ac468
"
git-tree-sha1
=
"
fdd89e5ab270ea0f2a0174bd9093e557d06d4bfa
"
uuid
=
"83775a58-1f1d-513f-b197-d71354ab007a"
version
=
"1.2.11+1
5
"
version
=
"1.2.11+1
6
"
docs/Project.toml
View file @
a45afc59
...
...
@@ -2,6 +2,7 @@
Documenter
=
"e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterMarkdown
=
"997ab1e6-3595-5248-9280-8efb232c3433"
DocumenterTools
=
"35a29f4d-8980-5a13-9543-d66fff28ecb8"
JuThinFilm
=
"b0f1a2c6-cb46-11ea-3e95-255d244e314e"
[compat]
Documenter
=
"0.24.6"
src/JuThinFilm.jl
View file @
a45afc59
...
...
@@ -13,7 +13,7 @@ include("runsimulation.jl")
include
(
"measurements.jl"
)
# Export generators for structs
export
default_moments
,
default_cumoments
,
default_velocity
,
default_cuvelocity
,
default_force
,
default_cuforce
,
default_distribution
export
default_moments
,
default_cumoments
,
default_velocity
,
default_cuvelocity
,
default_force
,
default_cuforce
,
default_distribution
,
default_cudistribution
# Defined initial fluid states
export
flatsurface
,
sinewaves
,
singledroplet
# As well as initial substrate states
...
...
@@ -25,7 +25,7 @@ export macroscopicmoments!
export
BGKandStream!
,
BGKwithBuickGreatedStream!
,
BGKwithGuoStream!
export
slippage!
,
thermalfluctuations!
,
h∇p!
,
inclinedplane!
,
sumforces!
# Put everything together to get a full simulation
export
runsimulation
,
runrealsimulation
export
runsimulation
#============================================================================#
# End of module #
...
...
src/initialstates.jl
View file @
a45afc59
...
...
@@ -161,8 +161,12 @@ CartesianIndex(50, 50)
See also: [`default_moments`](@ref), [`runsimulation`](@ref)
"""
function
singledroplet
(
T
,
lx
::
Int
,
ly
::
Int
,
radius
,
θ
,
center
)
mom
=
default_moments
(
T
,
lx
,
ly
)
function
singledroplet
(
T
,
lx
::
Int
,
ly
::
Int
,
radius
,
θ
,
center
;
device
=
false
)
if
device
mom
=
default_cumoments
(
T
,
lx
,
ly
)
else
mom
=
default_moments
(
T
,
lx
,
ly
)
end
area
=
2
π
*
radius
^
2
*
(
1
-
cospi
(
θ
))
drop
=
1
+
0
im
@inbounds
for
i
in
1
:
lx
...
...
src/runsimulation.jl
View file @
a45afc59
#
"""
#
runrealsimulation2(T, lx, ly, maxtime; kind="Droplet", θ=1/9, δ=4.0, h₀=25, θ₀=1/3)
"""
runrealsimulation2(T, lx, ly, maxtime; kind="
Droplet
", θ=1/9, δ=4.0, h₀=25, θ₀=1/3)
# Real simulation to test if a droplet is relaxing towards it's equilibrium contact angle.
# """
# function runrealsimulation2(T, lx, ly, maxtime; kind="Droplet", θ=1/9, δ=4.0, h₀=25, θ₀=1/3)
# center = (Int(lx/2), Int(ly/2))
# if kind == "Droplet"
# # mom = sinewaves(T, lx, ly)
# mom = singledroplet(T, lx, ly, h₀, θ₀, center)
# end
# wetted = []
Real simulation to test if a droplet is relaxing towards it's equilibrium contact angle.
"""
function
runsimulation
(
T
,
lx
,
ly
,
maxtime
;
kind
=
"Droplet"
,
θ
=
1
/
9
,
δ
=
2.0
,
h₀
=
30
,
θ₀
=
1
/
3
,
device
=
false
)
# # Some unuseful IO
# println("Hey mate, let's do some funky simulation!")
# println("You choose to run on a simulation of a $kind")
# # Some parameter defining at the start
# parameters = params{T}(lx=lx, ly=ly, mt=maxtime)
# collisionparameters = collisionparams{T}(δ=δ, τ=1.0)
# pressureparameters = pressurestats{T}(θ=θ)
# dists = distributions{T}(para=parameters)
# lat = lattice{T}()
# Fpressure = default_force(T, lx, ly)
# Fsum = default_force(T, lx, ly)
# Fslip = default_force(T, lx, ly)
# Fbody = default_force(T, lx, ly)
# JuThinFilm.measurecoxvoinov!(wetted, mom, collisionparameters, pressureparameters)
# # Get the first equilibrium here
# equilibrium!(dists, mom, lat, parameters, T)
# copy!(dists.fout,dists.feq)
# # Now move to the time loop
# for t in 1:parameters.mt
# if t % 100 == 0
# mass = sum(mom.height)
# println("time step $t with mass $mass")
# end
# copy!(dists.ftemp,dists.fout)
# # Compute forces
# kernel_pressure_2!(mom.pressure, mom.height, pressureparameters, T)
# filmpressure!(Fpressure, mom, T)
# slippage!(Fslip, mom, collisionparameters)
# # constantforce!(Fbody, mom, t, 1e-4, true, false, T)
# sumforces!(Fsum, Fpressure, Fslip, Fbody)
# Some unuseful IO
println
(
"Hey mate, let's do some funky simulation!"
)
println
(
"You choose to run on a simulation of a
$
kind"
)
# Some parameter defining at the start
parameters
=
JuThinFilm
.
params
{
T
}(
lx
=
lx
,
ly
=
ly
,
mt
=
maxtime
)
lat
=
lattice
{
T
}()
collisionparameters
=
JuThinFilm
.
collisionparams
{
T
}(
δ
=
δ
,
τ
=
1.0
)
pressureparameters
=
JuThinFilm
.
pressurestats
{
T
}(
θ
=
θ
,
γ
=
0.007
)
center
=
(
lx÷2
,
ly÷2
)
if
kind
==
"Droplet"
if
device
mom
=
singledroplet
(
T
,
lx
,
ly
,
h₀
,
θ₀
,
center
,
device
=
true
)
else
mom
=
singledroplet
(
T
,
lx
,
ly
,
h₀
,
θ₀
,
center
)
end
elseif
kind
==
"Sinewave"
mom
=
sinewaves
(
T
,
lx
,
ly
)
end
if
device
dists
=
default_cudistribution
(
T
,
parameters
.
lx
,
parameters
.
ly
)
Fpressure
=
default_cuforce
(
T
,
lx
,
ly
)
Fsum
=
default_cuforce
(
T
,
lx
,
ly
)
Fslip
=
default_cuforce
(
T
,
lx
,
ly
)
Fbody
=
default_cuforce
(
T
,
lx
,
ly
)
else
dists
=
default_distribution
(
T
,
parameters
.
lx
,
parameters
.
ly
)
Fpressure
=
default_force
(
T
,
lx
,
ly
)
Fsum
=
default_force
(
T
,
lx
,
ly
)
Fslip
=
default_force
(
T
,
lx
,
ly
)
Fbody
=
default_force
(
T
,
lx
,
ly
)
end
# 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
.
fout
,
dists
.
feq
)
# Now move to the time loop
for
t
in
1
:
parameters
.
mt
if
t
%
1000
==
0
mass
=
round
(
sum
(
mom
.
height
),
digits
=
3
)
println
(
"time step
$
t with mass
$
mass"
)
end
# # Get the equilibrium and then performe a collision.
# equilibrium!(dists, mom, lat, parameters)
# JuThinFilm.collidestreamBGK_periodicGUO!(dists, Fsum, lat, collisionparameters, T)
# JuThinFilm.macroscopicmoments!(mom, dists, Fsum)
# JuThinFilm.measurecoxvoinov!(wetted, mom, collisionparameters, pressureparameters)
# end
# return mom, wetted
# end
# # That works seemingly well :)
# function slidingdroplet(T, lx, ly, maxtime; θ₀=1/3, θₑ=1/6, δ₀=2.5, R₀=40, fbody=8e-5)
# center = (Int(lx/2), Int(ly/2))
# mom = singledroplet(T, lx, ly, R₀, θ₀, center)
# # Some parameter defining at the start
# parameters = params{T}(lx=lx, ly=ly, mt=maxtime)
# collisionparameters = collisionparams{T}(δ=δ₀, τ=1.0)
# pressureparameters = pressurestats{T}(θ=θₑ, γ=0.007, hstar=0.1)
# dists = distributions{T}(para=parameters)
# lat = lattice{T}()
# # Initialize Forcings
# Fpressure = default_force(T, lx, ly)
# Fsum = default_force(T, lx, ly)
# Fslip = default_force(T, lx, ly)
# Fbody = default_force(T, lx, ly)
# hperiodic = zeros(lx+2, ly+2)
# presperiodic = zeros(lx+2, ly+2)
# # Some measuring lists
# maxu = []
# maxv = []
# mass = []
# # Get the first equilibrium here
# JuThinFilm.equilibrium!(dists, mom, lat, parameters)
# copy!(dists.fout,dists.feq)
# for t in 1:parameters.mt
# # push!(maxu, maximum(mom.velocity.x))
# # push!(maxv, maximum(mom.velocity.y))
# push!(mass, sum(mom.height))
# if t%500 == 0 && t > 0
# massout = round(mass[t], digits=3)
# println("time step $t and mass $(massout)")
# end
# # Compute forces
# hperiodic = padarray(mom.height, Pad(:circular,1,1,))
# JuThinFilm.capillarypressure!(mom.pressure, hperiodic, pressureparameters)
# presperiodic = padarray(mom.pressure, Pad(:circular,1,1))
# JuThinFilm.h∇p!(Fpressure.x, Fpressure.y, mom.height, presperiodic, lx, ly)
# slippage!(Fslip, mom, collisionparameters)
# # constantforce!(Fbody, mom, t, fbody, true, false, tonset=500, tsmooth=1000)
# sumforces!(Fsum, Fpressure, Fslip, Fbody)
# 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.
#
JuThinFilm.
equilibrium!(dists, mom
, lat
, parameters)
#
JuThinFilm.
BGKandStream!(dists
.fout, dists.feq, dists.ftemp, Fsum.x, Fsum.y
, collisionparameters, kind="WFM")
#
JuThinFilm.
macroscopicmoments!(mom, dists)
#
end
#
# gif(anim, "animations/sliding_drop.gif", fps = 80)
# return mom
# end
# 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
end
src/structs.jl
View file @
a45afc59
...
...
@@ -729,4 +729,9 @@ function default_distribution(T, n, m)
dist
=
distributions
{
T
}(
para
=
paras
)
return
dist
end
# TODO: Write a test for `default_distribution`!
\ No newline at end of file
function
default_cudistribution
(
T
,
n
,
m
)
paras
=
params
{
T
}(
lx
=
n
,
ly
=
m
)
dist
=
cudistributions
{
T
}(
para
=
paras
)
return
dist
end
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment