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

Merge branch 'GPU_Usage' into 'master'

First version update with performance studies and simpler function calls.

See merge request !5
parents a8fc113e 0b2b86ef
Pipeline #22921 passed with stages
in 7 minutes and 10 seconds
image: julia:1.4 # image comes from Docker hub
image: julia:1.5 # image comes from Docker hub
before_script:
# workaround for https://github.com/JuliaDocs/Documenter.jl/issues/686
......
......@@ -5,8 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Performance test for all functions.
- A clearer and simpler GPU integration.
<!--- ## [1.0.0] - 2017-06-20
<!-- ## [1.0.0] - 2017-06-20
### Added
- New visual identity by [@tylerfortune8](https://github.com/tylerfortune8).
- Version navigation.
......@@ -122,13 +124,41 @@ notable changes.
## [0.0.3] - 2014-08-09
### Added
- "Why should I care?" section mentioning The Changelog podcast.
--->
## [0.0.2] - 2020-09-02
## [0.0.2] - 2014-07-10
### Added
- Explanation of the recommended reverse chronological release ordering.
--->
- Better documentation for the computation of the capillary pressure.
- Theory part in most of the docstrings.
- Performance tests for the computation of the capillary pressure, see [pressure.jl](test/pressure.jl).
- New collision kernels `BGKwithBuickGreatedStream!` and `BGKwithGuoStream!`, Buick and Guo use different force corrections.
- Performance tests for the collision kernels, `BGKwithGuoStream!` is the slowest option, further details see [collision.jl](test/collisions.jl).
- The gradient of the pressure is now calculated with a circular padded array and is called `h∇p!`.
- Performance tests for all available forces, `slippage!`, `thermalfluctuations!`, `h∇p!` and `inclinedplane!`, see [forcing.jl](test/forcing.jl)
### Changed
- Computation of pressure is now mostly vectorized, see [pressure.jl](src/pressure.jl).
- Collision kernels moved from looping to vectorization with broadcasting, for details see [collision.jl](src/collision.jl).
- The default collision operation was renamed to `BGKandStream!` and has now a flag to use the weigthing function correction.
- Vectorization of equilibrium calculation in function `equilibrium!`, see [equilibrium!.jl](src/equilibria.jl).
- structs are no longer exported, to initialize them use `JuThinFilm.name` with the name of the struct.
- Docstrings of all functions have been updated accordingly.
### Removed
- Calculation of the disjoining pressure with `Pi_cuda` has been removed, GPU functionality needs further testing.
- Kernels have been removed such `kernel_laplacianperiodic!`, `kernel_gradientperiodic!` and `kernel_pressure!` are no longer existing.
- `kernel_equilibrium!` has been removed in favor of a `equilibrium!` GPU version.
- `velocitysquare` for cumoments has been removed.
- `filmpressure!` in favor of `h∇p!`, see [forcing.jl](src/forcing.jl).
## [0.0.1] - 2020-08-18
### Added
- This CHANGELOG file to document upcoming changes
- README now contains a link to the CHANGELOGs
- Full working relaxing droplet simulation on a patterned substrate see [relaxwithpatch.jl](scripts/relaxwithpatch.jl)
\ No newline at end of file
......@@ -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"
......@@ -75,10 +75,10 @@ uuid = "aafaddc9-749c-510e-ac4f-586e18779b91"
version = "0.2.1"
[[CategoricalArrays]]
deps = ["DataAPI", "Future", "JSON", "Missings", "Printf", "Statistics", "Unicode"]
git-tree-sha1 = "a6c17353ee38ddab30e73dcfaa1107752de724ec"
deps = ["DataAPI", "Future", "JSON", "Missings", "Printf", "Statistics", "StructTypes", "Unicode"]
git-tree-sha1 = "e7cb4f23938914f09afae58b611a59f3aa8d8f66"
uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
version = "0.8.1"
version = "0.8.2"
[[CodeTracking]]
deps = ["InteractiveUtils", "UUIDs"]
......@@ -100,15 +100,15 @@ version = "0.7.0"
[[ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "607c0ea16cb32af49ea2976f90c0c5acbca37d21"
git-tree-sha1 = "4bffea7ed1a9f0f3d1a131bbcd4b925548d75288"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.10.8"
version = "0.10.9"
[[ColorVectorSpace]]
deps = ["ColorTypes", "Colors", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "StatsBase"]
git-tree-sha1 = "bd0c0c81a39923bc03f9c3b61d89ad816e741002"
git-tree-sha1 = "2ae827d936fa9d8e00dd5166563499c07c5672c5"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.8.5"
version = "0.8.6"
[[Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Reexport"]
......@@ -124,9 +124,9 @@ version = "0.3.0"
[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "083e7e5ec3ef443e9dcb6dd3fbcb815879823bfa"
git-tree-sha1 = "7c7f4cda0d58ec999189d70f5ee500348c4b4df1"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.14.0"
version = "3.16.0"
[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
......@@ -174,10 +174,10 @@ uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "0.21.7"
[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "88d48e133e6d3dd68183309877eac74393daa7eb"
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "a88a67acbf3b61057371f315cadd027c8bce6d6d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.20"
version = "0.18.5"
[[DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
......@@ -216,9 +216,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "c5714d9bcdba66389612dc4c47ed827c64112997"
git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.2"
version = "0.8.3"
[[Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
......@@ -249,9 +249,9 @@ uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a"
version = "0.5.2"
[[ExprTools]]
git-tree-sha1 = "6f0517056812fd6aa3af23d4b70d5325a2ae4e95"
git-tree-sha1 = "7fce513fcda766962ff67c5596cb16c463dfd371"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
version = "0.1.1"
version = "0.1.2"
[[FFTViews]]
deps = ["CustomUnitRanges", "FFTW"]
......@@ -279,9 +279,9 @@ version = "0.2.0"
[[FileIO]]
deps = ["Pkg"]
git-tree-sha1 = "1e7e88a949b52e6f7f589041bd60928322414997"
git-tree-sha1 = "992b4aeb62f99b69fcf0cb2085094494cc05dfb3"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.4.1"
version = "1.4.3"
[[FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
......@@ -334,9 +334,9 @@ version = "5.1.0"
[[GPUCompiler]]
deps = ["DataStructures", "InteractiveUtils", "LLVM", "Libdl", "TimerOutputs", "UUIDs"]
git-tree-sha1 = "c5687a4d9ff9fcfce8700b98106d63334dcbb4fe"
git-tree-sha1 = "05097d81898c527e3bf218bb083ad0ead4378e5f"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "0.6.0"
version = "0.6.1"
[[Graphics]]
deps = ["Colors", "LinearAlgebra", "NaNMath"]
......@@ -358,9 +358,9 @@ version = "0.3.1"
[[ImageAxes]]
deps = ["AxisArrays", "ImageCore", "MappedArrays", "Reexport", "SimpleTraits"]
git-tree-sha1 = "c0aca8db7e9fddda18c9cebff5d147b0e799d676"
git-tree-sha1 = "6f6e8be05a46733c69209c8b5828c4e463ccd5f5"
uuid = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac"
version = "0.6.4"
version = "0.6.5"
[[ImageContrastAdjustment]]
deps = ["ColorVectorSpace", "ImageCore", "ImageTransformations", "MappedArrays", "Parameters"]
......@@ -370,9 +370,9 @@ version = "0.3.5"
[[ImageCore]]
deps = ["Colors", "FixedPointNumbers", "Graphics", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "Reexport", "Requires"]
git-tree-sha1 = "a652c05f8f374861580d420b420fddf3e2e84312"
git-tree-sha1 = "8628794375a87e8006e489a8575ddbb98b779370"
uuid = "a09fc81d-aa75-5fe9-8630-4744c3626534"
version = "0.8.14"
version = "0.8.16"
[[ImageDistances]]
deps = ["ColorVectorSpace", "Distances", "ImageCore", "LinearAlgebra", "MappedArrays", "Statistics"]
......@@ -388,9 +388,9 @@ version = "0.6.15"
[[ImageMetadata]]
deps = ["AxisArrays", "ColorVectorSpace", "ImageAxes", "ImageCore", "IndirectArrays"]
git-tree-sha1 = "5c2c78dc11343d83320e790379e0f58de3aa1b7e"
git-tree-sha1 = "c899f9bc8e4dc30da95628c88356355dd34f6108"
uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49"
version = "0.9.1"
version = "0.9.2"
[[ImageMorphology]]
deps = ["ColorVectorSpace", "ImageCore", "LinearAlgebra", "TiledIteration"]
......@@ -412,9 +412,9 @@ version = "0.2.3"
[[ImageTransformations]]
deps = ["AxisAlgorithms", "ColorVectorSpace", "CoordinateTransformations", "IdentityRanges", "ImageCore", "Interpolations", "OffsetArrays", "Rotations", "StaticArrays"]
git-tree-sha1 = "ac8bdd1920078ac047e441aa19135702ecab3d0c"
git-tree-sha1 = "5a0207dafba64650268bb5718875c0eea441e1ee"
uuid = "02fcd773-0e25-5acc-982a-7f6622650795"
version = "0.8.5"
version = "0.8.6"
[[Images]]
deps = ["AxisArrays", "Base64", "ColorVectorSpace", "FileIO", "Graphics", "ImageAxes", "ImageContrastAdjustment", "ImageCore", "ImageDistances", "ImageFiltering", "ImageMetadata", "ImageMorphology", "ImageQualityIndexes", "ImageShow", "ImageTransformations", "IndirectArrays", "MappedArrays", "OffsetArrays", "Random", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "StatsBase", "TiledIteration"]
......@@ -479,9 +479,9 @@ version = "1.0.0"
[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.0"
version = "0.21.1"
[[JSONSchema]]
deps = ["HTTP", "JSON", "ZipFile"]
......@@ -490,10 +490,10 @@ uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "0.3.2"
[[JuMP]]
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "MutableArithmetics", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "cbab42e2e912109d27046aa88f02a283a9abac7c"
deps = ["Calculus", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MathOptInterface", "MutableArithmetics", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "766014f271bd33b7f9d9bdc4847e214ee20ae84d"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.21.3"
version = "0.21.4"
[[JuliaInterpreter]]
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
......@@ -556,9 +556,9 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MathOptInterface]]
deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "JSON", "JSONSchema", "LinearAlgebra", "MutableArithmetics", "OrderedCollections", "SparseArrays", "Test", "Unicode"]
git-tree-sha1 = "cd2049c055c7d192a235670d50faa375361624ba"
git-tree-sha1 = "a121678315668752aa5d26fef9ab564941c81e43"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
version = "0.9.14"
version = "0.9.15"
[[MathProgBase]]
deps = ["LinearAlgebra", "SparseArrays"]
......@@ -574,30 +574,24 @@ version = "1.0.2"
[[MbedTLS_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "a0cb0d489819fa7ea5f9fa84c7e7eba19d8073af"
git-tree-sha1 = "c0b1286883cac4e2b617539de41111e0776d02e8"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.16.6+1"
version = "2.16.8+0"
[[Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "de0a5ce9e5289f27df672ffabef4d1e5861247d5"
git-tree-sha1 = "ed61674a0864832495ffe0a7e889c0da76b0f4c8"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "0.4.3"
version = "0.4.4"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[MosaicViews]]
deps = ["OffsetArrays", "PaddedViews"]
git-tree-sha1 = "b483b88403ac0ac01667778cbb29462b111b1deb"
deps = ["MappedArrays", "OffsetArrays", "PaddedViews"]
git-tree-sha1 = "29d121f9e7a6cf081278029121ed90e1f3b33de8"
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"
version = "0.2.3"
[[MutableArithmetics]]
deps = ["LinearAlgebra", "SparseArrays", "Test"]
......@@ -617,9 +611,9 @@ uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.4"
[[OffsetArrays]]
git-tree-sha1 = "2066e16af994955287f2e03ba1d9e890eb43b0dd"
git-tree-sha1 = "663d3402efa943c95f4736fa7b462e9dd97be1a9"
uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
version = "1.1.2"
version = "1.2.0"
[[OpenSpecFun_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
......@@ -628,9 +622,9 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.3+3"
[[OrderedCollections]]
git-tree-sha1 = "293b70ac1780f9584c89268a6e2a560d938a7065"
git-tree-sha1 = "16c08bf5dba06609fe45e30860092d6fa41fde7b"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.3.0"
version = "1.3.1"
[[PaddedViews]]
deps = ["OffsetArrays"]
......@@ -654,12 +648,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"
......@@ -689,9 +677,9 @@ uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439"
version = "0.4.0"
[[RecipesBase]]
git-tree-sha1 = "58de8f7e33b7fda6ee39eff65169cd1e19d0c107"
git-tree-sha1 = "6ee6c35fe69e79e17c455a386c1ccdc66d9f7da4"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.0.2"
version = "1.1.0"
[[Reexport]]
deps = ["Pkg"]
......@@ -701,15 +689,15 @@ version = "0.2.0"
[[Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "d37400976e98018ee840e0ca4f9d20baa231dc6b"
git-tree-sha1 = "8c08d0c7812169e438a8478dae2a529377ad13f7"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "1.0.1"
version = "1.0.2"
[[Revise]]
deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "UUIDs", "Unicode"]
git-tree-sha1 = "0992d4643e27b2deb9f2e4ec7a56b7033813a027"
git-tree-sha1 = "a860e786779be1ab6407d427470e1415711dd459"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "2.7.3"
version = "2.7.5"
[[Rotations]]
deps = ["LinearAlgebra", "StaticArrays", "Statistics"]
......@@ -781,9 +769,15 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"]
git-tree-sha1 = "a6102b1f364befdb05746f386b67c6b7e3262c45"
git-tree-sha1 = "d72a47c47c522e283db774fc8c459dd5ed773710"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.33.0"
version = "0.33.1"
[[StructTypes]]
deps = ["Dates", "UUIDs"]
git-tree-sha1 = "1ed04f622a39d2e5a6747c3a70be040c00333933"
uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
version = "1.1.0"
[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
......@@ -845,6 +839,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+15"
version = "1.2.11+16"
......@@ -4,6 +4,7 @@ authors = ["Zitzeronion <s.zitz@fz-juelich.de>"]
version = "0.1.0"
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
......@@ -15,7 +16,6 @@ LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
......
......@@ -74,8 +74,8 @@ begin
hd_var = "height"
polygon = triangle
shape = @name triangle
contrast = -10.0 # [5, 10, 15, 20, -10]
vol = 30 # [20, 25, 30]
contrast = 20.0 # [5, 10, 15, 20, -10]
vol = 20 # [20, 25, 30]
end
# ╔═╡ 508d3c22-e772-11ea-3b00-03c64a90ecd2
......@@ -115,7 +115,7 @@ begin
end
# ╔═╡ ed7cdbbc-e783-11ea-0675-23b30b549382
md"And the surface area of the droplet"
md"And the surface area of the droplet excluding the base area"
# ╔═╡ fd0136e6-e783-11ea-38fa-71130320f53b
begin
......@@ -131,7 +131,7 @@ begin
plot!(trianglesurf, label="triangle", lw=2)
plot!(ellipsesurf, label="ellipse", lw=2)
plot!(circlesurf, label="circle", lw=2)
plot!(xlims = (0, 4000))
plot!(xlims = (0, 2000))
end
# ╔═╡ e91776a2-e77b-11ea-2b1b-efec77ae5aa4
......@@ -161,8 +161,8 @@ end
# ╔═╡ Cell order:
# ╠═fbec2be8-e775-11ea-3b9d-a95eac0bb6b7
# ╠═15c6d3ec-e776-11ea-271b-7d32a12e86d5
# ╠═da280ffa-e77e-11ea-30d5-65eb4b74d8c7
# ╠═15c6d3ec-e776-11ea-271b-7d32a12e86d5
# ╟─e84a8518-e39e-11ea-1cd9-59bd95e672bf
# ╠═40854412-e76f-11ea-01aa-379d8e332c43
# ╟─2aabe662-e771-11ea-37c9-0f1ca548971f
......
......@@ -47,7 +47,7 @@ anim = @animate for t in 1:parameters.mt
# Relevant for plotting and animation generation
# cuts[:,1] .= mom.height[:,center[2]]
# cuts[:,2] .= mom.height[center[1],:]
l = @layout [a b; c{0.2h} d{0.2h}]
l = @layout [a b; c{0.2h}; d{0.2h}]
p1 = Plots.surface(mom.height, c=:viridis)
p2 = plot(P, fill=:blue)
p2 = contourf!(mom.height, aspect_ratio=1, c=:viridis)
......
module JuThinFilm
using CUDA, Revise, Parameters, Random, Images, LazySets, LinearAlgebra, Pluto
using CUDA, Revise, Parameters, Random, Images, LazySets, LinearAlgebra
include("structs.jl")
include("initialstates.jl")
......@@ -12,19 +12,18 @@ include("forcing.jl")
include("runsimulation.jl")
include("measurements.jl")
# Export structs
export params, lattice, culattice, velocity, cuvelocity, force, cuforce, moments, cumoments, pressurestats, collisionparams, distributions, cudistributions
export default_moments, default_cumoments, default_velocity, default_cuvelocity, default_force, default_cuforce
# Export generators for structs
export default_moments, default_cumoments, default_velocity, default_cuvelocity, default_force, default_cuforce, default_distribution
# Defined initial fluid states
export flatsurface, sinewaves, singledroplet
# As well as initial substrate states
export ellipsepattern
export ellipsepattern, trianglepattern, boxpattern
# Export functions
export Π, Pi_cuda, Δ!, kernel_laplacianperiodic!, kernel_gradientperiodic!, kernel_pressure!
export equilibrium!, kernel_equilibrium!, velsquare
export Π, Δ!, capillarypressure!
export equilibrium!
export macroscopicmoments!
export collidestreamBGK_periodic!, collidestreamBGK_periodicGUO!
export slippage!, thermalflutuations!, filmpressure!, constantforce!, sumforces!
export BGKandStream!, BGKwithBuickGreatedStream!, BGKwithGuoStream!
export slippage!, thermalfluctuations!, h∇p!, inclinedplane!, sumforces!
# Put everything together to get a full simulation
export runsimulation, runrealsimulation
......
"""
macroscopicmoments(mom, dists)
Computes the first few moments, `height`, `velocity.x` & `velocity.y` of the post collision distribution.
Computes the macroscopic moments `height` and `velocity` from the post collision distribution `fout`.
In case of using `BGKwithBuickGreatedStream` or `BGKwithGuoStream` add the sum of all forces to the moment calculation.
# Theory
The macroscopic moments, `density` (ρ) and `velocity` can be obtained as moments of the distribution function.
Density ρ reduces in the shallow water case to the `height` (h) of the film and is given by the zeroth moment.
On the other hand the velocity vector in 2d `(u,v)` is given by both the first and the second moment.
They are calculated according to
`` h = \\sum_{\\alpha} f_{\\alpha} .``
Velocities are thus given by
`` v_i = \\frac{1}{h}\\sum_{\\alpha} c_{\\alpha}^i f_{\\alpha},``
where the subscript `i` indicated the two components `(x,y)`.
To be efficient the height is computed simply using **Julia**s `sum!` function.
For the velocities I decided to do a little index shifting to use `sum` as well.
One can add a force as input as well, if so a Guo like force correction is applied.
# Examples
```jldoctest
julia> using JuThinFilm
julia> dists = distributions{Float64}(para=params(lx=5,ly=5));
julia> dists = default_distribution(Float64, 5, 5);
julia> mom = default_moments(Float64, 5, 5); mom.height
5×5 Array{Float64,2}:
......@@ -30,7 +50,7 @@ julia> mom.height # height is now the sum of fout.
0.1 0.1 0.1 0.1 0.1
0.1 0.1 0.1 0.1 0.1
julia> dists = cudistributions{Float32}(para=params{Float32}(lx=5,ly=5)); dists.fout[:, :, 1] .= 0.1f0; # Works similar on the GPU.
julia> dists = JuThinFilm.cudistributions{Float32}(para=JuThinFilm.params{Float32}(lx=5,ly=5)); dists.fout[:, :, 1] .= 0.1f0; # Works similar on the GPU.
julia> mom = default_cumoments(Float32, 5, 5); mom.height
5×5 CUDA.CuArray{Float32,2}:
......@@ -56,8 +76,20 @@ julia> mom.height
See also: [`distributions`](@ref), [`moments`](@ref), [`default_moments`](@ref)
"""
function macroscopicmoments!(mom::Moment, dists::Distribution)
mom.height .= sum(dists.fout, dims=3)[:,:,1]
function macroscopicmoments!(mom::moments, dists::Distribution)
sum!(mom.height, dists.fout)
mom.velocity.x = permutedims(sum(permutedims(dists.fout, [3,1,2]) .* [0; 1; 0; -1; 0; 1; -1; -1; 1;], dims=1),[2,3,1])[:, : ,1]
mom.velocity.y = permutedims(sum(permutedims(dists.fout, [3,1,2]) .* [0; 0; 1; 0; -1; 1; 1; -1; -1;], dims=1),[2,3,1])[:, : ,1]
# Normalize with height
mom.velocity.x ./= mom.height
mom.velocity.y ./= mom.height
return nothing
end
function macroscopicmoments!(mom::cumoments, dists::Distribution)
sum!(mom.height, dists.fout)
mom.velocity.x .= dists.fout[:,:,2] .- dists.fout[:,:,4] .+ dists.fout[:,:,6] .- dists.fout[:,:,7] .- dists.fout[:,:,8] .+ dists.fout[:,:,9] # This is not as easy as thought
mom.velocity.y .= dists.fout[:,:,3] .- dists.fout[:,:,5] .+ dists.fout[:,:,6] .+ dists.fout[:,:,7] .- dists.fout[:,:,8] .- dists.fout[:,:,9]
......@@ -68,8 +100,20 @@ function macroscopicmoments!(mom::Moment, dists::Distribution)
return nothing
end
function macroscopicmoments!(mom::Moment, dists::Distribution, F::Force)
mom.height .= sum(dists.fout, dims=3)[:,:,1]
function macroscopicmoments!(mom::moments, dists::Distribution, F::Force)
sum!(mom.height, dists.fout)
mom.velocity.x = permutedims(sum(permutedims(dists.fout, [3,1,2]) .* [0; 1; 0; -1; 0; 1; -1; -1; 1;], dims=1),[2,3,1])[:, : ,1] .+ F.x ./ 2
mom.velocity.y = permutedims(sum(permutedims(dists.fout, [3,1,2]) .* [0; 0; 1; 0; -1; 1; 1; -1; -1;], dims=1),[2,3,1])[:, : ,1] .+ F.y ./ 2
# Normalize with height
mom.velocity.x ./= mom.height
mom.velocity.y ./= mom.height
return nothing
end
function macroscopicmoments!(mom::cumoments, dists::Distribution, F::Force)
sum!(mom.height, dists.fout)
mom.velocity.x .= dists.fout[:,:,2] .- dists.fout[:,:,4] .+ dists.fout[:,:,6] .- dists.fout[:,:,7] .- dists.fout[:,:,8] .+ dists.fout[:,:,9] .+ F.x ./ 2
mom.velocity.y .= dists.fout[:,:,3] .- dists.fout[:,:,5] .+ dists.fout[:,:,6] .+ dists.fout[:,:,7] .- dists.fout[:,:,8] .- dists.fout[:,:,9] .+ F.y ./ 2
......@@ -78,4 +122,4 @@ function macroscopicmoments!(mom::Moment, dists::Distribution, F::Force)
mom.velocity.y ./= mom.height
return nothing
end
\ No newline at end of file
end
"""
collidestreamBGK_periodic!(fout, ftemp, feq, Fx, Fy, lat, col, T)
BGKandStream!(fout, feq, ftemp, Fx, Fy, col, kind="simple")
Performs a lattice Boltzmann collision operation according to single relaxation time `τ` with forcing `F`.
Performs a lattice Boltzmann **BGK** collision operation with a single relaxation time `τ` and forcing `Fx`, `Fy`.
This is a simple BKG collision kernel with an explicit streaming step, see the left hand expressions.
To include the forcing the weighting factor method is used.
This is a simple BKG collision kernel with additional streaming done by `circshift`.
To include the forcing the weighting factor method (WFM) is used.
# Theory
The idea behind this collision operator is quite simple.
Within the time `τ` a system close to equilibrium should relax towards its equilibrium.
``f_{\\alpha}(\\mathbf{x}+\\mathbf{c}_{\\alpha}\\Delta t, t + \\Delta t) - f_{\\alpha}(\\mathbf{x},t) = \\frac{1}{\\tau}(f_{\\alpha}(\\mathbf{x},t) - f_{\\alpha}^{\\text{eq.}}(\\mathbf{x},t)) +\\Delta t \\mathcal{S}.``
Usually the collision kernel does only define the part ``\\frac{1}{\\tau}(f_{\\alpha}(\\mathbf{x},t) - f_{\\alpha}^{\\text{eq.}}(\\mathbf{x},t)), however since the case without forcing is boring we account for them as well.
This accounting is done with the weighting factor method (WFM), for which the source term ``\\mathcal{S}`` becomes
`` \\mathcal{S} = \\frac{3 w_{\\alpha}}{e_{\\alpha x}e_{\\alpha x} + e_{\\alpha y}e_{\\alpha y}}e_{\\alpha i}F_i \\quad i \\in {x,y}.``
Second part of this function is the streaming of post collision populations.
Such the computation of ``f_{\\alpha}(\\mathbf{x}+\\mathbf{c}_{\\alpha}\\Delta t, t + \\Delta t)``.
This is straightforwardly taken care of by Julias function `circshift`, which has the additional feature of computing `ftemp` for the next time step.
# Arguments