From a901df8a552a189fdb0e6707bc54d8d3589c12c0 Mon Sep 17 00:00:00 2001 From: Thanushika Date: Wed, 8 Jan 2025 16:29:52 +0100 Subject: [PATCH] new changes --- JuliaVisualisation/Project.toml | 1 - JuliaVisualisation/T_Select_Markers_MD7.jl | 2 +- JuliaVisualisation/read_bin.jl | 35 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 JuliaVisualisation/read_bin.jl diff --git a/JuliaVisualisation/Project.toml b/JuliaVisualisation/Project.toml index 565d7e27..e19349cc 100644 --- a/JuliaVisualisation/Project.toml +++ b/JuliaVisualisation/Project.toml @@ -7,7 +7,6 @@ DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964" 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" diff --git a/JuliaVisualisation/T_Select_Markers_MD7.jl b/JuliaVisualisation/T_Select_Markers_MD7.jl index 911768d8..b93c86e5 100644 --- a/JuliaVisualisation/T_Select_Markers_MD7.jl +++ b/JuliaVisualisation/T_Select_Markers_MD7.jl @@ -51,7 +51,7 @@ function main() file_select_start = 0 # First time step - Select marker coordinates from here file_select_end = 3000 # Last time step - Select marker coordinates from here - target_coords = (-40e3, -30e3, -15e3, -10e3) # Coordinate bounds (min(x), max(x), min(y), max(y)) + target_coords = (-70e4, -69e4, -81.5e3, -79e3) # Coordinate bounds (min(x), max(x), min(y), max(y)) # Select field to visualise field = :Phases diff --git a/JuliaVisualisation/read_bin.jl b/JuliaVisualisation/read_bin.jl new file mode 100644 index 00000000..e46bb5b8 --- /dev/null +++ b/JuliaVisualisation/read_bin.jl @@ -0,0 +1,35 @@ +using CairoMakie + +function main_func() + fname = "/home/thanushika/software/MDOODZ7.0/IMPORT/Hydrated_Pdt.dat" + # = 793; // Resolution for temperature (MANTLE) [] + # model.PDMnP[pid] = 793; // Resolution for pressure (MANTLE) [] + # model.PDMTmin[pid] = 373.0/scaling.T; // Minimum temperature (MANTLE) [K] + # model.PDMTmax[pid] = 1373.0/scaling.T; // Maximum temperature (MANTLE) [K] + # model.PDMPmin[pid] = 10.13e6/scaling.S; // Minimum pressure (MANTLE) [Pa] + # model.PDMPmax[pid] = 5.5816e9 /scaling.S; // Maximum pressure (MANTLE) [Pa] + # model.PDMrho[pid] = ReadBin(model.import_files_dir, "Hydrated_Pdt.dat", model.PDMnT[pid], model.PDMnP + + nT = 793 + nP = 793 + rho = Array{Float64}(undef, nT*nP) + rho_2D = read!(fname, rho) |> x -> reshape(x, nT, nP) + + T = collect(LinRange(373.0, 1373.0, nT)) + P = collect(LinRange(10.13e6, 5.5816e9, nP)) + + fig = Figure(size = (500, 500), fontsize = 18) + ax1 = Axis( + fig[1, 1][1, 1], + aspect = 1.0, + xlabel = L"$T$ [°C]", + ylabel = L"$P$ [kbar]" + ) + hm = heatmap!(ax1, T .- 273.15, P ./ 1e8, rho_2D) + Colorbar(fig[1,1][1,2], hm, label = L"$\rho$ [kg.m$^{-1}$]") + rowsize!(fig.layout, 1, Fixed(300)) + display(fig) +end + +main_func(); +save("heatmap_output.png", fig)