Note that there are some explanatory texts on larger screens.

plurals
  1. POpython: How to plot 2D discontinuous node-centered data?
    primarykey
    data
    text
    <p>I have a two dimensional data and two dimensional mesh of quadrilaterals describing a domain subdivided into patches. The data is defined at each mesh node. Discontinuities in the data exist at patch boundaries, i.e. data is multiply defined at the same location.</p> <p><strong>How can I use Python to plot this data with linear interpolation in-between nodes and correct representation of the discontinuous values along each patch face?</strong></p> <p>Below are three example elements or patches, each with six node values each.</p> <p><img src="https://i.stack.imgur.com/6uTTx.png" alt="Figure of three example elements or patches, with six node values each."></p> <p>Node position and value data might be stored in <code>[Kx3x2]</code> array, where K is the number of elements. For example,</p> <pre><code>x = np.array( [ [ [0.0, 1.0], [0.0, 1.0], [0.0, 1.0] ], #element 0 [ [1.0, 2.0], [1.0, 2.0], [1.0, 2.0] ], #element 1 [ [2.0, 3.0], [2.0, 3.0], [2.0, 3.0] ], #element 2 ] ) y = np.array( [ [ [0.0, 0.0], [0.5, 0.5], [1.0, 1.0] ], #element 0 [ [0.0, 1.0], [0.5, 1.5], [1.0, 2.0] ], #element 1 [ [1.0, 1.0], [1.5, 1.5], [2.0, 2.0] ], #element 2 ] ) z = np.array( [ [ [0.0, 0.5], [0.0, 0.8], [0.0, 1.0] ], #element 0 [ [0.3, 1.0], [0.6, 1.2], [0.8, 1.3] ], #element 1 [ [1.2, 1.5], [1.3, 1.4], [1.5, 1.7] ], #element 2 ] ) </code></pre> <p>I have considered <code>pyplot.imshow()</code>. This is not able consider the whole domain all at once and still represent the multiply-valued discontinuous nodes. It might work to call <code>imshow()</code> separately for each patch. But, how would I draw each patch image on the same axis? <code>imshow()</code> is also problematic for non-rectangular patches, which is my general case.</p> <p>I have considered <code>pyplot.pcolormesh()</code>, but it seems to work exclusively with cell-centered data.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload