From ce2cfe6acf84fbe68bf3b5a010b48052f7b70cea Mon Sep 17 00:00:00 2001 From: halterw Date: Thu, 4 Apr 2024 12:00:00 +0200 Subject: [PATCH] update setups and visualizations --- ...sation_Makie_MD7_compositevisualisation.jl | 3 +- ...tion_Makie_MD7_compositevisualisation_w.jl | 676 +++++++++++++++ ...akie_MD7_compositevisualisation_w_multi.jl | 701 ++++++++++++++++ ..._compositevisualisation_w_multi_2_bueno.jl | 784 ++++++++++++++++++ ..._compositevisualisation_w_multi_3_dVxdz.jl | 671 +++++++++++++++ ..._Visualisation_Makie_MD7_polarcartesian.jl | 679 +++++++++++++++ ...alisation_Makie_MD7_viscosity_reduction.jl | 189 +++++ ...isation_Makie_MD7_viscosity_reduction_2.jl | 152 ++++ ...e_MD7_viscosity_reduction_2_posterSGM23.jl | 134 +++ ...n_Makie_MD7_viscosity_reduction_3_bueno.jl | 198 +++++ ...e_MD7_viscosity_reduction_4_convergence.jl | 229 +++++ ...e_MD7_viscosity_reduction_5_functionFit.jl | 29 + ...Makie_MD7_viscosity_reduction_6_fitting.jl | 176 ++++ ...ie_MD7_viscosity_reduction_7_export_sxz.jl | 141 ++++ JuliaVisualisation/Project.toml | 17 +- SETS/AnisoViscTest_evolv_multi_ellipses.c | 76 +- SETS/AnisoViscTest_evolv_multi_ellipses.txt | 8 +- ...iscTest_evolv_multi_ellipses_PSDirichlet.c | 192 +++++ ...cTest_evolv_multi_ellipses_PSDirichlet.txt | 143 ++++ SETS/CollisionPolarCartesianEllipses.c | 324 ++++++++ SETS/CollisionPolarCartesianEllipses.txt | 166 ++++ SETS/Fig0a_bench.c | 89 ++ SETS/Fig0a_bench.txt | 143 ++++ SETS/Fig10_bench.c | 98 +++ SETS/Fig10_bench.txt | 143 ++++ SETS/Fig6a_bench.c | 130 +++ SETS/Fig6a_bench.txt | 143 ++++ SETS/Fig6b_bench.c | 130 +++ SETS/Fig6b_bench.txt | 143 ++++ SETS/Fig_ellipse_bench.c | 81 ++ SETS/Fig_ellipse_bench.txt | 143 ++++ 31 files changed, 6887 insertions(+), 44 deletions(-) create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_2_bueno.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_3_dVxdz.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_polarcartesian.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2_posterSGM23.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_3_bueno.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_4_convergence.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_5_functionFit.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_6_fitting.jl create mode 100644 JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_7_export_sxz.jl create mode 100644 SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.c create mode 100644 SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.txt create mode 100755 SETS/CollisionPolarCartesianEllipses.c create mode 100755 SETS/CollisionPolarCartesianEllipses.txt create mode 100644 SETS/Fig0a_bench.c create mode 100644 SETS/Fig0a_bench.txt create mode 100644 SETS/Fig10_bench.c create mode 100644 SETS/Fig10_bench.txt create mode 100644 SETS/Fig6a_bench.c create mode 100644 SETS/Fig6a_bench.txt create mode 100644 SETS/Fig6b_bench.c create mode 100644 SETS/Fig6b_bench.txt create mode 100644 SETS/Fig_ellipse_bench.c create mode 100644 SETS/Fig_ellipse_bench.txt diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation.jl index 94076804..bf23f8ab 100644 --- a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation.jl +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation.jl @@ -26,11 +26,12 @@ function main() path = "/home/whalter1/lib/MDOODZ7.0/cmake-exec/AnisoViscTest_evolv_multi_circles/" path = "/home/whalter1/lib/MDOODZ7.0/cmake-exec/AnisoViscTest_evolv_multi_ellipses/" #path = "/home/whalter1/lib/MDOODZ7.0/cmake-exec/AnisoHomoVEVP/" + path = "/users/whalter1/MDOODZ7.0/cmake-exec/AnisoViscTest_evolv_multi_ellipses/" # File numbers file_start = 0 file_step = 10 - file_end = 270 + file_end = 0 # Select one field to visualise #field = :Phases diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w.jl new file mode 100644 index 00000000..33887495 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w.jl @@ -0,0 +1,676 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +s = 1 +d = 24*3600*s +y = 365*d +My = 1e6*y + +function main() + + # Set the path to your files + path = "/users/whalter1/work/aniso_small_scale/A1_250/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/A1_500/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/A1_1000/"; file_start = 1280 + # + path = "/users/whalter1/work/aniso_small_scale/A2_250/"; file_start = 2490 + path = "/users/whalter1/work/aniso_small_scale/A2_500/"; file_start = 2300 + path = "/users/whalter1/work/aniso_small_scale/A2_1000/"; file_start = 930 + # + path = "/users/whalter1/work/aniso_small_scale/A3_250/"; file_start = 880 + path = "/users/whalter1/work/aniso_small_scale/A3_500/"; file_start = 2420 + path = "/users/whalter1/work/aniso_small_scale/A3_1000/"; file_start = 1360 + # + path = "/users/whalter1/work/aniso_small_scale/A4_250/"; file_start = 2750 + path = "/users/whalter1/work/aniso_small_scale/A4_500/"; file_start = 2650 + path = "/users/whalter1/work/aniso_small_scale/A4_1000/"; file_start = 910 + # + path = "/users/whalter1/work/aniso_small_scale/A5_250/"; file_start = 2960 + path = "/users/whalter1/work/aniso_small_scale/A5_500/"; file_start = 2570 + path = "/users/whalter1/work/aniso_small_scale/A5_1000/"; file_start = 1060 + # + path = "/users/whalter1/work/aniso_small_scale/B1_250/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B1_500/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B1_1000/"; file_start = 1660 + # + path = "/users/whalter1/work/aniso_small_scale/B2_250/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B2_500/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B2_1000/"; file_start = 1520 + # + path = "/users/whalter1/work/aniso_small_scale/B3_250/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B3_500/"; file_start = 5000 + path = "/users/whalter1/work/aniso_small_scale/B3_1000/"; file_start = 1600 + + + # File numbers + #file_start = 0 + file_step = 10 + file_end = file_start + + # Select one field to visualise + #field = :Phases + #field = :Density + field = :Viscosity + #field = :Stress + #field = :Stress_xx + #field = :Stress_zz + #field = :Stress_xz + #field = :StrainRate + #field = :PlasticStrainrate + #field = :Pressure + #field = :Temperature + #field = :Velocity + #field = :Velocity_x + #field = :Velocity_z + #field = :Strain # cumulated strain + #field = :AnisoFactor # anisotropy factor + #field = :GrainSize # doesn't function properly yet + #field = :Topography # doesn't function properly yet + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + printvid = false # print a video (printfig must be on) + ph_contours = false # add phase contours + T_contours = false # add temperature contours + fabric = false # add fabric quiver (normal to director) + velocity = false # add velocity quiver + deviatoricV = false # considers deviatoric velocity for plot and quiver (deviatoric velocity = velocity minus far-field velocity) + α_heatmap = 0.85 # transparency of heatmap + σ1_axis = false + polar = false # for curved setups using Earth's curvature (transforms tensors from x-z to r-phi coord system) + nap = 0.3 # pause for animation + resol = 1600 + inspector = false # (not possible on any "headless server") + framerate = 30 # Frame rate for the movie + movieName = "$(path)/_$(field)/$(field)" # Name of the movie + xshift = 0.5 # periodically shifts all values to the right, fraction 0.0-1.0 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + for istep=file_start:file_step:file_end + + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=6) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + ph = Float64.(reshape(ExtractData( filename, "/VizGrid/compo"), ncx, ncz)); mask_air = ph .== -1.00 + ph_hr = Float64.(reshape(ExtractData( filename, "/VizGrid/compo_hr"), ncx_hr, ncz_hr)); + group_phases = copy( ph_hr); ph_hr[ph_hr.==-1.00] .= NaN + ηc = Float64.(reshape(ExtractData( filename, "/Centers/eta_n"), ncx, ncz)); ηc[mask_air] .= NaN + ρc = Float64.(reshape(ExtractData( filename, "/Centers/rho_n"), ncx, ncz)); ρc[mask_air] .= NaN + P = Float64.(reshape(ExtractData( filename, "/Centers/P"), ncx, ncz)); P[mask_air] .= NaN + T = Float64.(reshape(ExtractData( filename, "/Centers/T"), ncx, ncz)) .- 273.15; T[mask_air] .= NaN + d = Float64.(reshape(ExtractData( filename, "/Centers/d"), ncx, ncz)); d[mask_air] .= NaN + ε̇pl = Float64.(reshape(ExtractData( filename, "/Centers/eII_pl"), ncx, ncz)); ε̇pl[mask_air] .= NaN + Vx = Float64.(reshape(ExtractData( filename, "/VxNodes/Vx"), (ncx+1), (ncz+2))) + Vz = Float64.(reshape(ExtractData( filename, "/VzNodes/Vz"), (ncx+2), (ncz+1))) + τxx = Float64.(reshape(ExtractData( filename, "/Centers/sxxd"), ncx, ncz)); τxx[mask_air] .= NaN + τzz = Float64.(reshape(ExtractData( filename, "/Centers/szzd"), ncx, ncz)); τzz[mask_air] .= NaN + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + τxzc = 0.25*(τxz[1:end-1,1:end-1].+τxz[2:end,1:end-1].+τxz[1:end-1,2:end].+τxz[2:end,2:end]); τxzc[mask_air] .= NaN + ε̇xx = Float64.(reshape(ExtractData( filename, "/Centers/exxd"), ncx, ncz)) + ε̇xz = Float64.(reshape(ExtractData( filename, "/Vertices/exz"), nvx, nvz)) + εII = Float64.(reshape(ExtractData( filename, "/Centers/strain"), ncx, ncz)); εII[mask_air] .= NaN + τII = sqrt.( 0.5*(2*τxx.^2 .+ 0.5*(τxz[1:end-1,1:end-1].^2 .+ τxz[2:end,1:end-1].^2 .+ τxz[1:end-1,2:end].^2 .+ τxz[2:end,2:end].^2 ) ) ); τII[mask_air] .= NaN + ε̇II = sqrt.( 0.5*(2*ε̇xx.^2 .+ 0.5*(ε̇xz[1:end-1,1:end-1].^2 .+ ε̇xz[2:end,1:end-1].^2 .+ ε̇xz[1:end-1,2:end].^2 .+ ε̇xz[2:end,2:end].^2 ) ) ); ε̇II[mask_air] .= NaN + if field==:AnisoFactor + AniFac= Float64.(reshape(ExtractData( filename, "/Centers/ani_fac"), ncx, ncz)) + #@show AniFac[50,50] + @show minimum(AniFac) + @show maximum(AniFac) + # weird issue that sometimes aniso factor is negative infinity (e.g. -9e12 or so) where it should actually be at maximum (e.g. 1000, saturated)! + maxifac = maximum(AniFac) + AniFac[AniFac .< 0] .= maxifac + @show minimum(AniFac) + + AniFac[mask_air] .= NaN + end + if fabric + Nx = Float64.(reshape(ExtractData( filename, "/Centers/nx"), ncx, ncz)) + Nz = Float64.(reshape(ExtractData( filename, "/Centers/nz"), ncx, ncz)) + Fab_x = -Nz./Nx + Fab_z = ones(size(Nz)) + nrm = sqrt.(Fab_x.^2 .+ Fab_z.^2) + Fab_x ./= nrm + Fab_z ./= nrm + end + if field==:Topography + height = Float64.(ExtractData( filename, "/Topo/z_grid")); + Vx_grid = Float64.(ExtractData( filename, "/Topo/Vx_grid")); + Vz_grid = Float64.(ExtractData( filename, "/Topo/Vz_grid")); + Vx_mark = Float64.(ExtractData( filename, "/Topo/Vx_mark")); + Vz_mark = Float64.(ExtractData( filename, "/Topo/Vz_mark")); + x_mark = Float64.(ExtractData( filename, "/Topo/x_mark")); + z_mark = Float64.(ExtractData( filename, "/Topo/z_mark")); + end + if σ1_axis + σ1 = PrincipalStress(τxx, τzz, τxz, P) + end + + ##################################### + # x-shift + if xshift > 0.0 + xidx = Int(floor(ncx*xshift))+1 # x index where to cut + ηc = ηc[[xidx:end;1:xidx-1],:] + ε̇II = ε̇II[[xidx:end;1:xidx-1],:] + εII = εII[[xidx:end;1:xidx-1],:] + if field==:AnisoFactor + AniFac = AniFac[[xidx:end;1:xidx-1],:] + end + if fabric + Fab_x = Fab_x[[xidx:end;1:xidx-1],:] + Fab_z = Fab_z[[xidx:end;1:xidx-1],:] + end + end + + ##################################### + + # Postprocessing deviatoric velocity + if deviatoricV + shear_style = 1 # 0 = pure shear; 1 = simple shear + bkg_strain_rate = 1 # background (far-field) strain rate + + Vx_bkg = Vx + Vz_bkg = Vz + if shear_style == 1 + bla = 2*bkg_strain_rate*zc' + @show size(Vx) + @show size(bla) + Vx_bkg = repeat(bla, outer = nvx+1) + @show size(Vx_bkg) + end + Vx = Vx-Vx_bkg + end + + # Postprocessing velocity + Vxc = 0.5 .* (Vx[1:end-1,2:end-1] .+ Vx[2:end-0,2:end-1]); Vxc[mask_air] .= NaN + Vzc = 0.5 .* (Vz[2:end-1,1:end-1] .+ Vz[2:end-1,2:end-0]); Vzc[mask_air] .= NaN + Vc = (Vxc.^2 .+ Vzc.^2).^0.5 + + ##################################### + # Postprocessing polar setups + if polar + τxx, τzz, τxz, τxz = tensorCartesianToPolar( τxx, τzz, τxz, τxz, xc, zc, ncx, ncz ) + end + + ##################################### + + # Color palette for phase map + cmap = zeros(RGB{Float64}, 7) + cmap[1] = RGBA{Float64}(210/255, 218/255, 205/255, 1.) + cmap[2] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[3] = RGBA{Float64}(117/255, 164/255, 148/255, 1.) + cmap[4] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + cmap[5] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[6] = RGBA{Float64}(244/255, 218/255, 205/255, 1.) + cmap[7] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + phase_colors = MoC.cgrad(cmap, length(cmap), categorical=true, rev=false) + + # Group phases for contouring + group_phases[ ph_hr.==4 .|| ph_hr.==0 .|| ph_hr.==5 .|| ph_hr.==1 ] .= 0 + group_phases[ ph_hr.==2 .|| ph_hr.==6 ] .= 1 + group_phases[ ph_hr.==3 ] .= 3 + + ##################################### + + f = MoC.Figure(resolution = (Lx/Lz*resol, resol), fontsize=25) + + if field==:Phases + ax1 = MoC.Axis(f[1, 1], title = L"Phases at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc_hr./Lc, zc_hr./Lc, ph_hr, colormap = phase_colors) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "Phases", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Density + ax1 = MoC.Axis(f[1, 1], title = L"Density $ρ$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ρc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"Density $ρ$ [kg/m^3]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Viscosity + ax1 = MoC.Axis(f[1, 1], title = L"$\eta$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ηc), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\eta$ [Pa.s]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{II}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xx + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xx}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxx, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xx}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_zz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{zz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τzz, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{zz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxz, colormap = (:turbo, α_heatmap)) + else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, τxz, colormap = (:turbo, α_heatmap)) + end + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:StrainRate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇II), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:PlasticStrainrate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ at $t$ = %$(tMy) %$(tMytext), sum = %$(round(sum(ε̇pl),sigdigits=4)), max = %$(round(maximum(ε̇pl),sigdigits=4)), min = %$(round(minimum(ε̇pl),sigdigits=4))", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + ε̇pl[mask_air] .= NaN + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇pl), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Pressure + ax1 = MoC.Axis(f[1, 1], title = L"$P$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, P, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$P$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Temperature + ax1 = MoC.Axis(f[1, 1], title = L"$T$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, T, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$T$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity + ax1 = MoC.Axis(f[1, 1], title = L"$V$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_x + ax1 = MoC.Axis(f[1, 1], title = L"$V_{x}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xv./Lc, zc./Lc, Vx[:,2:end-1], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{x}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_z + ax1 = MoC.Axis(f[1, 1], title = L"$V_{z}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zv./Lc, Vz[2:end-1,:], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{z}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Strain + ax1 = MoC.Axis(f[1, 1], title = L"$\varepsilon_{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, εII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\varepsilon_{II}$ []", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:AnisoFactor + ax1 = MoC.Axis(f[1, 1], title = L"Anisotropy factor at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(AniFac), colormap = (:turbo, α_heatmap), colorrange=(0, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label =L"$log_{10}\left(\text{Anisotropy factor}\right)$", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:GrainSize + ax1 = MoC.Axis(f[1, 1], title = L"$d$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(d.*1e6), colormap = (:turbo, α_heatmap), colorrange=(1, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + xminz, xmaxz = -0.4, 0.4 + zminz, zmaxz = -0.17, 0.17 + Lx = xmaxz - xminz + Lz = zmaxz - zminz + xlims!(ax1, -0.4, 0.4) + ylims!(ax1, -0.17, 0.17) + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "d", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Topography + ax1 = MoC.Axis(f[1, 1], title = L"Topography at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$h$ [km]") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if velocity + #qv,qh = 10,10 + #MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = Δ*1000, lengthscale=Δ*20) + qv,qh = 6,3 + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = 1e1, lengthscale=Δ/1.5*1e10) + end + if fabric + fac = 1 + qv,qh = fac,fac + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Fab_x[1:qh:end,1:qv:end], Fab_z[1:qh:end,1:qv:end], arrowsize = 0, lengthscale=Δ*0.7*fac, align = :center) + #MoC.arrows!(ax1, xc./Lc, zc./Lc, Nz, Nx, arrowsize = 0, lengthscale=Δ/1.5) + end + if printfig Print2Disk( f, path, string(field), istep, xshift) end + + if inspector + DataInspector(f) + end + if displayfig + display(f) + end + sleep(nap) + end + end + if printvid + #FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=1920:1080" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + zres = resol + xres = resol + if xshift > 0.0 + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/shift/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName)_shift.mov"`) + else + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + end + end +end + +function PrincipalStress(τxx, τzz, τxz, P) + σ1 = (x=zeros(size(τxx)), z=zeros(size(τxx)) ) + τxzc = 0.25*(τxz[1:end-1,1:end-1] .+ τxz[2:end-0,1:end-1] .+ τxz[1:end-1,2:end-0] .+ τxz[2:end-0,2:end-0]) + for i in eachindex(τxzc) + if P[i]>1e-13 + σ = [-P[i]+τxx[i] τxzc[i]; τxzc[i] -P[i]+τzz[i]] + v = eigvecs(σ) + σ1.x[i] = v[1,1] + σ1.z[i] = v[2,1] + end + end + return σ1 +end + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep, xshift; res=4) + if xshift > 0.0 + path1 = path*"/_$field/shift/" + else + path1 = path*"/_$field/" + end + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function tensorCartesianToPolar( AXX, AZZ, AXZ, AZX, xc, zc, ncx, ncz ) + # tensor coordinate transformation from x-z to r-phi coordinate system + # A_XZ = tensor to transform + # A_RP = transformed tensor + XX = ones(ncx)*zc' # matrix with all x-coords + ZZ = xc*one(ncz)' # matrix with all z-coords + ALPHA = asin.( XX ./ ( XX.^2 .+ ZZ.^2 ).^0.5 ) + # Idea for coord transform: + # R = [cos.(ALPHA) sin.(ALPHA) + # -sin.(ALPHA) cos.(ALPHA)] + # ARP = R' * AXZ * R + AXZc = v2c(AXZ) + AZXc = v2c(AZX) + #ARR = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + #APP = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* sin.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) + #ARP = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) + #APR = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* cos.(ALPHA) .- ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + ARR = ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + APP = ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* sin.(ALPHA) + ARP = ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) + APR = ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + check = 1 + if check == 1 + AIIXZ = (0.5*( AXX.^2 .+ AZZ.^2 .+ AXZc.^2 .+ AZXc.^2 )).^0.5 + AIIRP = (0.5*( ARR.^2 .+ APP.^2 .+ ARP.^2 .+ APR.^2 )).^0.5 + AIIdiff = AIIRP .- AIIXZ + @show maximum(AIIdiff) + end + return ARR, APP, ARP, APR +end + +function v2c(Av) # interpolation vertex to center + return 0.25 * ( Av[1:end-1,1:end-1] + Av[2:end,1:end-1] + Av[2:end,1:end-1] + Av[2:end,2:end] ) +end + +main() + +#run(`ffmpeg -framerate 2 -i /Users/lcandiot/Developer/MDOODZ7.0/RUNS/RiftingChenin/_Phases/Phases%05d.png -c libx264 -pix_fmt yuv420p -y out_movie.mp4`) + +# Working command +#ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4 \ No newline at end of file diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi.jl new file mode 100644 index 00000000..f2571fec --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi.jl @@ -0,0 +1,701 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +s = 1 +d = 24*3600*s +y = 365*d +My = 1e6*y + +function main(path, file_start, file_end,fac, xshift, file_step) + + # File numbers + #file_start = 0 + #file_step = 10 + #file_end = file_start + + # Select one field to visualise + #field = :Phases + #field = :Density + #field = :Viscosity + #field = :Stress + #field = :Stress_xx + #field = :Stress_zz + #field = :Stress_xz + #field = :StrainRate + #field = :PlasticStrainrate + #field = :Pressure + #field = :Temperature + #field = :Velocity + #field = :Velocity_x + #field = :Velocity_z + #field = :Strain # cumulated strain + field = :AnisoFactor # anisotropy factor + #field = :GrainSize # doesn't function properly yet + #field = :Topography # doesn't function properly yet + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + printvid = true # print a video (printfig must be on) + ph_contours = false # add phase contours + T_contours = false # add temperature contours + fabric = true # add fabric quiver (normal to director) + velocity = false # add velocity quiver + deviatoricV = false # considers deviatoric velocity for plot and quiver (deviatoric velocity = velocity minus far-field velocity) + α_heatmap = 0.85 # transparency of heatmap + σ1_axis = false + polar = false # for curved setups using Earth's curvature (transforms tensors from x-z to r-phi coord system) + nap = 0.3 # pause for animation + resol = 1600 + inspector = false # (not possible on any "headless server") + framerate = 30 # Frame rate for the movie + movieName = "$(path)/_$(field)/$(field)" # Name of the movie + #xshift = 0.5 # periodically shifts all values to the right, fraction 0.0-1.0 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + for istep=file_start:file_step:file_end + + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=6) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + ph = Float64.(reshape(ExtractData( filename, "/VizGrid/compo"), ncx, ncz)); mask_air = ph .== -1.00 + ph_hr = Float64.(reshape(ExtractData( filename, "/VizGrid/compo_hr"), ncx_hr, ncz_hr)); + group_phases = copy( ph_hr); ph_hr[ph_hr.==-1.00] .= NaN + ηc = Float64.(reshape(ExtractData( filename, "/Centers/eta_n"), ncx, ncz)); ηc[mask_air] .= NaN + ρc = Float64.(reshape(ExtractData( filename, "/Centers/rho_n"), ncx, ncz)); ρc[mask_air] .= NaN + P = Float64.(reshape(ExtractData( filename, "/Centers/P"), ncx, ncz)); P[mask_air] .= NaN + T = Float64.(reshape(ExtractData( filename, "/Centers/T"), ncx, ncz)) .- 273.15; T[mask_air] .= NaN + d = Float64.(reshape(ExtractData( filename, "/Centers/d"), ncx, ncz)); d[mask_air] .= NaN + ε̇pl = Float64.(reshape(ExtractData( filename, "/Centers/eII_pl"), ncx, ncz)); ε̇pl[mask_air] .= NaN + Vx = Float64.(reshape(ExtractData( filename, "/VxNodes/Vx"), (ncx+1), (ncz+2))) + Vz = Float64.(reshape(ExtractData( filename, "/VzNodes/Vz"), (ncx+2), (ncz+1))) + τxx = Float64.(reshape(ExtractData( filename, "/Centers/sxxd"), ncx, ncz)); τxx[mask_air] .= NaN + τzz = Float64.(reshape(ExtractData( filename, "/Centers/szzd"), ncx, ncz)); τzz[mask_air] .= NaN + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + τxzc = 0.25*(τxz[1:end-1,1:end-1].+τxz[2:end,1:end-1].+τxz[1:end-1,2:end].+τxz[2:end,2:end]); τxzc[mask_air] .= NaN + ε̇xx = Float64.(reshape(ExtractData( filename, "/Centers/exxd"), ncx, ncz)) + ε̇xz = Float64.(reshape(ExtractData( filename, "/Vertices/exz"), nvx, nvz)) + εII = Float64.(reshape(ExtractData( filename, "/Centers/strain"), ncx, ncz)); εII[mask_air] .= NaN + τII = sqrt.( 0.5*(2*τxx.^2 .+ 0.5*(τxz[1:end-1,1:end-1].^2 .+ τxz[2:end,1:end-1].^2 .+ τxz[1:end-1,2:end].^2 .+ τxz[2:end,2:end].^2 ) ) ); τII[mask_air] .= NaN + ε̇II = sqrt.( 0.5*(2*ε̇xx.^2 .+ 0.5*(ε̇xz[1:end-1,1:end-1].^2 .+ ε̇xz[2:end,1:end-1].^2 .+ ε̇xz[1:end-1,2:end].^2 .+ ε̇xz[2:end,2:end].^2 ) ) ); ε̇II[mask_air] .= NaN + if field==:AnisoFactor + AniFac= Float64.(reshape(ExtractData( filename, "/Centers/ani_fac"), ncx, ncz)) + #@show AniFac[50,50] + @show minimum(AniFac) + @show maximum(AniFac) + # weird issue that sometimes aniso factor is negative infinity (e.g. -9e12 or so) where it should actually be at maximum (e.g. 1000, saturated)! + maxifac = maximum(AniFac) + AniFac[AniFac .< 0] .= maxifac + @show minimum(AniFac) + + AniFac[mask_air] .= NaN + end + if fabric + Nx = Float64.(reshape(ExtractData( filename, "/Centers/nx"), ncx, ncz)) + Nz = Float64.(reshape(ExtractData( filename, "/Centers/nz"), ncx, ncz)) + Fab_x = -Nz./Nx + Fab_z = ones(size(Nz)) + nrm = sqrt.(Fab_x.^2 .+ Fab_z.^2) + Fab_x ./= nrm + Fab_z ./= nrm + end + if field==:Topography + height = Float64.(ExtractData( filename, "/Topo/z_grid")); + Vx_grid = Float64.(ExtractData( filename, "/Topo/Vx_grid")); + Vz_grid = Float64.(ExtractData( filename, "/Topo/Vz_grid")); + Vx_mark = Float64.(ExtractData( filename, "/Topo/Vx_mark")); + Vz_mark = Float64.(ExtractData( filename, "/Topo/Vz_mark")); + x_mark = Float64.(ExtractData( filename, "/Topo/x_mark")); + z_mark = Float64.(ExtractData( filename, "/Topo/z_mark")); + end + if σ1_axis + σ1 = PrincipalStress(τxx, τzz, τxz, P) + end + + ##################################### + # x-shift + if xshift > 0.0 + xidx = Int(floor(ncx*xshift))+1 # x index where to cut + ηc = ηc[[xidx:end;1:xidx-1],:] + ε̇II = ε̇II[[xidx:end;1:xidx-1],:] + τII = τII[[xidx:end;1:xidx-1],:] + εII = εII[[xidx:end;1:xidx-1],:] + if field==:AnisoFactor + AniFac = AniFac[[xidx:end;1:xidx-1],:] + end + if fabric + Fab_x = Fab_x[[xidx:end;1:xidx-1],:] + Fab_z = Fab_z[[xidx:end;1:xidx-1],:] + end + end + + ##################################### + + # Postprocessing deviatoric velocity + if deviatoricV + shear_style = 1 # 0 = pure shear; 1 = simple shear + bkg_strain_rate = 1 # background (far-field) strain rate + + Vx_bkg = Vx + Vz_bkg = Vz + if shear_style == 1 + bla = 2*bkg_strain_rate*zc' + @show size(Vx) + @show size(bla) + Vx_bkg = repeat(bla, outer = nvx+1) + @show size(Vx_bkg) + end + Vx = Vx-Vx_bkg + end + + # Postprocessing velocity + Vxc = 0.5 .* (Vx[1:end-1,2:end-1] .+ Vx[2:end-0,2:end-1]); Vxc[mask_air] .= NaN + Vzc = 0.5 .* (Vz[2:end-1,1:end-1] .+ Vz[2:end-1,2:end-0]); Vzc[mask_air] .= NaN + Vc = (Vxc.^2 .+ Vzc.^2).^0.5 + + ##################################### + # Postprocessing polar setups + if polar + τxx, τzz, τxz, τxz = tensorCartesianToPolar( τxx, τzz, τxz, τxz, xc, zc, ncx, ncz ) + end + + ##################################### + + # Color palette for phase map + cmap = zeros(RGB{Float64}, 7) + cmap[1] = RGBA{Float64}(210/255, 218/255, 205/255, 1.) + cmap[2] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[3] = RGBA{Float64}(117/255, 164/255, 148/255, 1.) + cmap[4] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + cmap[5] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[6] = RGBA{Float64}(244/255, 218/255, 205/255, 1.) + cmap[7] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + phase_colors = MoC.cgrad(cmap, length(cmap), categorical=true, rev=false) + + # Group phases for contouring + group_phases[ ph_hr.==4 .|| ph_hr.==0 .|| ph_hr.==5 .|| ph_hr.==1 ] .= 0 + group_phases[ ph_hr.==2 .|| ph_hr.==6 ] .= 1 + group_phases[ ph_hr.==3 ] .= 3 + + ##################################### + + f = MoC.Figure(resolution = (Lx/Lz*resol, resol), fontsize=25) + + if field==:Phases + ax1 = MoC.Axis(f[1, 1], title = L"Phases at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc_hr./Lc, zc_hr./Lc, ph_hr, colormap = phase_colors) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "Phases", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Density + ax1 = MoC.Axis(f[1, 1], title = L"Density $ρ$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ρc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"Density $ρ$ [kg/m^3]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Viscosity + ax1 = MoC.Axis(f[1, 1], title = L"$\eta$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ηc), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\eta$ [Pa.s]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{II}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xx + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xx}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxx, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xx}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_zz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{zz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τzz, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{zz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxz, colormap = (:turbo, α_heatmap)) + else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, τxz, colormap = (:turbo, α_heatmap)) + end + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:StrainRate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇II), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:PlasticStrainrate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ at $t$ = %$(tMy) %$(tMytext), sum = %$(round(sum(ε̇pl),sigdigits=4)), max = %$(round(maximum(ε̇pl),sigdigits=4)), min = %$(round(minimum(ε̇pl),sigdigits=4))", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + ε̇pl[mask_air] .= NaN + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇pl), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Pressure + ax1 = MoC.Axis(f[1, 1], title = L"$P$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, P, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$P$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Temperature + ax1 = MoC.Axis(f[1, 1], title = L"$T$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, T, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$T$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity + ax1 = MoC.Axis(f[1, 1], title = L"$V$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_x + ax1 = MoC.Axis(f[1, 1], title = L"$V_{x}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xv./Lc, zc./Lc, Vx[:,2:end-1], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{x}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_z + ax1 = MoC.Axis(f[1, 1], title = L"$V_{z}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zv./Lc, Vz[2:end-1,:], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{z}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Strain + ax1 = MoC.Axis(f[1, 1], title = L"$\varepsilon_{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, εII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\varepsilon_{II}$ []", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:AnisoFactor + ax1 = MoC.Axis(f[1, 1], title = L"Anisotropy factor at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(AniFac), colormap = (:turbo, α_heatmap), colorrange=(0, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label =L"$log_{10}\left(\text{Anisotropy factor}\right)$", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:GrainSize + ax1 = MoC.Axis(f[1, 1], title = L"$d$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(d.*1e6), colormap = (:turbo, α_heatmap), colorrange=(1, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + xminz, xmaxz = -0.4, 0.4 + zminz, zmaxz = -0.17, 0.17 + Lx = xmaxz - xminz + Lz = zmaxz - zminz + xlims!(ax1, -0.4, 0.4) + ylims!(ax1, -0.17, 0.17) + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "d", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Topography + ax1 = MoC.Axis(f[1, 1], title = L"Topography at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$h$ [km]") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if velocity + #qv,qh = 10,10 + #MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = Δ*1000, lengthscale=Δ*20) + qv,qh = 6,3 + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = 1e1, lengthscale=Δ/1.5*1e10) + end + if fabric + #fac = 1 + qv,qh = fac,fac + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Fab_x[1:qh:end,1:qv:end], Fab_z[1:qh:end,1:qv:end], arrowsize = 0, lengthscale=Δ*0.7*fac, align = :center) + #MoC.arrows!(ax1, xc./Lc, zc./Lc, Nz, Nx, arrowsize = 0, lengthscale=Δ/1.5) + end + if printfig Print2Disk( f, path, string(field), istep, xshift) end + + if inspector + DataInspector(f) + end + if displayfig + display(f) + end + sleep(nap) + end + end + if printvid + #FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=1920:1080" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + zres = resol + xres = resol + if xshift > 0.0 + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/shift/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName)_shift.mov"`) + else + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + end + end +end + +function PrincipalStress(τxx, τzz, τxz, P) + σ1 = (x=zeros(size(τxx)), z=zeros(size(τxx)) ) + τxzc = 0.25*(τxz[1:end-1,1:end-1] .+ τxz[2:end-0,1:end-1] .+ τxz[1:end-1,2:end-0] .+ τxz[2:end-0,2:end-0]) + for i in eachindex(τxzc) + if P[i]>1e-13 + σ = [-P[i]+τxx[i] τxzc[i]; τxzc[i] -P[i]+τzz[i]] + v = eigvecs(σ) + σ1.x[i] = v[1,1] + σ1.z[i] = v[2,1] + end + end + return σ1 +end + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep, xshift; res=4) + if xshift > 0.0 + path1 = path*"/_$field/shift/" + else + path1 = path*"/_$field/" + end + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function tensorCartesianToPolar( AXX, AZZ, AXZ, AZX, xc, zc, ncx, ncz ) + # tensor coordinate transformation from x-z to r-phi coordinate system + # A_XZ = tensor to transform + # A_RP = transformed tensor + XX = ones(ncx)*zc' # matrix with all x-coords + ZZ = xc*one(ncz)' # matrix with all z-coords + ALPHA = asin.( XX ./ ( XX.^2 .+ ZZ.^2 ).^0.5 ) + # Idea for coord transform: + # R = [cos.(ALPHA) sin.(ALPHA) + # -sin.(ALPHA) cos.(ALPHA)] + # ARP = R' * AXZ * R + AXZc = v2c(AXZ) + AZXc = v2c(AZX) + #ARR = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + #APP = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* sin.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) + #ARP = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) + #APR = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* cos.(ALPHA) .- ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + ARR = ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + APP = ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* sin.(ALPHA) + ARP = ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) + APR = ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + check = 1 + if check == 1 + AIIXZ = (0.5*( AXX.^2 .+ AZZ.^2 .+ AXZc.^2 .+ AZXc.^2 )).^0.5 + AIIRP = (0.5*( ARR.^2 .+ APP.^2 .+ ARP.^2 .+ APR.^2 )).^0.5 + AIIdiff = AIIRP .- AIIXZ + @show maximum(AIIdiff) + end + return ARR, APP, ARP, APR +end + +function v2c(Av) # interpolation vertex to center + return 0.25 * ( Av[1:end-1,1:end-1] + Av[2:end,1:end-1] + Av[2:end,1:end-1] + Av[2:end,2:end] ) +end + +#main() + +#run(`ffmpeg -framerate 2 -i /Users/lcandiot/Developer/MDOODZ7.0/RUNS/RiftingChenin/_Phases/Phases%05d.png -c libx264 -pix_fmt yuv420p -y out_movie.mp4`) + +# Working command +#ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4 + + +# Set the path to your files +#main("/users/whalter1/work/aniso_fix/A1_1000/", 2610, 2610, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A1_500/", 11410, 11410, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A1_250/", 0, 0, 1, 0.5, 10) + +#main("/users/whalter1/work/aniso_fix/A2_1000/", 2790, 3100, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A2_500/", 2680, 6190, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A2_250/", 5230, 10000, 1, 0.5, 10) +# +#main("/users/whalter1/work/aniso_fix/A3_1000/", 3320, 3640, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A3_500/", 5000, 7500, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A3_250/", 0, 5000, 1, 0.5, 10) +# +#main("/users/whalter1/work/aniso_fix/A4_1000/", 2770, 3080, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A4_500/", 5000, 7500, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A4_250/", 0, 5000, 1, 0.5, 10) +# +#main("/users/whalter1/work/aniso_fix/A5_1000/", 3460, 3880, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A5_500/", 5000, 7500, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/A5_250/", 0, 5000, 1, 0.5, 10) + +#main("/users/whalter1/work/aniso_fix/B1_1000/", 0, 0, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B1_500/", 0, 0, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B1_250/", 0, 0, 1, 0.5, 10) +# +#main("/users/whalter1/work/aniso_fix/B2_1000/", 0, 0, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B2_500/", 0, 0, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B2_250/", 0, 0, 1, 0.5, 10) +# +#main("/users/whalter1/work/aniso_fix/B3_1000/", 0, 0, 4, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B3_500/", 0, 0, 2, 0.5, 10) +#main("/users/whalter1/work/aniso_fix/B3_250/", 0, 0, 1, 0.5, 10) + +# +#main("/users/whalter1/work/aniso_fix/A2_500_PSALE/", 200, 200, 1, 0.0, 10) +#main("/users/whalter1/work/aniso_fix/A2_250_PSALE/", 80, 80, 1, 0.0, 10) +# +#main("/users/whalter1/work/aniso_fix/A2_500_PSDirichlet/", 280, 280, 2, 0.0, 10) +#main("/users/whalter1/work/aniso_fix/A2_250_PSDirichlet/", 461, 800, 1, 0.0, 10) + +#main("/users/whalter1/work/aniso_fix/MWE_100_PSALE/", 1556, 1556, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/MWE_100_PSDirichlet/", 0, 100, 1, 0.0, 1) + +#main("/users/whalter1/work/aniso_fix/A3_250_PSALE/", 915, 920, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A4_250_PSALE/", 193, 198, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A5_250_PSALE/", 168, 173, 1, 0.0, 1) + +#main("/users/whalter1/work/aniso_fix/A2_250_PS180/", 85, 90, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A2_200_PSALE/", 0, 94, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A2_250_PSALE_another/", 0, 79, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A2_100_PSALE_another/", 0, 314, 1, 0.0, 1) +#main("/users/whalter1/work/aniso_fix/A2_150_PSALE/", 0, 700, 1, 0.0, 1) + +#main("/users/whalter1/work/aniso_fix/MWE_500/", 400, 400, 1, 0.5, 10) + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_2_bueno.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_2_bueno.jl new file mode 100644 index 00000000..70110989 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_2_bueno.jl @@ -0,0 +1,784 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +s = 1 +d = 24*3600*s +y = 365*d +My = 1e6*y + +function main(path, file_start, file_end_max,fac, xshift, file_step) + + # Select one field to visualise + #field = :Phases + #field = :Density + #field = :Viscosity + #field = :Stress + #field = :Stress_xx + #field = :Stress_zz + #field = :Stress_xz + field = :StrainRate + #field = :PlasticStrainrate + #field = :Pressure + #field = :Temperature + #field = :Velocity + #field = :Velocity_x + #field = :Velocity_z + #field = :Strain # cumulated strain + #field = :AnisoFactor # anisotropy factor + #field = :GrainSize # doesn't function properly yet + #field = :Topography # doesn't function properly yet + #field = :ViscosityReduction + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + printvid = true # print a video (printfig must be on) + ph_contours = false # add phase contours + T_contours = false # add temperature contours + fabric = true # add fabric quiver (normal to director) + velocity = false # add velocity quiver + deviatoricV = true # considers deviatoric velocity for plot and quiver (deviatoric velocity = velocity minus far-field velocity) + α_heatmap = 0.85 # transparency of heatmap + σ1_axis = false + polar = false # for curved setups using Earth's curvature (transforms tensors from x-z to r-phi coord system) + nap = 0.3 # pause for animation + resol = 1600 + inspector = false # (not possible on any "headless server") + framerate = 30 # Frame rate for the movie + movieName = "$(path)/_$(field)/$(field)" # Name of the movie + #xshift = 0.5 # periodically shifts all values to the right, fraction 0.0-1.0 + TimeSeries = true + + # File numbers + #file_step = 10 + # 1) find file_start + # Check index of last (highest) already generated picture file (.png) + path_to_pics = joinpath(path,"_$(field)") + if xshift > 0.0; path_to_pics = joinpath(path_to_pics,"shift"); end + @show path_to_pics + if ~isdir(path_to_pics) || ~isfile("$(path_to_pics)/$(field)$(lpad(0,5,"0")).png") + file_start = 0 + else + firstIsGood = false + k = 0 + while firstIsGood == false + #path_file_start = "$(path_to_pics)/$(field)$(lpad(k,5,"0")).png" + path_file_above = "$(path_to_pics)/$(field)$(lpad(k+file_step,5,"0")).png" + if isfile(path_file_above) + k += file_step + else + file_start = k + file_step + firstIsGood = true + end + end + end + # 2) find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + if file_start >= file_end; file_start = file_end; printvid = false; printfig = false; end # don't make video if (probably) already done... + + @show path + @show file_start, file_end, file_step + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + for istep=[file_end;file_start:file_step:file_end] + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=6) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + ph = Float64.(reshape(ExtractData( filename, "/VizGrid/compo"), ncx, ncz)); mask_air = ph .== -1.00 + ph_hr = Float64.(reshape(ExtractData( filename, "/VizGrid/compo_hr"), ncx_hr, ncz_hr)); + group_phases = copy( ph_hr); ph_hr[ph_hr.==-1.00] .= NaN + ηc = Float64.(reshape(ExtractData( filename, "/Centers/eta_n"), ncx, ncz)); ηc[mask_air] .= NaN + ρc = Float64.(reshape(ExtractData( filename, "/Centers/rho_n"), ncx, ncz)); ρc[mask_air] .= NaN + P = Float64.(reshape(ExtractData( filename, "/Centers/P"), ncx, ncz)); P[mask_air] .= NaN + T = Float64.(reshape(ExtractData( filename, "/Centers/T"), ncx, ncz)) .- 273.15; T[mask_air] .= NaN + d = Float64.(reshape(ExtractData( filename, "/Centers/d"), ncx, ncz)); d[mask_air] .= NaN + ε̇pl = Float64.(reshape(ExtractData( filename, "/Centers/eII_pl"), ncx, ncz)); ε̇pl[mask_air] .= NaN + Vx = Float64.(reshape(ExtractData( filename, "/VxNodes/Vx"), nvx, (ncz+2))) + Vz = Float64.(reshape(ExtractData( filename, "/VzNodes/Vz"), (ncx+2), nvz)) + τxx = Float64.(reshape(ExtractData( filename, "/Centers/sxxd"), ncx, ncz)); τxx[mask_air] .= NaN + τzz = Float64.(reshape(ExtractData( filename, "/Centers/szzd"), ncx, ncz)); τzz[mask_air] .= NaN + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + τxzc = 0.25*(τxz[1:end-1,1:end-1].+τxz[2:end,1:end-1].+τxz[1:end-1,2:end].+τxz[2:end,2:end]); τxzc[mask_air] .= NaN + ε̇xx = Float64.(reshape(ExtractData( filename, "/Centers/exxd"), ncx, ncz)) + ε̇xz = Float64.(reshape(ExtractData( filename, "/Vertices/exz"), nvx, nvz)) + εII = Float64.(reshape(ExtractData( filename, "/Centers/strain"), ncx, ncz)); εII[mask_air] .= NaN + τII = sqrt.( 0.5*(2*τxx.^2 .+ 0.5*(τxz[1:end-1,1:end-1].^2 .+ τxz[2:end,1:end-1].^2 .+ τxz[1:end-1,2:end].^2 .+ τxz[2:end,2:end].^2 ) ) ); τII[mask_air] .= NaN + ε̇II = sqrt.( 0.5*(2*ε̇xx.^2 .+ 0.5*(ε̇xz[1:end-1,1:end-1].^2 .+ ε̇xz[2:end,1:end-1].^2 .+ ε̇xz[1:end-1,2:end].^2 .+ ε̇xz[2:end,2:end].^2 ) ) ); ε̇II[mask_air] .= NaN + if field==:AnisoFactor + AniFac= Float64.(reshape(ExtractData( filename, "/Centers/ani_fac"), ncx, ncz)) + #@show AniFac[50,50] + @show minimum(AniFac) + @show maximum(AniFac) + # weird issue that sometimes aniso factor is negative infinity (e.g. -9e12 or so) where it should actually be at maximum (e.g. 1000, saturated)! + maxifac = maximum(AniFac) + AniFac[AniFac .< 0] .= maxifac + @show minimum(AniFac) + + AniFac[mask_air] .= NaN + end + if fabric + Nx = Float64.(reshape(ExtractData( filename, "/Centers/nx"), ncx, ncz)) + Nz = Float64.(reshape(ExtractData( filename, "/Centers/nz"), ncx, ncz)) + Fab_x = -Nz./Nx + Fab_z = ones(size(Nz)) + nrm = sqrt.(Fab_x.^2 .+ Fab_z.^2) + Fab_x ./= nrm + Fab_z ./= nrm + end + if field==:Topography + height = Float64.(ExtractData( filename, "/Topo/z_grid")); + Vx_grid = Float64.(ExtractData( filename, "/Topo/Vx_grid")); + Vz_grid = Float64.(ExtractData( filename, "/Topo/Vz_grid")); + Vx_mark = Float64.(ExtractData( filename, "/Topo/Vx_mark")); + Vz_mark = Float64.(ExtractData( filename, "/Topo/Vz_mark")); + x_mark = Float64.(ExtractData( filename, "/Topo/x_mark")); + z_mark = Float64.(ExtractData( filename, "/Topo/z_mark")); + end + if σ1_axis + σ1 = PrincipalStress(τxx, τzz, τxz, P) + end + if TimeSeries + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + end + + ##################################### + # x-shift + if xshift > 0.0 + # x-coord on center location + xidx = Int(floor(ncx*xshift))+1 # x index where to cut + + ph = ph[[xidx:end;1:xidx-1],:] + ηc = ηc[[xidx:end;1:xidx-1],:] + ρc = ρc[[xidx:end;1:xidx-1],:] + P = P[[xidx:end;1:xidx-1],:] + T = T[[xidx:end;1:xidx-1],:] + d = d[[xidx:end;1:xidx-1],:] + ε̇pl = ε̇pl[[xidx:end;1:xidx-1],:] + Vz = Vz[[xidx:end;1:xidx-1],:] # not accurate ... to solve later...! + τxx = τxx[[xidx:end;1:xidx-1],:] + τzz = τzz[[xidx:end;1:xidx-1],:] + τxzc = τxzc[[xidx:end;1:xidx-1],:] + ε̇xx = ε̇xx[[xidx:end;1:xidx-1],:] + εII = εII[[xidx:end;1:xidx-1],:] + ε̇II = ε̇II[[xidx:end;1:xidx-1],:] + τII = τII[[xidx:end;1:xidx-1],:] + if field==:AnisoFactor + AniFac = AniFac[[xidx:end;1:xidx-1],:] + end + if fabric + Nx = Nx[[xidx:end;1:xidx-1],:] + Nz = Nz[[xidx:end;1:xidx-1],:] + Fab_x = Fab_x[[xidx:end;1:xidx-1],:] + Fab_z = Fab_z[[xidx:end;1:xidx-1],:] + end + # x-coord on vertex location + xidx = Int(floor(nvx*xshift))+1 # x index where to cut + Vx = Vx[[xidx:end;1:xidx-1],:] + τxz = τxz[[xidx:end;1:xidx-1],:] + ε̇xz = ε̇xz[[xidx:end;1:xidx-1],:] + end + + ##################################### + + # Postprocessing deviatoric velocity + if deviatoricV + shear_style = 1 # 0 = pure shear; 1 = simple shear + bkg_strain_rate = 1 # background (far-field) strain rate + + Vx_bkg = Vx + Vz_bkg = Vz + if shear_style == 1 + bla = 2*bkg_strain_rate*zc' + bla_first = bla[1]-(bla[2]-bla[1]) + bla_last = bla[end]+(bla[end]-bla[end-1]) + bla = [bla_first; bla'; bla_last]' + Vx_bkg = repeat(bla, outer = nvx) + end + Vx = Vx-Vx_bkg + end + + # Postprocessing velocity + Vxc = 0.5 .* (Vx[1:end-1,2:end-1] .+ Vx[2:end-0,2:end-1]); Vxc[mask_air] .= NaN + Vzc = 0.5 .* (Vz[2:end-1,1:end-1] .+ Vz[2:end-1,2:end-0]); Vzc[mask_air] .= NaN + Vc = (Vxc.^2 .+ Vzc.^2).^0.5 + + ##################################### + # Postprocessing polar setups + if polar + τxx, τzz, τxz, τxz = tensorCartesianToPolar( τxx, τzz, τxz, τxz, xc, zc, ncx, ncz ) + end + + ##################################### + + # Color palette for phase map + cmap = zeros(RGB{Float64}, 7) + cmap[1] = RGBA{Float64}(210/255, 218/255, 205/255, 1.) + cmap[2] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[3] = RGBA{Float64}(117/255, 164/255, 148/255, 1.) + cmap[4] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + cmap[5] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[6] = RGBA{Float64}(244/255, 218/255, 205/255, 1.) + cmap[7] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + phase_colors = MoC.cgrad(cmap, length(cmap), categorical=true, rev=false) + + # Group phases for contouring + group_phases[ ph_hr.==4 .|| ph_hr.==0 .|| ph_hr.==5 .|| ph_hr.==1 ] .= 0 + group_phases[ ph_hr.==2 .|| ph_hr.==6 ] .= 1 + group_phases[ ph_hr.==3 ] .= 3 + + ##################################### + + f = MoC.Figure(resolution = (Lx/Lz*resol, resol), fontsize=25) + + if field==:Phases + ax1 = MoC.Axis(f[1, 1], title = L"Phases at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc_hr./Lc, zc_hr./Lc, ph_hr, colormap = phase_colors) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "Phases", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Density + ax1 = MoC.Axis(f[1, 1], title = L"Density $ρ$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ρc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"Density $ρ$ [kg/m^3]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Viscosity + ax1 = MoC.Axis(f[1, 1], title = L"$\eta$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ηc), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\eta$ [Pa.s]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{II}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xx + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xx}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxx, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xx}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_zz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{zz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τzz, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{zz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxz, colormap = (:turbo, α_heatmap)) + else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, τxz, colormap = (:turbo, α_heatmap), colorrange=(0, 1e1))#, colorrange=(0, 5e3)) + end + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:StrainRate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇II), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:PlasticStrainrate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ at $t$ = %$(tMy) %$(tMytext), sum = %$(round(sum(ε̇pl),sigdigits=4)), max = %$(round(maximum(ε̇pl),sigdigits=4)), min = %$(round(minimum(ε̇pl),sigdigits=4))", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + ε̇pl[mask_air] .= NaN + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇pl), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Pressure + ax1 = MoC.Axis(f[1, 1], title = L"$P$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, P, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$P$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Temperature + ax1 = MoC.Axis(f[1, 1], title = L"$T$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, T, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$T$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity + ax1 = MoC.Axis(f[1, 1], title = L"$V$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vc, colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_x + ax1 = MoC.Axis(f[1, 1], title = L"$V_{x}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xv./Lc, zc./Lc, Vx[:,2:end-1], colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{x}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_z + ax1 = MoC.Axis(f[1, 1], title = L"$V_{z}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zv./Lc, Vz[2:end-1,:], colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{z}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Strain + ax1 = MoC.Axis(f[1, 1], title = L"$\varepsilon_{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, εII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\varepsilon_{II}$ []", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:AnisoFactor + ax1 = MoC.Axis(f[1, 1], title = L"Anisotropy factor at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(AniFac), colormap = (:turbo, α_heatmap), colorrange=(0, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label =L"$log_{10}\left(\text{Anisotropy factor}\right)$", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:GrainSize + ax1 = MoC.Axis(f[1, 1], title = L"$d$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(d.*1e6), colormap = (:turbo, α_heatmap), colorrange=(1, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + xminz, xmaxz = -0.4, 0.4 + zminz, zmaxz = -0.17, 0.17 + Lx = xmaxz - xminz + Lz = zmaxz - zminz + xlims!(ax1, -0.4, 0.4) + ylims!(ax1, -0.17, 0.17) + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "d", width = 20, labelsize = 25, ticklabelsize = 14 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Topography + ax1 = MoC.Axis(f[1, 1], title = L"Topography at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$h$ [km]") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if field==:ViscosityReduction + ax1 = MoC.Axis(f[1, 1], title = L"Reduction of effective shear viscosity at $t$ = %$(tMy) %$(tMytext)", xlabel = L"shear deformation γ", ylabel = L"η_{s eff} / η_{s init}") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if velocity + #qv,qh = 10,10 + #MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = Δ*1000, lengthscale=Δ*20) + qv,qh = 6,3 + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = 1e1, lengthscale=Δ/1.5*1e10) + end + if fabric + #fac = 1 + qv,qh = fac,fac + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Fab_x[1:qh:end,1:qv:end], Fab_z[1:qh:end,1:qv:end], arrowsize = 0, lengthscale=Δ*0.7*fac, align = :center) + #MoC.arrows!(ax1, xc./Lc, zc./Lc, Nz, Nx, arrowsize = 0, lengthscale=Δ/1.5) + end + if printfig Print2Disk( f, path, string(field), istep, xshift) end + + if inspector + DataInspector(f) + end + if displayfig + display(f) + end + sleep(nap) + end + end + if printvid + #FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=1920:1080" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + zres = resol + xres = resol + if xshift > 0.0 + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/shift/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName)_shift.mov"`) + else + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + end + end +end + +function PrincipalStress(τxx, τzz, τxz, P) + σ1 = (x=zeros(size(τxx)), z=zeros(size(τxx)) ) + τxzc = 0.25*(τxz[1:end-1,1:end-1] .+ τxz[2:end-0,1:end-1] .+ τxz[1:end-1,2:end-0] .+ τxz[2:end-0,2:end-0]) + for i in eachindex(τxzc) + if P[i]>1e-13 + σ = [-P[i]+τxx[i] τxzc[i]; τxzc[i] -P[i]+τzz[i]] + v = eigvecs(σ) + σ1.x[i] = v[1,1] + σ1.z[i] = v[2,1] + end + end + return σ1 +end + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep, xshift; res=4) + if xshift > 0.0 + path1 = path*"/_$field/shift/" + else + path1 = path*"/_$field/" + end + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function tensorCartesianToPolar( AXX, AZZ, AXZ, AZX, xc, zc, ncx, ncz ) + # tensor coordinate transformation from x-z to r-phi coordinate system + # A_XZ = tensor to transform + # A_RP = transformed tensor + XX = ones(ncx)*zc' # matrix with all x-coords + ZZ = xc*one(ncz)' # matrix with all z-coords + ALPHA = asin.( XX ./ ( XX.^2 .+ ZZ.^2 ).^0.5 ) + # Idea for coord transform: + # R = [cos.(ALPHA) sin.(ALPHA) + # -sin.(ALPHA) cos.(ALPHA)] + # ARP = R' * AXZ * R + AXZc = v2c(AXZ) + AZXc = v2c(AZX) + #ARR = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + #APP = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* sin.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) + #ARP = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) + #APR = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* cos.(ALPHA) .- ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + ARR = ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + APP = ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* sin.(ALPHA) + ARP = ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) + APR = ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + check = 1 + if check == 1 + AIIXZ = (0.5*( AXX.^2 .+ AZZ.^2 .+ AXZc.^2 .+ AZXc.^2 )).^0.5 + AIIRP = (0.5*( ARR.^2 .+ APP.^2 .+ ARP.^2 .+ APR.^2 )).^0.5 + AIIdiff = AIIRP .- AIIXZ + @show maximum(AIIdiff) + end + return ARR, APP, ARP, APR +end + +function v2c(Av) # interpolation vertex to center + return 0.25 * ( Av[1:end-1,1:end-1] + Av[2:end,1:end-1] + Av[2:end,1:end-1] + Av[2:end,2:end] ) +end + +#main() + +#run(`ffmpeg -framerate 2 -i /Users/lcandiot/Developer/MDOODZ7.0/RUNS/RiftingChenin/_Phases/Phases%05d.png -c libx264 -pix_fmt yuv420p -y out_movie.mp4`) + +# Working command +#ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4 + +# Set the path to your files + +aniSetupsOnly = false +file_step = 10 + +if aniSetupsOnly == false + # all iso setups + + main("/users/whalter1/work/aniso_fix/B19_2000/", 0, 100000, 8, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B19_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B19_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B6_2000/", 0, 100000, 8, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B6_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B6_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B7_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B8_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B9_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B10_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B11_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B12_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B13_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B14_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B15_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B16_2000/", 0, 100000, 8, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B16_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B16_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B17_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B18_1000/", 0, 100000, 4, 0.5, file_step) + + main("/users/whalter1/work/aniso_fix/A1_1000/", 2610, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/A6_1000/", 3460, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/A7_1000/", 3460, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B1_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B2_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B2_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B3_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B3_1250/", 0, 100000, 5, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B3_1000/", 0, 100000, 4, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B3_750/" , 0, 100000, 3, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B3_500/" , 0, 100000, 2, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B4_1500/", 0, 100000, 6, 0.5, file_step) + main("/users/whalter1/work/aniso_fix/B5_1000/", 0, 100000, 4, 0.5, file_step) +end + +# all aniso setups +main("/users/whalter1/work/aniso_fix/A2_1000/", 2790, 100000, 4, 0.5, file_step) +main("/users/whalter1/work/aniso_fix/A3_1000/", 3320, 100000, 4, 0.5, file_step) +main("/users/whalter1/work/aniso_fix/A4_1000/", 2770, 100000, 4, 0.5, file_step) +main("/users/whalter1/work/aniso_fix/A5_1000/", 3460, 100000, 4, 0.5, file_step) +main("/users/whalter1/work/aniso_fix/MWE_1000/", 400, 100000, 4, 0.5, file_step) + +# for testing new setup... +#main("/users/whalter1/MDOODZ7.0/cmake-exec/AnisoViscTest_evolv_multi_ellipses/", 0, 18000, 4, 0.5, file_step) +#main("/users/whalter1/MDOODZ7.0/cmake-exec/Fig10_bench/", 0, 18000, 4, 0.0, 1) diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_3_dVxdz.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_3_dVxdz.jl new file mode 100644 index 00000000..1842e748 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_compositevisualisation_w_multi_3_dVxdz.jl @@ -0,0 +1,671 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +s = 1 +d = 24*3600*s +y = 365*d +My = 1e6*y + +function main(path, file_start, file_end_max,fac, xshift, file_step) + + # Select one field to visualise + #field = :Phases + #field = :Density + #field = :Viscosity + #field = :Stress + #field = :Stress_xx + #field = :Stress_zz + #field = :Stress_xz + #field = :StrainRate + #field = :StrainRate_xz + field = :dVxdz + #field = :dVzdx + #field = :dVzdx_percent + #field = :PlasticStrainrate + #field = :Pressure + #field = :Temperature + #field = :Velocity + #field = :Velocity_x + #field = :Velocity_z + #field = :Strain # cumulated strain + #field = :AnisoFactor # anisotropy factor + #field = :GrainSize # doesn't function properly yet + #field = :Topography # doesn't function properly yet + #field = :ViscosityReduction + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + printvid = true # print a video (printfig must be on) + ph_contours = false # add phase contours + T_contours = false # add temperature contours + fabric = true # add fabric quiver (normal to director) + velocity = false # add velocity quiver + deviatoricV = true # considers deviatoric velocity for plot and quiver (deviatoric velocity = velocity minus far-field velocity) + α_heatmap = 0.85 # transparency of heatmap + σ1_axis = false + polar = false # for curved setups using Earth's curvature (transforms tensors from x-z to r-phi coord system) + fabricAlign = true # also a coordinate transformation, transforms to fabric coordinates + nap = 0.3 # pause for animation + resol = 1600 + inspector = false # (not possible on any "headless server") + framerate = 30 # Frame rate for the movie + movieName = "$(path)/_$(field)/$(field)" # Name of the movie + #xshift = 0.5 # periodically shifts all values to the right, fraction 0.0-1.0 + TimeSeries = true + + # File numbers + #file_step = 10 + # 1) find file_start + # Check index of last (highest) already generated picture file (.png) + path_to_pics = joinpath(path,"_$(field)") + if xshift > 0.0; path_to_pics = joinpath(path_to_pics,"shift"); end + @show path_to_pics + if ~isdir(path_to_pics) || ~isfile("$(path_to_pics)/$(field)$(lpad(0,5,"0")).png") + file_start = 0 + else + firstIsGood = false + k = 0 + while firstIsGood == false + #path_file_start = "$(path_to_pics)/$(field)$(lpad(k,5,"0")).png" + path_file_above = "$(path_to_pics)/$(field)$(lpad(k+file_step,5,"0")).png" + if isfile(path_file_above) + k += file_step + else + file_start = k + file_step + firstIsGood = true + end + end + end + # 2) find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + if file_start >= file_end; file_start = file_end; printvid = false; printfig = false; end # don't make video if (probably) already done... + + @show path + @show file_start, file_end, file_step + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + for istep=[file_end;file_start:file_step:file_end] + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=6) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + ph = Float64.(reshape(ExtractData( filename, "/VizGrid/compo"), ncx, ncz)); mask_air = ph .== -1.00 + ph_hr = Float64.(reshape(ExtractData( filename, "/VizGrid/compo_hr"), ncx_hr, ncz_hr)); + group_phases = copy( ph_hr); ph_hr[ph_hr.==-1.00] .= NaN + ηc = Float64.(reshape(ExtractData( filename, "/Centers/eta_n"), ncx, ncz)); ηc[mask_air] .= NaN + ρc = Float64.(reshape(ExtractData( filename, "/Centers/rho_n"), ncx, ncz)); ρc[mask_air] .= NaN + P = Float64.(reshape(ExtractData( filename, "/Centers/P"), ncx, ncz)); P[mask_air] .= NaN + T = Float64.(reshape(ExtractData( filename, "/Centers/T"), ncx, ncz)) .- 273.15; T[mask_air] .= NaN + d = Float64.(reshape(ExtractData( filename, "/Centers/d"), ncx, ncz)); d[mask_air] .= NaN + ε̇pl = Float64.(reshape(ExtractData( filename, "/Centers/eII_pl"), ncx, ncz)); ε̇pl[mask_air] .= NaN + Vx = Float64.(reshape(ExtractData( filename, "/VxNodes/Vx"), nvx, (ncz+2))) + Vz = Float64.(reshape(ExtractData( filename, "/VzNodes/Vz"), (ncx+2), nvz)) + τxx = Float64.(reshape(ExtractData( filename, "/Centers/sxxd"), ncx, ncz)); τxx[mask_air] .= NaN + τzz = Float64.(reshape(ExtractData( filename, "/Centers/szzd"), ncx, ncz)); τzz[mask_air] .= NaN + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + τxzc = 0.25*(τxz[1:end-1,1:end-1].+τxz[2:end,1:end-1].+τxz[1:end-1,2:end].+τxz[2:end,2:end]); τxzc[mask_air] .= NaN + ε̇xx = Float64.(reshape(ExtractData( filename, "/Centers/exxd"), ncx, ncz)) + ε̇xz = Float64.(reshape(ExtractData( filename, "/Vertices/exz"), nvx, nvz)) + εII = Float64.(reshape(ExtractData( filename, "/Centers/strain"), ncx, ncz)); εII[mask_air] .= NaN + τII = sqrt.( 0.5*(2*τxx.^2 .+ 0.5*(τxz[1:end-1,1:end-1].^2 .+ τxz[2:end,1:end-1].^2 .+ τxz[1:end-1,2:end].^2 .+ τxz[2:end,2:end].^2 ) ) ); τII[mask_air] .= NaN + ε̇II = sqrt.( 0.5*(2*ε̇xx.^2 .+ 0.5*(ε̇xz[1:end-1,1:end-1].^2 .+ ε̇xz[2:end,1:end-1].^2 .+ ε̇xz[1:end-1,2:end].^2 .+ ε̇xz[2:end,2:end].^2 ) ) ); ε̇II[mask_air] .= NaN + if field==:AnisoFactor + AniFac= Float64.(reshape(ExtractData( filename, "/Centers/ani_fac"), ncx, ncz)) + #@show AniFac[50,50] + @show minimum(AniFac) + @show maximum(AniFac) + # weird issue that sometimes aniso factor is negative infinity (e.g. -9e12 or so) where it should actually be at maximum (e.g. 1000, saturated)! + maxifac = maximum(AniFac) + AniFac[AniFac .< 0] .= maxifac + @show minimum(AniFac) + + AniFac[mask_air] .= NaN + end + if fabric || fabricAlign + Nx = Float64.(reshape(ExtractData( filename, "/Centers/nx"), ncx, ncz)) + Nz = Float64.(reshape(ExtractData( filename, "/Centers/nz"), ncx, ncz)) + Fab_x = -Nz./Nx + Fab_z = ones(size(Nz)) + nrm = sqrt.(Fab_x.^2 .+ Fab_z.^2) + Fab_x ./= nrm + Fab_z ./= nrm + end + if field==:Topography + height = Float64.(ExtractData( filename, "/Topo/z_grid")); + Vx_grid = Float64.(ExtractData( filename, "/Topo/Vx_grid")); + Vz_grid = Float64.(ExtractData( filename, "/Topo/Vz_grid")); + Vx_mark = Float64.(ExtractData( filename, "/Topo/Vx_mark")); + Vz_mark = Float64.(ExtractData( filename, "/Topo/Vz_mark")); + x_mark = Float64.(ExtractData( filename, "/Topo/x_mark")); + z_mark = Float64.(ExtractData( filename, "/Topo/z_mark")); + end + if σ1_axis + σ1 = PrincipalStress(τxx, τzz, τxz, P) + end + if TimeSeries + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + end + + ##################################### + # x-shift + if xshift > 0.0 + # x-coord on center location + xidx = Int(floor(ncx*xshift))+1 # x index where to cut + + ph = ph[[xidx:end;1:xidx-1],:] + ηc = ηc[[xidx:end;1:xidx-1],:] + ρc = ρc[[xidx:end;1:xidx-1],:] + P = P[[xidx:end;1:xidx-1],:] + T = T[[xidx:end;1:xidx-1],:] + d = d[[xidx:end;1:xidx-1],:] + ε̇pl = ε̇pl[[xidx:end;1:xidx-1],:] + Vz = Vz[[xidx:end;1:xidx-1],:] # not accurate ... to solve later...! + τxx = τxx[[xidx:end;1:xidx-1],:] + τzz = τzz[[xidx:end;1:xidx-1],:] + τxzc = τxzc[[xidx:end;1:xidx-1],:] + ε̇xx = ε̇xx[[xidx:end;1:xidx-1],:] + εII = εII[[xidx:end;1:xidx-1],:] + ε̇II = ε̇II[[xidx:end;1:xidx-1],:] + τII = τII[[xidx:end;1:xidx-1],:] + if field==:AnisoFactor + AniFac = AniFac[[xidx:end;1:xidx-1],:] + end + if fabric + Nx = Nx[[xidx:end;1:xidx-1],:] + Nz = Nz[[xidx:end;1:xidx-1],:] + Fab_x = Fab_x[[xidx:end;1:xidx-1],:] + Fab_z = Fab_z[[xidx:end;1:xidx-1],:] + end + # x-coord on vertex location + xidx = Int(floor(nvx*xshift))+1 # x index where to cut + Vx = Vx[[xidx:end;1:xidx-1],:] + τxz = τxz[[xidx:end;1:xidx-1],:] + ε̇xz = ε̇xz[[xidx:end;1:xidx-1],:] + end + + ##################################### + + # Postprocessing deformation rate tensor + if field==:dVxdz || field==:dVzdx || field==:dVzdx_percent + dVxdx = diff(Vx, dims=1)./Δx + dVzdz = diff(Vz, dims=2)./Δz + dVxdz = diff(Vx, dims=2)./Δz + dVzdx = diff(Vz, dims=1)./Δx + + #@show size(dVxdx),size(dVzdz),size(dVxdz),size(dVzdx) + + dVxdx = dVxdx[:,2:end-1] + dVzdz = dVzdz[2:end-1,:] + #dVxdz = v2c(dVxdz) + #dVzdx = v2c(dVzdx) + + #@show size(dVxdx),size(dVzdz),size(dVxdz),size(dVzdx) + end + + + ##################################### + + # Postprocessing deviatoric velocity + if deviatoricV + shear_style = 1 # 0 = pure shear; 1 = simple shear + bkg_strain_rate = 1 # background (far-field) strain rate + + Vx_bkg = Vx + Vz_bkg = Vz + if shear_style == 1 + bla = 2*bkg_strain_rate*zc' + bla_first = bla[1]-(bla[2]-bla[1]) + bla_last = bla[end]+(bla[end]-bla[end-1]) + bla = [bla_first; bla'; bla_last]' + Vx_bkg = repeat(bla, outer = nvx) + end + Vx = Vx-Vx_bkg + end + + # Postprocessing velocity + Vxc = 0.5 .* (Vx[1:end-1,2:end-1] .+ Vx[2:end-0,2:end-1]); Vxc[mask_air] .= NaN + Vzc = 0.5 .* (Vz[2:end-1,1:end-1] .+ Vz[2:end-1,2:end-0]); Vzc[mask_air] .= NaN + Vc = (Vxc.^2 .+ Vzc.^2).^0.5 + + ##################################### + # Postprocessing polar setups + if polar + XX = ones(ncx)*zc' # matrix with all x-coords + ZZ = xc*one(ncz)' # matrix with all z-coords + ALPHA = asin.( XX ./ ( XX.^2 .+ ZZ.^2 ).^0.5 ) # angle of coordinate transformation + τxx, τzz, τxz, τxz = coordTransformTensor( τxx, τzz, τxz, τxz, ALPHA ) + ε̇xx, ε̇zz, ε̇xz, ε̇zx = coordTransformTensor( ε̇xx,-ε̇xx, ε̇xz, ε̇xz, ALPHA ) + Vxc, Vzc = coordTransformVector( Vxc, Vzc, ALPHA ) + if field==:dVxdz || field==:dVzdx || field==:dVzdx_percent + dVxdx, dVzdz, dVxdz, dVzdx = coordTransformTensor( dVxdx, dVzdz, dVxdz, dVzdx, ALPHA ) end + end + # Postprocessing fabricAlign setups + if fabricAlign + ALPHA = asin.(Fab_z ./ ( Fab_x.^2 .+ Fab_z.^2 ).^0.5) + τxx, τzz, τxz, τxz = coordTransformTensor( τxx, τzz, τxz, τxz, ALPHA ) + ε̇xx, ε̇zz, ε̇xz, ε̇zx = coordTransformTensor( ε̇xx,-ε̇xx, ε̇xz, ε̇xz, ALPHA ) + Vxc, Vzc = coordTransformVector( Vxc, Vzc, ALPHA ) + if field==:dVxdz || field==:dVzdx || field==:dVzdx_percent + dVxdx, dVzdz, dVxdz, dVzdx = coordTransformTensor( dVxdx, dVzdz, dVxdz, dVzdx, ALPHA ) end + end + + ##################################### + + # Color palette for phase map + cmap = zeros(RGB{Float64}, 7) + cmap[1] = RGBA{Float64}(210/255, 218/255, 205/255, 1.) + cmap[2] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[3] = RGBA{Float64}(117/255, 164/255, 148/255, 1.) + cmap[4] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + cmap[5] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + cmap[6] = RGBA{Float64}(244/255, 218/255, 205/255, 1.) + cmap[7] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + phase_colors = MoC.cgrad(cmap, length(cmap), categorical=true, rev=false) + + # Group phases for contouring + group_phases[ ph_hr.==4 .|| ph_hr.==0 .|| ph_hr.==5 .|| ph_hr.==1 ] .= 0 + group_phases[ ph_hr.==2 .|| ph_hr.==6 ] .= 1 + group_phases[ ph_hr.==3 ] .= 3 + + ##################################### + + f = MoC.Figure(resolution = (Lx/Lz*resol, resol), fontsize=25) + + if field==:Phases + ax1 = MoC.Axis(f[1, 1], title = L"Phases at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc_hr./Lc, zc_hr./Lc, ph_hr, colormap = phase_colors) + MoC.Colorbar(f[1, 2], hm, label = "Phases", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Density + ax1 = MoC.Axis(f[1, 1], title = L"Density $ρ$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ρc, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"Density $ρ$ [kg/m^3]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Viscosity + ax1 = MoC.Axis(f[1, 1], title = L"$\eta$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ηc), colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\eta$ [Pa.s]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Stress + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τII, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{II}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Stress_xx + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xx}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxx, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xx}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Stress_zz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{zz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τzz, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{zz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Stress_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxz, colormap = (:turbo, α_heatmap)) else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, τxz, colormap = (:turbo, α_heatmap), colorrange=(0, 1e1)) end + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xz}$ [Pa]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:StrainRate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇II), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:StrainRate_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{xz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ε̇xz, colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, ε̇xz, colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) end + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{xz}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:dVxdz + ax1 = MoC.Axis(f[1, 1], title = L"$\textrm{dVxdz}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(abs.(dVxdz)), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, log10.(abs.(dVxdz)), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) end + MoC.Colorbar(f[1, 2], hm, label = L"$\textrm{dVxdz}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:dVzdx + ax1 = MoC.Axis(f[1, 1], title = L"$\textrm{dVzdx}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(abs.(dVzdx)), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, log10.(abs.(dVzdx)), colormap = (:turbo, α_heatmap), colorrange=(-3, 1.5)) end + MoC.Colorbar(f[1, 2], hm, label = L"$\textrm{dVzdx}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:dVzdx_percent + ax1 = MoC.Axis(f[1, 1], title = L"$\textrm{dVzdx / (dVxdz+dVzdx) * 100%}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, dVzdx ./ dVxdz * 100 , colormap = (:turbo, α_heatmap), colorrange=(0, 100)) else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, dVzdx ./ dVxdz * 100 , colormap = (:turbo, α_heatmap), colorrange=(0, 100)) end + MoC.Colorbar(f[1, 2], hm, label = L"$\textrm{dVzdx / (dVxdz+dVzdx) * 100%}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:PlasticStrainrate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ at $t$ = %$(tMy) %$(tMytext), sum = %$(round(sum(ε̇pl),sigdigits=4)), max = %$(round(maximum(ε̇pl),sigdigits=4)), min = %$(round(minimum(ε̇pl),sigdigits=4))", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + ε̇pl[mask_air] .= NaN + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇pl), colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Pressure + ax1 = MoC.Axis(f[1, 1], title = L"$P$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, P, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$P$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Temperature + ax1 = MoC.Axis(f[1, 1], title = L"$T$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, T, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$T$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Velocity + ax1 = MoC.Axis(f[1, 1], title = L"$V$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vc, colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) + MoC.Colorbar(f[1, 2], hm, label = L"$V$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Velocity_x + ax1 = MoC.Axis(f[1, 1], title = L"$V_{x}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vxc , colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) else + hm = MoC.heatmap!(ax1, xv./Lc, zc./Lc, Vx[:,2:end-1] , colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) end + MoC.Colorbar(f[1, 2], hm, label = L"$V_{x}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Velocity_z + ax1 = MoC.Axis(f[1, 1], title = L"$V_{z}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + if polar || fabricAlign + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vzc , colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) else + hm = MoC.heatmap!(ax1, xc./Lc, zv./Lc, Vz[2:end-1,:] , colormap = (:turbo, α_heatmap), colorrange=(-0.2, 0.2)) end + MoC.Colorbar(f[1, 2], hm, label = L"$V_{z}$ [s$^{-1}$]", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Strain + ax1 = MoC.Axis(f[1, 1], title = L"$\varepsilon_{II}$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, εII, colormap = (:turbo, α_heatmap)) + MoC.Colorbar(f[1, 2], hm, label = L"$\varepsilon_{II}$ []", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:AnisoFactor + ax1 = MoC.Axis(f[1, 1], title = L"Anisotropy factor at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(AniFac), colormap = (:turbo, α_heatmap), colorrange=(0, 3)) + MoC.Colorbar(f[1, 2], hm, label =L"$log_{10}\left(\text{Anisotropy factor}\right)$", width = 20, labelsize = 40, ticklabelsize = 40 ) + end + + if field==:GrainSize + ax1 = MoC.Axis(f[1, 1], title = L"$d$ at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$y$ [m]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(d.*1e6), colormap = (:turbo, α_heatmap), colorrange=(1, 3)) + xminz, xmaxz = -0.4, 0.4 + zminz, zmaxz = -0.17, 0.17 + Lx = xmaxz - xminz + Lz = zmaxz - zminz + xlims!(ax1, -0.4, 0.4) + ylims!(ax1, -0.17, 0.17) + MoC.Colorbar(f[1, 2], hm, label = "d", width = 20, labelsize = 25, ticklabelsize = 14 ) + end + + if field==:Topography + ax1 = MoC.Axis(f[1, 1], title = L"Topography at $t$ = %$(tMy) %$(tMytext)", xlabel = L"$x$ [m]", ylabel = L"$h$ [km]") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if field==:ViscosityReduction + ax1 = MoC.Axis(f[1, 1], title = L"Reduction of effective shear viscosity at $t$ = %$(tMy) %$(tMytext)", xlabel = L"shear deformation γ", ylabel = L"η_{s eff} / η_{s init}") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if T_contours; contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ); end + if ph_contours; contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ); end + if σ1_axis; MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5); end + if velocity + #qv,qh = 10,10 + #MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = Δ*1000, lengthscale=Δ*20) + qv,qh = 6,3 + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = 1e1, lengthscale=Δ/1.5*1e10) + end + if fabric + #fac = 1 + qv,qh = fac,fac + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Fab_x[1:qh:end,1:qv:end], Fab_z[1:qh:end,1:qv:end], arrowsize = 0, lengthscale=Δ*0.7*fac, align = :center) + #MoC.arrows!(ax1, xc./Lc, zc./Lc, Nz, Nx, arrowsize = 0, lengthscale=Δ/1.5) + end + + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.colgap!(f.layout, 20) + + if printfig Print2Disk( f, path, string(field), istep, xshift) end + + if inspector DataInspector(f) end + if displayfig display(f) end + sleep(nap) + end + end + if printvid + #FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=1920:1080" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + zres = resol + xres = resol + if xshift > 0.0 + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/shift/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName)_shift.mov"`) + else + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + end + end +end + +function PrincipalStress(τxx, τzz, τxz, P) + σ1 = (x=zeros(size(τxx)), z=zeros(size(τxx)) ) + τxzc = 0.25*(τxz[1:end-1,1:end-1] .+ τxz[2:end-0,1:end-1] .+ τxz[1:end-1,2:end-0] .+ τxz[2:end-0,2:end-0]) + for i in eachindex(τxzc) + if P[i]>1e-13 + σ = [-P[i]+τxx[i] τxzc[i]; τxzc[i] -P[i]+τzz[i]] + v = eigvecs(σ) + σ1.x[i] = v[1,1] + σ1.z[i] = v[2,1] + end + end + return σ1 +end + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep, xshift; res=4) + if xshift > 0.0 + path1 = path*"/_$field/shift/" + else + path1 = path*"/_$field/" + end + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function coordTransformTensor( AXX, AZZ, AXZ, AZX, ALPHA) + # tensor coordinate transformation from x-z to r-phi coordinate system + # A_XZ = tensor to transform + # A_RP = transformed tensor + # Idea for coord transform: + # R = [cos.(ALPHA) sin.(ALPHA) + # -sin.(ALPHA) cos.(ALPHA)] + # ARP = R' * AXZ * R + AXZc = v2c(AXZ) + AZXc = v2c(AZX) + #ARR = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + #APP = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* sin.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) + #ARP = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) + #APR = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* cos.(ALPHA) .- ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + ARR = ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + APP = ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* sin.(ALPHA) + ARP = ( AXZc.*cos.(ALPHA) .+ AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXX.*cos.(ALPHA) .+ AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) + APR = ( AZXc.*cos.(ALPHA) .- AXX.*sin.(ALPHA) ) .* cos.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .- AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + + check = 1 + if check == 1 + AIIXZ = (0.5*( AXX.^2 .+ AZZ.^2 .+ AXZc.^2 .+ AZXc.^2 )).^0.5 + AIIRP = (0.5*( ARR.^2 .+ APP.^2 .+ ARP.^2 .+ APR.^2 )).^0.5 + AIIdiff = AIIRP .- AIIXZ + @show maximum(AIIdiff) + end + + return ARR, APP, ARP, APR +end + +function coordTransformVector( Ax, Az, ALPHA ) + + Ar = Ax.*cos.(ALPHA) + Az.*sin.(ALPHA) + Ap = -Ax.*sin.(ALPHA) + Az.*cos.(ALPHA) + + check = 1 + if check == 1 + AXZ = ( Ax.^2 .+ Az.^2 ).^0.5 + ARP = ( Ar.^2 .+ Ap.^2 ).^0.5 + Adiff = ARP .- AXZ + @show maximum(Adiff) + end + + return Ar, Ap +end + + +function v2c(Av) # interpolation vertex to center + return 0.25 * ( Av[1:end-1,1:end-1] + Av[2:end,1:end-1] + Av[2:end,1:end-1] + Av[2:end,2:end] ) +end + +#main() + +#run(`ffmpeg -framerate 2 -i /Users/lcandiot/Developer/MDOODZ7.0/RUNS/RiftingChenin/_Phases/Phases%05d.png -c libx264 -pix_fmt yuv420p -y out_movie.mp4`) + +# Working command +#ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4 + +# Set the path to your files + +aniSetupsOnly = false +file_step = 10 + +## all aniso setups +#main("/users/whalter1/work/aniso_fix/A2_1000/", 2790, 12000, 4, 0.5, file_step) +#main("/users/whalter1/work/aniso_fix/A3_1000/", 3320, 12000, 4, 0.5, file_step) +main("/users/whalter1/work/aniso_fix/A4_1000/", 2770, 12000, 4, 0.5, file_step) +#main("/users/whalter1/work/aniso_fix/A5_1000/", 3460, 12000, 4, 0.5, file_step) +#main("/users/whalter1/work/aniso_fix/MWE_1000/", 400, 12000, 4, 0.5, file_step) +#main("/users/whalter1/work/aniso_fix/MWE_500/" , 400, 12000, 2, 0.5, file_step) + +if aniSetupsOnly == false + ## all iso setups + #main("/users/whalter1/work/aniso_fix/A1_1000/", 2610, 12000, 4, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/A7_1000/", 3460, 12000, 4, 0.5, file_step) + ##main("/users/whalter1/work/aniso_fix/A7_500/" , 5000, 12000, 2, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/A6_1000/", 3460, 12000, 4, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B1_1000/", 0, 12000, 4, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B2_1500/", 0, 12000, 6, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B2_1000/", 0, 12000, 4, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B3_1500/", 0, 12000, 6, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B3_1250/", 0, 12000, 5, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B3_1000/", 0, 12000, 4, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B3_750/" , 0, 12000, 3, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B4_1500/", 0, 12000, 6, 0.5, file_step) + #main("/users/whalter1/work/aniso_fix/B5_1000/", 0, 12000, 4, 0.5, file_step) +end + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_polarcartesian.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_polarcartesian.jl new file mode 100644 index 00000000..23896cf0 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_polarcartesian.jl @@ -0,0 +1,679 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +My = 1e6*365*24*3600 + +function main() + + # Set the path to your files + + #GeoMod23 unused + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/anievo_cartes_rand/" + + #GeoMod23 used + path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/anievo_polar_rand/"#; file_start = 750 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/normal_cartes/"; file_start = 840 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/normal_polar/"; file_start = 830 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/slim100_cartes/"; file_start = 660 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/slim100_polar/"; file_start = 640 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/slim300_cartes/"; file_start = 830 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/slim300_polar/"; file_start = 840 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/surface_cartes/"; file_start = 830 + #path = "/mnt/c/Users/whalter1/Desktop/GeoMod23/polarcartesian/surface_polar/"; file_start = 840 + + path = "/users/whalter1/work/MDOODZ_polar2/hres/anievo_polar_rand/" + + + # File numbers + file_start = 750 + file_step = 10 + file_end = 750 + #file_end = file_start + + # Select one field to visualise + #field = :Phases + #field = :Density + #field = :Viscosity + #field = :Stress + field = :Stress_xx + #field = :Stress_zz + #field = :Stress_xz + #field = :StrainRate + #field = :PlasticStrainrate + #field = :Pressure + #field = :Temperature + #field = :Velocity + #field = :Velocity_x + #field = :Velocity_z + #field = :Strain # cumulated strain + #field = :AnisoFactor # anisotropy factor + #field = :GrainSize # doesn't function properly yet + #field = :Topography # doesn't function properly yet + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + printvid = false # print a video (printfig must be on) + ph_contours = false # add phase contours + T_contours = false # add temperature contours + fabric = false # add fabric quiver (normal to director) + velocity = false # add velocity quiver + activeV = false # considers the "active velocity" (the velocity minus the background velocity) + α_heatmap = 0.85 # transparency of heatmap + σ1_axis = false + polar = false # for curved setups using Earth's curvature (transforms tensors from x-z to r-phi coord system) + nap = 0.3 # pause for animation + resol = 1600 + inspector = false # (not possible on any "headless server") + framerate = 2 # Frame rate for the movie + movieName = "$(path)/_$(field)/$(field)" # Name of the movie + xcrop = true # crops on both sides from lateral boundary + xcropfract = 0.1 # fraction to crop away on either side + + # Scaling + Lc = 1e3 # km + tc = My + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + for istep=file_start:file_step:file_end + + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=2) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + ph = Float64.(reshape(ExtractData( filename, "/VizGrid/compo"), ncx, ncz)); mask_air = ph .== -1.00; ph[mask_air] .= NaN + ph_hr = Float64.(reshape(ExtractData( filename, "/VizGrid/compo_hr"), ncx_hr, ncz_hr)); + group_phases = copy( ph_hr); ph_hr[ph_hr.==-1.00] .= NaN + ηc = Float64.(reshape(ExtractData( filename, "/Centers/eta_n"), ncx, ncz)); ηc[mask_air] .= NaN + ρc = Float64.(reshape(ExtractData( filename, "/Centers/rho_n"), ncx, ncz)); ρc[mask_air] .= NaN + P = Float64.(reshape(ExtractData( filename, "/Centers/P"), ncx, ncz)); P[mask_air] .= NaN + T = Float64.(reshape(ExtractData( filename, "/Centers/T"), ncx, ncz)) .- 273.15; T[mask_air] .= NaN + d = Float64.(reshape(ExtractData( filename, "/Centers/d"), ncx, ncz)); d[mask_air] .= NaN + ε̇pl = Float64.(reshape(ExtractData( filename, "/Centers/eII_pl"), ncx, ncz)); ε̇pl[mask_air] .= NaN + Vx = Float64.(reshape(ExtractData( filename, "/VxNodes/Vx"), (ncx+1), (ncz+2))) + Vz = Float64.(reshape(ExtractData( filename, "/VzNodes/Vz"), (ncx+2), (ncz+1))) + τxx = Float64.(reshape(ExtractData( filename, "/Centers/sxxd"), ncx, ncz)); τxx[mask_air] .= NaN + τzz = Float64.(reshape(ExtractData( filename, "/Centers/szzd"), ncx, ncz)); τzz[mask_air] .= NaN + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + τxzc = 0.25*(τxz[1:end-1,1:end-1].+τxz[2:end,1:end-1].+τxz[1:end-1,2:end].+τxz[2:end,2:end]); τxzc[mask_air] .= NaN + ε̇xx = Float64.(reshape(ExtractData( filename, "/Centers/exxd"), ncx, ncz)) + ε̇xz = Float64.(reshape(ExtractData( filename, "/Vertices/exz"), nvx, nvz)) + εII = Float64.(reshape(ExtractData( filename, "/Centers/strain"), ncx, ncz)); εII[mask_air] .= NaN + τII = sqrt.( 0.5*(2*τxx.^2 .+ 0.5*(τxz[1:end-1,1:end-1].^2 .+ τxz[2:end,1:end-1].^2 .+ τxz[1:end-1,2:end].^2 .+ τxz[2:end,2:end].^2 ) ) ); τII[mask_air] .= NaN + ε̇II = sqrt.( 0.5*(2*ε̇xx.^2 .+ 0.5*(ε̇xz[1:end-1,1:end-1].^2 .+ ε̇xz[2:end,1:end-1].^2 .+ ε̇xz[1:end-1,2:end].^2 .+ ε̇xz[2:end,2:end].^2 ) ) ); ε̇II[mask_air] .= NaN + if field==:AnisoFactor + AniFac= Float64.(reshape(ExtractData( filename, "/Centers/ani_fac"), ncx, ncz)) + #@show AniFac[50,50] + @show minimum(AniFac) + @show maximum(AniFac) + # weird issue that sometimes aniso factor is negative infinity (e.g. -9e12 or so) where it should actually be at maximum (e.g. 1000, saturated)! + maxifac = maximum(AniFac) + AniFac[AniFac .< 0] .= maxifac + @show minimum(AniFac) + + AniFac[mask_air] .= NaN + end + if fabric + Nx = Float64.(reshape(ExtractData( filename, "/Centers/nx"), ncx, ncz)) + Nz = Float64.(reshape(ExtractData( filename, "/Centers/nz"), ncx, ncz)) + Fab_x = -Nz./Nx + Fab_z = ones(size(Nz)) + nrm = sqrt.(Fab_x.^2 .+ Fab_z.^2) + Fab_x ./= nrm + Fab_z ./= nrm + end + if field==:Topography + height = Float64.(ExtractData( filename, "/Topo/z_grid")); + Vx_grid = Float64.(ExtractData( filename, "/Topo/Vx_grid")); + Vz_grid = Float64.(ExtractData( filename, "/Topo/Vz_grid")); + Vx_mark = Float64.(ExtractData( filename, "/Topo/Vx_mark")); + Vz_mark = Float64.(ExtractData( filename, "/Topo/Vz_mark")); + x_mark = Float64.(ExtractData( filename, "/Topo/x_mark")); + z_mark = Float64.(ExtractData( filename, "/Topo/z_mark")); + end + if σ1_axis + σ1 = PrincipalStress(τxx, τzz, τxz, P) + end + + ##################################### + + # Postprocessing Active Velocity + # Active Velocity = Velocity - Background Velocity + if activeV + shear_style = 1 # 0 = pure shear; 1 = simple shear + bkg_strain_rate = 1 # background (far-field) strain rate + if shear_style == 1 + Vx_bkg = 2*bkg_strain_rate*ones(nvx)*zc' + @show size(Vx_bkg) + Vx[:,2:end-1] .-= Vx_bkg + elseif shear_style == 0 + # not implemented yet + # feel free to add :) + end + end + + # Postprocessing velocity + Vxc = 0.5 .* (Vx[1:end-1,2:end-1] .+ Vx[2:end-0,2:end-1]); Vxc[mask_air] .= NaN + Vzc = 0.5 .* (Vz[2:end-1,1:end-1] .+ Vz[2:end-1,2:end-0]); Vzc[mask_air] .= NaN + Vc = (Vxc.^2 .+ Vzc.^2).^0.5 + + ##################################### + # Postprocessing polar setups + if polar + τxx, τzz, τxz, τxz = tensorCartesianToPolar( τxx, τzz, τxz, τxz, xc, zc, ncx, ncz ) + end + + ##################################### + + # Color palette for phase map + cmap = zeros(RGB{Float64}, 3) + cmap[1] = RGBA{Float64}(178/255, 86/255, 82/255, 1.) + cmap[2] = RGBA{Float64}( 48/255, 20/255, 55/255, 1.) + cmap[3] = RGBA{Float64}( 98/255, 118/255, 186/255, 1.) + #cmap[1] = RGBA{Float64}(210/255, 218/255, 205/255, 1.) + #cmap[2] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + #cmap[3] = RGBA{Float64}(117/255, 164/255, 148/255, 1.) + #cmap[4] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + #cmap[5] = RGBA{Float64}(217/255, 099/255, 097/255, 1.) + #cmap[6] = RGBA{Float64}(244/255, 218/255, 205/255, 1.) + #cmap[7] = RGBA{Float64}(223/255, 233/255, 219/255, 1.) + phase_colors = MoC.cgrad(cmap, length(cmap), categorical=true, rev=false) + + # Group phases for contouring + group_phases[ ph_hr.==4 .|| ph_hr.==0 .|| ph_hr.==5 .|| ph_hr.==1 ] .= 0 + group_phases[ ph_hr.==2 .|| ph_hr.==6 ] .= 1 + group_phases[ ph_hr.==3 ] .= 3 + + ##################################### + + # Cropping indices + xidx_start = Int(floor(ncx*xcropfract))+1 + xidx_end = Int(floor(ncx*(1-xcropfract)))+1 + zidx_start = 1 + zidx_end = ncz + + # Crop + xc = xc[xidx_start:xidx_end] + zc = zc[zidx_start:zidx_end] + xc_hr = xc_hr[xidx_start:xidx_end] + zc_hr = zc_hr[zidx_start:zidx_end] + + ph_hr = ph_hr[xidx_start:xidx_end,zidx_start:zidx_end] + ph = ph[xidx_start:xidx_end,zidx_start:zidx_end] + ηc = ηc[xidx_start:xidx_end,zidx_start:zidx_end] + τII = τII[xidx_start:xidx_end,zidx_start:zidx_end] + τxx = τxx[xidx_start:xidx_end,zidx_start:zidx_end] + Vc = Vc[xidx_start:xidx_end,zidx_start:zidx_end] + ε̇II = ε̇II[xidx_start:xidx_end,zidx_start:zidx_end] + εII = εII[xidx_start:xidx_end,zidx_start:zidx_end] + ε̇pl = ε̇pl[xidx_start:xidx_end,zidx_start:zidx_end] + if field==:AnisoFactor + AniFac = AniFac[xidx_start:xidx_end,zidx_start:zidx_end] + end + if fabric + Fab_x = Fab_x[xidx_start:xidx_end,zidx_start:zidx_end] + Fab_z = Fab_z[xidx_start:xidx_end,zidx_start:zidx_end] + end + #@show size(τxx) + #@show size(xc_hr) + #@show size(zc_hr) + + ##################################### + zres = resol + xres = Lx/Lz*resol + f = MoC.Figure(resolution = (xres, zres), fontsize=40) + + if field==:Phases + ax1 = MoC.Axis(f[1, 1], title = L"Phases at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + #hm = MoC.heatmap!(ax1, xc_hr./Lc, zc_hr./Lc, ph_hr, colormap = phase_colors) + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ph, colormap = phase_colors) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "Phases", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Density + ax1 = MoC.Axis(f[1, 1], title = L"Density $ρ$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, ρc, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"Density $ρ$ [kg/m^3]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Viscosity + ax1 = MoC.Axis(f[1, 1], title = L"$\eta$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ηc), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\eta$ [Pa.s]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{II}$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τII, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{II}$ [Pa]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xx + ax1 = MoC.Axis(f[1, 1], title = L"Deviatoric horizontal stress at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxx/1e6, colormap = (:turbo, α_heatmap), colorrange = (-400, 400)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xx}$ [MPa]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_zz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{zz}$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τzz, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{zz}$ [Pa]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Stress_xz + ax1 = MoC.Axis(f[1, 1], title = L"$\tau_\textrm{xz}$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + if polar + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, τxz, colormap = (:turbo, α_heatmap)) + else + hm = MoC.heatmap!(ax1, xv./Lc, zv./Lc, τxz, colormap = (:turbo, α_heatmap)) + end + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\tau_\textrm{xz}$ [Pa]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:StrainRate + ax1 = MoC.Axis(f[1, 1], title = L"Strain-rate at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇II), colormap = (:turbo, α_heatmap), colorrange = (-19, -12.5)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$log_{10}\left(\dot{\varepsilon}_\textrm{II}\right)$", ticks = (-20:2:-12), width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:PlasticStrainrate + ax1 = MoC.Axis(f[1, 1], title = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ at $t$ = %$(tMy) Ma, sum = %$(round(sum(ε̇pl),sigdigits=4)), max = %$(round(maximum(ε̇pl),sigdigits=4)), min = %$(round(minimum(ε̇pl),sigdigits=4))", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + #ε̇pl[mask_air] .= NaN + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(ε̇pl), colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\dot{\varepsilon}_\textrm{II}^\textrm{pl}$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Pressure + ax1 = MoC.Axis(f[1, 1], title = L"$P$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, P, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$P$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Temperature + ax1 = MoC.Axis(f[1, 1], title = L"$T$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, T, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$T$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity + ax1 = MoC.Axis(f[1, 1], title = L"Velocity at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, Vc, colormap = (:turbo, α_heatmap))#, colorrange = (1e-10, 3e-9)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_x + ax1 = MoC.Axis(f[1, 1], title = L"$V_{x}$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xv./Lc, zc./Lc, Vx[:,2:end-1], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{x}$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Velocity_z + ax1 = MoC.Axis(f[1, 1], title = L"$V_{z}$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zv./Lc, Vz[2:end-1,:], colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$V_{z}$ [s$^{-1}$]", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Strain + ax1 = MoC.Axis(f[1, 1], title = L"Cumulated strain at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, εII, colormap = (:turbo, α_heatmap), colorrange = (0, 150)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = L"$\varepsilon_{II}$", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:AnisoFactor + ax1 = MoC.Axis(f[1, 1], title = L"Anisotropy factor $\delta$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(AniFac), colormap = (:turbo, α_heatmap), colorrange = (0.0, 3.0)) + #hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, AniFac, colormap = (:turbo, α_heatmap)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label =L"$log_{10}\delta$", ticks = (0.0:0.5:3.0), width = 20, labelsize = 40, ticklabelsize = 40 ) + #MoC.Colorbar(f[1, 2], hm, label =L"$\delta$", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:GrainSize + ax1 = MoC.Axis(f[1, 1], title = L"$d$ at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$y$ [km]") + hm = MoC.heatmap!(ax1, xc./Lc, zc./Lc, log10.(d.*1e6), colormap = (:turbo, α_heatmap), colorrange=(1, 3)) + if T_contours + contour!(ax1, xc./Lc, zc./Lc, T, levels=0:200:1400, linewidth = 4, color=:white ) + end + if ph_contours + contour!(ax1, xc_hr./Lc, zc_hr./Lc, group_phases, levels=-1:1:maximum(group_phases), linewidth = 4, color=:white ) + end + if σ1_axis + MoC.arrows!(ax1, xc./Lc, zc./Lc, σ1.x, σ1.z, arrowsize = 0, lengthscale=Δ/1.5) + end + xminz, xmaxz = -0.4, 0.4 + zminz, zmaxz = -0.17, 0.17 + Lx = xmaxz - xminz + Lz = zmaxz - zminz + xlims!(ax1, -0.4, 0.4) + ylims!(ax1, -0.17, 0.17) + MoC.colsize!(f.layout, 1, MoC.Aspect(1, Lx/Lz)) + MoC.Colorbar(f[1, 2], hm, label = "d", width = 20, labelsize = 40, ticklabelsize = 40 ) + MoC.colgap!(f.layout, 20) + end + + if field==:Topography + ax1 = MoC.Axis(f[1, 1], title = L"Topography at $t$ = %$(tMy) Ma", xlabel = L"$x$ [km]", ylabel = L"$h$ [km]") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [km]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [km]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if velocity + #qv,qh = 10,10 + #MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = Δ*1000*2, lengthscale=Δ*20*2) + qv,qh = 6,3 + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Vxc[1:qh:end,1:qv:end], Vzc[1:qh:end,1:qv:end], arrowsize = 1e1, lengthscale=Δ/1.5*1e10) + end + if fabric + #fac = 3 # for usual + fac = 1 # for zoom + qv,qh = fac,fac + MoC.arrows!(ax1, xc[1:qh:end]./Lc, zc[1:qv:end]./Lc, Fab_x[1:qh:end,1:qv:end], Fab_z[1:qh:end,1:qv:end], arrowsize = 0, lengthscale=Δ*0.7*fac) + #MoC.arrows!(ax1, xc./Lc, zc./Lc, Nz, Nx, arrowsize = 0, lengthscale=Δ/1.5) + end + if printfig Print2Disk( f, path, string(field), istep) end + + if inspector + DataInspector(f) + end + if displayfig + display(f) + end + sleep(nap) + end + end + if printvid + + filename = string(path, @sprintf("Output%05d.gzip.h5", file_start)) + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xmin, xmax = xv[1], xv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + + zres = resol + xres = Int(floor(Lx/Lz*resol))+1 # solve issue later: Lx, Lz not defined in outer loop... + #xres = resol + FFMPEG.ffmpeg_exe(`-framerate $(framerate) -f image2 -pattern_type glob -i $(path)_$(field)/'*'.png -vf "scale=$(xres):$(zres)" -c:v libx264 -pix_fmt yuv420p -y "$(movieName).mov"`) + end +end + +function PrincipalStress(τxx, τzz, τxz, P) + σ1 = (x=zeros(size(τxx)), z=zeros(size(τxx)) ) + τxzc = 0.25*(τxz[1:end-1,1:end-1] .+ τxz[2:end-0,1:end-1] .+ τxz[1:end-1,2:end-0] .+ τxz[2:end-0,2:end-0]) + for i in eachindex(τxzc) + if P[i]>1e-13 + σ = [-P[i]+τxx[i] τxzc[i]; τxzc[i] -P[i]+τzz[i]] + v = eigvecs(σ) + σ1.x[i] = v[1,1] + σ1.z[i] = v[2,1] + end + end + return σ1 +end + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep; res=4) + path1 = path*"/_$field/" + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function tensorCartesianToPolar( AXX, AZZ, AXZ, AZX, xc, zc, ncx, ncz ) + # tensor coordinate transformation from x-z to r-phi coordinate system + # A_XZ = tensor to transform + # A_RP = transformed tensor + XX = ones(ncx)*zc' # matrix with all x-coords + ZZ = xc*one(ncz)' # matrix with all z-coords + ALPHA = asin.( XX ./ ( XX.^2 .+ ZZ.^2 ).^0.5 ) + # Idea for coord transform: + # R = [cos.(ALPHA) sin.(ALPHA) + # -sin.(ALPHA) cos.(ALPHA)] + # ARP = R' * AXZ * R + AXZc = v2c(AXZ) + AZXc = v2c(AZX) + ARR = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* cos.(ALPHA) .- ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* sin.(ALPHA) + APP = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* sin.(ALPHA) .+ ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* cos.(ALPHA) + ARP = ( AXX.*cos.(ALPHA) .- AZXc.*sin.(ALPHA) ) .* sin.(ALPHA) .+ ( AXZc.*cos.(ALPHA) .- AZZ.*sin.(ALPHA) ) .* cos.(ALPHA) + APR = ( AXX.*sin.(ALPHA) .+ AZXc.*cos.(ALPHA) ) .* cos.(ALPHA) .- ( AZZ.*cos.(ALPHA) .+ AXZc.*sin.(ALPHA) ) .* sin.(ALPHA) + check = 1 + if check == 1 + AIIXZ = (0.5*( AXX.^2 .+ AZZ.^2 .+ AXZc.^2 .+ AZXc.^2 )).^0.5 + AIIRP = (0.5*( ARR.^2 .+ APP.^2 .+ ARP.^2 .+ APR.^2 )).^0.5 + AIIdiff = AIIRP .- AIIXZ + @show maximum(AIIdiff) + end + return ARR, APP, ARP, APR +end + +function v2c(Av) # interpolation vertex to center + return 0.25 * ( Av[1:end-1,1:end-1] + Av[2:end,1:end-1] + Av[2:end,1:end-1] + Av[2:end,2:end] ) +end + +main() + +#run(`ffmpeg -framerate 2 -i /Users/lcandiot/Developer/MDOODZ7.0/RUNS/RiftingChenin/_Phases/Phases%05d.png -c libx264 -pix_fmt yuv420p -y out_movie.mp4`) + +# Working command +#ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4 \ No newline at end of file diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction.jl new file mode 100644 index 00000000..2ad0d390 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction.jl @@ -0,0 +1,189 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +s = 1 +d = 24*3600*s +y = 365*d +My = 1e6*y + +function main(path) + + # Select one field to visualise + field = :ViscosityReduction + + # Switches + displayfig = false # display figures on screen (not possible on any "headless server") + printfig = true # print figures to disk + resol = 1600 + + + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + # Time loop + if displayfig==1 || printfig==1 + + istep=file_end + filename = string(path, @sprintf("Output%05d.gzip.h5", istep)) + model = ExtractData( filename, "/Model/Params") + xc = ExtractData( filename, "/Model/xc_coord") + zc = ExtractData( filename, "/Model/zc_coord") + xv = ExtractData( filename, "/Model/xg_coord") + zv = ExtractData( filename, "/Model/zg_coord") + xv_hr = ExtractData( filename, "/VizGrid/xviz_hr") + zv_hr = ExtractData( filename, "/VizGrid/zviz_hr") + xc_hr = 0.5.*(xv_hr[1:end-1] .+ xv_hr[2:end]) + zc_hr = 0.5.*(zv_hr[1:end-1] .+ zv_hr[2:end]) + ncx_hr, ncz_hr = length(xc_hr), length(zc_hr) + + t = model[1] + tMy = round(t/tc, digits=6) + nvx = Int(model[4]) + nvz = Int(model[5]) + ncx, ncz = nvx-1, nvz-1 + xmin, xmax = xv[1], xv[end] + zmin, zmax = zv[1], zv[end] + Lx, Lz = (xmax-xmin)/Lc, (zv[end]-zv[1])/Lc + Δx, Δz, Δ = Lx/ncx, Lz/ncz, sqrt( (Lx/ncx)^2 + (Lz/ncz)^2) + @show "Time step" istep + #@show "Model apect ratio" Lx/Lz + @show "Model time" t/My + + + ##################################### + + f = MoC.Figure(resolution = (Lx/Lz*resol, resol), fontsize=25) + + if field==:ViscosityReduction + ax1 = MoC.Axis(f[1, 1], title = L"Reduction of effective shear viscosity at $t$ = %$(tMy) %$(tMytext)", xlabel = L"shear deformation γ", ylabel = L"η_{s eff} / η_{s init}") + lines!(ax1, xv./Lc, height./Lc) + scatter!(ax1, x_mark./Lc, z_mark./Lc) + + ax2 = MoC.Axis(f[2, 1], xlabel = L"$x$ [m]", ylabel = L"$Vx$ [km]") + lines!(ax2, xv./Lc, Vx_grid./Vc) + scatter!(ax2, x_mark./Lc, Vx_mark./Vc) + + ax3 = MoC.Axis(f[3, 1], xlabel = L"$x$ [m]", ylabel = L"$Vz$ [km]") + lines!(ax3, xc./Lc, Vz_grid[2:end-1]./Vc) + scatter!(ax3, x_mark/Lc, Vz_mark./Vc) + + @show minimum(Vx_grid) + @show minimum(Vx_mark) + @show maximum(Vx_grid) + @show maximum(Vx_mark) + end + + if printfig Print2Disk( f, path, string(field), istep, xshift) end + + if inspector + DataInspector(f) + end + if displayfig + display(f) + end + sleep(nap) + end +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field, istep, xshift; res=4) + if xshift > 0.0 + path1 = path*"/_$field/shift/" + else + path1 = path*"/_$field/" + end + mkpath(path1) + MoC.save(path1*"$field"*@sprintf("%05d", istep)*".png", f, px_per_unit = res) +end + +function collectData(path, name, file_end_max) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + return name, Time_time, sxz_mean_time +end + +# Set the path to your files +collectData("/users/whalter1/work/aniso_fix/A1_1000/", "A1 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A1_500/" , "A1 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/A1_250/" , "A1 250" , 12000) + +collectData("/users/whalter1/work/aniso_fix/A2_1000/", "A2 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A2_500/" , "A2 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/A2_250/" , "A2 250" , 12000) + +collectData("/users/whalter1/work/aniso_fix/A3_1000/", "A3 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A3_500/" , "A3 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/A3_250/" , "A3 250" , 12000) + +collectData("/users/whalter1/work/aniso_fix/A4_1000/", "A4 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A4_500/" , "A4 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/A4_250/" , "A4 250" , 12000) + +collectData("/users/whalter1/work/aniso_fix/A5_1000/", "A5 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A5_500/" , "A5 500" , 12000) + + +collectData("/users/whalter1/work/aniso_fix/A6_1000/", "A6 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/A6_500/" , "A6 500" , 12000) + +collectData("/users/whalter1/work/aniso_fix/B1_1000/", "B1 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/B1_500/" , "B1 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/B1_250/" , "B1 250" , 12000) +collectData("/users/whalter1/work/aniso_fix/B2_1000/", "B2 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/B2_500/" , "B2 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/B2_250/" , "B2 250" , 12000) +collectData("/users/whalter1/work/aniso_fix/B3_1000/", "B3 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/B3_500/" , "B3 500" , 12000) +collectData("/users/whalter1/work/aniso_fix/B3_250/" , "B3 250" , 12000) + + +collectData("/users/whalter1/work/aniso_fix/MWE_1000/", "MWE 1000", 12000) +collectData("/users/whalter1/work/aniso_fix/MWE_500/" , "MWE 500" , 12000) + + +main("/users/whalter1/work/aniso_fix/viscosityReduction/") + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2.jl new file mode 100644 index 00000000..aa579efa --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2.jl @@ -0,0 +1,152 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +function plotData(NameVect, TimeVect, SxzVect, path) + + s = 1 + d = 24*3600*s + y = 365*d + My = 1e6*y + + # Switches + resol = 1200 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + + ##################################### + + f = MoC.Figure(resolution = (resol, resol), fontsize=35) + + + + ax1 = MoC.Axis(f[1, 1], title = L"\text{Reduction of effective shear viscosity }η_{\text{eff}}", xlabel = L"\text{shear deformation }γ", ylabel = L"\frac{η_{\text{eff}}}{η_{\text{0}}}") + for i = 1:length(NameVect) + + Time = TimeVect[i] + sxz = SxzVect[i] + + Time = Time[2:end] # Time = 0.0 no good - unphysically high stresses + sxz = sxz[2:end] # Time = 0.0 no good + + #@show size(Time[sxz .> 0.0]) + #@show Time[1:10] + #@show Time[end-10:end] + #@show sxz[1:10] + #@show sxz[end-10:end] + #@show sxz .> 0.0 + + MoC.lines!(ax1, Time[sxz .> 0.0] .* 2, sxz[sxz .> 0.0]./sxz[1], label=NameVect[i]) + end + + #MoC.limits!(0,16,0,1.3) # 6 short, 16 normal, 50 long + #ax1.yticks = 0:0.25:1.25 + MoC.limits!(0,16,0,1.5) # 6 short, 16 normal, 50 long + ax1.yticks = 0:0.25:1.50 + + #MoC.Legend(f[1, 1], ax1) + MoC.axislegend("legend"; position=:rt) + #scatter!(ax1, x_mark./Lc, z_mark./Lc) + + Print2Disk( f, path, "ViscosityReduction") + +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field; res=4) + mkpath(path) + MoC.save(path*"$field"*".png", f, px_per_unit = res) +end + +function collectData!(path, name, file_end_max, NameVect, TimeVect, SxzVect) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + #Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + #Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + #Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + #Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + #T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + #P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + #τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + #τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + #τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + #ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + #ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + #ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + #ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + NameVect = push!(NameVect, name) + TimeVect = push!(TimeVect, Time_time) + SxzVect = push!(SxzVect, sxz_mean_time) + + return +end + +function main() + + NameVect = Vector{String}() + TimeVect = [] + SxzVect = [] + + @show NameVect + + # Collect all necessary data from desired output files + + # all aniso setups + collectData!("/users/whalter1/work/aniso_fix/A2_1000/", "A2 1000", 3100, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A3_1000/", "A3 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A4_1000/", "A4 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A5_1000/", "A5 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/MWE_1000/", "MWE 1000", 25000, NameVect, TimeVect, SxzVect) + # + # all iso setups + collectData!("/users/whalter1/work/aniso_fix/A1_1000/", "A1 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A6_1000/", "A6 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A7_1000/", "A7 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B1_1000/", "B1 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B2_1000/", "B2 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B2_1500/", "B2 1500", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B3_750/" , "B3 750" , 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B3_1000/", "B3 1000", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B3_1250/", "B3 1250", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B3_1500/", "B3 1500", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B4_1500/", "B4 1500", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B5_1000/", "B5 1000", 25000, NameVect, TimeVect, SxzVect) + + # Plot Data + plotData(NameVect, TimeVect, SxzVect, "/users/whalter1/work/aniso_fix/viscosityReduction/") + +end + +main() + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2_posterSGM23.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2_posterSGM23.jl new file mode 100644 index 00000000..258f3808 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_2_posterSGM23.jl @@ -0,0 +1,134 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +function plotData(NameVect, TimeVect, SxzVect, path) + + s = 1 + d = 24*3600*s + y = 365*d + My = 1e6*y + + # Switches + resol = 800 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + + ##################################### + + f = MoC.Figure(resolution = (resol, resol), fontsize=35) + + + + ax1 = MoC.Axis(f[1, 1], xlabel = L"γ", ylabel = L"\frac{η_{\text{eff}}}{η_{\text{0}}}") + for i = 1:length(NameVect) + + Time = TimeVect[i] + sxz = SxzVect[i] + + Time = Time[2:end] # Time = 0.0 no good - unphysically high stresses + sxz = sxz[2:end] # Time = 0.0 no good + + #@show size(Time[sxz .> 0.0]) + #@show Time[1:10] + #@show Time[end-10:end] + #@show sxz[1:10] + #@show sxz[end-10:end] + #@show sxz .> 0.0 + + MoC.lines!(ax1, Time[sxz .> 0.0] .* 2, sxz[sxz .> 0.0]./sxz[1], label=NameVect[i]) + end + + MoC.limits!(0,6,0,1.3) # 6 short, 16 normal, 50 long + ax1.yticks = 0:0.25:1.25 + + #MoC.Legend(f[1, 1], ax1) + MoC.axislegend("legend"; position=:rt) + #scatter!(ax1, x_mark./Lc, z_mark./Lc) + + Print2Disk( f, path, "ViscosityReduction") + +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field; res=4) + mkpath(path) + MoC.save(path*"$field"*".png", f, px_per_unit = res) +end + +function collectData!(path, name, file_end_max, NameVect, TimeVect, SxzVect) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + #Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + #Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + #Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + #Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + #T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + #P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + #τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + #τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + #τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + #ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + #ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + #ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + #ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + NameVect = push!(NameVect, name) + TimeVect = push!(TimeVect, Time_time) + SxzVect = push!(SxzVect, sxz_mean_time) + + return +end + +function main() + + NameVect = Vector{String}() + TimeVect = [] + SxzVect = [] + + @show NameVect + + # Collect all necessary data from desired output files + collectData!("/users/whalter1/work/aniso_fix/A5_1000/", "A", 6780, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A6_1000/", "B", 6750, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A4_1000/", "C", 25000, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/A3_1000/", "D", 6750, NameVect, TimeVect, SxzVect) + collectData!("/users/whalter1/work/aniso_fix/B2_1000/", "E", 6730, NameVect, TimeVect, SxzVect) + + # Plot Data + plotData(NameVect, TimeVect, SxzVect, "/users/whalter1/work/aniso_fix/viscosityReduction/") + +end + +main() + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_3_bueno.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_3_bueno.jl new file mode 100644 index 00000000..449078f1 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_3_bueno.jl @@ -0,0 +1,198 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG, Statistics + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +function plotData(NameVect, TimeVect, SxzVect, path) + + s = 1 + d = 24*3600*s + y = 365*d + My = 1e6*y + + # Switches + resol = 1200 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + + ##################################### + + f = MoC.Figure(resolution = (2.0*resol, resol), fontsize=35) + + ax1 = MoC.Axis(f[1, 1], title = L"\text{Reduction of effective shear viscosity }η_{\text{eff}}", xlabel = L"\text{shear deformation }γ", ylabel = L"\frac{η_{\text{eff}}}{η_{\text{0}}}") + for i = 1:length(NameVect) + + Time = TimeVect[i] + sxz = SxzVect[i] + + Time = Time[2:end] # Time = 0.0 no good - unphysically high stresses + sxz = sxz[2:end] # Time = 0.0 no good + + #@show size(Time[sxz .> 0.0]) + #@show Time[1:10] + #@show Time[end-10:end] + #@show sxz[1:10] + #@show sxz[end-10:end] + #@show sxz .> 0.0 + + MoC.lines!(ax1, Time[sxz .> 0.0] .* 2, sxz[sxz .> 0.0]./sxz[1], label=NameVect[i]) + end + + # define plotting limits + xmax = 50 # 6 short, 16 normal, 50 long, 60 or more for custom extralong + ymax = 1.35 # 1.35 normal + + MoC.limits!(0,xmax,0,ymax) + ax1.yticks = 0:0.25:ymax + + #MoC.Legend(f[1, 1], ax1) + #MoC.axislegend(""; position=:rt, labelsize=20, nbanks = 2) + MoC.axislegend(""; halign = :right, valign = :top, labelsize=20, nbanks = 6) + Print2Disk( f, path, "ViscosityReduction") + +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field; res=4) + mkpath(path) + MoC.save(path*"$field"*".png", f, px_per_unit = res) +end + +function collectData!(path, name, file_end_max, NameVect, TimeVect, SxzVect, autoManu) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + if autoManu == "auto" + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + #Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + #Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + #Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + #Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + #T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + #P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + #τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + #τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + #τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + #ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + #ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + #ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + #ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + else # if autoManu == "manu" + Time_time = [] + sxz_mean_time = [] + file_start = 0 + file_step = 100 + for i = file_start:file_step:file_end + filename = string(path, @sprintf("Output%05d.gzip.h5", i)) + model = ExtractData( filename, "/Model/Params") + t = model[1] + nvx = Int(model[4]) + nvz = Int(model[5]) + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + sxz_mean = mean(τxz) + Time_time = push!(Time_time, t) + sxz_mean_time = push!(sxz_mean_time, sxz_mean) + if mod(i,10*file_step) == 0; @show file_end, i; end + end + end + + NameVect = push!(NameVect, name) + TimeVect = push!(TimeVect, Time_time) + SxzVect = push!(SxzVect, sxz_mean_time) + return +end + +function main() + + NameVect = Vector{String}() + TimeVect = [] + SxzVect = [] + + @show NameVect + + # Collect all necessary data from desired output files + + # all aniso setups + collectData!("/users/whalter1/work/aniso_fix/A2_1000/" , "A2 1000" , 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/A3_1000/" , "A3 1000" , 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/A4_1000/" , "A4 1000" , 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/A5_1000/" , "A5 1000" , 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/MWE_1000/", "MWE 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + # all iso setups + collectData!("/users/whalter1/work/aniso_fix/A1_1000/", "A1 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/A6_1000/", "A6 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/A7_1000/", "A7 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B1_1000/", "B1 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B2_1000/", "B2 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B2_1500/", "B2 1500", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B3_250/" , "B3 250" , 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_500/" , "B3 500" , 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_750/" , "B3 750" , 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_1000/", "B3 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_1250/", "B3 1250", 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_1500/", "B3 1500", 100000, NameVect, TimeVect, SxzVect, "manu") + + collectData!("/users/whalter1/work/aniso_fix/B4_1500/", "B4 1500", 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B5_1000/", "B5 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B6_1000/", "B6 1000", 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B6_1500/", "B6 1500", 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B6_2000/", "B6 2000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B7_1000/", "B7 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B8_1000/", "B8 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B9_1000/", "B9 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B10_1000/", "B10 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B11_1000/", "B11 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B12_1000/", "B12 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B13_1000/", "B13 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B14_1000/", "B14 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B15_1000/", "B15 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B16_1000/", "B16 1000", 100000, NameVect, TimeVect, SxzVect, "manu") + collectData!("/users/whalter1/work/aniso_fix/B16_1500/", "B16 1500", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B16_2000/", "B16 2000", 100000, NameVect, TimeVect, SxzVect, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B17_1000/", "B17 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B18_1000/", "B18 1000", 100000, NameVect, TimeVect, SxzVect, "auto") + + # Plot Data + plotData(NameVect, TimeVect, SxzVect, "/users/whalter1/work/aniso_fix/viscosityReduction/") + +end + +main() + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_4_convergence.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_4_convergence.jl new file mode 100644 index 00000000..aed5a911 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_4_convergence.jl @@ -0,0 +1,229 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG, Statistics, LsqFit + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +function plotData(NameVect, ResVect, TimeVect, SxzVect, GammaVect, path) + + s = 1 + d = 24*3600*s + y = 365*d + My = 1e6*y + + # Switches + resol = 1200 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + + ##################################### + + f = MoC.Figure(resolution = (resol, resol), fontsize=35) + + + + ax1 = MoC.Axis(f[1, 1], title = L"\text{Reduction of effective shear viscosity }η_{\text{eff}}", xlabel = L"\text{horizontal grid resolution nx}", ylabel = L"\frac{η_{\text{eff}}}{η_{\text{0}}}") + + + + ResVect2_old = 0.0 + SXZ_atG_old = 0.0 + for j in eachindex(GammaVect) + + Time_atG = [] + Gamma_atG = [] + SXZ_atG = [] + ResVect2 = [] + + gamma = GammaVect[j] + + for i in eachindex(NameVect) + Time = TimeVect[i] + sxz = SxzVect[i] + + Time = Time[2:end] # Time = 0.0 no good - unphysically high stresses + sxz = sxz[2:end] # Time = 0.0 no good + + + time_atG = Time[abs.(Time .- gamma/2) .== minimum(abs.(Time .- gamma/2))] # time at timestep closest to the corresponding gamma + time_atG = time_atG[1] # convert vector (with one element) to a single number + gamma_atG = time_atG*2 + sxz_atG = sxz[Time .== time_atG]/sxz[1] # normalize by initial shear stress (to get reduction) + sxz_atG = sxz_atG[1] # convert vector (with one element) to a single number + @show NameVect[i], gamma_atG, sxz_atG + + tolerance = 1e-2 + if abs(gamma - gamma_atG) < tolerance + Time_atG = push!(Time_atG, time_atG) + Gamma_atG = push!(Gamma_atG, gamma_atG) + SXZ_atG = push!(SXZ_atG, sxz_atG) + ResVect2 = push!(ResVect2, ResVect[i]) + end + + end + + ResVect2 = Float64.(ResVect2) + SXZ_atG = Float64.(SXZ_atG) + + if j > 1 + #ResVect2 = ResVect2[ SXZ_atG .<= SXZ_atG_old ] + #SXZ_atG = SXZ_atG[ SXZ_atG .<= SXZ_atG_old ] + for k_old in eachindex(ResVect2_old) # idx in ResVect2_old + K_new = (ResVect2 .== ResVect2_old[k_old]) # idx vector in ResVect2 + if sum(K_new) > 0 + if (SXZ_atG[K_new])[1] > SXZ_atG_old[k_old] && gamma > 1.0 + # kill element + ResVect2 = ResVect2[.!(K_new)] + SXZ_atG = SXZ_atG[.!(K_new)] + else + SXZ_atG_old[k_old] = (SXZ_atG[K_new])[1] + end + end + end + else + ResVect2_old = ResVect2 + SXZ_atG_old = SXZ_atG + end + + #MoC.lines!(ax1, ResVect2, SXZ_atG, label=L"\gamma = %$(GammaVect[j])") + #v = j/length(GammaVect) + #MoC.scatterlines!(ax1, ResVect2, SXZ_atG, label=L"\gamma = %$(GammaVect[j])", color = MoC.RGBf(v, 0, 1-v)) + MoC.scatterlines!(ax1, ResVect2, SXZ_atG, label=L"%$(GammaVect[j])") + + ## exponential curve fitting; idea from: https://julianlsolvers.github.io/LsqFit.jl/latest/getting_started/ + #model(t,p) = p[1] * exp.(-p[2] * t) +# + #tdata = ResVect2 + #ydata = SXZ_atG + #p0 = [1.0, 0.15] +# + #fit = curve_fit(model, tdata, ydata, p0) + #param = fit.param + ##std_error = standard_error(fit) +# + #@show param#, std_error + + end + + + MoC.limits!(0,2000,0,1.3) + ax1.xticks = 0:250:1750 + ax1.yticks = 0:0.25:1.50 + + MoC.axislegend(L"\text{gamma }\gamma"; position=:rt, labelsize=20, nbanks = 2) + + Print2Disk( f, path, "z_ViscRed_B3converg") + +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field; res=4) + mkpath(path) + MoC.save(path*"$field"*".png", f, px_per_unit = res) +end + +function collectData!(path, name, file_end_max, NameVect, ResVect, TimeVect, SxzVect, autoManu) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + if autoManu == "auto" + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + #Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + #Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + #Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + #Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + #T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + #P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + #τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + #τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + #τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + #ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + #ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + #ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + #ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + else # if autoManu == "manu" + Time_time = [] + sxz_mean_time = [] + file_start = 0 + file_step = 10 + for i = file_start:file_step:file_end + filename = string(path, @sprintf("Output%05d.gzip.h5", i)) + model = ExtractData( filename, "/Model/Params") + t = model[1] + nvx = Int(model[4]) + nvz = Int(model[5]) + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + sxz_mean = mean(τxz) + Time_time = push!(Time_time, t) + sxz_mean_time = push!(sxz_mean_time, sxz_mean) + if mod(i,10*file_step) == 0; @show file_end, i; end + end + end + + # get x-resolution + model = ExtractData( filename, "/Model/Params") + nvx = Int(model[4]) + ncx = nvx-1 + + NameVect = push!(NameVect, name) + ResVect = push!(ResVect, ncx) + TimeVect = push!(TimeVect, Time_time) + SxzVect = push!(SxzVect, sxz_mean_time) + return +end + +function main() + + NameVect = Vector{String}() + ResVect = [] + TimeVect = [] + SxzVect = [] + + #GammaVect = [1,2,4] + #GammaVect = 0.1:0.1:5.9 + GammaVect = 0.1:0.1:8 + + # Collect all necessary data from desired output files + + # all setups B3 at different resolutions + collectData!("/users/whalter1/work/aniso_fix/B3_250/" , "B3 250" , 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_500/" , "B3 500" , 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_750/" , "B3 750" , 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_1000/", "B3 1000", 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_1250/", "B3 1250", 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_1500/", "B3 1500", 25000, NameVect, ResVect, TimeVect, SxzVect, "auto") + + # Plot Data + plotData(NameVect, ResVect, TimeVect, SxzVect, GammaVect, "/users/whalter1/work/aniso_fix/viscosityReduction/") + +end + +main() + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_5_functionFit.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_5_functionFit.jl new file mode 100644 index 00000000..9db46d4e --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_5_functionFit.jl @@ -0,0 +1,29 @@ +using LsqFit +using Plots + +# Define the function to fit +function func(x, p) + return p[1] * exp.(-p[2] * x) .+ p[3] +end + +# Generate some example data +x_data = collect(range(0, stop=4, length=50)) +y_data = func(x_data, [2.5, 1.3, 0.5]) + 0.2 * randn(length(x_data)) + +# Plot the example data +scatter(x_data, y_data, label="Data") + +# Define the model and fit it to the data +model(x, p) = func(x, p) +fit = curve_fit(model, x_data, y_data, [1.0, 1.0, 1.0]) + +# Plot the fitted function +x_fit = collect(range(0, stop=4, length=100)) +y_fit = model(x_fit, fit.param) +h = plot!(x_fit, y_fit, label="Fitted Function", line=:red) + +# Display the parameters of the fitted function +println("Fitted parameters: a=$(fit.param[1]), b=$(fit.param[2]), c=$(fit.param[3])") + +# Display the plot +display(h) diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_6_fitting.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_6_fitting.jl new file mode 100644 index 00000000..214ad769 --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_6_fitting.jl @@ -0,0 +1,176 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie") +using HDF5, Printf, Colors, ColorSchemes, MathTeXEngine, LinearAlgebra, FFMPEG, Statistics, LsqFit + +# Select your Makie of Choice: NOTE one has to quit the session when switching from CairoMakie to GLMakie or vice versa. +choice = 2 # 1 => GLMakie; 2 => CairoMakie +MakieOptions = ["import GLMakie as MoC", # necessary for interactive 'DataInspector', not supported on any 'headless server' + "import CairoMakie as MoC"] # does not support interactive 'DataInspector', runs also on any 'headless server' +eval(Meta.parse(MakieOptions[choice])) +MoC.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic))) +MoC.Makie.inline!(false) + +function plotData(NameVect, TimeVect, SxzVect, path) + + s = 1 + d = 24*3600*s + y = 365*d + My = 1e6*y + + # Switches + resol = 1200 + + # Scaling + Lc = 1. + tc = s; tMytext= "s" + Vc = 1e-9 + + + ##################################### + + f = MoC.Figure(resolution = (2.0*resol, resol), fontsize=35) + + ax1 = MoC.Axis(f[1, 1], title = L"\text{Reduction of effective shear viscosity }η_{\text{eff}}", xlabel = L"\text{shear deformation }γ", ylabel = L"\frac{η_{\text{eff}}}{η_{\text{0}}}") + for i = 1:length(NameVect) + Time = TimeVect[i] + sxz = SxzVect[i] + MoC.lines!(ax1, Time, sxz, label=NameVect[i]) + end + + #MoC.limits!(0,16,0,1.3) # 6 short, 16 normal, 50 long + #ax1.yticks = 0:0.25:1.25 + #MoC.limits!(0,16,0,1.5) # 6 short, 16 normal, 50 long + #ax1.yticks = 0:0.25:1.50 + MoC.limits!(0,50,0,1.35) # 6 short, 16 normal, 50 long + ax1.yticks = 0:0.25:1.35 + + #MoC.Legend(f[1, 1], ax1) + #MoC.axislegend(""; position=:rt, labelsize=20, nbanks = 2) + MoC.axislegend(""; halign = :right, valign = :top, labelsize=20, nbanks = 6) + Print2Disk( f, path, "ViscosityReduction") + +end + + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function Print2Disk( f, path, field; res=4) + mkpath(path) + MoC.save(path*"$field"*".png", f, px_per_unit = res) +end + +function collectData!(path, name, file_end_max, NameVect, TimeVect, SxzVect, autoManu, doFitData) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + if autoManu == "auto" + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + + else # if autoManu == "manu" + Time_time = [] + sxz_mean_time = [] + file_start = 0 + file_step = 100 + for i = file_start:file_step:file_end + filename = string(path, @sprintf("Output%05d.gzip.h5", i)) + model = ExtractData( filename, "/Model/Params") + t = model[1] + nvx = Int(model[4]) + nvz = Int(model[5]) + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + sxz_mean = mean(τxz) + Time_time = push!(Time_time, t) + sxz_mean_time = push!(sxz_mean_time, sxz_mean) + if mod(i,10*file_step) == 0; @show file_end, i; end + end + end + + Time_time = Time_time[2:end] # Time = 0.0 no good - unphysically high stresses + sxz_mean_time = sxz_mean_time[2:end] # Time = 0.0 no good + Time_time = Time_time[sxz_mean_time .> 0.0] .* 2 # i.e. gives γ (now not time anymore...) + sxz_mean_time = sxz_mean_time[sxz_mean_time .> 0.0]./sxz_mean_time[1] # normalization by first value + + NameVect = push!(NameVect, name) + TimeVect = push!(TimeVect, Time_time) + SxzVect = push!(SxzVect, sxz_mean_time) + + if doFitData + + # Define the model and fit it to the data + model(x, p) = func(x, p) + #fit = curve_fit(model, x_data, y_data, [1.0, 1.0, 1.0]) + #fit = curve_fit(model, x_data, y_data, [-0.0,0.0,0.0,0.0,1.0,-1.0,0.0]) + fit = curve_fit(model, x_data, y_data, [-1.0,-0.5,0.0,0.0,-1.0,1.0,0.5]) + + x_fit = collect(range(0, stop=50, length=1000)) + y_fit = model(x_fit, fit.param) + + #println("Fitted parameters: a=$(fit.param[1]), b=$(fit.param[2]), c=$(fit.param[3])") + #println("Fitted parameters: a=$(fit.param[1]), b=$(fit.param[2]), c=$(fit.param[3]), d=$(fit.param[4]), m=$(fit.param[5]), n=$(fit.param[6]), o=$(fit.param[7])") + println("Fitted parameters: p=$(fit.param)") + + name_fit = string(name,"_fit") + + NameVect = push!(NameVect, name_fit) + TimeVect = push!(TimeVect, x_fit) + SxzVect = push!(SxzVect, y_fit) + end + + return +end + +# Define the function to fit +function func(x, p) + #return p[1] * exp.(-p[2] * x) .+ p[3] + + a,b,c,d = p[1],p[2],p[3],p[4] + m,n,o = p[5],p[6],p[7] + + y_poly2 = a*(x.-d).^2 .+ b.*(x.-d) .+ c + + #y_expo1 = (a*exp.(b.*(x.-c)) .+ d) + + y_expo2 = (m*exp.(n.*(x.-o)) .+ 0.035) + + #y_expo3 = 0.9720593640446269*exp.(-0.6415103930237273.*(x.-1.516131406446425)) .+ 0.035 + + #return y_poly2 .+ y_expo2 + return y_expo2 + #return y_expo1 .+ y_expo2 +end + +function main() + + NameVect = Vector{String}() + TimeVect = [] + SxzVect = [] + + @show NameVect + + # Collect all necessary data from desired output files + + # all iso setups + collectData!("/users/whalter1/work/aniso_fix/B5_1000/", "B5 1000", 50000, NameVect, TimeVect, SxzVect, "auto", true) + #collectData!("/users/whalter1/work/aniso_fix/B6_1000/", "B6 1000", 100000, NameVect, TimeVect, SxzVect, "auto", true) + + # Plot Data + plotData(NameVect, TimeVect, SxzVect, "/users/whalter1/work/aniso_fix/viscosityReduction_fit/") + +end + +main() + + diff --git a/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_7_export_sxz.jl b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_7_export_sxz.jl new file mode 100644 index 00000000..4672806e --- /dev/null +++ b/JuliaVisualisation/Main_Visualisation_Makie_MD7_viscosity_reduction_7_export_sxz.jl @@ -0,0 +1,141 @@ +import Pkg +Pkg.activate(normpath(joinpath(@__DIR__, "."))) +# import Pkg; Pkg.add("HDF5"); Pkg.add("Printf"); Pkg.add("Colors"); Pkg.add("ColorSchemes"); Pkg.add("MathTeXEngine"); Pkg.add("LinearAlgebra"); Pkg.add("FFMPEG"), Pkg.add("CairoMakie"), Pkg.add("Tables") +using HDF5, Printf, LinearAlgebra, FFMPEG, Statistics, CSV, Tables + +function ExtractData( file_path, data_path) + data = h5open(file_path, "r") do file + read(file, data_path) + end + return data +end + +function collectData!(path, name, file_end_max, autoManu) + + # find file_end + # Check through all Output files (*.gzip.h5) + Files = sort(filter(x->endswith(x,".h5"), readdir(path))) + file_end = parse(Int64, replace(Files[end] , r"Output"=>"", r".gzip.h5"=>"")) + if file_end > file_end_max; file_end = file_end_max; end + filename = string(path, @sprintf("Output%05d.gzip.h5", file_end)) + @show filename + + if autoManu == "auto" + Time_time = Float64.(ExtractData( filename, "/TimeSeries/Time_time")); + #Short_time = Float64.(ExtractData( filename, "/TimeSeries/Short_time")); + #Work_time = Float64.(ExtractData( filename, "/TimeSeries/Work_time")); + #Uthermal_time = Float64.(ExtractData( filename, "/TimeSeries/Uthermal_time")); + #Uelastic_time = Float64.(ExtractData( filename, "/TimeSeries/Uelastic_time")); + #T_mean_time = Float64.(ExtractData( filename, "/TimeSeries/T_mean_time")); + #P_mean_time = Float64.(ExtractData( filename, "/TimeSeries/P_mean_time")); + #τxx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxxd_mean_time")); + #τzz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/szzd_mean_time")); + sxz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/sxz_mean_time")); + #τII_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Tii_mean_time")); + #ε̇xx_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exxd_mean_time")); + #ε̇zz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/ezzd_mean_time")); + #ε̇xz_mean_time = Float64.(ExtractData( filename, "/TimeSeries/exz_mean_time")); + #ε̇II_mean_time = Float64.(ExtractData( filename, "/TimeSeries/Eii_mean_time")); + + else # if autoManu == "manu" + Time_time = [] + sxz_mean_time = [] + file_start = 0 + #file_step = 100 + file_step = 10 + for i = file_start:file_step:file_end + filename = string(path, @sprintf("Output%05d.gzip.h5", i)) + model = ExtractData( filename, "/Model/Params") + t = model[1] + nvx = Int(model[4]) + nvz = Int(model[5]) + τxz = Float64.(reshape(ExtractData( filename, "/Vertices/sxz"), nvx, nvz)) + sxz_mean = mean(τxz) + Time_time = push!(Time_time, t) + sxz_mean_time = push!(sxz_mean_time, sxz_mean) + if mod(i,10*file_step) == 0; @show file_end, i; end + end + end + + sxz_mean_time = sxz_mean_time[Time_time .> 0.0] # the very first value is no good, and at the end there are many unusable 0.0 values + Time_time = Time_time[Time_time .> 0.0] + + matrixToSave = hcat(Time_time,sxz_mean_time) + @show(size(matrixToSave)) + saveName = (savePath*name*"_sxz.csv") + saveName = replace(saveName, " " => "_") + @show(saveName) + CSV.write(saveName, Tables.table(matrixToSave), writeheader=false) + + return +end + +function main() + + + global savePath = "/users/whalter1/work/aniso_fix/viscosityReduction/data_sxz/" + + + # Collect all necessary data from desired output files + + # all aniso setups + collectData!("/users/whalter1/work/aniso_fix/A2_1000/" , "A2 1000" , 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/A3_1000/" , "A3 1000" , 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/A4_1000/" , "A4 1000" , 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/A5_1000/" , "A5 1000" , 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/MWE_1000/", "MWE 1000", 100000, "auto") + + # all iso setups + collectData!("/users/whalter1/work/aniso_fix/A1_1000/", "A1 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/A6_1000/", "A6 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/A7_1000/", "A7 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B1_1000/", "B1 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B2_1000/", "B2 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B2_1500/", "B2 1500", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B3_250/" , "B3 250" , 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_500/" , "B3 500" , 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_750/" , "B3 750" , 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_1000/", "B3 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B3_1250/", "B3 1250", 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B3_1500/", "B3 1500", 100000, "manu") + + collectData!("/users/whalter1/work/aniso_fix/B4_1500/", "B4 1500", 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B5_1000/", "B5 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B6_1000/", "B6 1000", 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B6_1500/", "B6 1500", 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B6_2000/", "B6 2000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B7_1000/", "B7 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B8_1000/", "B8 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B9_1000/", "B9 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B10_1000/", "B10 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B11_1000/", "B11 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B12_1000/", "B12 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B13_1000/", "B13 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B14_1000/", "B14 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B15_1000/", "B15 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B16_1000/", "B16 1000", 100000, "manu") + collectData!("/users/whalter1/work/aniso_fix/B16_1500/", "B16 1500", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B16_2000/", "B16 2000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B17_1000/", "B17 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B18_1000/", "B18 1000", 100000, "auto") + + collectData!("/users/whalter1/work/aniso_fix/B19_1000/", "B19 1000", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B19_1500/", "B19 1500", 100000, "auto") + collectData!("/users/whalter1/work/aniso_fix/B19_2000/", "B19 2000", 100000, "auto") + + # Plot Data + #saveData(NameVect, TimeVect, SxzVect, "/users/whalter1/work/aniso_fix/viscosityReduction/data_sxz/") + +end + +main() + + diff --git a/JuliaVisualisation/Project.toml b/JuliaVisualisation/Project.toml index 71b00814..330c68a9 100644 --- a/JuliaVisualisation/Project.toml +++ b/JuliaVisualisation/Project.toml @@ -2,21 +2,8 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" -DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a" -FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" -GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb" HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" -ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534" -ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19" -LazyGrids = "7031d0ef-c40d-4431-b2f8-61a8d2f650db" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +LsqFit = "2fda8390-95c7-5789-9bda-21331edee243" MathTeXEngine = "0a4f8689-d25c-4efe-a92b-7142dfc1aa53" -PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" -Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" -SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" -Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" diff --git a/SETS/AnisoViscTest_evolv_multi_ellipses.c b/SETS/AnisoViscTest_evolv_multi_ellipses.c index f08b7ed7..0374283d 100644 --- a/SETS/AnisoViscTest_evolv_multi_ellipses.c +++ b/SETS/AnisoViscTest_evolv_multi_ellipses.c @@ -3,22 +3,32 @@ int SetPhase(MdoodzInput *input, Coordinates coordinates) { - int nellipses = 0; - - // (for 299 setup) - double Xshift[299] = { -0.22816 , -0.021336 , 0.05523 , -0.32056 , 0.25487 , -0.078159 , 0.19636 , 0.10404 , 0.25895 , -0.022912 , -0.28754 , -0.38468 , -0.089949 , -0.0050744 , 0.17039 , -0.318 , 0.40806 , 0.19729 , -0.47074 , -0.38096 , 0.47563 , -0.42267 , -0.36596 , 0.12273 , -0.092511 , -0.40519 , -0.084045 , 0.10114 , -0.3926 , -0.029798 , -0.2662 , -0.19559 , -0.075464 , 0.07131 , -0.48309 , -0.019021 , 0.49423 , 0.00028556 , 0.08106 , 0.19416 , 0.00084054 , 0.53115 , 0.069583 , 0.30878 , -0.16643 , -0.026291 , 0.38379 , 0.50059 , -0.53594 , -0.28638 , 0.37212 , -0.44905 , 0.44363 , 0.01414 , -0.31281 , 0.43897 , 0.090365 , -0.51925 , 0.17622 , 0.35899 , -0.388 , -0.036146 , 0.53654 , -0.1379 , 0.46033 , -0.36426 , -0.51956 , -0.084741 , 0.20375 , -0.20879 , -0.13447 , 0.34352 , -0.32432 , -0.20247 , -0.45219 , -0.3114 , 0.24505 , -0.083951 , 0.23035 , -0.30295 , 0.30972 , 0.028167 , -0.44292 , 0.41391 , -0.22493 , -0.12975 , -0.163 , -0.53987 , -0.21171 , -0.54145 , 0.12609 , -0.080698 , 0.040559 , -0.040591 , 0.41627 , -0.47606 , -0.25297 , 0.51085 , -0.20487 , 0.27565 , -0.42918 , -0.29596 , -0.24222 , 0.31079 , 0.052846 , -0.013232 , -0.10747 , 0.21718 , 0.49894 , -0.41927 , -0.36252 , 0.29682 , 0.48155 , 0.14915 , -0.098248 , -0.12913 , -0.32764 , 0.010045 , 0.24628 , -0.53413 , 0.065074 , 0.039831 , 0.31714 , 0.093487 , -0.22003 , 0.34886 , 0.37217 , 0.10217 , -0.53436 , -0.049081 , 0.52527 , 0.068685 , 0.27133 , 0.0031221 , 0.18593 , -0.45724 , -0.16345 , 0.39594 , -0.015962 , -0.069537 , 0.36635 , 0.52031 , -0.37068 , 0.32639 , 0.36991 , -0.3419 , -0.093731 , 0.3124 , -0.23413 , -0.28888 , -0.025687 , -0.27212 , 0.37024 , 0.21112 , -0.118 , -0.37629 , -0.41248 , 0.048335 , -0.41036 , -0.2483 , -0.14721 , -0.10204 , 0.36277 , -0.27307 , 0.27017 , -0.16687 , 0.079883 , 0.42454 , 0.44547 , -0.25542 , 0.21606 , 0.047524 , -0.26081 , -0.45067 , 0.28547 , 0.4304 , 0.27773 , 0.25735 , -0.057085 , -0.17188 , -0.059101 , 0.3709 , -0.54234 , -0.43161 , 0.035947 , 0.39347 , -0.052967 , 0.11991 , 0.28647 , 0.19851 , 0.44191 , -0.25738 , 0.097025 , 0.055415 , 0.45101 , -0.18302 , -0.4336 , -0.40715 , -0.26009 , 0.44376 , 0.22898 , 0.16317 , -0.049781 , -0.39171 , -0.45436 , 0.0063516 , -0.18887 , -0.44237 , -0.16966 , -0.16166 , 0.30487 , -0.26893 , 0.52784 , -0.4828 , -0.2379 , 0.38542 , 0.34065 , -0.13584 , -0.39507 , 0.292 , -0.064576 , 0.44992 , 0.38687 , 0.38762 , -0.13723 , 0.24304 , -0.25919 , -0.23592 , -0.16201 , -0.10797 , -0.064879 , 0.29997 , 0.35496 , 0.040786 , -0.35007 , 0.38789 , -0.15498 , -0.15759 , 0.07224 , -0.36945 , 0.18746 , -0.34249 , -0.36879 , -0.20154 , 0.061779 , -0.073078 , 0.19187 , -0.19955 , 0.37717 , -0.18949 , -0.54227 , 0.54145 , 0.2583 , -0.31814 , -0.21199 , 0.37992 , 0.15956 , -0.10309 , 0.2234 , 0.32783 , 0.3771 , -0.31839 , 0.17589 , -0.43926 , -0.098158 , -0.089941 , 0.020064 , 0.46082 , -0.27499 , 0.03183 , -0.47407 , 0.46537 , -0.003658 , 0.51691 , -0.50577 , -0.46885 , -0.49941 , 0.46406 , 0.48075 , -0.46346 , 0.48044 , 0.46013 , 0.45855 , 0.52394 , -0.48915 , -0.50106 , -0.51845 , 0.46587 , 0.46564 , -0.47473 , -0.47969 , 0.45766 , -0.47216 , 0.5172 , 0.45773 , -0.45855 , -0.53918 , 0.52593 , -0.53463 }; - double Zshift[299] = { 0.5415 , -0.026175 , 0.38234 , -0.37879 , -0.031663 , -0.50704 , 0.24111 , 0.090023 , -0.091293 , -0.074906 , -0.2646 , 0.16727 , 0.064955 , -0.11888 , 0.37096 , -0.54272 , 0.34296 , 0.40407 , 0.51143 , -0.22603 , 0.22583 , -0.37372 , 0.42521 , -0.33813 , 0.28935 , 0.47852 , 0.45326 , -0.26711 , 0.24635 , -0.1562 , 0.43203 , 0.25527 , -0.45837 , 0.3046 , 0.24536 , 0.5239 , -0.21266 , 0.059282 , -0.3272 , 0.4344 , -0.039987 , 0.37979 , -0.08379 , 0.18575 , -0.27354 , 0.3139 , 0.12818 , -0.3746 , 0.18782 , 0.3387 , 0.28979 , 0.29479 , -0.38265 , 0.43713 , 0.50258 , 0.52507 , 0.37962 , 0.43927 , -0.3569 , -0.39338 , 0.33268 , -0.34848 , 0.1981 , -0.32482 , 0.40577 , 0.51918 , -0.052263 , -0.12362 , -0.17924 , -0.47367 , 0.43365 , -0.50578 , 0.40676 , 0.53135 , -0.2853 , -0.082201 , 0.51513 , 0.22755 , -0.12373 , 0.53182 , -0.36663 , 0.30579 , -0.099646 , -0.093709 , 0.1277 , -0.0054239 , 0.29654 , 0.37043 , 0.166 , 0.3242 , -0.52519 , -0.035496 , 0.17399 , -0.23772 , 0.01141 , -0.54485 , -0.53264 , 0.17363 , -0.10154 , 0.29367 , -0.0056675 , 0.18975 , -0.31213 , -0.46908 , -0.37156 , 0.18793 , -0.32041 , 0.25593 , -0.16684 , 0.20145 , 0.20993 , 0.11047 , -0.30298 , 0.54115 , -0.27183 , -0.47836 , -0.14523 , 0.51425 , 0.21178 , -0.50743 , -0.54139 , 0.14244 , -0.53099 , -0.24178 , -0.3699 , -0.24031 , 0.54045 , 0.43709 , 0.27353 , 0.039606 , 0.072539 , -0.46702 , 0.0050052 , 0.10811 , -0.48881 , -0.32163 , -0.0020008 , -0.16712 , -0.47333 , -0.0052957 , -0.43963 , -0.46954 , -0.035304 , 0.36634 , 0.40783 , -0.28039 , -0.36128 , 0.053035 , 0.27931 , 0.090446 , 0.46951 , 0.50602 , 0.052007 , -0.25658 , 0.050455 , 0.13301 , -0.27248 , -0.27492 , 0.035256 , -0.43586 , 0.18338 , -0.5343 , 0.17652 , 0.29816 , -0.17234 , 0.055155 , -0.0047934 , -0.037906 , -0.32944 , 0.38764 , -0.3552 , 0.3356 , -0.19353 , 0.24259 , -0.32704 , 0.078286 , 0.37657 , 0.05733 , 0.14018 , -0.43498 , 0.51929 , -0.017455 , -0.086105 , 0.094388 , 0.52401 , -0.54389 , -0.54091 , -0.41362 , -0.43836 , 0.015585 , 0.14916 , -0.47846 , -0.38079 , -0.22913 , 0.041096 , -0.20817 , 0.39094 , 0.5437 , 0.0048242 , -0.43728 , -0.5396 , -0.069328 , -0.1615 , -0.46176 , -0.14909 , 0.28491 , 0.41844 , -0.47852 , 0.36699 , 0.477 , 0.4616 , -0.11209 , 0.023602 , 0.1294 , 0.043565 , -0.35396 , 0.002009 , -0.14754 , -0.52797 , -0.25148 , -0.22665 , -0.35621 , 0.16845 , -0.21548 , -0.21882 , -0.24656 , -0.38865 , 0.45176 , -0.18102 , 0.53679 , -0.28183 , 0.52386 , 0.4389 , 0.47522 , -0.34161 , 0.48019 , -0.4894 , -0.34372 , -0.16902 , -0.39673 , 0.48618 , -0.19908 , 0.38465 , 0.19825 , 0.24221 , 0.34745 , 0.54175 , -0.28974 , -0.25584 , 0.047639 , -0.22256 , 0.44844 , -0.39822 , 0.35743 , -0.14659 , -0.077251 , 0.25557 , -0.40132 , 0.30568 , -0.11616 , 0.24221 , 0.065132 , 0.16769 , -0.19437 , -0.056612 , 0.37653 , -0.41642 , -0.27579 , -0.3475 , 0.25428 , -0.40994 , -0.53469 , -0.30806 , 0.24536 , -0.21266 , 0.37979 , -0.3746 , 0.18782 , 0.43927 , 0.1981 , -0.052263 , 0.37043 , 0.3242 , -0.54485 , 0.17363 , -0.16684 , -0.30298 , -0.50743 , 0.27353 , 0.072539 , -0.46954 , -0.086105 , 0.023602 , 0.1294 , -0.22256 , 0.44844 , -0.27579 , -0.40994 , -0.53469 }; - double Majaxis[299] = { 0.020004 , 0.02004 , 0.020062 , 0.02011 , 0.020123 , 0.020139 , 0.020181 , 0.020182 , 0.02026 , 0.020279 , 0.020296 , 0.020363 , 0.020363 , 0.020375 , 0.020402 , 0.020422 , 0.020423 , 0.020437 , 0.02046 , 0.020466 , 0.020469 , 0.020523 , 0.020523 , 0.020526 , 0.020548 , 0.020586 , 0.020612 , 0.020696 , 0.020771 , 0.020806 , 0.020844 , 0.020865 , 0.020978 , 0.021012 , 0.021104 , 0.021143 , 0.021148 , 0.02121 , 0.021257 , 0.021287 , 0.021329 , 0.021394 , 0.021405 , 0.021414 , 0.021479 , 0.021621 , 0.021632 , 0.021655 , 0.021672 , 0.021705 , 0.021718 , 0.021849 , 0.02188 , 0.021911 , 0.021912 , 0.022019 , 0.022112 , 0.022149 , 0.022181 , 0.022192 , 0.022249 , 0.022271 , 0.022402 , 0.022414 , 0.022494 , 0.022507 , 0.022762 , 0.022839 , 0.022917 , 0.022925 , 0.022981 , 0.022983 , 0.023031 , 0.02304 , 0.023091 , 0.023163 , 0.023312 , 0.023338 , 0.023453 , 0.023519 , 0.023569 , 0.023595 , 0.023677 , 0.02368 , 0.023704 , 0.023793 , 0.023798 , 0.023855 , 0.023909 , 0.02392 , 0.023965 , 0.023975 , 0.024004 , 0.024045 , 0.024291 , 0.024353 , 0.024388 , 0.024492 , 0.024604 , 0.024626 , 0.024644 , 0.024752 , 0.02477 , 0.024776 , 0.024881 , 0.024971 , 0.025214 , 0.025216 , 0.025264 , 0.025365 , 0.02539 , 0.025435 , 0.025443 , 0.025617 , 0.025749 , 0.025759 , 0.025759 , 0.02576 , 0.025769 , 0.025815 , 0.025948 , 0.026073 , 0.026118 , 0.026124 , 0.026274 , 0.026405 , 0.026577 , 0.026608 , 0.026732 , 0.026777 , 0.026902 , 0.026943 , 0.026962 , 0.027083 , 0.027125 , 0.027125 , 0.027209 , 0.027313 , 0.027426 , 0.027528 , 0.027584 , 0.027658 , 0.02772 , 0.02776 , 0.027777 , 0.027796 , 0.027838 , 0.027882 , 0.027914 , 0.027935 , 0.028 , 0.028058 , 0.02836 , 0.028375 , 0.028442 , 0.0285 , 0.028504 , 0.028511 , 0.028559 , 0.028733 , 0.028799 , 0.028827 , 0.029037 , 0.029057 , 0.029218 , 0.02924 , 0.029269 , 0.02933 , 0.02935 , 0.029397 , 0.029459 , 0.029526 , 0.029534 , 0.029655 , 0.029803 , 0.029817 , 0.029966 , 0.030027 , 0.030029 , 0.030087 , 0.030087 , 0.030147 , 0.030235 , 0.030247 , 0.030314 , 0.030408 , 0.030571 , 0.030698 , 0.030702 , 0.030719 , 0.030815 , 0.030821 , 0.030984 , 0.031028 , 0.031106 , 0.031114 , 0.031309 , 0.031337 , 0.031502 , 0.031505 , 0.031629 , 0.031913 , 0.032007 , 0.032405 , 0.032518 , 0.032618 , 0.032664 , 0.03268 , 0.032684 , 0.033117 , 0.033188 , 0.033196 , 0.033267 , 0.03352 , 0.033834 , 0.033843 , 0.034007 , 0.034245 , 0.03437 , 0.034668 , 0.03473 , 0.034838 , 0.035036 , 0.035053 , 0.035149 , 0.035409 , 0.03557 , 0.03572 , 0.035747 , 0.0358 , 0.035874 , 0.036028 , 0.036202 , 0.036219 , 0.036401 , 0.036418 , 0.036456 , 0.036511 , 0.03658 , 0.036974 , 0.037067 , 0.037142 , 0.037223 , 0.03731 , 0.037346 , 0.037352 , 0.037377 , 0.037485 , 0.037835 , 0.038909 , 0.039492 , 0.039608 , 0.039689 , 0.039796 , 0.039898 , 0.039994 , 0.040015 , 0.040017 , 0.040172 , 0.040309 , 0.040405 , 0.040516 , 0.041238 , 0.041243 , 0.041777 , 0.042256 , 0.042554 , 0.042737 , 0.042815 , 0.042964 , 0.043061 , 0.043634 , 0.043867 , 0.021104 , 0.021148 , 0.021394 , 0.021655 , 0.021672 , 0.022149 , 0.022402 , 0.022762 , 0.023855 , 0.02392 , 0.024353 , 0.024492 , 0.025264 , 0.025443 , 0.025815 , 0.026732 , 0.026902 , 0.027658 , 0.030235 , 0.033267 , 0.03352 , 0.039492 , 0.039608 , 0.042737 , 0.043061 , 0.043634 }; - double Minaxis[299] = { 0.014327 , 0.0099816 , 0.0079475 , 0.0067382 , 0.0092416 , 0.0054686 , 0.0079646 , 0.01336 , 0.012604 , 0.013941 , 0.015507 , 0.006454 , 0.0055965 , 0.010408 , 0.013413 , 0.0097163 , 0.015056 , 0.0061028 , 0.0077156 , 0.0051759 , 0.017189 , 0.0052982 , 0.0096657 , 0.01076 , 0.012129 , 0.012807 , 0.0076778 , 0.006741 , 0.0060004 , 0.0056357 , 0.0053628 , 0.016735 , 0.0052267 , 0.0057199 , 0.0083263 , 0.0094517 , 0.012813 , 0.01103 , 0.0098089 , 0.013574 , 0.006371 , 0.012738 , 0.0073692 , 0.013902 , 0.011126 , 0.0098853 , 0.0080003 , 0.0064415 , 0.0066103 , 0.012389 , 0.0060653 , 0.0087545 , 0.010981 , 0.0092382 , 0.015435 , 0.0096992 , 0.011574 , 0.0080925 , 0.011675 , 0.012981 , 0.015948 , 0.015128 , 0.010294 , 0.0080096 , 0.0051034 , 0.010367 , 0.011007 , 0.010025 , 0.005869 , 0.0055645 , 0.0075996 , 0.0079119 , 0.0055819 , 0.0063155 , 0.0088309 , 0.01453 , 0.0050177 , 0.0053662 , 0.010173 , 0.0082155 , 0.0074167 , 0.006434 , 0.015945 , 0.0077343 , 0.0095707 , 0.016882 , 0.013134 , 0.0059642 , 0.0065564 , 0.015614 , 0.017264 , 0.0075763 , 0.006793 , 0.0051688 , 0.01707 , 0.006315 , 0.010919 , 0.0079502 , 0.0096913 , 0.0082356 , 0.0092863 , 0.0052858 , 0.016991 , 0.011849 , 0.0063774 , 0.010478 , 0.012739 , 0.0069143 , 0.01976 , 0.0086271 , 0.009269 , 0.0091104 , 0.0062468 , 0.01799 , 0.012409 , 0.0053492 , 0.0077024 , 0.0050801 , 0.012564 , 0.0075616 , 0.016538 , 0.0069052 , 0.014742 , 0.0055335 , 0.010662 , 0.0087099 , 0.0092536 , 0.010254 , 0.010465 , 0.0065039 , 0.0055155 , 0.019832 , 0.0089958 , 0.0098236 , 0.018973 , 0.007204 , 0.010104 , 0.01323 , 0.014672 , 0.010585 , 0.0058373 , 0.011372 , 0.013203 , 0.0099765 , 0.0070372 , 0.010354 , 0.0055951 , 0.0060131 , 0.013103 , 0.0079449 , 0.0051299 , 0.005036 , 0.010246 , 0.012704 , 0.0057771 , 0.014115 , 0.014807 , 0.0052778 , 0.0084248 , 0.0096462 , 0.0055434 , 0.0095333 , 0.011269 , 0.01221 , 0.012258 , 0.0067901 , 0.006454 , 0.012845 , 0.014736 , 0.010879 , 0.0083323 , 0.0077235 , 0.0051711 , 0.0069054 , 0.017363 , 0.014372 , 0.0072299 , 0.0063376 , 0.010933 , 0.018564 , 0.0061667 , 0.012848 , 0.0064541 , 0.0058952 , 0.0051857 , 0.0072317 , 0.0078115 , 0.0099858 , 0.010605 , 0.013646 , 0.014084 , 0.0094785 , 0.012782 , 0.010161 , 0.007457 , 0.0051096 , 0.0067752 , 0.0070392 , 0.0055331 , 0.013437 , 0.013798 , 0.0061589 , 0.0051074 , 0.015242 , 0.0051894 , 0.0077062 , 0.010107 , 0.010847 , 0.013242 , 0.0052751 , 0.010423 , 0.0070397 , 0.017173 , 0.0094386 , 0.0074332 , 0.0064722 , 0.0092312 , 0.0059999 , 0.0067572 , 0.010947 , 0.008076 , 0.0054722 , 0.0081541 , 0.0082725 , 0.01725 , 0.0089949 , 0.011478 , 0.017171 , 0.0071159 , 0.006895 , 0.011438 , 0.0068836 , 0.008132 , 0.01367 , 0.0088901 , 0.0059138 , 0.0081291 , 0.0059966 , 0.0086854 , 0.013832 , 0.0068204 , 0.005614 , 0.0096036 , 0.014077 , 0.010208 , 0.0060625 , 0.0052894 , 0.011616 , 0.0050841 , 0.0068374 , 0.0096471 , 0.012576 , 0.016383 , 0.0090394 , 0.0075459 , 0.0057784 , 0.0060681 , 0.013247 , 0.0057273 , 0.0099803 , 0.0070866 , 0.0066253 , 0.007665 , 0.0064052 , 0.010079 , 0.0076156 , 0.0070544 , 0.0063735 , 0.0060472 , 0.0063675 , 0.0062031 , 0.0060378 , 0.0056123 , 0.0083263 , 0.012813 , 0.012738 , 0.0064415 , 0.0066103 , 0.0080925 , 0.010294 , 0.011007 , 0.0059642 , 0.015614 , 0.006315 , 0.0079502 , 0.01976 , 0.0062468 , 0.0075616 , 0.010465 , 0.0055155 , 0.011372 , 0.0064541 , 0.017173 , 0.0094386 , 0.0096471 , 0.012576 , 0.0063735 , 0.0062031 , 0.0060378 }; - double Angle[299] = { 1.4558 , 1.0249 , 0.91246 , 3.7799 , 1.4959 , 1.7974 , 5.3369 , 5.7376 , 3.5275 , 2.1432 , 3.5593 , 4.3224 , 2.7564 , 1.51 , 4.5466 , 3.919 , 5.4015 , 0.30619 , 0.67212 , 3.5822 , 6.238 , 5.3461 , 5.0576 , 5.0017 , 2.834 , 6.059 , 2.9888 , 3.6527 , 1.3913 , 1.8141 , 4.7455 , 1.4383 , 1.1027 , 1.1936 , 0.59347 , 1.7009 , 3.6973 , 4.8118 , 1.848 , 2.8246 , 1.5613 , 5.2432 , 5.4165 , 5.8815 , 5.5182 , 5.4343 , 2.1553 , 3.0717 , 6.1326 , 3.7169 , 4.8459 , 1.3129 , 0.15237 , 5.8569 , 5.9889 , 0.86512 , 1.9941 , 2.5237 , 5.433 , 0.58891 , 1.7834 , 1.4294 , 4.8015 , 2.0355 , 1.9812 , 0.89478 , 4.4992 , 1.1769 , 4.2821 , 2.4354 , 4.3865 , 2.0177 , 0.76227 , 4.8369 , 2.8215 , 1.646 , 4.3235 , 4.5098 , 2.9366 , 5.7934 , 4.8433 , 0.20172 , 5.7323 , 3.9258 , 0.23259 , 1.5851 , 5.3528 , 5.6937 , 3.1197 , 4.6992 , 1.5269 , 2.9197 , 5.9799 , 3.9698 , 5.1291 , 0.46843 , 0.32144 , 1.3667 , 3.6631 , 4.3596 , 5.3843 , 5.0461 , 2.8384 , 0.4362 , 4.9122 , 0.91605 , 2.291 , 2.334 , 3.6956 , 3.0292 , 1.1774 , 0.82064 , 1.6694 , 3.2481 , 4.5823 , 2.4318 , 4.2287 , 4.6383 , 4.3096 , 6.0267 , 4.974 , 2.5711 , 5.7808 , 0.86595 , 1.9546 , 1.169 , 0.94583 , 1.6645 , 4.3546 , 4.9469 , 4.3364 , 2.9925 , 0.19103 , 1.8663 , 1.8633 , 3.596 , 1.4591 , 1.9571 , 4.8912 , 6.009 , 4.9117 , 1.4427 , 1.1956 , 3.8217 , 1.4041 , 0.48615 , 5.4622 , 2.4336 , 4.6307 , 1.4259 , 2.5079 , 4.2249 , 0.23295 , 4.5866 , 1.6253 , 3.0094 , 5.5111 , 2.2686 , 4.7023 , 2.9195 , 5.0689 , 5.6642 , 4.5094 , 4.5253 , 1.6656 , 4.3838 , 1.1062 , 6.1138 , 0.32075 , 3.4346 , 4.1934 , 6.0929 , 2.803 , 1.7798 , 1.4638 , 1.1769 , 1.6757 , 3.5648 , 5.805 , 1.7655 , 1.869 , 3.4948 , 5.0538 , 0.5722 , 5.2496 , 0.74496 , 0.93514 , 3.845 , 4.0066 , 1.4639 , 0.98186 , 1.6919 , 0.41886 , 5.0204 , 4.4884 , 1.6724 , 2.3402 , 4.468 , 5.6256 , 5.7988 , 4.1419 , 4.5061 , 2.1176 , 6.0354 , 5.7664 , 3.1422 , 4.2172 , 5.2365 , 5.3768 , 1.6359 , 0.86165 , 4.5322 , 4.5114 , 4.4432 , 4.5294 , 5.1042 , 3.9791 , 1.1958 , 1.8184 , 4.6404 , 1.1193 , 2.8933 , 1.0764 , 2.3314 , 4.668 , 5.0065 , 2.2973 , 5.637 , 1.2619 , 2.4728 , 4.9948 , 2.4295 , 0.80222 , 3.4089 , 1.3484 , 1.6781 , 5.9017 , 2.6379 , 2.663 , 5.0669 , 1.9895 , 3.4627 , 2.2352 , 0.15207 , 0.62638 , 6.1007 , 1.1807 , 5.8529 , 4.8815 , 1.5408 , 1.4216 , 4.0129 , 3.5676 , 0.60916 , 0.28774 , 3.7289 , 5.2765 , 1.9752 , 4.8562 , 2.3279 , 5.9472 , 4.7341 , 0.67569 , 2.1298 , 6.1253 , 1.1864 , 5.4152 , 0.9864 , 0.21133 , 0.53214 , 2.5471 , 1.9962 , 1.5181 , 0.59347 , 3.6973 , 5.2432 , 3.0717 , 6.1326 , 2.5237 , 4.8015 , 4.4992 , 5.6937 , 4.6992 , 0.46843 , 1.3667 , 3.6956 , 1.6694 , 6.0267 , 4.3546 , 4.3364 , 1.4427 , 5.0538 , 4.5114 , 4.4432 , 1.4216 , 4.0129 , 0.9864 , 2.5471 , 1.9962 }; - - // (for 5 setup) - //double Xshift[5] = { -0.22816 , -0.021336 , 0.05523 , -0.32056 , 0.25487 }; - //double Zshift[5] = { 0.5415 , -0.026175 , 0.38234 , -0.37879 , -0.031663 }; - //double Majaxis[5] = { 0.020004 , 0.02004 , 0.020062 , 0.02011 , 0.020123 }; - //double Minaxis[5] = { 0.014327 , 0.0099816 , 0.0079475 , 0.0067382 , 0.0092416 }; - //double Angle[5] = { 1.4558 , 1.0249 , 0.91246 , 3.7799 , 1.4959 }; - + // B5) circles, same size, 5x5 all aligned + double d_Xshift[25] = { 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.9485484492371699 , 0.5890979596406679 , 0.6829027842212059 , 0.9942515475871702 , 0.9621266398494146 , 0.5890979596406679 , 0.908601239653215 , 0.8622361781698946 , 0.9925757704891546 , 0.8503822186310541 , 0.908601239653215 , 0.0013589198992898233 , 0.9334670539028086 , 0.07588996956074079 , 0.8657927415787832 , 0.0013589198992898233 , 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.9485484492371699 }; + double d_Zshift[25] = { 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.4273171754694547 , 0.5425866165938917 , 0.6201318911085705 , 0.90273532152766 , 0.0019465420865421024 , 0.5425866165938917 , 0.6583670587253173 , 0.052142170900339346 , 0.11051969187091559 , 0.12033430560852221 , 0.6583670587253173 , 0.7117852782330175 , 0.8241369329108513 , 0.8610212856101548 , 0.35619242168110343 , 0.7117852782330175 , 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.4273171754694547 }; + //double d_Xshift[25] = { 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.15496802379385022 , 0.5890979596406679 , 0.6829027842212059 , 0.9942515475871702 , 0.9621266398494146 , 0.4259237710938296 , 0.908601239653215 , 0.8622361781698946 , 0.9925757704891546 , 0.8503822186310541 , 0.6854127168974997 , 0.0013589198992898233 , 0.9334670539028086 , 0.07588996956074079 , 0.8657927415787832 , 0.367442674337337 , 0.2509770419357381 , 0.7662147966485621 , 0.49155362059076 , 0.34965262596847924 , 0.22472835082437814 }; + //double d_Zshift[25] = { 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.24442697436391425 , 0.5425866165938917 , 0.6201318911085705 , 0.90273532152766 , 0.0019465420865421024 , 0.8767279816239639 , 0.6583670587253173 , 0.052142170900339346 , 0.11051969187091559 , 0.12033430560852221 , 0.8371639193166704 , 0.7117852782330175 , 0.8241369329108513 , 0.8610212856101548 , 0.35619242168110343 , 0.0026585669431200554 , 0.098480050950839 , 0.3672892330306361 , 0.35165850677517885 , 0.40825308767366664 , 0.7289186882099035 }; + + int nellipses = 25; + double Xshift[25]; + double Zshift[25]; + double Majaxis[25]; + double Minaxis[25]; + double Angle[25]; + int kg; + for (int i = 0; i < 5; ++i) { // z idx + for (int j = 0; j < 5; ++j) { // x idx + kg = 5 * i + j; // global idx + Xshift[kg] = ( (1.0 / 4.0) * j - 0.5 ) ;// + (d_Xshift[kg]-0.5)*0.05; // including random delta + Zshift[kg] = ( (1.0 / 4.0) * i - 0.5 ) ;// + (d_Zshift[kg]-0.5)*0.05; // including random delta + Majaxis[kg] = 0.075; + Minaxis[kg] = 0.075; + Angle[kg] = 45.0 / 180.0 * M_PI; + if (j == 1 || j == 3) { + Zshift[kg] += 1.0 / 8.0 ; + } + } + } // scaling geometry values int i; for (i = 0; i < nellipses; ++i) { @@ -57,14 +67,32 @@ double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { const double radius = input->model.user1 / input->scaling.L; - int nellipses = 0; - - // (for 299 setup) - double Xshift[299] = { -0.22816 , -0.021336 , 0.05523 , -0.32056 , 0.25487 , -0.078159 , 0.19636 , 0.10404 , 0.25895 , -0.022912 , -0.28754 , -0.38468 , -0.089949 , -0.0050744 , 0.17039 , -0.318 , 0.40806 , 0.19729 , -0.47074 , -0.38096 , 0.47563 , -0.42267 , -0.36596 , 0.12273 , -0.092511 , -0.40519 , -0.084045 , 0.10114 , -0.3926 , -0.029798 , -0.2662 , -0.19559 , -0.075464 , 0.07131 , -0.48309 , -0.019021 , 0.49423 , 0.00028556 , 0.08106 , 0.19416 , 0.00084054 , 0.53115 , 0.069583 , 0.30878 , -0.16643 , -0.026291 , 0.38379 , 0.50059 , -0.53594 , -0.28638 , 0.37212 , -0.44905 , 0.44363 , 0.01414 , -0.31281 , 0.43897 , 0.090365 , -0.51925 , 0.17622 , 0.35899 , -0.388 , -0.036146 , 0.53654 , -0.1379 , 0.46033 , -0.36426 , -0.51956 , -0.084741 , 0.20375 , -0.20879 , -0.13447 , 0.34352 , -0.32432 , -0.20247 , -0.45219 , -0.3114 , 0.24505 , -0.083951 , 0.23035 , -0.30295 , 0.30972 , 0.028167 , -0.44292 , 0.41391 , -0.22493 , -0.12975 , -0.163 , -0.53987 , -0.21171 , -0.54145 , 0.12609 , -0.080698 , 0.040559 , -0.040591 , 0.41627 , -0.47606 , -0.25297 , 0.51085 , -0.20487 , 0.27565 , -0.42918 , -0.29596 , -0.24222 , 0.31079 , 0.052846 , -0.013232 , -0.10747 , 0.21718 , 0.49894 , -0.41927 , -0.36252 , 0.29682 , 0.48155 , 0.14915 , -0.098248 , -0.12913 , -0.32764 , 0.010045 , 0.24628 , -0.53413 , 0.065074 , 0.039831 , 0.31714 , 0.093487 , -0.22003 , 0.34886 , 0.37217 , 0.10217 , -0.53436 , -0.049081 , 0.52527 , 0.068685 , 0.27133 , 0.0031221 , 0.18593 , -0.45724 , -0.16345 , 0.39594 , -0.015962 , -0.069537 , 0.36635 , 0.52031 , -0.37068 , 0.32639 , 0.36991 , -0.3419 , -0.093731 , 0.3124 , -0.23413 , -0.28888 , -0.025687 , -0.27212 , 0.37024 , 0.21112 , -0.118 , -0.37629 , -0.41248 , 0.048335 , -0.41036 , -0.2483 , -0.14721 , -0.10204 , 0.36277 , -0.27307 , 0.27017 , -0.16687 , 0.079883 , 0.42454 , 0.44547 , -0.25542 , 0.21606 , 0.047524 , -0.26081 , -0.45067 , 0.28547 , 0.4304 , 0.27773 , 0.25735 , -0.057085 , -0.17188 , -0.059101 , 0.3709 , -0.54234 , -0.43161 , 0.035947 , 0.39347 , -0.052967 , 0.11991 , 0.28647 , 0.19851 , 0.44191 , -0.25738 , 0.097025 , 0.055415 , 0.45101 , -0.18302 , -0.4336 , -0.40715 , -0.26009 , 0.44376 , 0.22898 , 0.16317 , -0.049781 , -0.39171 , -0.45436 , 0.0063516 , -0.18887 , -0.44237 , -0.16966 , -0.16166 , 0.30487 , -0.26893 , 0.52784 , -0.4828 , -0.2379 , 0.38542 , 0.34065 , -0.13584 , -0.39507 , 0.292 , -0.064576 , 0.44992 , 0.38687 , 0.38762 , -0.13723 , 0.24304 , -0.25919 , -0.23592 , -0.16201 , -0.10797 , -0.064879 , 0.29997 , 0.35496 , 0.040786 , -0.35007 , 0.38789 , -0.15498 , -0.15759 , 0.07224 , -0.36945 , 0.18746 , -0.34249 , -0.36879 , -0.20154 , 0.061779 , -0.073078 , 0.19187 , -0.19955 , 0.37717 , -0.18949 , -0.54227 , 0.54145 , 0.2583 , -0.31814 , -0.21199 , 0.37992 , 0.15956 , -0.10309 , 0.2234 , 0.32783 , 0.3771 , -0.31839 , 0.17589 , -0.43926 , -0.098158 , -0.089941 , 0.020064 , 0.46082 , -0.27499 , 0.03183 , -0.47407 , 0.46537 , -0.003658 , 0.51691 , -0.50577 , -0.46885 , -0.49941 , 0.46406 , 0.48075 , -0.46346 , 0.48044 , 0.46013 , 0.45855 , 0.52394 , -0.48915 , -0.50106 , -0.51845 , 0.46587 , 0.46564 , -0.47473 , -0.47969 , 0.45766 , -0.47216 , 0.5172 , 0.45773 , -0.45855 , -0.53918 , 0.52593 , -0.53463 }; - double Zshift[299] = { 0.5415 , -0.026175 , 0.38234 , -0.37879 , -0.031663 , -0.50704 , 0.24111 , 0.090023 , -0.091293 , -0.074906 , -0.2646 , 0.16727 , 0.064955 , -0.11888 , 0.37096 , -0.54272 , 0.34296 , 0.40407 , 0.51143 , -0.22603 , 0.22583 , -0.37372 , 0.42521 , -0.33813 , 0.28935 , 0.47852 , 0.45326 , -0.26711 , 0.24635 , -0.1562 , 0.43203 , 0.25527 , -0.45837 , 0.3046 , 0.24536 , 0.5239 , -0.21266 , 0.059282 , -0.3272 , 0.4344 , -0.039987 , 0.37979 , -0.08379 , 0.18575 , -0.27354 , 0.3139 , 0.12818 , -0.3746 , 0.18782 , 0.3387 , 0.28979 , 0.29479 , -0.38265 , 0.43713 , 0.50258 , 0.52507 , 0.37962 , 0.43927 , -0.3569 , -0.39338 , 0.33268 , -0.34848 , 0.1981 , -0.32482 , 0.40577 , 0.51918 , -0.052263 , -0.12362 , -0.17924 , -0.47367 , 0.43365 , -0.50578 , 0.40676 , 0.53135 , -0.2853 , -0.082201 , 0.51513 , 0.22755 , -0.12373 , 0.53182 , -0.36663 , 0.30579 , -0.099646 , -0.093709 , 0.1277 , -0.0054239 , 0.29654 , 0.37043 , 0.166 , 0.3242 , -0.52519 , -0.035496 , 0.17399 , -0.23772 , 0.01141 , -0.54485 , -0.53264 , 0.17363 , -0.10154 , 0.29367 , -0.0056675 , 0.18975 , -0.31213 , -0.46908 , -0.37156 , 0.18793 , -0.32041 , 0.25593 , -0.16684 , 0.20145 , 0.20993 , 0.11047 , -0.30298 , 0.54115 , -0.27183 , -0.47836 , -0.14523 , 0.51425 , 0.21178 , -0.50743 , -0.54139 , 0.14244 , -0.53099 , -0.24178 , -0.3699 , -0.24031 , 0.54045 , 0.43709 , 0.27353 , 0.039606 , 0.072539 , -0.46702 , 0.0050052 , 0.10811 , -0.48881 , -0.32163 , -0.0020008 , -0.16712 , -0.47333 , -0.0052957 , -0.43963 , -0.46954 , -0.035304 , 0.36634 , 0.40783 , -0.28039 , -0.36128 , 0.053035 , 0.27931 , 0.090446 , 0.46951 , 0.50602 , 0.052007 , -0.25658 , 0.050455 , 0.13301 , -0.27248 , -0.27492 , 0.035256 , -0.43586 , 0.18338 , -0.5343 , 0.17652 , 0.29816 , -0.17234 , 0.055155 , -0.0047934 , -0.037906 , -0.32944 , 0.38764 , -0.3552 , 0.3356 , -0.19353 , 0.24259 , -0.32704 , 0.078286 , 0.37657 , 0.05733 , 0.14018 , -0.43498 , 0.51929 , -0.017455 , -0.086105 , 0.094388 , 0.52401 , -0.54389 , -0.54091 , -0.41362 , -0.43836 , 0.015585 , 0.14916 , -0.47846 , -0.38079 , -0.22913 , 0.041096 , -0.20817 , 0.39094 , 0.5437 , 0.0048242 , -0.43728 , -0.5396 , -0.069328 , -0.1615 , -0.46176 , -0.14909 , 0.28491 , 0.41844 , -0.47852 , 0.36699 , 0.477 , 0.4616 , -0.11209 , 0.023602 , 0.1294 , 0.043565 , -0.35396 , 0.002009 , -0.14754 , -0.52797 , -0.25148 , -0.22665 , -0.35621 , 0.16845 , -0.21548 , -0.21882 , -0.24656 , -0.38865 , 0.45176 , -0.18102 , 0.53679 , -0.28183 , 0.52386 , 0.4389 , 0.47522 , -0.34161 , 0.48019 , -0.4894 , -0.34372 , -0.16902 , -0.39673 , 0.48618 , -0.19908 , 0.38465 , 0.19825 , 0.24221 , 0.34745 , 0.54175 , -0.28974 , -0.25584 , 0.047639 , -0.22256 , 0.44844 , -0.39822 , 0.35743 , -0.14659 , -0.077251 , 0.25557 , -0.40132 , 0.30568 , -0.11616 , 0.24221 , 0.065132 , 0.16769 , -0.19437 , -0.056612 , 0.37653 , -0.41642 , -0.27579 , -0.3475 , 0.25428 , -0.40994 , -0.53469 , -0.30806 , 0.24536 , -0.21266 , 0.37979 , -0.3746 , 0.18782 , 0.43927 , 0.1981 , -0.052263 , 0.37043 , 0.3242 , -0.54485 , 0.17363 , -0.16684 , -0.30298 , -0.50743 , 0.27353 , 0.072539 , -0.46954 , -0.086105 , 0.023602 , 0.1294 , -0.22256 , 0.44844 , -0.27579 , -0.40994 , -0.53469 }; - double Majaxis[299] = { 0.020004 , 0.02004 , 0.020062 , 0.02011 , 0.020123 , 0.020139 , 0.020181 , 0.020182 , 0.02026 , 0.020279 , 0.020296 , 0.020363 , 0.020363 , 0.020375 , 0.020402 , 0.020422 , 0.020423 , 0.020437 , 0.02046 , 0.020466 , 0.020469 , 0.020523 , 0.020523 , 0.020526 , 0.020548 , 0.020586 , 0.020612 , 0.020696 , 0.020771 , 0.020806 , 0.020844 , 0.020865 , 0.020978 , 0.021012 , 0.021104 , 0.021143 , 0.021148 , 0.02121 , 0.021257 , 0.021287 , 0.021329 , 0.021394 , 0.021405 , 0.021414 , 0.021479 , 0.021621 , 0.021632 , 0.021655 , 0.021672 , 0.021705 , 0.021718 , 0.021849 , 0.02188 , 0.021911 , 0.021912 , 0.022019 , 0.022112 , 0.022149 , 0.022181 , 0.022192 , 0.022249 , 0.022271 , 0.022402 , 0.022414 , 0.022494 , 0.022507 , 0.022762 , 0.022839 , 0.022917 , 0.022925 , 0.022981 , 0.022983 , 0.023031 , 0.02304 , 0.023091 , 0.023163 , 0.023312 , 0.023338 , 0.023453 , 0.023519 , 0.023569 , 0.023595 , 0.023677 , 0.02368 , 0.023704 , 0.023793 , 0.023798 , 0.023855 , 0.023909 , 0.02392 , 0.023965 , 0.023975 , 0.024004 , 0.024045 , 0.024291 , 0.024353 , 0.024388 , 0.024492 , 0.024604 , 0.024626 , 0.024644 , 0.024752 , 0.02477 , 0.024776 , 0.024881 , 0.024971 , 0.025214 , 0.025216 , 0.025264 , 0.025365 , 0.02539 , 0.025435 , 0.025443 , 0.025617 , 0.025749 , 0.025759 , 0.025759 , 0.02576 , 0.025769 , 0.025815 , 0.025948 , 0.026073 , 0.026118 , 0.026124 , 0.026274 , 0.026405 , 0.026577 , 0.026608 , 0.026732 , 0.026777 , 0.026902 , 0.026943 , 0.026962 , 0.027083 , 0.027125 , 0.027125 , 0.027209 , 0.027313 , 0.027426 , 0.027528 , 0.027584 , 0.027658 , 0.02772 , 0.02776 , 0.027777 , 0.027796 , 0.027838 , 0.027882 , 0.027914 , 0.027935 , 0.028 , 0.028058 , 0.02836 , 0.028375 , 0.028442 , 0.0285 , 0.028504 , 0.028511 , 0.028559 , 0.028733 , 0.028799 , 0.028827 , 0.029037 , 0.029057 , 0.029218 , 0.02924 , 0.029269 , 0.02933 , 0.02935 , 0.029397 , 0.029459 , 0.029526 , 0.029534 , 0.029655 , 0.029803 , 0.029817 , 0.029966 , 0.030027 , 0.030029 , 0.030087 , 0.030087 , 0.030147 , 0.030235 , 0.030247 , 0.030314 , 0.030408 , 0.030571 , 0.030698 , 0.030702 , 0.030719 , 0.030815 , 0.030821 , 0.030984 , 0.031028 , 0.031106 , 0.031114 , 0.031309 , 0.031337 , 0.031502 , 0.031505 , 0.031629 , 0.031913 , 0.032007 , 0.032405 , 0.032518 , 0.032618 , 0.032664 , 0.03268 , 0.032684 , 0.033117 , 0.033188 , 0.033196 , 0.033267 , 0.03352 , 0.033834 , 0.033843 , 0.034007 , 0.034245 , 0.03437 , 0.034668 , 0.03473 , 0.034838 , 0.035036 , 0.035053 , 0.035149 , 0.035409 , 0.03557 , 0.03572 , 0.035747 , 0.0358 , 0.035874 , 0.036028 , 0.036202 , 0.036219 , 0.036401 , 0.036418 , 0.036456 , 0.036511 , 0.03658 , 0.036974 , 0.037067 , 0.037142 , 0.037223 , 0.03731 , 0.037346 , 0.037352 , 0.037377 , 0.037485 , 0.037835 , 0.038909 , 0.039492 , 0.039608 , 0.039689 , 0.039796 , 0.039898 , 0.039994 , 0.040015 , 0.040017 , 0.040172 , 0.040309 , 0.040405 , 0.040516 , 0.041238 , 0.041243 , 0.041777 , 0.042256 , 0.042554 , 0.042737 , 0.042815 , 0.042964 , 0.043061 , 0.043634 , 0.043867 , 0.021104 , 0.021148 , 0.021394 , 0.021655 , 0.021672 , 0.022149 , 0.022402 , 0.022762 , 0.023855 , 0.02392 , 0.024353 , 0.024492 , 0.025264 , 0.025443 , 0.025815 , 0.026732 , 0.026902 , 0.027658 , 0.030235 , 0.033267 , 0.03352 , 0.039492 , 0.039608 , 0.042737 , 0.043061 , 0.043634 }; - double Minaxis[299] = { 0.014327 , 0.0099816 , 0.0079475 , 0.0067382 , 0.0092416 , 0.0054686 , 0.0079646 , 0.01336 , 0.012604 , 0.013941 , 0.015507 , 0.006454 , 0.0055965 , 0.010408 , 0.013413 , 0.0097163 , 0.015056 , 0.0061028 , 0.0077156 , 0.0051759 , 0.017189 , 0.0052982 , 0.0096657 , 0.01076 , 0.012129 , 0.012807 , 0.0076778 , 0.006741 , 0.0060004 , 0.0056357 , 0.0053628 , 0.016735 , 0.0052267 , 0.0057199 , 0.0083263 , 0.0094517 , 0.012813 , 0.01103 , 0.0098089 , 0.013574 , 0.006371 , 0.012738 , 0.0073692 , 0.013902 , 0.011126 , 0.0098853 , 0.0080003 , 0.0064415 , 0.0066103 , 0.012389 , 0.0060653 , 0.0087545 , 0.010981 , 0.0092382 , 0.015435 , 0.0096992 , 0.011574 , 0.0080925 , 0.011675 , 0.012981 , 0.015948 , 0.015128 , 0.010294 , 0.0080096 , 0.0051034 , 0.010367 , 0.011007 , 0.010025 , 0.005869 , 0.0055645 , 0.0075996 , 0.0079119 , 0.0055819 , 0.0063155 , 0.0088309 , 0.01453 , 0.0050177 , 0.0053662 , 0.010173 , 0.0082155 , 0.0074167 , 0.006434 , 0.015945 , 0.0077343 , 0.0095707 , 0.016882 , 0.013134 , 0.0059642 , 0.0065564 , 0.015614 , 0.017264 , 0.0075763 , 0.006793 , 0.0051688 , 0.01707 , 0.006315 , 0.010919 , 0.0079502 , 0.0096913 , 0.0082356 , 0.0092863 , 0.0052858 , 0.016991 , 0.011849 , 0.0063774 , 0.010478 , 0.012739 , 0.0069143 , 0.01976 , 0.0086271 , 0.009269 , 0.0091104 , 0.0062468 , 0.01799 , 0.012409 , 0.0053492 , 0.0077024 , 0.0050801 , 0.012564 , 0.0075616 , 0.016538 , 0.0069052 , 0.014742 , 0.0055335 , 0.010662 , 0.0087099 , 0.0092536 , 0.010254 , 0.010465 , 0.0065039 , 0.0055155 , 0.019832 , 0.0089958 , 0.0098236 , 0.018973 , 0.007204 , 0.010104 , 0.01323 , 0.014672 , 0.010585 , 0.0058373 , 0.011372 , 0.013203 , 0.0099765 , 0.0070372 , 0.010354 , 0.0055951 , 0.0060131 , 0.013103 , 0.0079449 , 0.0051299 , 0.005036 , 0.010246 , 0.012704 , 0.0057771 , 0.014115 , 0.014807 , 0.0052778 , 0.0084248 , 0.0096462 , 0.0055434 , 0.0095333 , 0.011269 , 0.01221 , 0.012258 , 0.0067901 , 0.006454 , 0.012845 , 0.014736 , 0.010879 , 0.0083323 , 0.0077235 , 0.0051711 , 0.0069054 , 0.017363 , 0.014372 , 0.0072299 , 0.0063376 , 0.010933 , 0.018564 , 0.0061667 , 0.012848 , 0.0064541 , 0.0058952 , 0.0051857 , 0.0072317 , 0.0078115 , 0.0099858 , 0.010605 , 0.013646 , 0.014084 , 0.0094785 , 0.012782 , 0.010161 , 0.007457 , 0.0051096 , 0.0067752 , 0.0070392 , 0.0055331 , 0.013437 , 0.013798 , 0.0061589 , 0.0051074 , 0.015242 , 0.0051894 , 0.0077062 , 0.010107 , 0.010847 , 0.013242 , 0.0052751 , 0.010423 , 0.0070397 , 0.017173 , 0.0094386 , 0.0074332 , 0.0064722 , 0.0092312 , 0.0059999 , 0.0067572 , 0.010947 , 0.008076 , 0.0054722 , 0.0081541 , 0.0082725 , 0.01725 , 0.0089949 , 0.011478 , 0.017171 , 0.0071159 , 0.006895 , 0.011438 , 0.0068836 , 0.008132 , 0.01367 , 0.0088901 , 0.0059138 , 0.0081291 , 0.0059966 , 0.0086854 , 0.013832 , 0.0068204 , 0.005614 , 0.0096036 , 0.014077 , 0.010208 , 0.0060625 , 0.0052894 , 0.011616 , 0.0050841 , 0.0068374 , 0.0096471 , 0.012576 , 0.016383 , 0.0090394 , 0.0075459 , 0.0057784 , 0.0060681 , 0.013247 , 0.0057273 , 0.0099803 , 0.0070866 , 0.0066253 , 0.007665 , 0.0064052 , 0.010079 , 0.0076156 , 0.0070544 , 0.0063735 , 0.0060472 , 0.0063675 , 0.0062031 , 0.0060378 , 0.0056123 , 0.0083263 , 0.012813 , 0.012738 , 0.0064415 , 0.0066103 , 0.0080925 , 0.010294 , 0.011007 , 0.0059642 , 0.015614 , 0.006315 , 0.0079502 , 0.01976 , 0.0062468 , 0.0075616 , 0.010465 , 0.0055155 , 0.011372 , 0.0064541 , 0.017173 , 0.0094386 , 0.0096471 , 0.012576 , 0.0063735 , 0.0062031 , 0.0060378 }; - double Angle[299] = { 1.4558 , 1.0249 , 0.91246 , 3.7799 , 1.4959 , 1.7974 , 5.3369 , 5.7376 , 3.5275 , 2.1432 , 3.5593 , 4.3224 , 2.7564 , 1.51 , 4.5466 , 3.919 , 5.4015 , 0.30619 , 0.67212 , 3.5822 , 6.238 , 5.3461 , 5.0576 , 5.0017 , 2.834 , 6.059 , 2.9888 , 3.6527 , 1.3913 , 1.8141 , 4.7455 , 1.4383 , 1.1027 , 1.1936 , 0.59347 , 1.7009 , 3.6973 , 4.8118 , 1.848 , 2.8246 , 1.5613 , 5.2432 , 5.4165 , 5.8815 , 5.5182 , 5.4343 , 2.1553 , 3.0717 , 6.1326 , 3.7169 , 4.8459 , 1.3129 , 0.15237 , 5.8569 , 5.9889 , 0.86512 , 1.9941 , 2.5237 , 5.433 , 0.58891 , 1.7834 , 1.4294 , 4.8015 , 2.0355 , 1.9812 , 0.89478 , 4.4992 , 1.1769 , 4.2821 , 2.4354 , 4.3865 , 2.0177 , 0.76227 , 4.8369 , 2.8215 , 1.646 , 4.3235 , 4.5098 , 2.9366 , 5.7934 , 4.8433 , 0.20172 , 5.7323 , 3.9258 , 0.23259 , 1.5851 , 5.3528 , 5.6937 , 3.1197 , 4.6992 , 1.5269 , 2.9197 , 5.9799 , 3.9698 , 5.1291 , 0.46843 , 0.32144 , 1.3667 , 3.6631 , 4.3596 , 5.3843 , 5.0461 , 2.8384 , 0.4362 , 4.9122 , 0.91605 , 2.291 , 2.334 , 3.6956 , 3.0292 , 1.1774 , 0.82064 , 1.6694 , 3.2481 , 4.5823 , 2.4318 , 4.2287 , 4.6383 , 4.3096 , 6.0267 , 4.974 , 2.5711 , 5.7808 , 0.86595 , 1.9546 , 1.169 , 0.94583 , 1.6645 , 4.3546 , 4.9469 , 4.3364 , 2.9925 , 0.19103 , 1.8663 , 1.8633 , 3.596 , 1.4591 , 1.9571 , 4.8912 , 6.009 , 4.9117 , 1.4427 , 1.1956 , 3.8217 , 1.4041 , 0.48615 , 5.4622 , 2.4336 , 4.6307 , 1.4259 , 2.5079 , 4.2249 , 0.23295 , 4.5866 , 1.6253 , 3.0094 , 5.5111 , 2.2686 , 4.7023 , 2.9195 , 5.0689 , 5.6642 , 4.5094 , 4.5253 , 1.6656 , 4.3838 , 1.1062 , 6.1138 , 0.32075 , 3.4346 , 4.1934 , 6.0929 , 2.803 , 1.7798 , 1.4638 , 1.1769 , 1.6757 , 3.5648 , 5.805 , 1.7655 , 1.869 , 3.4948 , 5.0538 , 0.5722 , 5.2496 , 0.74496 , 0.93514 , 3.845 , 4.0066 , 1.4639 , 0.98186 , 1.6919 , 0.41886 , 5.0204 , 4.4884 , 1.6724 , 2.3402 , 4.468 , 5.6256 , 5.7988 , 4.1419 , 4.5061 , 2.1176 , 6.0354 , 5.7664 , 3.1422 , 4.2172 , 5.2365 , 5.3768 , 1.6359 , 0.86165 , 4.5322 , 4.5114 , 4.4432 , 4.5294 , 5.1042 , 3.9791 , 1.1958 , 1.8184 , 4.6404 , 1.1193 , 2.8933 , 1.0764 , 2.3314 , 4.668 , 5.0065 , 2.2973 , 5.637 , 1.2619 , 2.4728 , 4.9948 , 2.4295 , 0.80222 , 3.4089 , 1.3484 , 1.6781 , 5.9017 , 2.6379 , 2.663 , 5.0669 , 1.9895 , 3.4627 , 2.2352 , 0.15207 , 0.62638 , 6.1007 , 1.1807 , 5.8529 , 4.8815 , 1.5408 , 1.4216 , 4.0129 , 3.5676 , 0.60916 , 0.28774 , 3.7289 , 5.2765 , 1.9752 , 4.8562 , 2.3279 , 5.9472 , 4.7341 , 0.67569 , 2.1298 , 6.1253 , 1.1864 , 5.4152 , 0.9864 , 0.21133 , 0.53214 , 2.5471 , 1.9962 , 1.5181 , 0.59347 , 3.6973 , 5.2432 , 3.0717 , 6.1326 , 2.5237 , 4.8015 , 4.4992 , 5.6937 , 4.6992 , 0.46843 , 1.3667 , 3.6956 , 1.6694 , 6.0267 , 4.3546 , 4.3364 , 1.4427 , 5.0538 , 4.5114 , 4.4432 , 1.4216 , 4.0129 , 0.9864 , 2.5471 , 1.9962 }; + // B5) circles, same size, 5x5 all aligned + double d_Xshift[25] = { 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.9485484492371699 , 0.5890979596406679 , 0.6829027842212059 , 0.9942515475871702 , 0.9621266398494146 , 0.5890979596406679 , 0.908601239653215 , 0.8622361781698946 , 0.9925757704891546 , 0.8503822186310541 , 0.908601239653215 , 0.0013589198992898233 , 0.9334670539028086 , 0.07588996956074079 , 0.8657927415787832 , 0.0013589198992898233 , 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.9485484492371699 }; + double d_Zshift[25] = { 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.4273171754694547 , 0.5425866165938917 , 0.6201318911085705 , 0.90273532152766 , 0.0019465420865421024 , 0.5425866165938917 , 0.6583670587253173 , 0.052142170900339346 , 0.11051969187091559 , 0.12033430560852221 , 0.6583670587253173 , 0.7117852782330175 , 0.8241369329108513 , 0.8610212856101548 , 0.35619242168110343 , 0.7117852782330175 , 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.4273171754694547 }; + //double d_Xshift[25] = { 0.9485484492371699 , 0.9333762393916095 , 0.3076373730588343 , 0.8635277035926671 , 0.15496802379385022 , 0.5890979596406679 , 0.6829027842212059 , 0.9942515475871702 , 0.9621266398494146 , 0.4259237710938296 , 0.908601239653215 , 0.8622361781698946 , 0.9925757704891546 , 0.8503822186310541 , 0.6854127168974997 , 0.0013589198992898233 , 0.9334670539028086 , 0.07588996956074079 , 0.8657927415787832 , 0.367442674337337 , 0.2509770419357381 , 0.7662147966485621 , 0.49155362059076 , 0.34965262596847924 , 0.22472835082437814 }; + //double d_Zshift[25] = { 0.4273171754694547 , 0.10767404451273999 , 0.46873148134167775 , 0.012067110769540812 , 0.24442697436391425 , 0.5425866165938917 , 0.6201318911085705 , 0.90273532152766 , 0.0019465420865421024 , 0.8767279816239639 , 0.6583670587253173 , 0.052142170900339346 , 0.11051969187091559 , 0.12033430560852221 , 0.8371639193166704 , 0.7117852782330175 , 0.8241369329108513 , 0.8610212856101548 , 0.35619242168110343 , 0.0026585669431200554 , 0.098480050950839 , 0.3672892330306361 , 0.35165850677517885 , 0.40825308767366664 , 0.7289186882099035 }; + + int nellipses = 25; + double Xshift[25]; + double Zshift[25]; + double Majaxis[25]; + double Minaxis[25]; + double Angle[25]; + int kg; + for (int i = 0; i < 5; ++i) { // z idx + for (int j = 0; j < 5; ++j) { // x idx + kg = 5 * i + j; // global idx + Xshift[kg] = ( (1.0 / 4.0) * j - 0.5 ) ;// + (d_Xshift[kg]-0.5)*0.05; // including random delta + Zshift[kg] = ( (1.0 / 4.0) * i - 0.5 ) ;// + (d_Zshift[kg]-0.5)*0.05; // including random delta + Majaxis[kg] = 0.075; + Minaxis[kg] = 0.075; + Angle[kg] = 45.0 / 180.0 * M_PI; + if (j == 1 || j == 3) { + Zshift[kg] += 1.0 / 8.0 ; + } + } + } bool isInsideSomeEllipse = false; bool isInsideThisEllipse = false; diff --git a/SETS/AnisoViscTest_evolv_multi_ellipses.txt b/SETS/AnisoViscTest_evolv_multi_ellipses.txt index 9e5ca7ce..7a9c4bc0 100644 --- a/SETS/AnisoViscTest_evolv_multi_ellipses.txt +++ b/SETS/AnisoViscTest_evolv_multi_ellipses.txt @@ -4,7 +4,7 @@ irestart = 0 /**** OUTPUT FILES ****/ writer = 1 -writer_step = 10 +writer_step = 1 writer_markers = 0 writer_debug = 0 writer_energies = 0 @@ -26,9 +26,9 @@ V = 1 T = 1 /**** SPACE ****/ -Nx = 501 -Nz = 501 -Nt = 10000 +Nx = 251 +Nz = 251 +Nt = 1 xmin = -5.000000e-1 zmin = -5.000000e-1 xmax = 5.000000e-1 diff --git a/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.c b/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.c new file mode 100644 index 00000000..bc85e0fb --- /dev/null +++ b/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.c @@ -0,0 +1,192 @@ +#include "mdoodz.h" +#include "math.h" + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + // MWE) for low-resolution debugging + int nellipses = 46; + double Xshift[46] = { 0.14036 , -0.11268 , 0.24353 , -0.34266 , 0.45344 , 0.49266 , -0.50734 , 0.37634 , 0.067858 , -0.089395 , -0.23548 , 0.31887 , -0.076753 , 0.2086 , -0.0093535 , 0.19594 , -0.031205 , -0.031205 , -0.24553 , -0.47397 , 0.52603 , -0.42756 , 0.57244 , -0.42756 , -0.16365 , -0.40672 , 0.59328 , -0.46635 , 0.53365 , 0.32767 , 0.068486 , 0.068486 , 0.074511 , -0.23201 , 0.42689 , 0.038432 , 0.43358 , -0.56642 , -0.28905 , -0.070306 , -0.11491 , 0.41344 , -0.30113 , -0.33428 , 0.33004 , 0.11228 }; + double Zshift[46] = { 0.14251 , -0.10932 , 0.37856 , 0.1628 , -0.043601 , 0.28552 , 0.28552 , -0.34138 , 0.030389 , -0.24957 , 0.4286 , 0.029191 , 0.015828 , -0.40661 , 0.23162 , -0.16622 , -0.46134 , 0.53866 , -0.33674 , -0.17276 , -0.17276 , 0.44227 , 0.44227 , -0.55773 , 0.27526 , 0.025552 , 0.025552 , -0.32503 , -0.32503 , 0.27232 , 0.4403 , -0.5597 , -0.32427 , -0.022648 , -0.46102 , -0.14104 , 0.15231 , 0.15231 , -0.21928 , 0.4189 , 0.14613 , 0.41121 , 0.31233 , -0.45689 , -0.21632 , 0.2974 }; + double Majaxis[46] = { 0.052437 , 0.03046 , 0.089708 , 0.090078 , 0.037522 , 0.056607 , 0.056607 , 0.14476 , 0.10404 , 0.07289 , 0.079292 , 0.12932 , 0.087105 , 0.082802 , 0.091982 , 0.045612 , 0.09301 , 0.09301 , 0.068281 , 0.091439 , 0.091439 , 0.098052 , 0.098052 , 0.098052 , 0.048567 , 0.11467 , 0.11467 , 0.068854 , 0.068854 , 0.057753 , 0.069777 , 0.069777 , 0.045112 , 0.055955 , 0.04789 , 0.043844 , 0.075793 , 0.075793 , 0.032836 , 0.085728 , 0.063202 , 0.056998 , 0.049149 , 0.048561 , 0.046138 , 0.056277 }; + double Minaxis[46] = { 0.038253 , 0.025612 , 0.035496 , 0.059133 , 0.024537 , 0.022656 , 0.022656 , 0.017574 , 0.04173 , 0.041351 , 0.058487 , 0.03469 , 0.041007 , 0.065536 , 0.026623 , 0.032284 , 0.020823 , 0.020823 , 0.066661 , 0.029949 , 0.029949 , 0.048698 , 0.048698 , 0.048698 , 0.023575 , 0.033936 , 0.033936 , 0.061486 , 0.061486 , 0.040552 , 0.064303 , 0.064303 , 0.029315 , 0.052324 , 0.018565 , 0.040745 , 0.01416 , 0.01416 , 0.028269 , 0.029061 , 0.025401 , 0.031616 , 0.049131 , 0.025632 , 0.038871 , 0.030815 }; + double Angle[46] = { 4.9702 , 2.9206 , 0.99466 , 5.8229 , 3.7018 , 4.1396 , 4.1396 , 0.98391 , 2.0355 , 3.0199 , 6.1515 , 4.6023 , 3.9951 , 4.969 , 5.2839 , 3.1487 , 4.8142 , 4.8142 , 0.98966 , 6.1201 , 6.1201 , 2.4922 , 2.4922 , 2.4922 , 1.2953 , 2.5204 , 2.5204 , 5.7058 , 5.7058 , 4.07 , 0.88427 , 0.88427 , 5.1292 , 1.1315 , 3.3275 , 0.72347 , 6.1036 , 6.1036 , 3.8381 , 5.3507 , 1.041 , 2.8052 , 3.0119 , 2.9069 , 0.64516 , 2.6789 }; + + // A1+A2) circles, same size, iso+aniso + //int nellipses = 269; + //double Xshift[269] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[269] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.51941 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[269] = { 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 }; + //double Minaxis[269] = { 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 }; + //double Angle[269] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A3) circles, var size + //int nellipses = 268; + //double Xshift[268] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[268] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[268] = { 0.021814 , 0.012685 , 0.019766 , 0.01598 , 0.026829 , 0.011001 , 0.021819 , 0.024398 , 0.024398 , 0.019726 , 0.023293 , 0.023213 , 0.017549 , 0.019494 , 0.02067 , 0.0098893 , 0.016756 , 0.017046 , 0.015631 , 0.018123 , 0.021512 , 0.01464 , 0.021939 , 0.024802 , 0.023591 , 0.025699 , 0.021967 , 0.01075 , 0.025369 , 0.011898 , 0.022891 , 0.021745 , 0.02167 , 0.018424 , 0.014455 , 0.017608 , 0.026781 , 0.021205 , 0.016512 , 0.02563 , 0.011344 , 0.026508 , 0.024858 , 0.022894 , 0.020216 , 0.02024 , 0.02024 , 0.020521 , 0.020521 , 0.024218 , 0.01496 , 0.026217 , 0.012825 , 0.014689 , 0.022165 , 0.014978 , 0.024558 , 0.025001 , 0.009741 , 0.024535 , 0.011841 , 0.019421 , 0.010568 , 0.025261 , 0.025791 , 0.018325 , 0.013608 , 0.026804 , 0.021424 , 0.025321 , 0.018858 , 0.018858 , 0.02158 , 0.025444 , 0.025444 , 0.017835 , 0.017835 , 0.017458 , 0.0123 , 0.013084 , 0.023715 , 0.022739 , 0.022659 , 0.024077 , 0.0097258 , 0.017477 , 0.017477 , 0.023021 , 0.021067 , 0.023706 , 0.020966 , 0.011828 , 0.015379 , 0.015849 , 0.025424 , 0.019007 , 0.022218 , 0.0206 , 0.0206 , 0.014359 , 0.010276 , 0.023108 , 0.026647 , 0.020078 , 0.020078 , 0.011713 , 0.01736 , 0.010442 , 0.016831 , 0.022485 , 0.017512 , 0.010187 , 0.010299 , 0.017066 , 0.020598 , 0.021624 , 0.010884 , 0.0092785 , 0.018515 , 0.011116 , 0.023879 , 0.017008 , 0.009787 , 0.015632 , 0.012052 , 0.022754 , 0.022754 , 0.024344 , 0.014258 , 0.014258 , 0.025199 , 0.020066 , 0.020937 , 0.0097336 , 0.022589 , 0.018006 , 0.017985 , 0.019318 , 0.016772 , 0.016772 , 0.020315 , 0.017066 , 0.023335 , 0.019714 , 0.023078 , 0.023078 , 0.011498 , 0.023883 , 0.010009 , 0.012244 , 0.024303 , 0.016999 , 0.017763 , 0.019376 , 0.021358 , 0.017061 , 0.022174 , 0.016017 , 0.020546 , 0.021105 , 0.018862 , 0.018862 , 0.021519 , 0.021519 , 0.020317 , 0.020317 , 0.014478 , 0.023612 , 0.0091034 , 0.017959 , 0.014195 , 0.013999 , 0.013999 , 0.015933 , 0.0092386 , 0.021007 , 0.024838 , 0.019921 , 0.018833 , 0.026233 , 0.02394 , 0.023047 , 0.016013 , 0.020058 , 0.022475 , 0.016515 , 0.018513 , 0.0261 , 0.02515 , 0.014565 , 0.018572 , 0.021599 , 0.016339 , 0.010223 , 0.01492 , 0.016681 , 0.023043 , 0.022781 , 0.023132 , 0.013779 , 0.013215 , 0.025072 , 0.025526 , 0.021034 , 0.011281 , 0.022689 , 0.019155 , 0.021293 , 0.011639 , 0.013969 , 0.018149 , 0.02263 , 0.013409 , 0.011299 , 0.024968 , 0.011997 , 0.022524 , 0.0090754 , 0.01318 , 0.020063 , 0.013137 , 0.017669 , 0.021127 , 0.012849 , 0.011777 , 0.0108 , 0.018972 , 0.014944 , 0.012911 , 0.017576 , 0.013668 , 0.012133 , 0.024158 , 0.014167 , 0.023577 , 0.020389 , 0.021533 , 0.010036 , 0.01501 , 0.019797 , 0.012982 , 0.023152 , 0.021316 , 0.023982 , 0.021229 , 0.0139 , 0.011083 , 0.012193 , 0.02367 , 0.021089 , 0.01204 , 0.012245 , 0.020131 , 0.0096595 , 0.016933 , 0.020146 , 0.019118 , 0.018727 , 0.011982 , 0.024482 , 0.024482 , 0.022129 , 0.011161 , 0.0092531 , 0.023668 , 0.015553 , 0.014525 , 0.010804 }; + //double Minaxis[268] = { 0.021814 , 0.012685 , 0.019766 , 0.01598 , 0.026829 , 0.011001 , 0.021819 , 0.024398 , 0.024398 , 0.019726 , 0.023293 , 0.023213 , 0.017549 , 0.019494 , 0.02067 , 0.0098893 , 0.016756 , 0.017046 , 0.015631 , 0.018123 , 0.021512 , 0.01464 , 0.021939 , 0.024802 , 0.023591 , 0.025699 , 0.021967 , 0.01075 , 0.025369 , 0.011898 , 0.022891 , 0.021745 , 0.02167 , 0.018424 , 0.014455 , 0.017608 , 0.026781 , 0.021205 , 0.016512 , 0.02563 , 0.011344 , 0.026508 , 0.024858 , 0.022894 , 0.020216 , 0.02024 , 0.02024 , 0.020521 , 0.020521 , 0.024218 , 0.01496 , 0.026217 , 0.012825 , 0.014689 , 0.022165 , 0.014978 , 0.024558 , 0.025001 , 0.009741 , 0.024535 , 0.011841 , 0.019421 , 0.010568 , 0.025261 , 0.025791 , 0.018325 , 0.013608 , 0.026804 , 0.021424 , 0.025321 , 0.018858 , 0.018858 , 0.02158 , 0.025444 , 0.025444 , 0.017835 , 0.017835 , 0.017458 , 0.0123 , 0.013084 , 0.023715 , 0.022739 , 0.022659 , 0.024077 , 0.0097258 , 0.017477 , 0.017477 , 0.023021 , 0.021067 , 0.023706 , 0.020966 , 0.011828 , 0.015379 , 0.015849 , 0.025424 , 0.019007 , 0.022218 , 0.0206 , 0.0206 , 0.014359 , 0.010276 , 0.023108 , 0.026647 , 0.020078 , 0.020078 , 0.011713 , 0.01736 , 0.010442 , 0.016831 , 0.022485 , 0.017512 , 0.010187 , 0.010299 , 0.017066 , 0.020598 , 0.021624 , 0.010884 , 0.0092785 , 0.018515 , 0.011116 , 0.023879 , 0.017008 , 0.009787 , 0.015632 , 0.012052 , 0.022754 , 0.022754 , 0.024344 , 0.014258 , 0.014258 , 0.025199 , 0.020066 , 0.020937 , 0.0097336 , 0.022589 , 0.018006 , 0.017985 , 0.019318 , 0.016772 , 0.016772 , 0.020315 , 0.017066 , 0.023335 , 0.019714 , 0.023078 , 0.023078 , 0.011498 , 0.023883 , 0.010009 , 0.012244 , 0.024303 , 0.016999 , 0.017763 , 0.019376 , 0.021358 , 0.017061 , 0.022174 , 0.016017 , 0.020546 , 0.021105 , 0.018862 , 0.018862 , 0.021519 , 0.021519 , 0.020317 , 0.020317 , 0.014478 , 0.023612 , 0.0091034 , 0.017959 , 0.014195 , 0.013999 , 0.013999 , 0.015933 , 0.0092386 , 0.021007 , 0.024838 , 0.019921 , 0.018833 , 0.026233 , 0.02394 , 0.023047 , 0.016013 , 0.020058 , 0.022475 , 0.016515 , 0.018513 , 0.0261 , 0.02515 , 0.014565 , 0.018572 , 0.021599 , 0.016339 , 0.010223 , 0.01492 , 0.016681 , 0.023043 , 0.022781 , 0.023132 , 0.013779 , 0.013215 , 0.025072 , 0.025526 , 0.021034 , 0.011281 , 0.022689 , 0.019155 , 0.021293 , 0.011639 , 0.013969 , 0.018149 , 0.02263 , 0.013409 , 0.011299 , 0.024968 , 0.011997 , 0.022524 , 0.0090754 , 0.01318 , 0.020063 , 0.013137 , 0.017669 , 0.021127 , 0.012849 , 0.011777 , 0.0108 , 0.018972 , 0.014944 , 0.012911 , 0.017576 , 0.013668 , 0.012133 , 0.024158 , 0.014167 , 0.023577 , 0.020389 , 0.021533 , 0.010036 , 0.01501 , 0.019797 , 0.012982 , 0.023152 , 0.021316 , 0.023982 , 0.021229 , 0.0139 , 0.011083 , 0.012193 , 0.02367 , 0.021089 , 0.01204 , 0.012245 , 0.020131 , 0.0096595 , 0.016933 , 0.020146 , 0.019118 , 0.018727 , 0.011982 , 0.024482 , 0.024482 , 0.022129 , 0.011161 , 0.0092531 , 0.023668 , 0.015553 , 0.014525 , 0.010804 }; + //double Angle[268] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A4) ellipses, same size + //int nellipses = 274; + //double Xshift[274] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.52653 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , -0.52637 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.52012 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[274] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.51941 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , 0.52854 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[274] = { 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 }; + //double Minaxis[274] = { 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 }; + //double Angle[274] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A5) ellipses, var size + //int nellipses = 271; + //double Xshift[271] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.52653 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[271] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.53722 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[271] = { 0.024691 , 0.020391 , 0.032143 , 0.03399 , 0.030834 , 0.020343 , 0.029908 , 0.028401 , 0.028401 , 0.023032 , 0.025078 , 0.023907 , 0.026733 , 0.040349 , 0.043391 , 0.017732 , 0.018083 , 0.018009 , 0.024957 , 0.019928 , 0.044568 , 0.023231 , 0.027203 , 0.032535 , 0.026989 , 0.049512 , 0.030912 , 0.012006 , 0.045045 , 0.022069 , 0.031292 , 0.026398 , 0.028207 , 0.019884 , 0.014686 , 0.023105 , 0.030396 , 0.031892 , 0.02138 , 0.058549 , 0.01387 , 0.064729 , 0.02804 , 0.025132 , 0.021393 , 0.025399 , 0.025399 , 0.036528 , 0.036528 , 0.032518 , 0.016857 , 0.034558 , 0.014624 , 0.017482 , 0.028107 , 0.018841 , 0.028656 , 0.040688 , 0.040688 , 0.020634 , 0.034982 , 0.016898 , 0.028593 , 0.012886 , 0.071323 , 0.071323 , 0.028958 , 0.050177 , 0.014106 , 0.027331 , 0.059915 , 0.041006 , 0.024794 , 0.024794 , 0.045971 , 0.068782 , 0.068782 , 0.020854 , 0.020854 , 0.018689 , 0.030292 , 0.022844 , 0.02834 , 0.025516 , 0.02732 , 0.026547 , 0.012048 , 0.027713 , 0.027713 , 0.033867 , 0.036831 , 0.054139 , 0.038312 , 0.023348 , 0.026284 , 0.018436 , 0.038959 , 0.02008 , 0.042862 , 0.039783 , 0.039783 , 0.029421 , 0.011095 , 0.036799 , 0.050276 , 0.02107 , 0.02107 , 0.011913 , 0.030651 , 0.011663 , 0.0175 , 0.024129 , 0.041915 , 0.013024 , 0.01158 , 0.018324 , 0.027144 , 0.03621 , 0.017492 , 0.018095 , 0.018806 , 0.01402 , 0.054247 , 0.037359 , 0.011661 , 0.019296 , 0.027763 , 0.04332 , 0.04332 , 0.043284 , 0.015939 , 0.015939 , 0.037587 , 0.027177 , 0.027302 , 0.0098417 , 0.037048 , 0.019075 , 0.020831 , 0.029755 , 0.026454 , 0.026454 , 0.022831 , 0.023466 , 0.038743 , 0.022172 , 0.023283 , 0.023283 , 0.024152 , 0.025877 , 0.020762 , 0.017652 , 0.024558 , 0.034604 , 0.02702 , 0.04725 , 0.022061 , 0.027743 , 0.03213 , 0.022541 , 0.0308 , 0.024059 , 0.020025 , 0.020025 , 0.023127 , 0.023127 , 0.033779 , 0.033779 , 0.016145 , 0.02464 , 0.011569 , 0.030084 , 0.014427 , 0.02163 , 0.02163 , 0.019215 , 0.027219 , 0.027219 , 0.027272 , 0.033828 , 0.022704 , 0.0191 , 0.071963 , 0.027631 , 0.038214 , 0.02035 , 0.023515 , 0.035952 , 0.021311 , 0.026324 , 0.050484 , 0.032081 , 0.042139 , 0.023397 , 0.029904 , 0.018047 , 0.020221 , 0.030412 , 0.024024 , 0.023167 , 0.046699 , 0.032627 , 0.015706 , 0.033936 , 0.0422 , 0.036404 , 0.033944 , 0.016965 , 0.026772 , 0.020973 , 0.030841 , 0.018082 , 0.026576 , 0.039003 , 0.034278 , 0.015792 , 0.01276 , 0.030154 , 0.016811 , 0.03888 , 0.013006 , 0.015309 , 0.021041 , 0.014044 , 0.039373 , 0.026322 , 0.033793 , 0.013975 , 0.015662 , 0.031778 , 0.022092 , 0.013433 , 0.019503 , 0.016114 , 0.023423 , 0.030807 , 0.015767 , 0.030581 , 0.021738 , 0.028652 , 0.013856 , 0.019447 , 0.034535 , 0.01891 , 0.040701 , 0.043531 , 0.02722 , 0.030786 , 0.029463 , 0.016034 , 0.015993 , 0.030985 , 0.023031 , 0.031089 , 0.014064 , 0.023966 , 0.010684 , 0.020221 , 0.045593 , 0.020284 , 0.025045 , 0.01722 , 0.027413 , 0.027413 , 0.028535 , 0.01861 , 0.012612 , 0.035936 , 0.017029 , 0.016053 , 0.019248 }; + //double Minaxis[271] = { 0.019273 , 0.0078917 , 0.012155 , 0.007513 , 0.023344 , 0.0059486 , 0.015917 , 0.020958 , 0.020958 , 0.016895 , 0.021634 , 0.022538 , 0.011521 , 0.0094185 , 0.0098469 , 0.0055152 , 0.015526 , 0.016135 , 0.0097904 , 0.016482 , 0.010383 , 0.009226 , 0.017694 , 0.018907 , 0.020621 , 0.013339 , 0.01561 , 0.009625 , 0.014287 , 0.006415 , 0.016745 , 0.017911 , 0.016649 , 0.017071 , 0.014226 , 0.013418 , 0.023596 , 0.014099 , 0.012753 , 0.01122 , 0.0092782 , 0.010855 , 0.022036 , 0.020855 , 0.019103 , 0.016128 , 0.016128 , 0.011529 , 0.011529 , 0.018037 , 0.013276 , 0.01989 , 0.011248 , 0.012342 , 0.01748 , 0.011906 , 0.021046 , 0.015362 , 0.015362 , 0.0045985 , 0.017208 , 0.0082977 , 0.013192 , 0.0086674 , 0.008947 , 0.008947 , 0.022971 , 0.0066928 , 0.013127 , 0.026287 , 0.0076608 , 0.015636 , 0.014343 , 0.014343 , 0.01013 , 0.009412 , 0.009412 , 0.015253 , 0.015253 , 0.016308 , 0.0049943 , 0.007494 , 0.019844 , 0.020264 , 0.018792 , 0.021836 , 0.0078512 , 0.011022 , 0.011022 , 0.015648 , 0.01205 , 0.010381 , 0.011473 , 0.0059917 , 0.0089986 , 0.013625 , 0.016592 , 0.017992 , 0.011518 , 0.010666 , 0.010666 , 0.0070076 , 0.0095174 , 0.01451 , 0.014123 , 0.019133 , 0.019133 , 0.011516 , 0.0098319 , 0.0093484 , 0.016189 , 0.020952 , 0.0073161 , 0.0079689 , 0.0091595 , 0.015895 , 0.015631 , 0.012914 , 0.0067728 , 0.0047578 , 0.018229 , 0.008814 , 0.010511 , 0.0077432 , 0.0082142 , 0.012664 , 0.0052318 , 0.011952 , 0.011952 , 0.013692 , 0.012754 , 0.012754 , 0.016894 , 0.014816 , 0.016056 , 0.0096267 , 0.013773 , 0.016998 , 0.015527 , 0.012542 , 0.010634 , 0.010634 , 0.018077 , 0.012411 , 0.014054 , 0.017528 , 0.022875 , 0.022875 , 0.0054738 , 0.022043 , 0.0048253 , 0.0084935 , 0.024051 , 0.0083501 , 0.011678 , 0.0079458 , 0.020677 , 0.010492 , 0.015303 , 0.011381 , 0.013705 , 0.018513 , 0.017767 , 0.017767 , 0.020022 , 0.020022 , 0.01222 , 0.01222 , 0.012984 , 0.022627 , 0.0071635 , 0.010721 , 0.013967 , 0.0090604 , 0.0090604 , 0.013212 , 0.0031357 , 0.0031357 , 0.016181 , 0.018238 , 0.017479 , 0.01857 , 0.0095628 , 0.020741 , 0.0139 , 0.012601 , 0.01711 , 0.01405 , 0.012798 , 0.01302 , 0.013494 , 0.019716 , 0.0050341 , 0.014742 , 0.0156 , 0.014793 , 0.0051683 , 0.0073197 , 0.011582 , 0.02292 , 0.011114 , 0.016401 , 0.012088 , 0.0051457 , 0.014896 , 0.017898 , 0.013035 , 0.0075009 , 0.019229 , 0.017495 , 0.0147 , 0.007491 , 0.0073426 , 0.0084454 , 0.014941 , 0.011386 , 0.010006 , 0.020673 , 0.008562 , 0.013049 , 0.0063325 , 0.011347 , 0.01913 , 0.012289 , 0.0079291 , 0.016957 , 0.0048858 , 0.0099247 , 0.0074476 , 0.011327 , 0.010108 , 0.012408 , 0.01584 , 0.011593 , 0.0062848 , 0.018944 , 0.01273 , 0.018178 , 0.019124 , 0.016182 , 0.0072685 , 0.011585 , 0.011349 , 0.0089124 , 0.01317 , 0.010438 , 0.021129 , 0.014639 , 0.0065576 , 0.0076606 , 0.0092965 , 0.018082 , 0.01931 , 0.0046628 , 0.010662 , 0.016909 , 0.0087331 , 0.01418 , 0.0089021 , 0.018019 , 0.014002 , 0.0083381 , 0.021864 , 0.021864 , 0.017162 , 0.0066936 , 0.006789 , 0.015588 , 0.014205 , 0.013142 , 0.0060648 }; + //double Angle[271] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // scaling geometry values + int i; + for (i = 0; i < nellipses; ++i) { + Xshift[i] = Xshift[i] / input->scaling.L; + Zshift[i] = Zshift[i] / input->scaling.L; + Majaxis[i] = Majaxis[i] / input->scaling.L; + Minaxis[i] = Minaxis[i] / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + } + + bool isInsideSomeEllipse = false; + bool isInsideThisEllipse = false; + for (i = 0; i < nellipses; ++i) { + isInsideThisEllipse = ((coordinates.x - Xshift[i])*cos(Angle[i]) + (coordinates.z - Zshift[i])*sin(Angle[i]))*((coordinates.x - Xshift[i])*cos(Angle[i]) + (coordinates.z - Zshift[i])*sin(Angle[i]))/(Majaxis[i] * Majaxis[i]) + (-(coordinates.z - Zshift[i])*cos(Angle[i]) + (coordinates.x - Xshift[i])*sin(Angle[i]))*(-(coordinates.z - Zshift[i])*cos(Angle[i]) + (coordinates.x - Xshift[i])*sin(Angle[i]))/ (Minaxis[i] * Minaxis[i]) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + if (isInsideThisEllipse) { + isInsideSomeEllipse = true; + } + } + if (isInsideSomeEllipse) { + return 1; + } else { + return 0; + } +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // MWE) for low-resolution debugging + int nellipses = 46; + double Xshift[46] = { 0.14036 , -0.11268 , 0.24353 , -0.34266 , 0.45344 , 0.49266 , -0.50734 , 0.37634 , 0.067858 , -0.089395 , -0.23548 , 0.31887 , -0.076753 , 0.2086 , -0.0093535 , 0.19594 , -0.031205 , -0.031205 , -0.24553 , -0.47397 , 0.52603 , -0.42756 , 0.57244 , -0.42756 , -0.16365 , -0.40672 , 0.59328 , -0.46635 , 0.53365 , 0.32767 , 0.068486 , 0.068486 , 0.074511 , -0.23201 , 0.42689 , 0.038432 , 0.43358 , -0.56642 , -0.28905 , -0.070306 , -0.11491 , 0.41344 , -0.30113 , -0.33428 , 0.33004 , 0.11228 }; + double Zshift[46] = { 0.14251 , -0.10932 , 0.37856 , 0.1628 , -0.043601 , 0.28552 , 0.28552 , -0.34138 , 0.030389 , -0.24957 , 0.4286 , 0.029191 , 0.015828 , -0.40661 , 0.23162 , -0.16622 , -0.46134 , 0.53866 , -0.33674 , -0.17276 , -0.17276 , 0.44227 , 0.44227 , -0.55773 , 0.27526 , 0.025552 , 0.025552 , -0.32503 , -0.32503 , 0.27232 , 0.4403 , -0.5597 , -0.32427 , -0.022648 , -0.46102 , -0.14104 , 0.15231 , 0.15231 , -0.21928 , 0.4189 , 0.14613 , 0.41121 , 0.31233 , -0.45689 , -0.21632 , 0.2974 }; + double Majaxis[46] = { 0.052437 , 0.03046 , 0.089708 , 0.090078 , 0.037522 , 0.056607 , 0.056607 , 0.14476 , 0.10404 , 0.07289 , 0.079292 , 0.12932 , 0.087105 , 0.082802 , 0.091982 , 0.045612 , 0.09301 , 0.09301 , 0.068281 , 0.091439 , 0.091439 , 0.098052 , 0.098052 , 0.098052 , 0.048567 , 0.11467 , 0.11467 , 0.068854 , 0.068854 , 0.057753 , 0.069777 , 0.069777 , 0.045112 , 0.055955 , 0.04789 , 0.043844 , 0.075793 , 0.075793 , 0.032836 , 0.085728 , 0.063202 , 0.056998 , 0.049149 , 0.048561 , 0.046138 , 0.056277 }; + double Minaxis[46] = { 0.038253 , 0.025612 , 0.035496 , 0.059133 , 0.024537 , 0.022656 , 0.022656 , 0.017574 , 0.04173 , 0.041351 , 0.058487 , 0.03469 , 0.041007 , 0.065536 , 0.026623 , 0.032284 , 0.020823 , 0.020823 , 0.066661 , 0.029949 , 0.029949 , 0.048698 , 0.048698 , 0.048698 , 0.023575 , 0.033936 , 0.033936 , 0.061486 , 0.061486 , 0.040552 , 0.064303 , 0.064303 , 0.029315 , 0.052324 , 0.018565 , 0.040745 , 0.01416 , 0.01416 , 0.028269 , 0.029061 , 0.025401 , 0.031616 , 0.049131 , 0.025632 , 0.038871 , 0.030815 }; + double Angle[46] = { 4.9702 , 2.9206 , 0.99466 , 5.8229 , 3.7018 , 4.1396 , 4.1396 , 0.98391 , 2.0355 , 3.0199 , 6.1515 , 4.6023 , 3.9951 , 4.969 , 5.2839 , 3.1487 , 4.8142 , 4.8142 , 0.98966 , 6.1201 , 6.1201 , 2.4922 , 2.4922 , 2.4922 , 1.2953 , 2.5204 , 2.5204 , 5.7058 , 5.7058 , 4.07 , 0.88427 , 0.88427 , 5.1292 , 1.1315 , 3.3275 , 0.72347 , 6.1036 , 6.1036 , 3.8381 , 5.3507 , 1.041 , 2.8052 , 3.0119 , 2.9069 , 0.64516 , 2.6789 }; + + // A1+A2) circles, same size, isotropic+anisotropic + //int nellipses = 269; + //double Xshift[269] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[269] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.51941 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[269] = { 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 }; + //double Minaxis[269] = { 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 , 0.02 }; + //double Angle[269] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A3) circles, var size + //int nellipses = 268; + //double Xshift[268] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[268] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[268] = { 0.021814 , 0.012685 , 0.019766 , 0.01598 , 0.026829 , 0.011001 , 0.021819 , 0.024398 , 0.024398 , 0.019726 , 0.023293 , 0.023213 , 0.017549 , 0.019494 , 0.02067 , 0.0098893 , 0.016756 , 0.017046 , 0.015631 , 0.018123 , 0.021512 , 0.01464 , 0.021939 , 0.024802 , 0.023591 , 0.025699 , 0.021967 , 0.01075 , 0.025369 , 0.011898 , 0.022891 , 0.021745 , 0.02167 , 0.018424 , 0.014455 , 0.017608 , 0.026781 , 0.021205 , 0.016512 , 0.02563 , 0.011344 , 0.026508 , 0.024858 , 0.022894 , 0.020216 , 0.02024 , 0.02024 , 0.020521 , 0.020521 , 0.024218 , 0.01496 , 0.026217 , 0.012825 , 0.014689 , 0.022165 , 0.014978 , 0.024558 , 0.025001 , 0.009741 , 0.024535 , 0.011841 , 0.019421 , 0.010568 , 0.025261 , 0.025791 , 0.018325 , 0.013608 , 0.026804 , 0.021424 , 0.025321 , 0.018858 , 0.018858 , 0.02158 , 0.025444 , 0.025444 , 0.017835 , 0.017835 , 0.017458 , 0.0123 , 0.013084 , 0.023715 , 0.022739 , 0.022659 , 0.024077 , 0.0097258 , 0.017477 , 0.017477 , 0.023021 , 0.021067 , 0.023706 , 0.020966 , 0.011828 , 0.015379 , 0.015849 , 0.025424 , 0.019007 , 0.022218 , 0.0206 , 0.0206 , 0.014359 , 0.010276 , 0.023108 , 0.026647 , 0.020078 , 0.020078 , 0.011713 , 0.01736 , 0.010442 , 0.016831 , 0.022485 , 0.017512 , 0.010187 , 0.010299 , 0.017066 , 0.020598 , 0.021624 , 0.010884 , 0.0092785 , 0.018515 , 0.011116 , 0.023879 , 0.017008 , 0.009787 , 0.015632 , 0.012052 , 0.022754 , 0.022754 , 0.024344 , 0.014258 , 0.014258 , 0.025199 , 0.020066 , 0.020937 , 0.0097336 , 0.022589 , 0.018006 , 0.017985 , 0.019318 , 0.016772 , 0.016772 , 0.020315 , 0.017066 , 0.023335 , 0.019714 , 0.023078 , 0.023078 , 0.011498 , 0.023883 , 0.010009 , 0.012244 , 0.024303 , 0.016999 , 0.017763 , 0.019376 , 0.021358 , 0.017061 , 0.022174 , 0.016017 , 0.020546 , 0.021105 , 0.018862 , 0.018862 , 0.021519 , 0.021519 , 0.020317 , 0.020317 , 0.014478 , 0.023612 , 0.0091034 , 0.017959 , 0.014195 , 0.013999 , 0.013999 , 0.015933 , 0.0092386 , 0.021007 , 0.024838 , 0.019921 , 0.018833 , 0.026233 , 0.02394 , 0.023047 , 0.016013 , 0.020058 , 0.022475 , 0.016515 , 0.018513 , 0.0261 , 0.02515 , 0.014565 , 0.018572 , 0.021599 , 0.016339 , 0.010223 , 0.01492 , 0.016681 , 0.023043 , 0.022781 , 0.023132 , 0.013779 , 0.013215 , 0.025072 , 0.025526 , 0.021034 , 0.011281 , 0.022689 , 0.019155 , 0.021293 , 0.011639 , 0.013969 , 0.018149 , 0.02263 , 0.013409 , 0.011299 , 0.024968 , 0.011997 , 0.022524 , 0.0090754 , 0.01318 , 0.020063 , 0.013137 , 0.017669 , 0.021127 , 0.012849 , 0.011777 , 0.0108 , 0.018972 , 0.014944 , 0.012911 , 0.017576 , 0.013668 , 0.012133 , 0.024158 , 0.014167 , 0.023577 , 0.020389 , 0.021533 , 0.010036 , 0.01501 , 0.019797 , 0.012982 , 0.023152 , 0.021316 , 0.023982 , 0.021229 , 0.0139 , 0.011083 , 0.012193 , 0.02367 , 0.021089 , 0.01204 , 0.012245 , 0.020131 , 0.0096595 , 0.016933 , 0.020146 , 0.019118 , 0.018727 , 0.011982 , 0.024482 , 0.024482 , 0.022129 , 0.011161 , 0.0092531 , 0.023668 , 0.015553 , 0.014525 , 0.010804 }; + //double Minaxis[268] = { 0.021814 , 0.012685 , 0.019766 , 0.01598 , 0.026829 , 0.011001 , 0.021819 , 0.024398 , 0.024398 , 0.019726 , 0.023293 , 0.023213 , 0.017549 , 0.019494 , 0.02067 , 0.0098893 , 0.016756 , 0.017046 , 0.015631 , 0.018123 , 0.021512 , 0.01464 , 0.021939 , 0.024802 , 0.023591 , 0.025699 , 0.021967 , 0.01075 , 0.025369 , 0.011898 , 0.022891 , 0.021745 , 0.02167 , 0.018424 , 0.014455 , 0.017608 , 0.026781 , 0.021205 , 0.016512 , 0.02563 , 0.011344 , 0.026508 , 0.024858 , 0.022894 , 0.020216 , 0.02024 , 0.02024 , 0.020521 , 0.020521 , 0.024218 , 0.01496 , 0.026217 , 0.012825 , 0.014689 , 0.022165 , 0.014978 , 0.024558 , 0.025001 , 0.009741 , 0.024535 , 0.011841 , 0.019421 , 0.010568 , 0.025261 , 0.025791 , 0.018325 , 0.013608 , 0.026804 , 0.021424 , 0.025321 , 0.018858 , 0.018858 , 0.02158 , 0.025444 , 0.025444 , 0.017835 , 0.017835 , 0.017458 , 0.0123 , 0.013084 , 0.023715 , 0.022739 , 0.022659 , 0.024077 , 0.0097258 , 0.017477 , 0.017477 , 0.023021 , 0.021067 , 0.023706 , 0.020966 , 0.011828 , 0.015379 , 0.015849 , 0.025424 , 0.019007 , 0.022218 , 0.0206 , 0.0206 , 0.014359 , 0.010276 , 0.023108 , 0.026647 , 0.020078 , 0.020078 , 0.011713 , 0.01736 , 0.010442 , 0.016831 , 0.022485 , 0.017512 , 0.010187 , 0.010299 , 0.017066 , 0.020598 , 0.021624 , 0.010884 , 0.0092785 , 0.018515 , 0.011116 , 0.023879 , 0.017008 , 0.009787 , 0.015632 , 0.012052 , 0.022754 , 0.022754 , 0.024344 , 0.014258 , 0.014258 , 0.025199 , 0.020066 , 0.020937 , 0.0097336 , 0.022589 , 0.018006 , 0.017985 , 0.019318 , 0.016772 , 0.016772 , 0.020315 , 0.017066 , 0.023335 , 0.019714 , 0.023078 , 0.023078 , 0.011498 , 0.023883 , 0.010009 , 0.012244 , 0.024303 , 0.016999 , 0.017763 , 0.019376 , 0.021358 , 0.017061 , 0.022174 , 0.016017 , 0.020546 , 0.021105 , 0.018862 , 0.018862 , 0.021519 , 0.021519 , 0.020317 , 0.020317 , 0.014478 , 0.023612 , 0.0091034 , 0.017959 , 0.014195 , 0.013999 , 0.013999 , 0.015933 , 0.0092386 , 0.021007 , 0.024838 , 0.019921 , 0.018833 , 0.026233 , 0.02394 , 0.023047 , 0.016013 , 0.020058 , 0.022475 , 0.016515 , 0.018513 , 0.0261 , 0.02515 , 0.014565 , 0.018572 , 0.021599 , 0.016339 , 0.010223 , 0.01492 , 0.016681 , 0.023043 , 0.022781 , 0.023132 , 0.013779 , 0.013215 , 0.025072 , 0.025526 , 0.021034 , 0.011281 , 0.022689 , 0.019155 , 0.021293 , 0.011639 , 0.013969 , 0.018149 , 0.02263 , 0.013409 , 0.011299 , 0.024968 , 0.011997 , 0.022524 , 0.0090754 , 0.01318 , 0.020063 , 0.013137 , 0.017669 , 0.021127 , 0.012849 , 0.011777 , 0.0108 , 0.018972 , 0.014944 , 0.012911 , 0.017576 , 0.013668 , 0.012133 , 0.024158 , 0.014167 , 0.023577 , 0.020389 , 0.021533 , 0.010036 , 0.01501 , 0.019797 , 0.012982 , 0.023152 , 0.021316 , 0.023982 , 0.021229 , 0.0139 , 0.011083 , 0.012193 , 0.02367 , 0.021089 , 0.01204 , 0.012245 , 0.020131 , 0.0096595 , 0.016933 , 0.020146 , 0.019118 , 0.018727 , 0.011982 , 0.024482 , 0.024482 , 0.022129 , 0.011161 , 0.0092531 , 0.023668 , 0.015553 , 0.014525 , 0.010804 }; + //double Angle[268] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A4) ellipses, same size + //int nellipses = 274; + //double Xshift[274] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.52653 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , -0.52637 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.52012 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[274] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.51941 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , 0.52854 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[274] = { 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 , 0.034641 }; + //double Minaxis[274] = { 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 , 0.011547 }; + //double Angle[274] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + // A5) ellipses, var size + //int nellipses = 271; + //double Xshift[271] = { -0.30974 , 0.41437 , 0.026398 , -0.086268 , 0.19372 , -0.29907 , -0.15527 , 0.48944 , -0.51056 , -0.26405 , 0.020267 , -0.39281 , 0.28111 , -0.08235 , 0.051164 , -0.16069 , -0.26425 , 0.0075611 , 0.25582 , -0.033613 , -0.25124 , -1.9996e-05 , 0.22512 , -0.40701 , -0.3993 , 0.32808 , -0.040873 , 0.28151 , -0.24251 , -0.4612 , -0.20373 , -0.30287 , 0.11236 , 0.069604 , 0.25725 , -0.43992 , 0.092633 , 0.4429 , 0.26808 , -0.071462 , 0.45957 , 0.15675 , 0.16895 , -0.36123 , 0.2166 , -0.48964 , 0.51036 , -0.20284 , -0.20284 , -0.2424 , -0.34026 , 0.40872 , -0.01918 , 0.015498 , -0.42252 , -0.26149 , 0.31179 , 0.47347 , -0.52653 , -0.38406 , 0.30573 , -0.052594 , -0.24626 , -0.13737 , -0.13568 , -0.13568 , 0.43058 , -0.04408 , -0.091522 , -0.012383 , 0.36386 , 0.23287 , 0.48616 , -0.51384 , -0.21095 , 0.087401 , 0.087401 , -0.49176 , 0.50824 , 0.41264 , 0.45231 , 0.30981 , 0.25284 , 0.32883 , -0.47535 , -0.10055 , -0.40027 , -0.31297 , -0.31297 , -0.36003 , -0.44611 , -0.36726 , -0.31095 , 0.1068 , -0.39982 , 0.25603 , -0.00093784 , 0.18308 , 0.13662 , -0.49038 , 0.50962 , -0.056193 , 0.01996 , 0.18308 , -0.13048 , -0.36642 , -0.36642 , 0.16807 , -0.24499 , -0.32202 , 0.10327 , 0.17259 , 0.41989 , 0.10276 , -0.17241 , -0.42452 , -0.29008 , -0.12712 , 0.27615 , 0.054291 , 0.11133 , -0.3661 , -0.2931 , -0.46745 , 0.09855 , 0.048009 , -0.080695 , 0.30906 , 0.30906 , -0.1932 , -0.49681 , 0.50319 , 0.43282 , 0.47363 , 0.29377 , 0.0012649 , -0.33702 , 0.2267 , 0.02044 , 0.39761 , -0.26752 , -0.26752 , -0.018118 , -0.18914 , 0.38319 , 0.31046 , 0.42106 , 0.42106 , 0.39086 , 0.086467 , -0.098862 , 0.35198 , -0.15457 , 0.35829 , -0.21108 , -0.17468 , 0.012866 , 0.32948 , 0.11278 , 0.22532 , 0.33162 , 0.46364 , 0.19401 , 0.19401 , -0.47969 , 0.52031 , -0.49748 , 0.50252 , 0.47988 , -0.45818 , -0.35075 , -0.32307 , -0.020485 , 0.49312 , -0.50688 , -0.41441 , -0.4618 , -0.4618 , 0.048469 , -0.39697 , -0.14023 , 0.23731 , 0.37993 , -0.32485 , -0.099383 , 0.17233 , -0.10653 , 0.29028 , 0.078393 , 0.3931 , -0.45998 , 0.18507 , -0.26174 , -0.19273 , 0.26838 , 0.2122 , -0.07792 , 0.18409 , 0.36114 , -0.039375 , 0.24278 , -0.46476 , -0.18414 , -0.39514 , 0.03407 , -0.18034 , -0.0851 , 0.16461 , 0.12542 , 0.11696 , 0.41426 , 0.247 , 0.25175 , 0.0013497 , -0.27296 , 0.4549 , -0.18874 , -0.033957 , 0.16871 , 0.37953 , -0.25735 , -0.29345 , 0.35696 , -0.11773 , -0.077905 , -0.20948 , 0.090435 , 0.36898 , -0.45418 , -0.041913 , 0.37585 , -0.028879 , -0.25468 , 0.32814 , -0.34826 , -0.46125 , -0.33793 , -0.038842 , -0.44886 , 0.14572 , 0.13913 , -0.38873 , -0.086188 , 0.34387 , 0.11371 , -0.4255 , 0.3537 , -0.15081 , 0.42537 , 0.083384 , -0.38961 , 0.30673 , -0.13746 , -0.42621 , 0.043906 , -0.15566 , -0.328 , -0.1365 , -0.2403 , 0.071672 , 0.31682 , 0.37225 , -0.49621 , 0.50379 , -0.21161 , 0.43382 , -0.19562 , 0.46565 , 0.47056 , -0.10997 , 0.479 }; + //double Zshift[271] = { -0.0046447 , 0.23731 , -0.17913 , -0.29887 , 0.27671 , 0.10626 , -0.36997 , -0.45621 , -0.45621 , -0.19378 , 0.090064 , -0.44938 , 0.054669 , 0.29612 , -0.10023 , -0.43077 , -0.061466 , -0.39465 , -0.35249 , -0.2534 , -0.33178 , -0.14235 , -0.24501 , 0.35592 , -0.21675 , 0.38133 , 0.25787 , -0.41781 , 0.35271 , 0.10851 , -0.15703 , 0.23951 , 0.20624 , 0.4036 , 0.13123 , -0.047915 , -0.0077206 , 0.1889 , 0.20404 , -0.14004 , -0.086809 , 0.35211 , 0.11166 , -0.34662 , -0.15657 , 0.4669 , 0.4669 , 0.49479 , -0.50521 , 0.20742 , -0.13149 , -0.20407 , 0.017916 , 0.14991 , -0.29149 , -0.12717 , -0.19041 , 0.075374 , 0.075374 , 0.094928 , -0.041487 , -0.038025 , -0.39872 , -0.27855 , 0.46278 , -0.53722 , -0.0024558 , -0.4147 , -0.37547 , 0.41209 , -0.10685 , -0.098389 , 0.27597 , 0.27597 , 0.11436 , -0.48011 , 0.51989 , 0.35089 , 0.35089 , -0.13034 , 0.355 , 0.29565 , -0.29771 , -0.30121 , -0.16766 , 0.20885 , -0.093766 , -0.49622 , 0.50378 , 0.16161 , 0.3193 , 0.22235 , -0.44362 , -0.063382 , -0.37873 , 0.48059 , -0.075724 , -0.42149 , 0.42642 , -0.33118 , -0.33118 , 0.47459 , 0.22499 , -0.06399 , 0.35147 , 0.48111 , -0.51889 , 0.0074525 , -0.0018616 , 0.045735 , 0.089497 , -0.3526 , -0.30056 , -0.23166 , -0.072202 , 0.025719 , 0.31497 , -0.18695 , 0.33699 , 0.30431 , -0.13112 , 0.0011493 , -0.27174 , 0.16324 , -0.42074 , -0.37428 , 0.10549 , -0.49418 , 0.50582 , -0.2233 , 0.22084 , 0.22084 , 0.40619 , -0.39196 , -0.11757 , -0.33536 , 0.4283 , 0.38493 , -0.0094715 , 0.31678 , -0.48637 , 0.51363 , -0.47146 , -0.27287 , -0.45012 , -0.36544 , -0.49293 , 0.50707 , 0.04918 , -0.34509 , -0.014863 , -0.15715 , 0.04257 , 0.21744 , 0.25594 , 0.17904 , -0.2467 , 0.13128 , 0.25744 , 0.44498 , -0.44338 , 0.14133 , -0.49315 , 0.50685 , 0.4021 , 0.4021 , -0.0044312 , -0.0044312 , -0.17852 , -0.23934 , -0.062828 , -0.1942 , 0.29903 , -0.26561 , -0.26561 , 0.25987 , -0.49044 , 0.50956 , 0.042315 , -0.14903 , 0.28241 , 0.040975 , -0.38304 , 0.35825 , 0.40176 , -0.2356 , -0.063678 , 0.42616 , 0.17118 , 0.43889 , -0.42341 , 0.17156 , 0.42326 , 0.37497 , -0.22155 , 0.32835 , 0.15888 , -0.29461 , 0.0090381 , 0.061707 , -0.44379 , -0.10997 , 0.43762 , 0.4164 , 0.45691 , -0.0090446 , -0.45711 , -0.13827 , -0.18948 , -0.27874 , 0.1328 , 0.25524 , -0.015398 , 0.36389 , 0.16295 , -0.24003 , -0.33058 , 0.1323 , 0.22122 , -0.054415 , 0.26083 , -0.36274 , -0.24469 , 0.075959 , -0.19563 , 0.055705 , 0.35704 , 0.35475 , -0.3781 , 0.34264 , -0.32334 , 0.19554 , 0.077357 , 0.053291 , -0.2656 , 0.055035 , 0.2853 , -0.30907 , 0.21114 , 0.061206 , -0.46433 , -0.037677 , 0.032204 , 0.43321 , 0.1401 , 0.45126 , 0.27636 , 0.10809 , -0.3503 , 0.46637 , 0.3089 , 0.23647 , -0.13403 , -0.33653 , -0.29217 , 0.22868 , 0.1962 , -0.46926 , -0.26911 , -0.19475 , 0.17677 , 0.099057 , -0.054851 , -0.054851 , -0.44544 , -0.43917 , 0.32036 , -0.13129 , -0.30439 , -0.23342 , 0.43186 }; + //double Majaxis[271] = { 0.024691 , 0.020391 , 0.032143 , 0.03399 , 0.030834 , 0.020343 , 0.029908 , 0.028401 , 0.028401 , 0.023032 , 0.025078 , 0.023907 , 0.026733 , 0.040349 , 0.043391 , 0.017732 , 0.018083 , 0.018009 , 0.024957 , 0.019928 , 0.044568 , 0.023231 , 0.027203 , 0.032535 , 0.026989 , 0.049512 , 0.030912 , 0.012006 , 0.045045 , 0.022069 , 0.031292 , 0.026398 , 0.028207 , 0.019884 , 0.014686 , 0.023105 , 0.030396 , 0.031892 , 0.02138 , 0.058549 , 0.01387 , 0.064729 , 0.02804 , 0.025132 , 0.021393 , 0.025399 , 0.025399 , 0.036528 , 0.036528 , 0.032518 , 0.016857 , 0.034558 , 0.014624 , 0.017482 , 0.028107 , 0.018841 , 0.028656 , 0.040688 , 0.040688 , 0.020634 , 0.034982 , 0.016898 , 0.028593 , 0.012886 , 0.071323 , 0.071323 , 0.028958 , 0.050177 , 0.014106 , 0.027331 , 0.059915 , 0.041006 , 0.024794 , 0.024794 , 0.045971 , 0.068782 , 0.068782 , 0.020854 , 0.020854 , 0.018689 , 0.030292 , 0.022844 , 0.02834 , 0.025516 , 0.02732 , 0.026547 , 0.012048 , 0.027713 , 0.027713 , 0.033867 , 0.036831 , 0.054139 , 0.038312 , 0.023348 , 0.026284 , 0.018436 , 0.038959 , 0.02008 , 0.042862 , 0.039783 , 0.039783 , 0.029421 , 0.011095 , 0.036799 , 0.050276 , 0.02107 , 0.02107 , 0.011913 , 0.030651 , 0.011663 , 0.0175 , 0.024129 , 0.041915 , 0.013024 , 0.01158 , 0.018324 , 0.027144 , 0.03621 , 0.017492 , 0.018095 , 0.018806 , 0.01402 , 0.054247 , 0.037359 , 0.011661 , 0.019296 , 0.027763 , 0.04332 , 0.04332 , 0.043284 , 0.015939 , 0.015939 , 0.037587 , 0.027177 , 0.027302 , 0.0098417 , 0.037048 , 0.019075 , 0.020831 , 0.029755 , 0.026454 , 0.026454 , 0.022831 , 0.023466 , 0.038743 , 0.022172 , 0.023283 , 0.023283 , 0.024152 , 0.025877 , 0.020762 , 0.017652 , 0.024558 , 0.034604 , 0.02702 , 0.04725 , 0.022061 , 0.027743 , 0.03213 , 0.022541 , 0.0308 , 0.024059 , 0.020025 , 0.020025 , 0.023127 , 0.023127 , 0.033779 , 0.033779 , 0.016145 , 0.02464 , 0.011569 , 0.030084 , 0.014427 , 0.02163 , 0.02163 , 0.019215 , 0.027219 , 0.027219 , 0.027272 , 0.033828 , 0.022704 , 0.0191 , 0.071963 , 0.027631 , 0.038214 , 0.02035 , 0.023515 , 0.035952 , 0.021311 , 0.026324 , 0.050484 , 0.032081 , 0.042139 , 0.023397 , 0.029904 , 0.018047 , 0.020221 , 0.030412 , 0.024024 , 0.023167 , 0.046699 , 0.032627 , 0.015706 , 0.033936 , 0.0422 , 0.036404 , 0.033944 , 0.016965 , 0.026772 , 0.020973 , 0.030841 , 0.018082 , 0.026576 , 0.039003 , 0.034278 , 0.015792 , 0.01276 , 0.030154 , 0.016811 , 0.03888 , 0.013006 , 0.015309 , 0.021041 , 0.014044 , 0.039373 , 0.026322 , 0.033793 , 0.013975 , 0.015662 , 0.031778 , 0.022092 , 0.013433 , 0.019503 , 0.016114 , 0.023423 , 0.030807 , 0.015767 , 0.030581 , 0.021738 , 0.028652 , 0.013856 , 0.019447 , 0.034535 , 0.01891 , 0.040701 , 0.043531 , 0.02722 , 0.030786 , 0.029463 , 0.016034 , 0.015993 , 0.030985 , 0.023031 , 0.031089 , 0.014064 , 0.023966 , 0.010684 , 0.020221 , 0.045593 , 0.020284 , 0.025045 , 0.01722 , 0.027413 , 0.027413 , 0.028535 , 0.01861 , 0.012612 , 0.035936 , 0.017029 , 0.016053 , 0.019248 }; + //double Minaxis[271] = { 0.019273 , 0.0078917 , 0.012155 , 0.007513 , 0.023344 , 0.0059486 , 0.015917 , 0.020958 , 0.020958 , 0.016895 , 0.021634 , 0.022538 , 0.011521 , 0.0094185 , 0.0098469 , 0.0055152 , 0.015526 , 0.016135 , 0.0097904 , 0.016482 , 0.010383 , 0.009226 , 0.017694 , 0.018907 , 0.020621 , 0.013339 , 0.01561 , 0.009625 , 0.014287 , 0.006415 , 0.016745 , 0.017911 , 0.016649 , 0.017071 , 0.014226 , 0.013418 , 0.023596 , 0.014099 , 0.012753 , 0.01122 , 0.0092782 , 0.010855 , 0.022036 , 0.020855 , 0.019103 , 0.016128 , 0.016128 , 0.011529 , 0.011529 , 0.018037 , 0.013276 , 0.01989 , 0.011248 , 0.012342 , 0.01748 , 0.011906 , 0.021046 , 0.015362 , 0.015362 , 0.0045985 , 0.017208 , 0.0082977 , 0.013192 , 0.0086674 , 0.008947 , 0.008947 , 0.022971 , 0.0066928 , 0.013127 , 0.026287 , 0.0076608 , 0.015636 , 0.014343 , 0.014343 , 0.01013 , 0.009412 , 0.009412 , 0.015253 , 0.015253 , 0.016308 , 0.0049943 , 0.007494 , 0.019844 , 0.020264 , 0.018792 , 0.021836 , 0.0078512 , 0.011022 , 0.011022 , 0.015648 , 0.01205 , 0.010381 , 0.011473 , 0.0059917 , 0.0089986 , 0.013625 , 0.016592 , 0.017992 , 0.011518 , 0.010666 , 0.010666 , 0.0070076 , 0.0095174 , 0.01451 , 0.014123 , 0.019133 , 0.019133 , 0.011516 , 0.0098319 , 0.0093484 , 0.016189 , 0.020952 , 0.0073161 , 0.0079689 , 0.0091595 , 0.015895 , 0.015631 , 0.012914 , 0.0067728 , 0.0047578 , 0.018229 , 0.008814 , 0.010511 , 0.0077432 , 0.0082142 , 0.012664 , 0.0052318 , 0.011952 , 0.011952 , 0.013692 , 0.012754 , 0.012754 , 0.016894 , 0.014816 , 0.016056 , 0.0096267 , 0.013773 , 0.016998 , 0.015527 , 0.012542 , 0.010634 , 0.010634 , 0.018077 , 0.012411 , 0.014054 , 0.017528 , 0.022875 , 0.022875 , 0.0054738 , 0.022043 , 0.0048253 , 0.0084935 , 0.024051 , 0.0083501 , 0.011678 , 0.0079458 , 0.020677 , 0.010492 , 0.015303 , 0.011381 , 0.013705 , 0.018513 , 0.017767 , 0.017767 , 0.020022 , 0.020022 , 0.01222 , 0.01222 , 0.012984 , 0.022627 , 0.0071635 , 0.010721 , 0.013967 , 0.0090604 , 0.0090604 , 0.013212 , 0.0031357 , 0.0031357 , 0.016181 , 0.018238 , 0.017479 , 0.01857 , 0.0095628 , 0.020741 , 0.0139 , 0.012601 , 0.01711 , 0.01405 , 0.012798 , 0.01302 , 0.013494 , 0.019716 , 0.0050341 , 0.014742 , 0.0156 , 0.014793 , 0.0051683 , 0.0073197 , 0.011582 , 0.02292 , 0.011114 , 0.016401 , 0.012088 , 0.0051457 , 0.014896 , 0.017898 , 0.013035 , 0.0075009 , 0.019229 , 0.017495 , 0.0147 , 0.007491 , 0.0073426 , 0.0084454 , 0.014941 , 0.011386 , 0.010006 , 0.020673 , 0.008562 , 0.013049 , 0.0063325 , 0.011347 , 0.01913 , 0.012289 , 0.0079291 , 0.016957 , 0.0048858 , 0.0099247 , 0.0074476 , 0.011327 , 0.010108 , 0.012408 , 0.01584 , 0.011593 , 0.0062848 , 0.018944 , 0.01273 , 0.018178 , 0.019124 , 0.016182 , 0.0072685 , 0.011585 , 0.011349 , 0.0089124 , 0.01317 , 0.010438 , 0.021129 , 0.014639 , 0.0065576 , 0.0076606 , 0.0092965 , 0.018082 , 0.01931 , 0.0046628 , 0.010662 , 0.016909 , 0.0087331 , 0.01418 , 0.0089021 , 0.018019 , 0.014002 , 0.0083381 , 0.021864 , 0.021864 , 0.017162 , 0.0066936 , 0.006789 , 0.015588 , 0.014205 , 0.013142 , 0.0060648 }; + //double Angle[271] = { 1.5859 , 0.5067 , 4.6468 , 4.789 , 4.6335 , 1.6499 , 3.9858 , 5.18 , 5.18 , 0.3487 , 0.2992 , 4.465 , 2.1872 , 0.6976 , 5.2317 , 2.5476 , 2.7344 , 4.9107 , 3.09 , 4.4679 , 1.0874 , 4.1861 , 1.3113 , 5.6955 , 0.18593 , 6.2174 , 5.4015 , 5.6346 , 5.419 , 5.7841 , 3.5782 , 4.9152 , 2.8857 , 1.3688 , 1.9815 , 1.2568 , 0.78144 , 0.71859 , 3.0943 , 5.7377 , 3.0885 , 4.095 , 0.23876 , 2.7656 , 2.3593 , 2.2702 , 2.2702 , 0.39909 , 0.39909 , 4.6703 , 0.40318 , 5.4705 , 1.085 , 2.2453 , 3.4918 , 0.74949 , 2.256 , 6.2059 , 6.2059 , 1.5086 , 2.1397 , 1.5869 , 5.2014 , 1.0504 , 1.0843 , 1.0843 , 2.6035 , 1.4087 , 0.70944 , 5.3177 , 0.52922 , 4.8816 , 3.1705 , 3.1705 , 5.2355 , 2.4539 , 2.4539 , 0.5325 , 0.5325 , 4.2736 , 0.64273 , 5.3398 , 3.0516 , 1.6029 , 5.086 , 4.1835 , 5.9445 , 1.4642 , 1.4642 , 6.039 , 5.3413 , 0.79642 , 0.045509 , 1.4149 , 5.6681 , 5.0788 , 1.1275 , 0.54679 , 2.6958 , 4.5119 , 4.5119 , 2.381 , 2.6699 , 4.5835 , 3.7454 , 4.23 , 4.23 , 5.0814 , 4.4332 , 0.56852 , 6.1497 , 2.9591 , 2.1268 , 0.55486 , 5.9225 , 2.8982 , 5.267 , 5.7869 , 0.53009 , 1.4467 , 0.72535 , 0.34081 , 0.42143 , 5.7537 , 3.8163 , 1.6083 , 3.0505 , 5.9769 , 5.9769 , 2.5157 , 2.4654 , 2.4654 , 4.164 , 3.8175 , 0.69281 , 3.3053 , 3.7468 , 1.7414 , 6.1647 , 4.5048 , 4.3079 , 4.3079 , 4.6887 , 3.8079 , 4.0856 , 1.408 , 5.1866 , 5.1866 , 2.5279 , 1.3531 , 3.448 , 0.78387 , 5.4008 , 2.4122 , 4.5063 , 2.5483 , 2.2473 , 0.58544 , 3.0466 , 6.0189 , 3.6455 , 1.7688 , 3.4303 , 3.4303 , 0.79824 , 0.79824 , 0.72748 , 0.72748 , 5.6882 , 4.392 , 0.53155 , 4.4917 , 2.359 , 1.5126 , 1.5126 , 3.4765 , 5.0265 , 5.0265 , 6.2794 , 5.775 , 5.3992 , 4.7876 , 0.17087 , 4.0837 , 3.0232 , 4.5348 , 2.6504 , 3.6385 , 2.8003 , 2.3976 , 2.1161 , 2.8483 , 0.016909 , 6.0548 , 1.1849 , 2.2921 , 3.3154 , 4.2357 , 3.1022 , 1.567 , 1.3805 , 5.3854 , 2.5928 , 0.71986 , 4.96 , 3.5874 , 5.7472 , 1.7759 , 0.019619 , 0.75612 , 0.70758 , 6.0931 , 3.6919 , 5.9006 , 2.6916 , 0.92243 , 0.0725 , 3.3056 , 2.4738 , 3.8593 , 1.387 , 4.5025 , 1.2987 , 2.9451 , 5.375 , 1.8591 , 0.019589 , 0.78981 , 5.6161 , 6.0205 , 0.23537 , 3.6231 , 1.6705 , 4.6091 , 4.7419 , 0.31365 , 0.52691 , 0.59266 , 1.8274 , 3.1491 , 5.9468 , 3.5395 , 5.8915 , 1.8201 , 0.18014 , 4.3828 , 1.9818 , 0.66297 , 6.0694 , 6.0212 , 0.72981 , 2.0378 , 2.7018 , 2.7447 , 3.2524 , 2.9971 , 4.898 , 3.182 , 0.79211 , 1.6791 , 3.5141 , 5.345 , 3.54 , 3.54 , 4.2966 , 5.3129 , 4.86 , 3.5078 , 5.1142 , 5.8153 , 4.9495 }; + + bool isInsideSomeEllipse = false; + bool isInsideThisEllipse = false; + for (int i = 0; i < nellipses; ++i) { + isInsideThisEllipse = ((coordinates.x - Xshift[i])*cos(Angle[i]) + (coordinates.z - Zshift[i])*sin(Angle[i]))*((coordinates.x - Xshift[i])*cos(Angle[i]) + (coordinates.z - Zshift[i])*sin(Angle[i]))/(Majaxis[i] * Majaxis[i]) + (-(coordinates.z - Zshift[i])*cos(Angle[i]) + (coordinates.x - Xshift[i])*sin(Angle[i]))*(-(coordinates.z - Zshift[i])*cos(Angle[i]) + (coordinates.x - Xshift[i])*sin(Angle[i]))/ (Minaxis[i] * Minaxis[i]) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + if (isInsideThisEllipse) { + isInsideSomeEllipse = true; + return Angle[i] * 180.0 / M_PI + 90; // corresponding aniso_angle + } + } + if (!isInsideSomeEllipse) { + //return 135; // fixed value in matrix + return rand()*360; // random value in matrix + } +} + +SetBC SetPureShearBCVx(MdoodzInput *input, POSITION position, Coordinates coordinates) { + SetBC bc; + if (position == N || position == S || position == NW || position == SW || position == NE || position == SE) { + bc.value = 0; + bc.type = 11; // 11: Dirichlet (new); 13: Neumann (as it was in original setup) + } else if (position == W || position == E) { + bc.value = -coordinates.x * input->model.bkg_strain_rate; + bc.type = 0; + } else { + bc.value = 0.0; + bc.type = -1; + } + return bc; +} + +SetBC SetPureShearBCVz(MdoodzInput *input, POSITION position, Coordinates coordinates) { + SetBC bc; + if (position == W || position == E || position == SW || position == SE || position == NW || position == NE) { + bc.value = 0; + bc.type = 11; // 11: Dirichlet (new); 13: Neumann (as it was in original setup) + } else if (position == S || position == N) { + bc.value = coordinates.z * input->model.bkg_strain_rate; + bc.type = 0; + } else { + bc.value = 0; + bc.type = -1; + } + return bc; +} + +int main(int nargs, char *args[]) { + // Input file name + char *input_file; + if ( nargs < 2 ) { + asprintf(&input_file, "AnisoViscTest_evolv_multi_ellipses_PSDirichlet.txt"); // Default + } + else { + asprintf(&input_file, "%s", args[1]); // Custom + } + printf("Running MDoodz7.0 using %s\n", input_file); + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureShearBCVx, + .SetBCVz = SetPureShearBCVz, + }, + }; + RunMDOODZ(input_file, &setup); + free(input_file); +} diff --git a/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.txt b/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.txt new file mode 100644 index 00000000..9e5ca7ce --- /dev/null +++ b/SETS/AnisoViscTest_evolv_multi_ellipses_PSDirichlet.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 10 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 501 +Nz = 501 +Nt = 10000 +xmin = -5.000000e-1 +zmin = -5.000000e-1 +xmax = 5.000000e-1 +zmax = 5.000000e-1 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 1 +periodic_x = 1 +pure_shear_ALE = 0 +bkg_strain_rate = 1 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 1 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file diff --git a/SETS/CollisionPolarCartesianEllipses.c b/SETS/CollisionPolarCartesianEllipses.c new file mode 100755 index 00000000..6447e7c0 --- /dev/null +++ b/SETS/CollisionPolarCartesianEllipses.c @@ -0,0 +1,324 @@ +#include "math.h" +#include "mdoodz.h" +#include "stdbool.h" +#include "stdlib.h" +#include "stdio.h" + +double SetSurfaceZCoord(MdoodzInput *instance, double x) { + double h = 0.0; + const double Earth_radius = 6370e3/instance->scaling.L; + if (instance->model.polar==0) { + // Flat topo + h = Earth_radius; + } + if (instance->model.polar==1) { + // Curved topography (see PolarCoordinatesStuff.py) + h = sqrt((Earth_radius - x)*(Earth_radius + x)); + } + return h; +} + +int SetPhase(MdoodzInput *instance, Coordinates coordinates) { + int phase = 0; // Default: crust + const double x = coordinates.x, z = coordinates.z; + const double Earth_radius = 6370e3/instance->scaling.L; + const double zMoho = Earth_radius + instance->model.user0/instance->scaling.L; + const double zLAB = Earth_radius + instance->model.user1/instance->scaling.L; + const double angle = 35.*M_PI/180; + const double a_ell = 2.0*instance->model.user5/instance->scaling.L, b_ell = 0.5*instance->model.user5/instance->scaling.L; + double x_ell, z_ell, X, Z; + if ( instance->model.polar==0 ) { + if (z < zMoho) { + phase = 1; // Lithospheric mantle + } + if (z < zLAB) { + phase = 2; // Astenospheric mantle + } + } + if ( instance->model.polar==1 ) { + Z = sqrt((zMoho - x)*(zMoho + x)); // Lithospheric mantle + if ( z < Z ) phase = 1; + Z = sqrt((zLAB - x)*(zLAB + x)); // Astenospheric mantle + if ( z < Z ) phase = 2; + } + + // Draw ellipse + Z = Earth_radius - 55e3/instance->scaling.L; + X = 20e3/instance->scaling.L; + x_ell = (x-X)*cos(angle) + (z-Z)*sin(angle); + z_ell =-(x-X)*sin(angle) + (z-Z)*cos(angle); + if (pow(x_ell/a_ell,2.0) + pow(z_ell/b_ell,2.0) < 1.0) phase = 0; + + return phase; +} + +double SetTemperature(MdoodzInput *instance, Coordinates coordinates) { + const double x = coordinates.x, z = coordinates.z; + const double Lz = (double) (instance->model.zmax - instance->model.zmin) ; + const double Earth_radius = 6370e3/instance->scaling.L; + const double Ttop = 293.0/(instance->scaling.T); + const double Tbot = (instance->model.user3 + zeroC)/instance->scaling.T; + double Tgrad = (Ttop-Tbot)/ (Lz - (instance->model.zmax-Earth_radius)); + return Ttop + Tgrad*(z - Earth_radius); +} + +// double SetGrainSize(MdoodzInput *instance, Coordinates coordinates, int phase) { +// const int asthenospherePhase = 3; +// return instance->materials.gs_ref[asthenospherePhase]; +// } + +// double SetHorizontalVelocity(MdoodzInput *instance, Coordinates coordinates) { +// return -coordinates.x * instance->model.bkg_strain_rate; +// } + +// double SetVerticalVelocity(MdoodzInput *instance, Coordinates coordinates) { +// return coordinates.z * instance->model.bkg_strain_rate; +// } + +char SetBCPType(MdoodzInput *instance, POSITION position) { + if (position == NE || position == NW) { + return 0; + } else { + return -1; + } +} + +SetBC SetBCT(MdoodzInput *instance, POSITION position, double particleTemperature) { + SetBC bc; + double surface_temperature = (20. + zeroC) / instance->scaling.T; + double mantle_temperature = (instance->model.user3 + zeroC) / instance->scaling.T; + if (position == S) { + bc.type = constant_temperature; + bc.value = mantle_temperature; + } + if (position == free_surface || position == N) { + bc.type = constant_temperature; + bc.value = surface_temperature; + } + if (position == W || position == E) { + bc.type = constant_heatflux; + bc.value = 0.; + } + return bc; +} + +void AddCrazyConductivity(MdoodzInput *input) { + int *asthenospherePhases = (int *) malloc(sizeof(int)); + CrazyConductivity *crazyConductivity = (CrazyConductivity *) malloc(sizeof(CrazyConductivity)); + asthenospherePhases[0] = 2; + crazyConductivity->phases = asthenospherePhases; + crazyConductivity->nPhases = 1; + crazyConductivity->multiplier = 1000; + input->crazyConductivity = crazyConductivity; +} + +double BoundaryVelocityProfile(double V, double z, double z_LAB, double dz_smooth) { + return -0.5*V*erfc( (z-z_LAB)/dz_smooth ) + V; +} + +double BoundaryVelocityProfilePrimitive(double V, double z, double z_LAB, double dz_smooth) { + return V*(z - 0.5*(z-z_LAB) * erfc( (z-z_LAB)/dz_smooth ) ); +} + +SetBC SetBCVx(MdoodzInput *instance, POSITION position, Coordinates coordinates) { + SetBC bc; + const double Earth_radius = 6370e3/instance->scaling.L, dz_smooth = 10e3/instance->scaling.L; + const double Lx = instance->model.xmax - instance->model.xmin; + double V_tot = Lx * instance->model.bkg_strain_rate; // |VxW| + |VxE| + double maxAngle = asin(Lx/2/Earth_radius); // Aperture angle + double tet_W, alp_W, tet_E, alp_E; + double VxW, VxE; + double z_LAB, z_top; + const double x = coordinates.x, z = coordinates.z; + + // Compute surface height and LAB position + if (instance->model.polar == 1) { + z_top = sqrt((Earth_radius - x)*(Earth_radius + x)); + z_LAB = z_top + instance->model.user1/instance->scaling.L; + } + else { + z_top = Earth_radius; + z_LAB = z_top + instance->model.user1/instance->scaling.L; + } + + // Evaluate velocity of W and E boundaries + if (instance->model.polar == 1) { + const double tet_W = -maxAngle; + const double alp_W = M_PI/2.0 - tet_W; + VxW = (0.5*V_tot) * sin(alp_W) ; + + const double tet_E = maxAngle; + const double alp_E = M_PI/2.0 - tet_E; + VxE =-(0.5*V_tot) * sin(alp_E); + } + else { + VxW = 0.5*V_tot; + VxE = -0.5*V_tot; + } + + // Apply smooth transition with depth + VxW = BoundaryVelocityProfile(VxW, z, z_LAB, dz_smooth); + VxE = BoundaryVelocityProfile(VxE, z, z_LAB, dz_smooth); + + // Assign BC values + if (position == N || position == S || position == NW || position == SW || position == NE || position == SE) { + bc.value = 0; + bc.type = 13; + } else if (position == W) { + bc.value = VxW; + bc.type = 0; + } else if (position == E) { + bc.value = VxE; + bc.type = 0; + } else { + bc.value = 0.0; + bc.type = -1; + } + return bc; +} + +SetBC SetBCVz(MdoodzInput *instance, POSITION position, Coordinates coordinates) { + SetBC bc; + const double Earth_radius = 6370e3/instance->scaling.L, dz_smooth = 10e3/instance->scaling.L; + const double Lx = instance->model.xmax - instance->model.xmin; + double V_tot = Lx * instance->model.bkg_strain_rate; // |VxW| + |VxE| + double maxAngle = asin(Lx/2/Earth_radius); // Aperture angle + double tet_W, alp_W, tet_E, alp_E; + double VxW, VxE, VzW, VzE, VzS=0.0; + double z_LAB, z_top; + const double x = coordinates.x, z = coordinates.z; + + // Compute surface height and LAB position + if (instance->model.polar == 1) { + z_top = sqrt((Earth_radius - x)*(Earth_radius + x)); + z_LAB = z_top + instance->model.user1/instance->scaling.L; + } + else { + z_top = Earth_radius; + z_LAB = z_top + instance->model.user1/instance->scaling.L; + } + + // Evaluate velocity of W and E boundaries + if (instance->model.polar == 1) { + const double tet_W = -maxAngle; + const double alp_W = M_PI/2.0 - tet_W; + VxW = (0.5*V_tot) * sin(alp_W) ; + VzW = (0.5*V_tot) * cos(alp_W) ; + + const double tet_E = maxAngle; + const double alp_E = M_PI/2.0 - tet_E; + VxE =-(0.5*V_tot) * sin(alp_W) ; + VzE =-(0.5*V_tot) * cos(alp_E); + } + else { + VxW = 0.5*V_tot; + VxE = -0.5*V_tot; + VzW = 0.0; + VzE = -0.0; + } + + // // Compute compensating VzS value + const double z_min = instance->model.zmin; + const double prim_W_zmax = BoundaryVelocityProfilePrimitive(VxW, z_top, z_LAB, dz_smooth); + const double prim_W_zmin = BoundaryVelocityProfilePrimitive(VxW, z_min, z_LAB, dz_smooth); + const double prim_E_zmax = BoundaryVelocityProfilePrimitive(VxE, z_top, z_LAB, dz_smooth); + const double prim_E_zmin = BoundaryVelocityProfilePrimitive(VxE, z_min, z_LAB, dz_smooth); + const double intW = prim_W_zmax - prim_W_zmin; + const double intE = prim_E_zmax - prim_E_zmin; + VzS = - ( fabs(intW) + fabs(intE) ) / Lx; + + // Apply smooth transition with depth + VzW = -BoundaryVelocityProfile(VzW, z, z_LAB, dz_smooth); + VzE = -BoundaryVelocityProfile(VzE, z, z_LAB, dz_smooth); + + // printf("Vx %2.2e %2.2e %2.2e\n", 0*instance->scaling.V, VxW*instance->scaling.V, VxE*instance->scaling.V); + // printf("Vz %2.2e %2.2e %2.2e\n", VzS*instance->scaling.V, VzW*instance->scaling.V, VzE*instance->scaling.V); + + if (position == W || position == SW || position == NW ) { + bc.value = VzW; + bc.type = 11; + } else if ( position == E || position == SE || position == NE) { + bc.value = VzE; + bc.type = 11; + } else if (position == S || position == N) { + bc.value = VzS; + bc.type = 0; + } else { + bc.value = 0; + bc.type = -1; + } + return bc; +} + +//double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { +// if (phase == 0) { +// return 90; // Layered aniso in crust +// } +// else { +// return rand()*360; // random value in mantle +// } +//} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + + int nellipses = 3; + + // (for 4 setup) + double Xshift[4] = { -1.5e5 , 0.5e5 , 1.3e5 , 0.0 }; + double Zshift[4] = { 6.345e6 , 6.350e6 , 6.345e6 , 6.0e6 }; + double Majaxis[4] = { 0.7e5/4 , 0.6e5/4 , 0.9e5/4 , 1.0e5/2 }; + double Minaxis[4] = { 0.4e5/4 , 0.5e5/4 , 0.6e5/4 , 1.0e5/2 }; + double Angle[4] = { 30 , 120 , 0 , 0.0 }; // direction of layers + + bool isInsideSomeEllipse = false; + bool isInsideThisEllipse = false; + for (int i = 0; i < nellipses; ++i) { + //Xshift[i] = Xshift[i] / input->scaling.L; + //Zshift[i] = Zshift[i] / input->scaling.L; + //Majaxis[i] = Majaxis[i] / input->scaling.L; + //Minaxis[i] = Minaxis[i] / input->scaling.L; + Angle[i] = Angle[i] + 90; // have layers -> want director + isInsideThisEllipse = ((coordinates.x*input->scaling.L - Xshift[i])*cos(Angle[i]) + (coordinates.z*input->scaling.L - Zshift[i])*sin(Angle[i]))*((coordinates.x*input->scaling.L - Xshift[i])*cos(Angle[i]) + (coordinates.z*input->scaling.L - Zshift[i])*sin(Angle[i]))/(Majaxis[i] * Majaxis[i]) + (-(coordinates.z*input->scaling.L - Zshift[i])*cos(Angle[i]) + (coordinates.x*input->scaling.L - Xshift[i])*sin(Angle[i]))*(-(coordinates.z*input->scaling.L - Zshift[i])*cos(Angle[i]) + (coordinates.x*input->scaling.L - Xshift[i])*sin(Angle[i]))/ (Minaxis[i] * Minaxis[i]) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + if (isInsideThisEllipse && phase == 0) { + isInsideSomeEllipse = true; + return Angle[i]; // corresponding aniso_angle (i.e. director) + } + } + if (!isInsideSomeEllipse) { + //return 135; // fixed value in matrix + return rand()*360; // random value in matrix + } +} + +int main(int nargs, char *args[]) { + // Input file name + char *input_file; + if ( nargs < 2 ) { + asprintf(&input_file, "CollisionPolarCartesianEllipses.txt"); // Default + } + else { + asprintf(&input_file, "%s", args[1]); // Custom + } + printf("Running MDoodz7.0 using %s\n", input_file); + MdoodzSetup setup = { + .BuildInitialTopography = &(BuildInitialTopography_ff){ + .SetSurfaceZCoord = SetSurfaceZCoord, + }, + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetTemperature = SetTemperature, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetBCVx, + .SetBCVz = SetBCVz, + .SetBCPType = SetBCPType, + .SetBCT = SetBCT, + }, + .MutateInput = AddCrazyConductivity, + + }; + RunMDOODZ(input_file, &setup); + free(input_file); +} diff --git a/SETS/CollisionPolarCartesianEllipses.txt b/SETS/CollisionPolarCartesianEllipses.txt new file mode 100755 index 00000000..f2c4dbfc --- /dev/null +++ b/SETS/CollisionPolarCartesianEllipses.txt @@ -0,0 +1,166 @@ +/**** Original name: StefanBending.txt ****/ +/**** RESTART ****/ +istep = 00000500 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 + +/**** SCALES ****/ Scaling parameters for +eta = 1e23 +L = 1e6 +V = 1e-9 +T = 100 + +/**** SPACE ****/ +Nx = 400 +Nz = 250 +xmin = -9.959000e5 +xmax = 9.959000e5 +zmin = 5969400 / model bottom +zmax = 6.400000e6 / Earth surface + +/**** TIME ****/ +Nt = 1 +dt = 1.2623e+11 +Courant = 0.45 + +/**** SWITCHES ****/ +penalty = 1e3 +eta_average = 0 /0: arithmetic; 1: harmonic (leads to problems with aniso!) +interp_stencil = 9 +mechanical = 1 +constant_dt = 0 +RK = 4 +periodic_x = 0 +pure_shear_ALE = 0 /1: box stretched at constant strain rate; -1 box of constant size +elastic = 1 +thermal = 1 +isPl_soft = 0 +free_surface = 1 +free_surface_stab = 1 +topo_update = 0 / 0: total update of topotgraphy (likely diffusive) +initial_cooling = 1 +subgrid_diffusion = 2 +shear_heating = 1 +adiab_heating = 0 +polar = 1 +anisotropy = 1 +finite_strain = 1 +stress_rotation = 2 +/surface_processes = 1 +/surf_diff = 1e-6 / surface diffusivity +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** NON-LINEAR ITERATIONS ****/ +Newton = 0 +nit_max = 1 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-10 +nonlin_abs_div = 1e-10 +nonlin_rel_mom = 1e-10 +nonlin_rel_div = 1e-10 +min_eta = 1e17 +max_eta = 1e25 + +/**** SETUP DEPENDANT ****/ +bkg_strain_rate = 1e-15 +user0 = -35e3 / Moho depth [m] +user1 = -150e3 / LAB depth [m] +user2 = -200e3 / depth of compression [m] +user3 = 1400 / Mantle temperature [C] +user4 = 0 / 0:Bottom outflow / 1:Lateral outflow +user5 = 10e3 / radius perturbation [m] + +/**** GRAVITY ****/ +gx = 0.0000 +gz = -9.81 + +/**** MAT PROPERTIES ****/ +Nb_phases = 3 + +/**** PHASE 0 ****/ +ID = 0 +rho = 2800.00 / Crust +G = 3e10 +Cv = 1050 +k = 2.5 +Qr = 1e-6 +C = 5e7 +phi = 30 +eta_vp = 1e21 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 0 / constant visc law +pwlv = 10 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e23 +npwl = 1 +Qpwl = 0 +/Slim = 300e6 / 300 MPa +ani_fstrain = 1 / activates finite strain anisotropy +aniso_factor = 1.0 +/ani_fac_max = 1.5 + +/**** PHASE 1 ****/ +ID = 1 +rho = 3300.00 / Mantle lithosphere +G = 3e10 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 5e7 +phi = 30 +eta_vp = 1e21 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 0 / constant visc law +pwlv = 40 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e22 +npwl = 1 +Qpwl = 0 +/Slim = 300e6 / 300 MPa +ani_fstrain = 1 / activates finite strain anisotropy +aniso_factor = 1.0 +/ani_fac_max = 1.5 + +/**** PHASE 2 ****/ +ID = 2 +rho = 3300.00 / Astehenosphere +G = 3e10 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 5e7 +phi = 30 +eta_vp = 1e21 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 0 / constant visc law +pwlv = 40 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 5e21 +npwl = 1 +Qpwl = 0 +/Slim = 300e6 / 300 MPa +ani_fstrain = 1 / activates finite strain anisotropy +aniso_factor = 1.0 +/ani_fac_max = 1.5 + +/ ENDFILE / \ No newline at end of file diff --git a/SETS/Fig0a_bench.c b/SETS/Fig0a_bench.c new file mode 100644 index 00000000..7a1cd03e --- /dev/null +++ b/SETS/Fig0a_bench.c @@ -0,0 +1,89 @@ +#include "mdoodz.h" +#include "math.h" + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.2; + double Minaxis = Majaxis / 2.0; + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -Majaxis, -Minaxis }; + double B[2] = { -Majaxis, Minaxis }; + double C[2] = { Majaxis, Minaxis }; + double D[2] = { Majaxis, -Minaxis }; + + rotatePoint(&A, Angle); + rotatePoint(&B, Angle); + rotatePoint(&C, Angle); + rotatePoint(&D, Angle); + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 4; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}}; + + return isPointInsidePolygon(testPoint, testPolygon); +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // Fig. 0a) Ellipse pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.35; + double Minaxis = 0.15; + double Angle = 45.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + bool isInsideEllipse = false; + isInsideEllipse = ((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))*((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))/(Majaxis * Majaxis) + (-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))*(-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))/ (Minaxis * Minaxis) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + + + if (isPointInsidePolygon(testPoint, testPolygon)) { + return Angle * 180.0 / M_PI + 90; // corresponding aniso_angle + } else { + return rand()*360; // random value in matrix + } +} + +int main() { + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureOrSimpleShearBCVx, + .SetBCVz = SetPureOrSimpleShearBCVz, + }, + }; + RunMDOODZ("Fig6a_bench.txt", &setup); +} diff --git a/SETS/Fig0a_bench.txt b/SETS/Fig0a_bench.txt new file mode 100644 index 00000000..25c21d5d --- /dev/null +++ b/SETS/Fig0a_bench.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 201 +Nz = 201 +Nt = 1 +xmin = -5.000000e-1 +zmin = -5.000000e-1 +xmax = 5.000000e-1 +zmax = 5.000000e-1 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 0 +periodic_x = 0 +pure_shear_ALE = 0 +bkg_strain_rate = 2.0 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file diff --git a/SETS/Fig10_bench.c b/SETS/Fig10_bench.c new file mode 100644 index 00000000..c09a73cc --- /dev/null +++ b/SETS/Fig10_bench.c @@ -0,0 +1,98 @@ +#include "mdoodz.h" +#include "math.h" + +typedef struct { + double x, y; +} Point; + +typedef struct { + int numVertices; + Point *vertices; +} Polygon; + +// Function to check if a point is inside a polygon +bool isPointInsidePolygon(Point point, Polygon polygon) { + int i, j; + bool isInside = false; + for (i = 0, j = polygon.numVertices - 1; i < polygon.numVertices; j = i++) { + if ((polygon.vertices[i].y > point.y) != (polygon.vertices[j].y > point.y) && + (point.x < (polygon.vertices[j].x - polygon.vertices[i].x) * (point.y - polygon.vertices[i].y) / + (polygon.vertices[j].y - polygon.vertices[i].y) + polygon.vertices[i].x)) { + isInside = !isInside; + } + } + return isInside; +} + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + + // Fig. 10) Garnet pure shear + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -0.0924021300036714, -0.0665524544007828 }; + double B[2] = { 0.0198515118129514, -0.1222508262945290 }; + double C[2] = { 0.1346758477169800, -0.0125678785653086 }; + double D[2] = { 0.0172808177255486, 0.1176806218631410 }; + double E[2] = { -0.0906883339454028, 0.0508425755906477 }; + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 5; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}, {E[0], E[1]}}; + + return isPointInsidePolygon(testPoint, testPolygon); +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // Fig. 10) Garnet pure shear + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -0.0924021300036714, -0.0665524544007828 }; + double B[2] = { 0.0198515118129514, -0.1222508262945290 }; + double C[2] = { 0.1346758477169800, -0.0125678785653086 }; + double D[2] = { 0.0172808177255486, 0.1176806218631410 }; + double E[2] = { -0.0906883339454028, 0.0508425755906477 }; + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 5; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}, {E[0], E[1]}}; + + if (isPointInsidePolygon(testPoint, testPolygon)) { + return Angle * 180.0 / M_PI + 90; // corresponding aniso_angle + } else { + return rand()*360; // random value in matrix + } +} + +int main() { + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureOrSimpleShearBCVx, + .SetBCVz = SetPureOrSimpleShearBCVz, + }, + }; + RunMDOODZ("Fig10_bench.txt", &setup); +} diff --git a/SETS/Fig10_bench.txt b/SETS/Fig10_bench.txt new file mode 100644 index 00000000..89a529a1 --- /dev/null +++ b/SETS/Fig10_bench.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 301 +Nz = 186 +Nt = 1 +xmin = -0.5 +zmin = -0.3089700996677741 +xmax = 0.5 +zmax = 0.3089700996677741 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 0 +periodic_x = 0 +pure_shear_ALE = 0 +bkg_strain_rate = -1 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file diff --git a/SETS/Fig6a_bench.c b/SETS/Fig6a_bench.c new file mode 100644 index 00000000..4f56e6d2 --- /dev/null +++ b/SETS/Fig6a_bench.c @@ -0,0 +1,130 @@ +#include "mdoodz.h" +#include "math.h" + +typedef struct { + double x, y; +} Point; + +typedef struct { + int numVertices; + Point *vertices; +} Polygon; + +// Function to rotate a point by an angle (in radians) around the origin +void rotatePoint(Point *point, double angle) { + double x = point->x; + double y = point->y; + point->x = x * cos(angle) - y * sin(angle); + point->y = x * sin(angle) + y * cos(angle); +} + +// Function to check if a point is inside a polygon +bool isPointInsidePolygon(Point point, Polygon polygon) { + int i, j; + bool isInside = false; + for (i = 0, j = polygon.numVertices - 1; i < polygon.numVertices; j = i++) { + if ((polygon.vertices[i].y > point.y) != (polygon.vertices[j].y > point.y) && + (point.x < (polygon.vertices[j].x - polygon.vertices[i].x) * (point.y - polygon.vertices[i].y) / + (polygon.vertices[j].y - polygon.vertices[i].y) + polygon.vertices[i].x)) { + isInside = !isInside; + } + } + return isInside; +} + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.2; + double Minaxis = Majaxis / 2.0; + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -Majaxis, -Minaxis }; + double B[2] = { -Majaxis, Minaxis }; + double C[2] = { Majaxis, Minaxis }; + double D[2] = { Majaxis, -Minaxis }; + + rotatePoint(&A, Angle); + rotatePoint(&B, Angle); + rotatePoint(&C, Angle); + rotatePoint(&D, Angle); + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 4; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}}; + + return isPointInsidePolygon(testPoint, testPolygon); +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.2; + double Minaxis = Majaxis / 2.0; + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -Majaxis, -Minaxis }; + double B[2] = { -Majaxis, Minaxis }; + double C[2] = { Majaxis, Minaxis }; + double D[2] = { Majaxis, -Minaxis }; + + rotatePoint(&A, Angle); + rotatePoint(&B, Angle); + rotatePoint(&C, Angle); + rotatePoint(&D, Angle); + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 4; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}}; + + if (isPointInsidePolygon(testPoint, testPolygon)) { + return Angle * 180.0 / M_PI + 90; // corresponding aniso_angle + } else { + return rand()*360; // random value in matrix + } +} + +int main() { + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureOrSimpleShearBCVx, + .SetBCVz = SetPureOrSimpleShearBCVz, + }, + }; + RunMDOODZ("Fig6a_bench.txt", &setup); +} diff --git a/SETS/Fig6a_bench.txt b/SETS/Fig6a_bench.txt new file mode 100644 index 00000000..25c21d5d --- /dev/null +++ b/SETS/Fig6a_bench.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 201 +Nz = 201 +Nt = 1 +xmin = -5.000000e-1 +zmin = -5.000000e-1 +xmax = 5.000000e-1 +zmax = 5.000000e-1 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 0 +periodic_x = 0 +pure_shear_ALE = 0 +bkg_strain_rate = 2.0 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file diff --git a/SETS/Fig6b_bench.c b/SETS/Fig6b_bench.c new file mode 100644 index 00000000..92d9ffa1 --- /dev/null +++ b/SETS/Fig6b_bench.c @@ -0,0 +1,130 @@ +#include "mdoodz.h" +#include "math.h" + +typedef struct { + double x, y; +} Point; + +typedef struct { + int numVertices; + Point *vertices; +} Polygon; + +// Function to rotate a point by an angle (in radians) around the origin +void rotatePoint(Point *point, double angle) { + double x = point->x; + double y = point->y; + point->x = x * cos(angle) - y * sin(angle); + point->y = x * sin(angle) + y * cos(angle); +} + +// Function to check if a point is inside a polygon +bool isPointInsidePolygon(Point point, Polygon polygon) { + int i, j; + bool isInside = false; + for (i = 0, j = polygon.numVertices - 1; i < polygon.numVertices; j = i++) { + if ((polygon.vertices[i].y > point.y) != (polygon.vertices[j].y > point.y) && + (point.x < (polygon.vertices[j].x - polygon.vertices[i].x) * (point.y - polygon.vertices[i].y) / + (polygon.vertices[j].y - polygon.vertices[i].y) + polygon.vertices[i].x)) { + isInside = !isInside; + } + } + return isInside; +} + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.2; + double Minaxis = Majaxis / 2.0; + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -Majaxis, -Minaxis }; + double B[2] = { -Majaxis, Minaxis }; + double C[2] = { Majaxis, Minaxis }; + double D[2] = { Majaxis, -Minaxis }; + + rotatePoint(&A, Angle); + rotatePoint(&B, Angle); + rotatePoint(&C, Angle); + rotatePoint(&D, Angle); + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 4; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}}; + + return isPointInsidePolygon(testPoint, testPolygon); +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.2; + double Minaxis = Majaxis / 2.0; + double Angle = 60.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + double A[2] = { -Majaxis, -Minaxis }; + double B[2] = { -Majaxis, Minaxis }; + double C[2] = { Majaxis, Minaxis }; + double D[2] = { Majaxis, -Minaxis }; + + rotatePoint(&A, Angle); + rotatePoint(&B, Angle); + rotatePoint(&C, Angle); + rotatePoint(&D, Angle); + + Point testPoint = {coordinates.x, coordinates.z}; + Polygon testPolygon; + testPolygon.numVertices = 4; + testPolygon.vertices = (Point[]){{A[0], A[1]}, {B[0], B[1]}, {C[0], C[1]}, {D[0], D[1]}}; + + if (isPointInsidePolygon(testPoint, testPolygon)) { + return Angle * 180.0 / M_PI + 90; // corresponding aniso_angle + } else { + return rand()*360; // random value in matrix + } +} + +int main() { + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureOrSimpleShearBCVx, + .SetBCVz = SetPureOrSimpleShearBCVz, + }, + }; + RunMDOODZ("Fig6b_bench.txt", &setup); +} diff --git a/SETS/Fig6b_bench.txt b/SETS/Fig6b_bench.txt new file mode 100644 index 00000000..296101cc --- /dev/null +++ b/SETS/Fig6b_bench.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 201 +Nz = 201 +Nt = 1 +xmin = -5.000000e-1 +zmin = -5.000000e-1 +xmax = 5.000000e-1 +zmax = 5.000000e-1 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 1 +periodic_x = 1 +pure_shear_ALE = 0 +bkg_strain_rate = 1.0 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file diff --git a/SETS/Fig_ellipse_bench.c b/SETS/Fig_ellipse_bench.c new file mode 100644 index 00000000..cbe800a5 --- /dev/null +++ b/SETS/Fig_ellipse_bench.c @@ -0,0 +1,81 @@ +#include "mdoodz.h" +#include "math.h" + +int SetPhase(MdoodzInput *input, Coordinates coordinates) { + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.35; + double Minaxis = 0.15; + double Angle = 45.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + bool isInsideEllipse = false; + isInsideEllipse = ((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))*((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))/(Majaxis * Majaxis) + (-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))*(-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))/ (Minaxis * Minaxis) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + + if (isInsideEllipse) { + return 1; + } else { + return 0; + } +} + +double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) { + const double T_init = (zeroC) / input->scaling.T; + if (1 == 0) { + return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase])); + } else { + return input->materials.rho[phase]; + } +} + +double SetAnisoAngle(MdoodzInput *input, Coordinates coordinates, int phase) { + const double radius = input->model.user1 / input->scaling.L; + + // Fig. 06a) Rectangle pure shear + double Xshift = 0.0; + double Zshift = 0.0; + double Majaxis = 0.35; + double Minaxis = 0.15; + double Angle = 45.0 / 180.0 * M_PI; + + // scaling geometry values + Xshift = Xshift / input->scaling.L; + Zshift = Zshift / input->scaling.L; + Majaxis = Majaxis / input->scaling.L; + Minaxis = Minaxis / input->scaling.L; + // Angle doesn't need scaling (in radians btw) + + bool isInsideEllipse = false; + isInsideEllipse = ((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))*((coordinates.x - Xshift)*cos(Angle) + (coordinates.z - Zshift)*sin(Angle))/(Majaxis * Majaxis) + (-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))*(-(coordinates.z - Zshift)*cos(Angle) + (coordinates.x - Xshift)*sin(Angle))/ (Minaxis * Minaxis) < 1; // rotated ellipse + // reminder ellipse function: inside = [(x-x0)*cos(phi)+(z-z0)*sin(phi)]^2/majaxis^2 + [(x-x0)*sin(phi)-(z-z0)*cos(phi)]^2/minaxis^2 < 1 + + if (isInsideEllipse) { + return Angle * 180.0 / M_PI + 90; // corresponding aniso_angle + } else { + return rand()*360; // random value in matrix + } +} + +int main() { + MdoodzSetup setup = { + .SetParticles = &(SetParticles_ff){ + .SetPhase = SetPhase, + .SetDensity = SetDensity, + .SetAnisoAngle = SetAnisoAngle, + }, + .SetBCs = &(SetBCs_ff){ + .SetBCVx = SetPureOrSimpleShearBCVx, + .SetBCVz = SetPureOrSimpleShearBCVz, + }, + }; + RunMDOODZ("Fig_ellipse_bench.txt", &setup); +} diff --git a/SETS/Fig_ellipse_bench.txt b/SETS/Fig_ellipse_bench.txt new file mode 100644 index 00000000..cdb907ea --- /dev/null +++ b/SETS/Fig_ellipse_bench.txt @@ -0,0 +1,143 @@ +/**** RESTART ****/ +istep = 000000 +irestart = 0 + +/**** OUTPUT FILES ****/ +writer = 1 +writer_step = 1 +writer_markers = 0 +writer_debug = 0 +writer_energies = 0 +gnuplot_log_res = 0 + +/**** SWITCHES ****/ +elastic = 0 +free_surface = 0 +free_surface_stab = 0 +finite_strain = 1 +advection = 1 +anisotropy = 1 +marker_aniso_angle = 1 / to set individual initial aniso_angles within the same phase + +/**** SCALES ****/ +eta = 1 +L = 1 +V = 1 +T = 1 + +/**** SPACE ****/ +Nx = 201 +Nz = 201 +Nt = 1 +xmin = -5.000000e-1 +zmin = -5.000000e-1 +xmax = 5.000000e-1 +zmax = 5.000000e-1 + +/**** PARTICLES ****/ +Nx_part = 4 +Nz_part = 4 + +/**** TIME ****/ +constant_dt = 0 +Courant = 0.45 +dt = 1.0e+11 +RK = 4 + +/**** LINEAR SOLVER ****/ +noisy = 1 +penalty = 1e5 +lin_solver = -1 +diag_scaling = 0 +lin_abs_div = 1e-9 +lin_rel_div = 1e-9 +lin_abs_mom = 1e-11 +lin_rel_mom = 1e-11 + +/**** NON-LINEAR SOLVER ****/ +Newton = 1 +line_search = 1 +nit_max = 10 +rel_tol_KSP = 1e-4 +nonlin_abs_mom = 1e-9 +nonlin_rel_mom = 1e-9 +nonlin_abs_div = 1e-9 +nonlin_rel_div = 1e-9 + +/**** VISCOSITY CUT-OFF ****/ +min_eta = 1e-3 +max_eta = 1e6 + +/**** SETUP-DEPENDANT ****/ +shear_style = 1 +periodic_x = 1 +pure_shear_ALE = 0 +bkg_strain_rate = 1 +user0 = 0.0 / nothing +user1 = 0.0 / nothing +user2 = 0.0 / nothing +user3 = 0.0 / nothing +user4 = 0.0 / nothing +user5 = 0.0 / nothing +user6 = 0.0 / nothing + +/**** GRAVITY ****/ +gx = 0.0000 +gz = 0.000 + +/**** MAT PROPERTIES ****/ +Nb_phases = 2 + +/**** PHASE 1 ****/ +ID = 0 +rho = 2700.00 / matrix +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e0 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +/**** PHASE 2 ****/ +ID = 1 +rho = 2700.00 / elliptical inclusions +G = 1e30 +Cv = 1050 +k = 2.5 +Qr = 0 +C = 1e90 +phi = 30 +Slim = 500e9 +alp = 10.0e-6 +bet = 1e-11 +drho = 0 +cstv = 1 / constant visc law +pwlv = 0 / disloc. creep +linv = 0 / diff. creep +gbsv = 0 / grain boundary sliding +expv = 0 / peierls creep +gsel = 0 / grain size evo. +eta0 = 1e3 +npwl = 0 +Qpwl = 0 +ani_fstrain = 0 / activates finite strain anisotropy +ani_fac_max = 1000.0 +aniso_factor = 1.0 + +//END INPUT FILE// \ No newline at end of file