Skip to content

Extend plotSolution to visualize arbitrary geometries #41

Description

@nikoscham

The plotSolution function currently supports:

  • 1D line plots for scalar solutions (see e.g the tutorial)
  • 2D contour plots for structured rectangular grids (reshaping node coordinates into grids) (see e.g the tutorial)
  • 2D contour plots for unstructured meshes using node-based interpolation (via Plotly's contour type with x y z arrays) (see e.g the tutorial)

However, it does not handle true element-based visualization for arbitrary polygonal topologies.

Tasks:

  • Introduce a new plotType option, e.g., "polygon"
  • Use Plotly's scatter with fill: 'toself' or mesh3d to draw individual polygonal elements based on element connectivity (e.g., from nop arrays in meshGenerationScript.js)
  • For each element, extract node coordinates and solution values to create filled polygons with color mapping

Example API usage: plotSolution(solutionVector, nodesCoordinates, solverConfig, "2D", "polygon", plotDivId);

Activity

  1. added theissue type on Sep 23, 2025
  2. Pawankalyan2023 commented on Sep 23, 2025

    @Pawankalyan2023

    Hi @nikoscham , I would like to take this issue can you assign this to me for hacktoberfest

  3. nikoscham commented on Sep 24, 2025

    @nikoscham
    MemberAuthor

    Hi @Pawankalyan2023! Thanks for your interest in contributing to the FEAScript project. Visualizing arbitrary geometries is a core capability that will help drive the project’s future expansion. Feel free to reach out if you need any details or support. Please also consider ⭐️ the project!

    Nikos

  4. agrim317 commented on Oct 19, 2025

    @agrim317

    Hi @nikoscham ,
    I’m interested in working on this issue. If it’s still open and not currently being worked on, could you please assign it to me?

  5. nikoscham commented on Oct 19, 2025

    @nikoscham
    MemberAuthor

    Hi @agrim317! Thanks for your interest in contributing to the project. Please also consider ⭐️ the project!
    @Pawankalyan2023, just checking — are you still working on this issue? If not, we can reassign it to @agrim317 to keep progress moving.

  6. Pawankalyan2023 commented on Oct 19, 2025

    @Pawankalyan2023

    Hi @nikoscham , you can assign to @agrim317

  7. nikoscham commented on Oct 19, 2025

    @nikoscham
    MemberAuthor

    @agrim317 you can start working on this issue. Let me know if you need any clarifications!

  8. nikoscham commented on Oct 30, 2025

    @nikoscham
    MemberAuthor

    Hey @agrim317. Just a reminder that Hacktoberfest is wrapping up soon (October 31st). You can always contribute after Hacktoberfest, but you might miss out on their rewards. All the best

  9. added this to the 0.2.0 milestone on Nov 20, 2025
  10. linked a pull request that will close this issueSimplify plotSolution function #57on Nov 21, 2025
  11. linked a pull request that will close this issueFeature/arbitrary geometries2 #58on Nov 21, 2025
  12. nikoscham commented on Nov 25, 2025

    @nikoscham
    MemberAuthor

    @agrim317 I’m currently working on it, as I believe it will be one of the foundation stones for version 0.0.2. We’re adjusting the strategy because I don't think mesh3d is suitable for 2D cases (at least I wasn't satisfied with it). Below is the updated roadmap for this issue:

    • Preprocess the finite element mesh. If the element is a quadrilateral, split it into two triangles.
    • Build a spatial index over the triangles. This allows fast queries for triangles near point (x,y).
    • Create a dense visualization grid. Initialize each grid value to null.
    • For each visualization point (x, y), perform a point-in-triangle test and extract the parent element.
    • Interpolate the FE solution value using the local coordinates.
  13. nikoscham commented on Dec 17, 2025

    @nikoscham
    MemberAuthor

    Instead of using a spatial index, I have implemented an adjacency-based search to find which element contains a given point. The plotSolution function (as well as the new plotInterpolatedSolution) will be now called as plotSolution(model, result, plotType, plotDivId) in the HTML examples (see the new example with a rhomboidal geometry here https://feascript.com/tutorials/heat-conduction-2d-rhom-fin-gmsh.html). The new capability is included in the 0.2.0 (first release candidate) version.

  14. added a commit that references this issue on Dec 18, 2025
  15. linked a pull request that will close this issueFeature/arbitrary geometries2 #59on Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions