plotfile containing overlays

8 views
Skip to first unread message

matei

unread,
Nov 14, 2008, 9:02:57 PM11/14/08
to amrita-ebook
In a problem of a propagating wave, I am interested in superposing the
wave front at different times on the same image. For example, say I
have the solutions at times t1, t2 and t3. I want to plot first the
solution at t3, than overlay the solution at t2 extending partly over
t3, but not all the way to the front. Then overlay the solution at
t1, and so on. The end plot would be a sequence of the wave fronts.
Ahead of each wave front, i would have sufficient white space to avoid
visual clutter and confusion.

Right now, I call the same plotting procedure iteratively using the
stored solutions at different times, within the same plotfile block.
I use
plot image {G1} m<myfavoritefield[]>
instead of
plot image {G} m<myfavoritefield[]>
in the plotting procedures in order to avoid plotting the entire base
grid. However, this workaround is not very elegant, and does not give
sufficient white space demarcation ahead of the wave until the t-1
solution.
Any ideas of a better strategy? Perhaps I can add white rectangles to
make better controlled demarcations. I could plot these interposed
between the successive timesolutions.

James, this is like what i had (manually) last year for the APS poster
with the overlay of the schlieren snap shots and the soot foil.

James Quirk

unread,
Nov 14, 2008, 9:34:02 PM11/14/08
to matei, amrita-ebook
Matei,

You should use the plotarea command to fix the active drawing
area on the page, see:

amrhelp plotarea

and you'll need to activate clipping with:

clipping on

Have a stab at it, and if you get stuck I'll
help you further.

James

matei

unread,
Nov 14, 2008, 9:44:07 PM11/14/08
to amrita-ebook
Yes, thanks. I see where to go with this. It's essentially what I
was doing by hand last year using adobe illustrator to clip the
various profiles over a desired area.

However, I have to automate it, so the bounds of the plotarea need to
change dynamically with the position of the shock. Is there a
procedure to find the location of the leading shock already build in?

James Quirk

unread,
Nov 14, 2008, 10:42:03 PM11/14/08
to amrita-ebook
On Fri, 14 Nov 2008, matei wrote:

>
> Yes, thanks. I see where to go with this. It's essentially what I
> was doing by hand last year using adobe illustrator to clip the
> various profiles over a desired area.
>
> However, I have to automate it, so the bounds of the plotarea need to
> change dynamically with the position of the shock. Is there a
> procedure to find the location of the leading shock already build in?
You can use the along command. Suppose you have a wave moving
from left to right then you would use something along the lines of:

along y=$ymid locate last P[]>$Ptol -> Xfront

James

matei

unread,
Nov 14, 2008, 11:43:34 PM11/14/08
to amrita-ebook, j...@galcit.caltech.edu
Thanks, that should do it.

Gary Sharpe

unread,
Nov 15, 2008, 6:21:31 AM11/15/08
to amrita-ebook
Matei, there should be some examples of shock position tracking
in the scripts I sent Carlos, using the along command.

matei

unread,
Nov 15, 2008, 5:18:37 PM11/15/08
to amrita-ebook
Ok, Brian and I got it to work. The following part of script plots
the overlays. Note the difficulty due to the fact that plotarea
requires dimensions in mm on the page, different from the grid
coordinates.

---
set Ptol=1.1
proc MateiRed
RGB<255,0,0>
end proc
plotfile ps/density/densityend.ps
PlotDomain fcolour = m<1.0> , bcolour = MateiRed
bbox in mm -> xmm1,ymm1,xmm2,ymm2
bbox -> x1,y1,x2,y2
set mmscale #= $ymm2/ $y2
do m=48,1,-5
flowin io/default/Pulse$m
echo $m
along y=10 locate last P[]>$Ptol -> Xfront
set plotx1 #= ($Xfront-30)*$mmscale + $xmm1
set plotwidth #= 40*$mmscale
plotarea $plotx1, $ymm1,$plotwidth,$ymm2
clipping on
DensityPlot
end do
clipping off
DrawCylinderBody <- ParamSet::
plotfile
---

James Quirk

unread,
Nov 16, 2008, 12:09:41 PM11/16/08
to matei, amrita-ebook
On Sat, 15 Nov 2008, matei wrote:

>
> Ok, Brian and I got it to work. The following part of script plots
> the overlays. Note the difficulty due to the fact that plotarea
> requires dimensions in mm on the page, different from the grid
> coordinates.
It would be fairly straightforward to take what you've
done and package it in a procedure so that all the
scaling machinations are hidden away, and then you'd
end up with something that could be used transparently
by third parties.

James

James Quirk

unread,
Nov 17, 2008, 10:34:13 PM11/17/08
to Matei Radulescu, amrita...@googlegroups.com
Matei,

On Mon, 17 Nov 2008, Matei Radulescu wrote:

> james,
> I can post something like that shortly, although I'm not a 100%
> comfortable with passing variables and commands to call other
> procedures. Do I pass those as strings? For example, I want to pass
> the PlotDensity command to the procedure, so that it calls PlotDensity
> from within the procedure. Let me clean it up a little and give it a
> shot.
> matei
There's more than one way it could be done. But as a first step,
I would suggest you try something very simple and not even bother
to pass the drawing commands to the procedure. For instance,
you could use:

PlotWholeChannel
do n=1,$n
flowin io/soln$n
FocusOnFront
DensityPlot
end do

Have a stab at it and I'll answer any specific questions you might
have.

James

matei

unread,
Nov 18, 2008, 9:47:24 PM11/18/08
to amrita-ebook
James,
> Have a stab at it and I'll answer any specific questions you might
I stabbed it. There are two procedures that need to be called back
to back, as in your example:
--
fold::amrita{ PlotWholeChannel
proc PlotWholeChannel
PlotDomain fcolour = m<1.0>
bbox in mm -> xmm1,ymm1,xmm2,ymm2
bbox -> x1,y1,x2,y2
set ScaleParam::mmscale #= $ymm2/ $y2
set ScaleParam::xmm1 #= $xmm1
set ScaleParam::xmm2 #= $xmm2
set ScaleParam::ymm1 #= $ymm1
set ScaleParam::ymm2 #= $ymm2
end proc
}
fold::amrita{ PlotFront
proc PlotFront{
pc = SchlierenImage #Plot Command
ys = 0 #y-line along which to determine
leading shock location
Ptol = 1.1 #value of P used as threhhold to
find the shock
Xback = 5 #extent of the window to the back of
shock
Xfront = 5 #extent of the plot window to the
front of the shock
mmscale = 1 #scale parameters
xmm1 = 1
xmm2 = 1
ymm1 = 1
ymm2 = 1
} <-ScaleParam::
along y=$ys locate last P[]>$Ptol -> Xshock
set plotx1 #= ($Xshock-$Xback)*$mmscale + $xmm1
set plotwidth #= ($Xback+$Xfront)*$mmscale
plotarea $plotx1, $ymm1,$plotwidth,$ymm2
clipping on
$pc
end proc
}
plotfile ps/myplot.ps
PlotWholeChannel
do n = 1, $n
flowin io/model$n
PlotFront{
pc =DensityPlot
Xback=10
}
end do
clipping off
plotfile

James Quirk

unread,
Nov 18, 2008, 10:23:45 PM11/18/08
to matei, amrita-ebook
Matei,
I would move the clipping off command to
the PlotFront procedure so that you have:

clipping on
$pc
clipping off

so that the clipping commands are balanced
at the point of use. I would also replace $pc by

parse <token> pc

to allow multi-line parameters, as in:


PlotFront {
fold::param'pc {
DensityPlot
plot Z[] contour L0.9 rgb<1,0,0>
}
}

James



> >

matei

unread,
Nov 19, 2008, 10:25:14 AM11/19/08
to amrita-ebook
James,
Here are the updated procedures with your recommendations. Thanks for
your help. They are working nicely.
parse <token> pc
clipping off
end proc
}
plotfile ps/density_evolution.ps
PlotWholeChannel
do n = 1, $n
flowin io/model$n
PlotFront{
ys = 59.99
Xback = 60
Xfront = 20
fold::param'pc {
DensityPlot
plot Z[] contour L0.9 rgb<1,0,0>
}
}
end do
plotfile

James Quirk

unread,
Nov 19, 2008, 10:33:40 AM11/19/08
to matei, amrita-ebook
Matei,


On Wed, 19 Nov 2008, matei wrote:

>
> James,
> Here are the updated procedures with your recommendations. Thanks for
> your help. They are working nicely.
>

There's one last step you could do. If you employ
Amrita's utilize command your new procedures can be
squirreled away and then accessed using something
along the lines of:

utilize mateis::utils
...
PlotWholeDomain

This would allow you to build up your own extensions
that could be used from student to student.

James

matei

unread,
Nov 19, 2008, 5:12:12 PM11/19/08
to amrita-ebook
[mir] That's a good idea. I guess this is short from putting them
directly on the Amrita path where it looks for the *.amr procedures,
right?
>
> James

James Quirk

unread,
Nov 19, 2008, 5:20:54 PM11/19/08
to matei, amrita-ebook
> > There's one last step you could do. If you employ
> > Amrita's utilize command your new procedures can be
> > squirreled away and then accessed using something
> > along the lines of:
> >
> > utilize mateis::utils
> > ...
> > PlotWholeDomain
> >
> > This would allow you to build up your own extensions
> > that could be used from student to student.
>
> [mir] That's a good idea. I guess this is short from putting them
> directly on the Amrita path where it looks for the *.amr procedures,
> right?
> >
amrhelp utilize

describes how the utilize command hunts for resources.

James

Reply all
Reply to author
Forward
0 new messages