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

plotting, take 2 #27

Open
3 tasks
ajgoza opened this issue Jul 15, 2021 · 3 comments
Open
3 tasks

plotting, take 2 #27

ajgoza opened this issue Jul 15, 2021 · 3 comments

Comments

@ajgoza
Copy link
Collaborator

ajgoza commented Jul 15, 2021

  • functionality for plotting velocity magnitude
  • GET RID OF THE STUPID BORDERS ACROSS GRID LEVELS (I think interpolation would be useful here, maybe as in Interpolations.jl)
  • for MovingGrid, convert plot to be in lab frame rather than the simulated body frame
@jcallaham
Copy link
Collaborator

The new plotting utilities look great! Looking at plot_state... it seems like the logic is to plot all grid levels unless xlims and ylims are set to :auto, but sometimes it'd be good to just choose one grid level to plot, right? Here's the function:

function plot_state( prob, state, t;
    var=:omega, xlims=:auto, ylims=:auto, clims=:auto, clevs=30)

    if (xlims==:auto) & (ylims==:auto)
        #Would be nice to add vel mag
        if var == :omega
            plot_ω(state, prob.model.grid, lev=1, clims=clims, xlims=xlims,
                ylims=ylims, clevs=clevs )
            plot_bodies(state.xb)
        elseif var == :vel
            plt = plot(layout=(2,1))
            plot_u(state, prob.model.grid, lev=1, clims=clims, xlims=xlims,
                ylims=ylims, plt=plt, clevs=clevs )
            plot_bodies(prob.model.bodies, plt=plt )
        elseif var == :psi
            plot_ψ(state, prob.model.grid, lev=glev, clims=clims, xlims=xlims,
                ylims=ylims, clevs=clevs )
            plot_bodies(prob.model.bodies)
        end
    else
        if var == :vel
            plt = plot(layout=(2,1))
        end

        for glev = prob.model.grid.mg : -1 : 1

            #Would be nice to add vel mag
            if var == :omega
                plot_ω(state, prob.model.grid, lev=glev, clims=clims, xlims=xlims,
                    ylims=ylims, clevs=clevs )
                if glev==1
                    plot_bodies(state.xb)
                end
            elseif var == :vel
                plot_u(state, prob.model.grid, lev=glev, clims=clims, xlims=xlims,
                    ylims=ylims, plt=plt, clevs=clevs )
                if glev==1
                    plot_bodies(prob.model.bodies, plt=plt )
                end
            elseif var == :psi
                plot_ψ(state, prob.model.grid, lev=glev, clims=clims, xlims=xlims,
                    ylims=ylims, clevs=clevs )
                if glev==1
                    plot_bodies(prob.model.bodies)
                end
            end

        end
    end
end

I also think the glev reference in theif var==:omega block is broken. Would you object to me adding a glev kwarg and choosing to either plot one level or multiple based on that, rather than the xlims, ylims condition?

@ajgoza
Copy link
Collaborator Author

ajgoza commented Sep 23, 2021 via email

@jcallaham
Copy link
Collaborator

Ohh I missed that the domain would resize to the limits given. Yes, I definitely see your point about specifying the limits vs the level. Thinking about it now, that does make sense - aside from debugging, you probably wouldn't need to look at the coarse solution in the finely resolved region.

Part of the problem was an issue I was having with my plots that made it seem like something strange was going on. Also plotting all grid levels adds a lot of overhead, but I think your suggestion about finding the minimum level to capture the specified extent would take care of that nicely. I'll try to think of a good way to implement that when I have a minute.

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

No branches or pull requests

2 participants