arma-thesis

git clone https://git.igankevich.com/arma-thesis.git
Log | Files | Refs | LICENSE

commit 2b971b05de6ccc8aaeda533fd15a2bb70ae9b59a
parent 0ef9819eb98cc1a1523ea0eb209272f8b47c6f62
Author: Ivan Gankevich <igankevich@ya.ru>
Date:   Thu,  6 Apr 2017 00:48:02 +0300

Make plot pretty.

Diffstat:
R/velocity-potentials.R | 20++++++++++++++------
arma-thesis.org | 38++++++++++++++++++++++++++++++++------
2 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/R/velocity-potentials.R b/R/velocity-potentials.R @@ -27,26 +27,34 @@ arma.plot_velocity_potential_field <- function (dir, ...) { out[indices] <- phi out }) - #summary(u) # get wave profile zeta <- read.csv(file.path(dir, 'zeta.csv')) zeta_slice <- zeta[zeta$t == slice_t & zeta$y == slice_y & zeta$x >= left_top_x,] - #phi_range <- range(phi_slice[phi_slice$z <= zeta_slice$z, "phi"]) + plot.new() + plot.window(xlim=range(x),ylim=range(z),asp=1) + axis(1); axis(2); box() + + .filled.contour( + x, z, u, + levels=args$levels, + col=args$col + ) + contour( - x, z, u, levels=args$levels, + x, z, u, + levels=args$levels, asp=1, - drawlabels=FALSE - # color.palette=colorRampPalette( c("blue", "white", "red") ) + drawlabels=TRUE, + add=TRUE ) top_area_x <- c(left_top_x*0.99, zeta_slice$x, right_top_x*1.01) top_area_z <- c(left_top_z*1.10, zeta_slice$z, right_top_z*1.10) polygon(top_area_x, top_area_z, lwd=4, border=NA, col='white') lines(zeta_slice$x, zeta_slice$z, lwd=4) - #image(x, z, u, c(-2,2), col=heat.colors(128)) box() title(xlab="x", ylab="z") } diff --git a/arma-thesis.org b/arma-thesis.org @@ -2030,22 +2030,48 @@ experiment, in which all terms of eqref:eq-solution-2d-full that are neglected in the framework of linear wave theory are eliminated, shows no difference (as much as machine precision allows) in resulting velocity potential fields. -#+begin_src R :file build/plain-wave-linear-solver.pdf +#+header: :width 1024 :height 512 +#+begin_src R :file build/plain-wave-linear-solver.png source(file.path("R", "velocity-potentials.R")) -par(pty="s", mfrow=c(1, 2)) -lvls=pretty(c(-200,200), 20) +par(pty="s") +nlevels <- 41 +levels <- pretty(c(-200,200), nlevels) +palette <- colorRampPalette(c("blue", "lightyellow", "red")) +col <- palette(nlevels-1) + +# linear solver +par(fig=c(0,0.45,0,1),new=TRUE) arma.plot_velocity_potential_field( file.path("build", "plain_wave_linear_solver"), - levels=lvls + levels=levels, + col=col ) + +# high-amplitude solver +par(fig=c(0.45,0.90,0,1),new=TRUE) arma.plot_velocity_potential_field( file.path("build", "plain_wave_high_amplitude_solver"), - levels=lvls + levels=levels, + col=col +) + +# legend +par(pty="m") +par(fig=c(0.9,1,0,1), new=TRUE) +plot.new() +plot.window( + xlim = c(0, 1), + ylim = range(levels), + xaxs = "i", + yaxs = "i" ) +rect(0, levels[-length(levels)], 1, levels[-1L], col = col) +axis(4) +box() #+end_src #+RESULTS: -[[file:build/plain-wave-linear-solver.pdf]] +[[file:build/plain-wave-linear-solver.png]] #+name: fig-potential-field-nonlinear #+caption: Velocity potential field of propagating wave \(\zeta(x,y,t) = \cos(2\pi x - t/2)\). Field produced by formula eqref:eq-solution-2d-full (top) and linear wave theory formula (bottom).