update manual images for convection-box-2d - #7306
Conversation
alarshi
left a comment
There was a problem hiding this comment.
Thank you for making this PR to add the images that are actually used in the manual! I just have one comment, otherwise it looks good.
There was a problem hiding this comment.
I don't think the gridlines you are plotting in this image show the mesh (see the relevant line here. The grey overlain lines are passing through the figure ticks, but reading the text in the manual section, we want to overlay the mesh grid to discuss the subsequent subsection.
There is a way that you can plot the mesh edges in pyvista using plotter.add_mesh(mesh, show_edges=True) . I would suggest to plot the mesh gridlines on the right image here and remove the gridlines from both the combined images and the individual images in this folder that got merger earlier to avoid confusion.
|
Thanks Arushi, I updated the files. I noticed that the mesh plots triangles instead of rectangles when using pyvista. It does this whether or not I use the technique that I did in the script or the one you suggest. I noticed that in PR #7107 pyvista does not plot cells as rectangles, I am not sure why but I wonder if it is because that model is spherical. I think that this problem might be related to this issue. It doesn't seem ideal that pyvista plots the mesh as a grid of triangles since this doesn't represent the actual ASPECT mesh... I'll see if I can fix this tomorrow. |
alarshi
left a comment
There was a problem hiding this comment.
Ah, I see the issue. I have a suggestion if you're still looking for one.
| # For example, to generate an image at time step 1, change to path to: | ||
| # "../../output-convection-box/solution/solution-00001.pvtu" | ||
| # Remember to change the name of the output file as well. | ||
| mesh = pv.read("../output-convection-box/solution/solution-00004.pvtu") |
There was a problem hiding this comment.
| mesh_grid = mesh.extract_all_edges() |
| # scale the meshes down to put the scale bar on the side (like in the docs) | ||
| mesh = mesh.scale(0.75) | ||
| arrows = arrows.scale(0.75) | ||
|
|
There was a problem hiding this comment.
| mesh_grid = mesh_grid.scale(0.75) | |
| mesh_actor = plotter.add_mesh(mesh, scalars="T", log_scale=False, scalar_bar_args=sargs,cmap=cm.vik) | ||
| arrows_actor = plotter.add_mesh(arrows,color='white') | ||
| # Comment out the cells_actor variables if you don't want to plot the ASPECT mesh cells. | ||
| #cells_actor = plotter.add_mesh(mesh.extract_cells(range(mesh.n_cells)),style="wireframe",color="ivory_black",line_width=0.3,opacity=0.1) |
There was a problem hiding this comment.
Unfortunately, this solution does not work as we expect it to. I think this is because pyvista internally uses trianglular cells for rendering (you already identified this), and when you extract those cells and show its edges, it looks different than our input mesh edges.
I would recommend you to instead use the function extract_all_edges() on the mesh (see my suggestion above).
You can replace this line with:
grid_actor = plotter.add_mesh(mesh_grid, color="ivory_black", line_width=0.3, opacity=0.1)
|
|
||
| #cells_actor.position = (0.225,0.15,0) |
There was a problem hiding this comment.
| #cells_actor.position = (0.225,0.15,0) | |
| grid_actor.position = (0.225, 0.15, 0) |
|
Hmm, using your suggestions seems to have the same problem with plotting triangles. did it work on your computer? I think I found the problem. using mesh.clip_box() seems to automatically do some retopology of the mesh or something. If this function isn't used then the cells are properly plotted as quads... I think this is ready for another review. |
4bb11ea to
ff97562
Compare
|
/rebuild |
alarshi
left a comment
There was a problem hiding this comment.
Thank you, looks good now.
There was a problem hiding this comment.
The mesh on the right looks finer than what is currently in the manual because by default, Interpolate output is set to true (see parameter description here).
This parameter was probably added after this section was written in the manual. There are two ways you can reconcile the text and the image: one is to modify the caption that reflects this (add "The mesh has 16 × 16 cells, but its representation is finer than the actual mesh geometry because the Interpolate output parameter is set to true by default`") (refer to the parameter documentation here) or generate images with this parameter value set to false. In either case, the relevant results (i.e., heat flux statistics) do not change.
There was a problem hiding this comment.
Oh thank you for figuring this out! I wasn't sure why it was doing that. I will set Interpolate output to false and regenerate the images.
There was a problem hiding this comment.
ok, I uploaded the new image with interpolate output set to false
There was a problem hiding this comment.
Hmm, this doesn't look right. I think you accidentally replaced the figure that corresponds to Ra=1e4.
alarshi
left a comment
There was a problem hiding this comment.
Thank you! Almost there, just one more suggestion.
There was a problem hiding this comment.
Hmm, this doesn't look right. I think you accidentally replaced the figure that corresponds to Ra=1e4.
There was a problem hiding this comment.
You would have to replace the right sub-figure here as well.
I noticed that I did not actually update that images used in the manual in #6993 .
This should update the figures in the convection in a 2d box section of the manual.