From 9ccbd3d62373179cc3904efa13940813e4f962e2 Mon Sep 17 00:00:00 2001 From: Matthew Grasinger Date: Mon, 16 May 2022 07:02:29 -0400 Subject: [PATCH] more updates for julia v 1.x.x --- .../free-surface/pipe/pipe_with_obs.yaml | 17 +-- example_sims/free-surface/pipe/tow.yaml | 110 ++++++++++++++++ inc/col/mrt.jl | 6 +- inc/io/animate.jl | 36 ++---- publication_sims/tows/archive/tow.yaml | 121 +++++++++++++++++ publication_sims/tows/archive/tow_n-050.yaml | 111 ++++++++++++++++ publication_sims/tows/archive/tow_n-075.yaml | 111 ++++++++++++++++ publication_sims/tows/archive/tow_n-080.yaml | 122 ++++++++++++++++++ publication_sims/tows/archive/tow_n-090.yaml | 122 ++++++++++++++++++ publication_sims/tows/archive/tow_n-110.yaml | 122 ++++++++++++++++++ publication_sims/tows/archive/tow_n-125.yaml | 111 ++++++++++++++++ publication_sims/tows/tow.yaml | 114 ++++++++++++++++ publication_sims/tows/tow_n-080.yaml | 115 +++++++++++++++++ publication_sims/tows/tow_n-080_vented.yaml | 115 +++++++++++++++++ publication_sims/tows/tow_n-090.yaml | 115 +++++++++++++++++ publication_sims/tows/tow_n-090_vented.yaml | 115 +++++++++++++++++ publication_sims/tows/tow_vented.yaml | 114 ++++++++++++++++ 17 files changed, 1642 insertions(+), 35 deletions(-) create mode 100644 example_sims/free-surface/pipe/tow.yaml create mode 100644 publication_sims/tows/archive/tow.yaml create mode 100644 publication_sims/tows/archive/tow_n-050.yaml create mode 100644 publication_sims/tows/archive/tow_n-075.yaml create mode 100644 publication_sims/tows/archive/tow_n-080.yaml create mode 100644 publication_sims/tows/archive/tow_n-090.yaml create mode 100644 publication_sims/tows/archive/tow_n-110.yaml create mode 100644 publication_sims/tows/archive/tow_n-125.yaml create mode 100644 publication_sims/tows/tow.yaml create mode 100644 publication_sims/tows/tow_n-080.yaml create mode 100644 publication_sims/tows/tow_n-080_vented.yaml create mode 100644 publication_sims/tows/tow_n-090.yaml create mode 100644 publication_sims/tows/tow_n-090_vented.yaml create mode 100644 publication_sims/tows/tow_vented.yaml diff --git a/example_sims/free-surface/pipe/pipe_with_obs.yaml b/example_sims/free-surface/pipe/pipe_with_obs.yaml index 4579950..2eced72 100644 --- a/example_sims/free-surface/pipe/pipe_with_obs.yaml +++ b/example_sims/free-surface/pipe/pipe_with_obs.yaml @@ -3,20 +3,21 @@ version: 1.0.0 preamble: > @init_plot_env(); const datadir = joinpath("data", "pipe_with_obs"); - const nu = 0.2; - const constit_rel_f = init_constit_srt_const(nu); + const nuv = 0.2; + const constit_rel_f = init_constit_srt_const(nuv); const F = [2.0e-6; -0.0e-6]; - const forcing_kf = init_sukop_gravity_Fk(F); - const ni = 16; + const forcing_kf = init_sukop_Fk(F); + const ni = 64; const nj = 64; const nsteps = 200000; + const obs1 = [8; 16; 1; 8]; # data directory datadir: { value: datadir, expr: true } # material properties rho_0: { value: 1.0, expr: false } -nu: { value: nu, expr: true } +nu: { value: nuv, expr: true } # lattice parameters dx: { value: 1.0, expr: false } @@ -32,7 +33,7 @@ nsteps: { value: nsteps, expr: true } # obstacles obstacles: - type: bounce_back - coords: "[8; 16; 0; 8]" + coords: obs1 # boundary conditions bcs: @@ -48,7 +49,7 @@ fill_y: { value: 1.0, expr: false } # callback functions callbacks: - print_step_callback(50, "free-surf") - - plot_mass_contours_callback(200, joinpath(datadir, "mass"), [(1, 8, 8/ni, 16/ni)]; levs=[-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]) + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=[(1, 8, 8/ni, 16/ni)], levels=[-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]) - write_jld_file_callback(datadir, 500) # clean-up, backup, write out @@ -73,5 +74,5 @@ finally: end print_with_color(:green, "TEST PASSED\n"); end - - plot_mass_contours_callback(1, joinpath(datadir, "mass")) + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=[(1, 8, 8/ni, 16/ni)], levels=[-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]) - write_jld_file_callback(datadir) diff --git a/example_sims/free-surface/pipe/tow.yaml b/example_sims/free-surface/pipe/tow.yaml new file mode 100644 index 0000000..3b5e67c --- /dev/null +++ b/example_sims/free-surface/pipe/tow.yaml @@ -0,0 +1,110 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow"); + const nuv = 0.2; + const constit_rel_f = init_constit_srt_const(nuv); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 200000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back! + - south_bounce_back! + - (sim) -> east_pressure!(sim, 1.0); + - (sim) -> mass_inlet!(sim, 1, 1:nj, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/inc/col/mrt.jl b/inc/col/mrt.jl index bd27328..d6840d4 100644 --- a/inc/col/mrt.jl +++ b/inc/col/mrt.jl @@ -332,14 +332,14 @@ function (col_f::MRT_F)(sim::FreeSurfSim, active_cells::AbstractMatrix{Bool}) mu = col_f.constit_relation_f(sim, fneq, col_f.S, col_f.M, col_f.iM, i, j); - omega = omega(mu, lat.cssq, lat.dt); + omegav= omega(mu, lat.cssq, lat.dt); Sij = col_f.S(mu, rhoij, lat.cssq, lat.dt); - F = map(k -> col_f.forcing_f[2](sim, omega, k, i, j), 1:lat.n); + F = map(k -> col_f.forcing_f[2](sim, omegav, k, i, j), 1:lat.n); @inbounds lat.f[:,i,j] -= col_f.iM * Sij * col_f.M * fneq - F; # update collision frequency matrix - @inbounds msm.omega[i,j] = omega; + @inbounds msm.omega[i,j] = omegav; end end diff --git a/inc/io/animate.jl b/inc/io/animate.jl index 221f807..93cb3db 100644 --- a/inc/io/animate.jl +++ b/inc/io/animate.jl @@ -193,30 +193,18 @@ function pycontour_callback(stepout::Real, accessor::LBXFunction; mat = accessor(sim); PyPlot.clf(); - if filled - if colorbar - if levels != false - cs = PyPlot.contourf(mat, levels=levels); - PyPlot.colorbar(cs); - else - cs = PyPlot.contourf(mat); - PyPlot.colorbar(cs); - end - else - cs = PyPlot.contourf(mat) - end - else - if colorbar - if levels != false - cs = PyPlot.contour(mat, levels=levels); - PyPlot.colorbar(cs); - else - cs = PyPlot.contour(mat); - PyPlot.colorbar(cs); - end - else - cs = PyPlot.contour(mat) - end + cs = if filled && levels != false; + PyPlot.contourf(mat, levels=levels); + elseif !filled && levels != false + PyPlot.contour(mat, levels=levels); + elseif filled + PyPlot.contourf(mat); + else + PyPlot.contour(mat) + end + + if colorbar + PyPlot.colorbar(cs); end if title != "" diff --git a/publication_sims/tows/archive/tow.yaml b/publication_sims/tows/archive/tow.yaml new file mode 100644 index 0000000..1e7a36e --- /dev/null +++ b/publication_sims/tows/archive/tow.yaml @@ -0,0 +1,121 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow"); + const nuv = 0.2; + const constit_rel_f = init_constit_srt_const(nuv); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - (sim) -> east_bounce_back!(sim.lat, ni, 1, outletrange[1]-1); + - (sim) -> east_pressure!(sim.lat, 0.0, ni, outletrange[1], outletrange[2]); + - (sim) -> mass_inlet!(sim, ni, outletrange[1]:outletrange[2], 0.0) + - (sim) -> east_bounce_back!(sim.lat, ni, outletrange[2]+1, nj); + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, 1, inletrange[1]-1); +# - (sim) -> west_pressure!(sim.lat, 0.0, 1, inletrange[1], inletrange[2]); +# - (sim) -> mass_inlet!(sim, 1, inletrange[1]:inletrange[2], 0.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, inletrange[2]+1, nj); + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = 1.0\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-050.yaml b/publication_sims/tows/archive/tow_n-050.yaml new file mode 100644 index 0000000..c49d011 --- /dev/null +++ b/publication_sims/tows/archive/tow_n-050.yaml @@ -0,0 +1,111 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-050"); + const nuv = 0.2; + const n = 0.5; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back! + - south_bounce_back! + - (sim) -> east_pressure!(sim, 1.0); + - (sim) -> mass_inlet!(sim, 1, 1:nj, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-075.yaml b/publication_sims/tows/archive/tow_n-075.yaml new file mode 100644 index 0000000..7a9181d --- /dev/null +++ b/publication_sims/tows/archive/tow_n-075.yaml @@ -0,0 +1,111 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-075"); + const nuv = 0.2; + const n = 0.75; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back! + - south_bounce_back! + - (sim) -> east_pressure!(sim, 1.0); + - (sim) -> mass_inlet!(sim, 1, 1:nj, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-080.yaml b/publication_sims/tows/archive/tow_n-080.yaml new file mode 100644 index 0000000..74e4f0f --- /dev/null +++ b/publication_sims/tows/archive/tow_n-080.yaml @@ -0,0 +1,122 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-080"); + const nuv = 0.2; + const n = 0.8; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - (sim) -> east_bounce_back!(sim.lat, ni, 1, outletrange[1]-1); + - (sim) -> east_open!(sim.lat, ni, outletrange[1], outletrange[2]); +#- (sim) -> mass_inlet!(sim, ni, outletrange[1]:outletrange[2], 0.0) + - (sim) -> east_bounce_back!(sim.lat, ni, outletrange[2]+1, nj); + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, 1, inletrange[1]-1); +# - (sim) -> west_pressure!(sim.lat, 0.0, 1, inletrange[1], inletrange[2]); +# - (sim) -> mass_inlet!(sim, 1, inletrange[1]:inletrange[2], 0.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, inletrange[2]+1, nj); + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-090.yaml b/publication_sims/tows/archive/tow_n-090.yaml new file mode 100644 index 0000000..ae1f02b --- /dev/null +++ b/publication_sims/tows/archive/tow_n-090.yaml @@ -0,0 +1,122 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-090"); + const nuv = 0.2; + const n = 0.9; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - (sim) -> east_bounce_back!(sim.lat, ni, 1, outletrange[1]-1); + - (sim) -> east_pressure!(sim.lat, 0.0, ni, outletrange[1], outletrange[2]); + - (sim) -> mass_inlet!(sim, ni, outletrange[1]:outletrange[2], 0.0) + - (sim) -> east_bounce_back!(sim.lat, ni, outletrange[2]+1, nj); + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, 1, inletrange[1]-1); +# - (sim) -> west_pressure!(sim.lat, 0.0, 1, inletrange[1], inletrange[2]); +# - (sim) -> mass_inlet!(sim, 1, inletrange[1]:inletrange[2], 0.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, inletrange[2]+1, nj); + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-110.yaml b/publication_sims/tows/archive/tow_n-110.yaml new file mode 100644 index 0000000..1e39d64 --- /dev/null +++ b/publication_sims/tows/archive/tow_n-110.yaml @@ -0,0 +1,122 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-105"); + const nuv = 0.2; + const n = 1.05; + const constit_rel_f = init_constit_mrt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: MRT_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - (sim) -> east_bounce_back!(sim.lat, ni, 1, outletrange[1]-1); + - (sim) -> east_open!(sim.lat, ni, outletrange[1], outletrange[2]); +#- (sim) -> mass_inlet!(sim, ni, outletrange[1]:outletrange[2], 0.0) + - (sim) -> east_bounce_back!(sim.lat, ni, outletrange[2]+1, nj); + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, 1, inletrange[1]-1); +# - (sim) -> west_pressure!(sim.lat, 0.0, 1, inletrange[1], inletrange[2]); +# - (sim) -> mass_inlet!(sim, 1, inletrange[1]:inletrange[2], 0.0) +# - (sim) -> west_bounce_back!(sim.lat, 1, inletrange[2]+1, nj); + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/archive/tow_n-125.yaml b/publication_sims/tows/archive/tow_n-125.yaml new file mode 100644 index 0000000..691ff9e --- /dev/null +++ b/publication_sims/tows/archive/tow_n-125.yaml @@ -0,0 +1,111 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-125"); + const nuv = 0.2; + const n = 1.25; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 40000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back! + - south_bounce_back! + - (sim) -> east_pressure!(sim, 1.0); + - (sim) -> mass_inlet!(sim, 1, 1:nj, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + print_with_color(:green, "TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow.yaml b/publication_sims/tows/tow.yaml new file mode 100644 index 0000000..78a0560 --- /dev/null +++ b/publication_sims/tows/tow.yaml @@ -0,0 +1,114 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow"); + const nuv = 0.2; + const constit_rel_f = init_constit_srt_const(nuv); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back!; + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = 1.0\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow_n-080.yaml b/publication_sims/tows/tow_n-080.yaml new file mode 100644 index 0000000..112c1c1 --- /dev/null +++ b/publication_sims/tows/tow_n-080.yaml @@ -0,0 +1,115 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-080"); + const nuv = 0.2; + const n = 0.8; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back!; + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow_n-080_vented.yaml b/publication_sims/tows/tow_n-080_vented.yaml new file mode 100644 index 0000000..e708649 --- /dev/null +++ b/publication_sims/tows/tow_n-080_vented.yaml @@ -0,0 +1,115 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-080_vented"); + const nuv = 0.2; + const n = 0.8; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_mass_outlet! + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow_n-090.yaml b/publication_sims/tows/tow_n-090.yaml new file mode 100644 index 0000000..6e40c61 --- /dev/null +++ b/publication_sims/tows/tow_n-090.yaml @@ -0,0 +1,115 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-090"); + const nuv = 0.2; + const n = 0.9; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_bounce_back!; + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow_n-090_vented.yaml b/publication_sims/tows/tow_n-090_vented.yaml new file mode 100644 index 0000000..fae97ae --- /dev/null +++ b/publication_sims/tows/tow_n-090_vented.yaml @@ -0,0 +1,115 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_n-090_vented"); + const nuv = 0.2; + const n = 0.9; + const constit_rel_f = init_constit_srt_power_law_implicit(nuv, n, 1e-12, 15, 1e-6); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_mass_outlet! + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = $n\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir) diff --git a/publication_sims/tows/tow_vented.yaml b/publication_sims/tows/tow_vented.yaml new file mode 100644 index 0000000..91f1ac1 --- /dev/null +++ b/publication_sims/tows/tow_vented.yaml @@ -0,0 +1,114 @@ +version: 1.0.0 + +preamble: > + @init_plot_env(); + const datadir = joinpath("data", "tow_vented"); + const nuv = 0.2; + const constit_rel_f = init_constit_srt_const(nuv); + const F = [2.0e-6; -0.0e-6]; + const forcing_kf = init_sukop_Fk(F); + const ni = 128; + const nj = 128; + const nsteps = 100000; + const obssize = 10; + const gapsize = 5; + const obs1 = Int[ni/2 - obssize/2; ni/2 + obssize/2; nj/2 - obssize/2; nj/2 + obssize/2]; + const oset = obssize+gapsize; + const obs2 = obs1 + Int[oset; oset; 0; 0]; + const obs3 = obs1 + Int[oset; oset; -oset; -oset]; + const obs4 = obs1 + Int[0; 0; -oset; -oset]; + const obs5 = obs1 + Int[-oset; -oset; -oset; -oset]; + const obs6 = obs1 + Int[-oset; -oset; 0; 0]; + const obs7 = obs1 + Int[-oset; -oset; oset; oset]; + const obs8 = obs1 + Int[0; 0; oset; oset]; + const obs9 = obs1 + Int[oset; oset; oset; oset]; + const rects = map(x -> [x[3]; x[4]; x[1]/ni; x[2]/ni], Vector[obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9]); + const levels = [-0.5; 0.0; 0.5; 1.0; 1.5; 2.0; 2.5]; + const inletsize = 3*obssize + 2*gapsize; + const outletsize = 3*obssize + 2*gapsize; + const inletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + const outletrange = (Int(nj/2 - inletsize/2), Int(nj/2 + inletsize/2)); + +# data directory +datadir: { value: datadir, expr: true } + +# material properties +rho_0: { value: 1.0, expr: false } +nu: { value: nuv, expr: true } + +# lattice parameters +dx: { value: 1.0, expr: false } +dt: { value: 1.0, expr: false } +ni: { value: ni, expr: true } +nj: { value: nj, expr: true } + +# simulation parameters +simtype: free_surface +col_f: BGK_F(constit_rel_f, forcing_kf); +nsteps: { value: nsteps, expr: true } + +# obstacles +obstacles: + - type: bounce_back + coords: obs1 + - type: bounce_back + coords: obs2 + - type: bounce_back + coords: obs3 + - type: bounce_back + coords: obs4 + - type: bounce_back + coords: obs5 + - type: bounce_back + coords: obs6 + - type: bounce_back + coords: obs7 + - type: bounce_back + coords: obs8 + - type: bounce_back + coords: obs9 + +# boundary conditions +bcs: + - north_bounce_back! + - east_mass_outlet! + - south_bounce_back! + - (sim) -> west_pressure!(sim, 1.0); + - (sim) -> west_mass_inlet!(sim, 1.0) + +# free surface conditions +rho_g: 1.0 + +fill_x: { value: 0.1, expr: false } +fill_y: { value: 1.0, expr: false } + +# callback functions +callbacks: + - print_step_callback(100, "tow") + - pycontour_callback(200, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true, title="\$n = 1.0\$") + - write_jld_file_callback(datadir, 500) + +# clean-up, backup, write out +finally: + - > + (sim::FreeSurfSim, k::Int) -> begin + @assert(k == nsteps, "There was an error that ended the simulation early"); + for m in sim.tracker.M + @assert(-100 < m < 100, "Mass was numerically unstable"); + end + for u in sim.msm.u + @assert(-100 < u < 100, "Velocity was numerically unstable"); + end + for ρ in sim.msm.rho + @assert(-100 < ρ < 100, "ρ was numerically unstable"); + end + for f in sim.lat.f + @assert(-100 < f < 100, "f was numerically unstable"); + end + for ϵ in sim.tracker.eps + @assert(-10 < ϵ < 10, "ϵ was numerically unstable"); + end + println("TEST PASSED\n"); + end + - pycontour_callback(1, mass_acsr; fname=joinpath(datadir, "mass"), rects=rects, levels=levels, colorbar=true) + - write_jld_file_callback(datadir)