Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot cross-section through a CartData structure #69

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

boriskaus
Copy link
Member

@boriskaus boriskaus commented Jan 6, 2025

prompted by issue #68, this adds support to plot a cross-section through a LaMEM-created CartData structure

MWE

julia> using LaMEM, GeophysicalModelGenerator, Plots
julia> model  = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]));
julia> matrix = Phase(ID=0,Name="matrix",eta=1e20,rho=3000);
julia> sphere = Phase(ID=1,Name="sphere",eta=1e23,rho=3200);
julia> add_phase!(model, sphere, matrix)
julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=0.5);
julia> run_lamem(model,1);
julia> data_cart, time = read_LaMEM_timestep(model,2)
(CartData 
    size    : (17, 17, 17)
    x       ϵ [ -1.0 : 1.0]
    y       ϵ [ -1.0 : 1.0]
    z       ϵ [ -1.0 : 1.0]
    fields  : (:phase, :density, :visc_total, :visc_creep, :velocity, :pressure, :temperature, :j2_dev_stress, :j2_strain_rate)
, [0.0924])

Next, plot this with:

julia> plot_cross_section(data_cart, y=0, field=:phase)
Screenshot 2025-01-06 at 15 01 45

@boriskaus boriskaus merged commit 2aec0de into main Jan 7, 2025
25 checks passed
@boriskaus boriskaus deleted the bk-plot_cross_section_cartdata branch January 7, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant