proteus.Viewers module

Some simple modules for doing runtime visualization

Inheritance diagram of proteus.Viewers

proteus.Viewers.gnuplotOn(problemName)[source]
proteus.Viewers.matlabOn(problemName, silent=True)[source]
proteus.Viewers.vtkOn(problemName, silent=True)[source]
proteus.Viewers.viewerOn(problemName, viewer)[source]
proteus.Viewers.newPlot()[source]
proteus.Viewers.newWindow()[source]
class proteus.Viewers.V_base(p=None, n=None, s=None)[source]

Bases: object

windowNumber()[source]
plotNumber()[source]
preprocess(mlvt, tsim)[source]
processTimeLevel(mlvt, tsim=None, plotOffSet=None)[source]
postprocess(mlvt, tsim)[source]
stepProcessPlot(mlvt, tsim)[source]

plot desired quantities for a single step

Parameters
  • mlvt (multilevel vector transport that holds the quantities to measure) –

  • tsim (simulation time) –

assumes this is the correct time to plot

stepPlotExact(mlvt, tsim)[source]

plot ‘exact’ value of desired quantities for a single step

Parameters
  • mlvt (multilevel vector transport that holds the quantities to measure) –

  • tsim (simulation time) –

assumes this is the correct time to plot and plotOffSet is set correctly

stepPlotElementQuantities(mlvt, tsim)[source]
sort through desired quantities in quadrature dictionaries like m, dm, to plot

p — problem definition n — numerics definition mlvt — multilevel vector transport that holds the quantities to measure tsim — simulation time

assumes this is the correct time to plot and plotOffSet is set correctly

plotScalarElementQuantity(ckey, mlvt, tsim)[source]

plotting routine to look at scalar quantity stored in element quad dictionary q

Parameters
  • ckey (what should be plotted) –

  • mlvt (multilevel vector transport that holds the quantities to measure) –

  • tsim (simulation time) –

assumes this is the correct time to plot and plotOffSet is set correctly

plotVectorGlobalElementBoundaryQuantity(ckey, mlvt, tsim)[source]

plotting routine to look at vector quantity stored in global elementBoundary quad dictionary ebq_global

Parameters
  • ckey (what should be plotted) –

  • mlvt (multilevel vector transport that holds the quantities to measure) –

  • tsim (simulation time) –

assumes this is the correct time to plot and plotOffSet is set correctly

plotVectorElementQuantity(ckey, mlvt, tsim, nVectorPlotPointsPerElement=1)[source]
plotting routine to look at vector quantity stored in global element quad dictionary q
input :

ckey — what should be plotted p — problem definition n — numerics definition mlvt — multilevel vector transport that holds the quantities to measure tsim — simulation time

assumes this is the correct time to plot and plotOffSet is set correctly

class proteus.Viewers.MatlabWriter(nxgrid=50, nygrid=50, nzgrid=10, verbose=0)[source]

Bases: object

collect functionality for generating visualation data and commands in matlab .. todo:

C0P2 in 3d
DG monomials
storePointMeshData(cmdFile, x, name)[source]

write out spatial locations for generic point data

viewScalarPointData(cmdFile, nSpace, q, ckey, name=None, storeMeshData=True, useLocal=True, figureNumber=1, title=None)[source]

wrapper for visualling element quadrature points, can try to use a local representation or build a global one depending on useLocal.

If useLocal and nPoints_elemnet < nSpace+1 calls global routine

viewVectorPointData(cmdFile, nSpace, q, ckey, name=None, storeMeshData=True, useLocal=True, figureNumber=1, title=None)[source]

wrapper for visualling element quadrature points, can try to use a local representation or build a global one depending on useLocal. TODO: implement local view for vectors

If useLocal and nPoints_elemnet < nSpace+1 calls global routine

viewGlobalScalarPointData(cmdFile, nSpace, q, ckey, name=None, storeMeshData=True, figureNumber=1, title=None)[source]
input scalar variable and coordinates stored in dictionary

q[‘x’], q[ckey]

respectively, generate global continuous interpolant should work for q, ebq_global, and ebqe quadrature dictionaries

uses delaunay triangulation in 2d and 3d

scalar data is stored in

name_q

if storeMeshData = True, writes out

name_x_q – point data tri_name_q – Delaunay representation (2d,3d)

returns number of figures actually plotted

viewGlobalVectorPointData(cmdFile, nSpace, q, ckey, name=None, storeMeshData=True, figureNumber=1, title=None)[source]
input vector variable and coordinates stored in dictionary

q[‘x’], q[ckey]

respectively, generate global continuous interpolant should work for q, ebq_global, and ebqe quadrature dictionaries

uses delaunay triangulation in 2d and 3d

vector data is stored in

name_q

if storeMeshData = True, writes out

name_x_q – point data tri_name_q – Delaunay representation (2d,3d)

returns number of figures actually generated

viewLocalScalarPointData(cmdFile, nSpace, q, ckey, name=None, storeMeshData=True, figureNumber=1, title=None)[source]
input scalar variable and coordinates stored in dictionary

q[‘x’], q[ckey]

respectively, generate local interpolant that is element-wise continuous should work for q, ebq_global, and ebqe quadrature dictionaries

uses delaunay triangulation in 2d and 3d on each element (stored in cell array)

scalar data is stored in

name_q

if storeMeshData = True, writes out

name_x_q – point data tri_name_q – Delaunay representation (2d,3d)

returns number of figures actually plotted

viewScalarAnalyticalFunction(cmdFile, nSpace, f, t, x, elementNodesConnectivity=None, name='exact', storeMeshData=True, figureNumber=1, title=None)[source]

input scalar analytical function f(x,t) and array of points

respectively, generate global continuous interpolant

uses delaunay triangulation in 2d and 3d if element - node triangulation not already defined

scalar data is stored in

name_ex

if storeMeshData = True, writes out

name_x_ex – point data tri_name_ex – element-node representation (2d,3d)

returns number of figures actually plotted

viewVectorAnalyticalFunction(cmdFile, nSpace, f, t, x, elementNodesConnectivity=None, name='exact', storeMeshData=True, figureNumber=1, title=None)[source]

input vector analytical function f(x,t) and array of points

respectively, generate global continuous interpolant

uses delaunay triangulation in 2d and 3d if element - node triangulation not already defined

vector data is stored in

name_ex

if storeMeshData = True, writes out

name_x_ex – point data tri_name_ex – element-node representation (2d,3d)

returns number of figures actually plotted

viewScalar_LagrangeC0P1(cmdFile, nSpace, nodeArray, elementNodesArray, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewVector_LagrangeC0P1(cmdFile, nSpace, nodeArray, elementNodesArray, u_dof, v_dof=None, w_dof=None, name='velocity', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_LagrangeC0P2(cmdFile, nSpace, lagrangeNodesArray, elementNodesArray, l2g, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewVector_LagrangeC0P2(cmdFile, nSpace, lagrangeNodesArray, elementNodesArray, l2g, u_dof, v_dof=None, w_dof=None, name='velocity', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_DGP0(cmdFile, nSpace, nodeArray, elementNodesArray, l2g, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_LagrangeDGP1(cmdFile, nSpace, nodeArray, elementNodesArray, l2g, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_LagrangeDGP2(cmdFile, nSpace, nodeArray, elementNodesArray, midNodesArray, l2g, cg_l2g, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_CrouzeixRaviartP1(cmdFile, nSpace, nodeArray, elementNodesArray, l2g, u_dof, name='u', storeMeshData=True, figureNumber=1, title=None)[source]
viewScalar_MonomialDGPK(cmdFile, nSpace, nodeArray, elementNodesArray, interpolationPoints, u_interpolationPoints, name='u', storeMeshData=True, figureNumber=1, title=None)[source]