Coordinates to grid cells in Vorpal

Download gridCoords.mac

I’ve written a macro with a few useful functions to convert between coordinates (in meters) and cells (in…cells). It makes it a bit neater for those blocks which insist on being defined on the grid.

So something horrible like:

lowerBounds = [$int(floor((-XSTART-WG_A/2.)/DX))$ $int(floor((InWGCoupleOffSetY-YSTART)/DY))$ $int(floor(OutWGOffsetZ/DZ))$]

upperBounds = [$int(ceil((-XSTART+WG_A/2.)/DX))$ $int(ceil((InWGCoupleOffSetY-YSTART)/DY))+1$ $int(ceil((OutWGOffsetZ+WG_B)/DZ))$]

turns into something vaguely readable like:

lowerBounds = toGridFloorA(-WG_A/2.,InWGCoupleOffSetY+YSTART,OutWGOffsetZ)

upperBounds = toGridCeilA(WG_A/2.,InWGCoupleOffSetY+YSTART,OutWGOffsetZ+WG_B)

toCoords(x,dx,xstart) should convert the other way from cells to coordinates.

Read More

pyVorpal

PyVorpal-1.2.2

  • Uses VorpalDom
  • Extracts all or some blocks which can be plotted
  • Creates a Visit friendly .h5 file
  • There must be a .in file
  • VorpalComposer/VisIt can’t plot meshs with 0 or 1 cells in any dimension (at least on windows). As a workaround these are set to have 2 cells for plotting. It’s better than nothing for now.

With VorpalComposer you can integrate block plotting with the inbuilt visualisation. As the blocks are saved to an .h5 file as a mesh VorpalComposer lists the blocks as mesh’s and is able to plot them.

Plot the blocks as well as the fields in VorpalComposer

If you “Enable VisIt Context Menu” under “Visualisation Options” in Tools/Settings you can right click on the visualization pane and open the visit GUI. This lets you edit the colours and opacity of the plot.
Read More

Vorpal Blocks in VisIt

VorpalVisIt 0.11

  • Uses VorpalDom
  • Extracts all or some blocks which can be plotted
  • Creates a Visit friendly .h5 file
  • There must be a .in file and “”*_Globals_1.h5″.

Having become frustrated with Matlab’s inability to draw more than about 10,000 electrons without becoming unusable slow I thought I’d have a look at VisIt. It’s always nice to be able to plot the blocks from your .pre file so I thought I’d write something like VorpalPlotter to work with VisIt.

pmlSlabBlocks

pmlSlab example with blocks plotted

Read More

Vorpal In File to XML tree structure

VorpalDOM 0.1

  • Parses Vorpal .in files to a XML DOM structure using xml.etree.ElementTree
  • Block finding functions (by type and by name)
  • Scale class to convert between grid and length coordinate systems

With a little fiddling about, python’s built in XML packages can be used to parse the vorpal .in file. xml.etree.ElementTree only needs the block titles (“” for instance) to be altered to “” and a wrapping tag added (the equivalent of an “” tag) for it to be able to parse the file.

Read More

Plot fields with Vorpal Plotter

It occurred to me that it might be fairly straight forward to plot the fields on top of the block plots. It turns out that it is!

Update

Vorpal Plotter 0.31

  • Interpolates fields and grid bounds to plot them more accurately.
  • Fixed field arrow plots (so the arrows point in faintly the right direction)
  • Fixed some of the over plotting issues. STL and contour are now compatible.
Read More

Plot 3D blocks from Vorpal .in file (now with .stl files)

Following on from the last vorpal plotter I’ve updated things a bit. Instead of plotting everything in grid coordinates I’ve added a parser and appropriate conversion functions to plot everything in meters.

[scale, distanceOrigin, cellBounds, distanceBounds] = coords.getScales(file);

Where scale is the distance per cell; distanceOrigin is the position of grid position [0 0 0]; cellBounds is the boundary in cells; distance bounds is the same in meters.

Plot of pmlSlab.pre

This is a direct plot of Plot of pmlSlab.in using vorpal plotter.

Read More