From 0cbdb650609d24ec8bb6995bd5cacce8cbec90e6 Mon Sep 17 00:00:00 2001 From: Stefan Zitz Date: Fri, 18 Sep 2020 13:38:57 +0200 Subject: [PATCH] Fixed the wrong energy measurement --- src/measurements.jl | 92 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/src/measurements.jl b/src/measurements.jl index b9a59f3..96b4565 100644 --- a/src/measurements.jl +++ b/src/measurements.jl @@ -3,7 +3,17 @@ Measurement of the base wetted area of a droplet. +# Theory + +The area of the fluid-solid interface is easily computed by summing up the fluid nodes which are higher than the precursor film. + + S = \\int_{h>h_p}\\Theta(\\mathbf{x},t) \\text{d}\\mathbf{x}.  + +Where  \\Theta(\\mathbf{x},t)  is a Heavyside function that returns one for a film height h(\\mathbf{x},t) > \\text{precursor layer}. +The threshold value that seperates between film and dry spot is h = 0.06, all below will be counted as dry spot. + # Examples + jldoctest julia> using JuThinFilm @@ -24,7 +34,7 @@ julia> JuThinFilm.measurewettedarea!(area, mom) # Now there is only one spot wit # References -See also: [runrealsimulation2'](@ref) +See also: [runsimulation'](@ref) """ function measurewettedarea!(area, mom::Moment) mask = findall(x -> x > 0.06, mom.height) @@ -37,14 +47,38 @@ end Returns the differential surface area of the fluid interface. +# Theory + Computes the differential surface area according to -S = ∫∫√[(∂ᵢh)^2 + (∂ⱼh)^2 + 1]didj  +S = ∫∫√[(∂ᵢh)^2 + (∂ⱼh)^2 + 1]didj . + +Keep in mind that we are not interested in the layer that stabilizes the simulation. +That is why a flat interface offers **no surface area**. # Examples + jldoctest julia> using JuThinFilm + +julia> surface = []; mom = default_moments(Float64, 10, 10); + +julia> JuThinFilm.measurefluidsurfacearea!(surface, mom) +1-element Array{Any,1}: + 0.0 + +julia> mom.height = reshape(collect(1.0:100.0),10,10); + +julia> JuThinFilm.measurefluidsurfacearea!(surface, mom) # Mainly due to the periodic bc! +2-element Array{Any,1}: + 0.0 + 1620.682406458573 +  + +# References + +See also: [runsimulation](@ref) """ function measurefluidsurfacearea!(surface, mom::JuThinFilm.Moment) len, wid = size(mom.height) @@ -62,7 +96,59 @@ function measurefluidsurfacearea!(surface, mom::JuThinFilm.Moment) push!(surface, area) end +""" + measuresurfaceandenergy!(surface, energy, mom::JuThinFilm.Moment, θ) + +Returns the differential surface area of the fluid interface as well as the reduced interfacial energy. + +# Theory + +Again we use the formular from measurefluidsurfacearea to calculate the differential surface area + +S = ∫∫√[(∂ᵢh)^2 + (∂ⱼh)^2 + 1]didj . +Keep in mind that we are not interested in the layer that stabilizes the simulation. +That is why a flat interface offers **no surface area**. + +On top for the computation of the reduced interfacial free energy we use + + \\tilde{E} = \\frac{E}{\\gamma} = S_{lv} - \\int_{A_{ls}} \\cos(\\theta(x,y)) \\text{d}A. + +Where the contact angle \\theta(x,y) is assumed to be *Youngs* contact angle and not the dynamically measured one. + +# Examples + +jldoctest +julia> using JuThinFilm + +julia> surface = []; energy = []; mom = default_moments(Float64, 10, 10); + +julia> JuThinFilm.measuresurfaceandenergy!(surface, energy, mom, fill(1/9,10,10)) +1-element Array{Any,1}: + -93.96926207859084 + +julia> surface +1-element Array{Any,1}: + 0.0 + +julia> mom.height = reshape(collect(1.0:100.0),10,10); + +julia> JuThinFilm.measuresurfaceandenergy!(surface, energy, mom, fill(1/9,10,10)) +2-element Array{Any,1}: + -93.96926207859084 + 1526.7131443799822 + +julia> surface +2-element Array{Any,1}: + 0.0 + 1620.682406458573 + + + +# References + +See also: [runsimulation`](@ref) +""" function measuresurfaceandenergy!(surface, energy, mom::JuThinFilm.Moment, θ) len, wid = size(mom.height) minfilm = 0.05 @@ -78,7 +164,7 @@ function measuresurfaceandenergy!(surface, energy, mom::JuThinFilm.Moment, θ) area = sum(sqarea) # For the interfacial energy the contact angle field is needed as well. mask = findall(x -> x > 0.06, mom.height) - E = area - sum(θ[mask]) + E = area - sum(cospi.(θ[mask])) push!(surface, area) push!(energy, E) end -- GitLab