From 12ca4139c9356f402f2900626d134ed8ae39d240 Mon Sep 17 00:00:00 2001
From: martamestroni <marta.mestroni@gmail.com>
Date: Wed, 6 Jul 2022 17:57:40 +0200
Subject: [PATCH] Added file with examples of function calls updated to latest
 version of eff_drop

---
 Call_example_eff_drop.jl | 96 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Call_example_eff_drop.jl

diff --git a/Call_example_eff_drop.jl b/Call_example_eff_drop.jl
new file mode 100644
index 0000000..670775c
--- /dev/null
+++ b/Call_example_eff_drop.jl
@@ -0,0 +1,96 @@
+###FRAP initial conditions
+    include("C:/Users/marta/frap_theory/eff_Drop.jl")
+    P = 2; D_i = 0.1; D_o = 0.1; BP=0.5; 
+    T=5; perc=0.5;
+
+    A, u, x, b, Nb, t_perc, αi, αo= @time solve_D("3D",["FRAP", 0.1],P,
+        D_i,D_o,BP,T,perc,1)
+
+    #Plot analytical vs. numerical solution - 1D case
+    u = u[:, vcat(1:Nb-1, Nb+2:size(u, 2))]
+    x = vcat(collect(x[1:Nb-1]), collect(x[Nb+2:end]))
+
+    plt=Plots.plot(xlabel= "x", ylabel = "u", palette=:seaborn_colorblind,
+        foreground_color_legend = nothing, background_color_legend = nothing,
+        legend=:topright, background_color=:transparent, 
+        foreground_color=:black)
+
+    plot!(plt,x, u[1,:], label="3D FRAP, T="*string(T),
+        foreground_color_legend = nothing, lw=3, color=1)
+    # for i in 101:100:(Int(T/Δt))
+    for i in 11:10:(Int(T/Δt))
+        plot!(plt, x, u[i, :], label=false, color=1,
+            lw=1, xlims=(0, 2))
+    end
+    display(plt)
+###
+
+###Analytical initial conditions
+    include("C:/Users/marta/frap_theory/eff_Drop.jl")
+    P = 2; D_i = 0.1; D_o = 0.1; BP=0.5;
+    T=5; perc=0.5;
+
+    A, u, x, b, Nb, t_perc, αi, αo= @time solve_D("3D",
+        ["analytical",0.5,2, 0.01],P,D_i,D_o,BP,T,perc,1)
+
+    #Plot analytical vs. numerical solution - 1D case
+    u = u[:, vcat(1:Nb-1, Nb+2:size(u, 2))]
+    x = vcat(collect(x[1:Nb-1]), collect(x[Nb+2:end]))
+
+    plt=Plots.plot(xlabel= "x", ylabel = "u", palette=:seaborn_colorblind,
+        foreground_color_legend = nothing, background_color_legend = nothing,
+        legend=:topright, background_color=:transparent, 
+        foreground_color=:black)
+
+    plot!(plt,x, u[1,:], label="analytical, T="*string(T),
+        foreground_color_legend = nothing, lw=3, color=1)
+    # for i in 101:100:(Int(T/Δt))
+    for i in 11:10:(Int(T/Δt))
+        plot!(plt, x, u[i, :], label=false, color=1,
+            lw=1, xlims=(0, 2))
+    end
+    display(plt)
+###
+
+###Experimental initial conditions (for now just inside)
+    include("C:/Users/marta/frap_theory/eff_Drop.jl")
+    P = 2; D_i = 0.1; D_o = 0.1; BP=0.5; 
+    T=5; perc=0.5;
+
+    A, u, x, b, Nb, t_perc, αi, αo, MC, tN, Ni, No= @time solve_D("3D",
+        ["FRAP", 0.1],P,D_i,D_o,BP,T,perc,1)
+
+    BE=u[:,Nb-1]
+
+    u = u[:, vcat(1:Nb-1, Nb+2:size(u, 2))]
+    x = vcat(collect(x[1:Nb-1]), collect(x[Nb+2:end]))
+
+    plt=Plots.plot(xlabel= "x", ylabel = "u", 
+        palette=:seaborn_colorblind)
+
+    plot!(plt,x, u[1,:], label="Experiemental",
+        foreground_color_legend = nothing, lw=3, color=1)
+    for i in 101:100:(Int(T/Δt))
+        plot!(plt, x, u[i, :], label=false, color=1,
+            lw=3)
+    end
+    scatter!(plt,(x[Nb-1],BE[1]), label="EB",color=2,
+        markerstrokewidth=0, markersize=3)
+    for i in 101:100:(Int(T/Δt))
+        scatter!(plt,(x[Nb-1],BE[i]), label=false, color=2,
+        markerstrokewidth=0, markersize=3)
+    end
+
+    AE, uE, xE, bE, NbE, t_percE, αiE, αoE, MCE, tE, NiE, NoE= 
+        @time solve_D("3D",["Exp",zeros(9),BE,tN],P,D_i,D_o,BP,
+        T,perc,1)
+
+    plot!(plt,xE, uE[1,:], label="Simulation EB",
+        foreground_color_legend = nothing, linestyle=:dash, lw=3, 
+        color=4)
+    for i in 101:100:(Int(T/Δt))
+        plot!(plt, xE, uE[i, :], label=false, color=4,
+            linestyle=:dash, lw=3)
+    end
+    display(plt)
+###
\ No newline at end of file
-- 
GitLab