Skip to content

Conversation

@jerrypaulvarghese
Copy link
Collaborator

@jerrypaulvarghese jerrypaulvarghese commented Sep 16, 2025

Changes

  • Added Plotter2D class in fol/tools/plotter.py for flat 2D mesh visualization
  • Added comprehensive unit tests in tests/unit/test_plotter2d.py (9 tests, all passing)

Features

  • Reuses Plotter3D configuration
  • Supports optional in-plane warping
  • Auto-selects best sample by minimum error
  • Generates 3-panel overview (FOL |U|, REF |U|, |ΔU|)

Testing

All tests passing

jerrypaulvarghese and others added 30 commits May 30, 2025 14:24
Supports torsion, uniform stretch / compression, simple shear.
Merge origin/main into 3D_Tetra-ifol: migrate setup.py → pyproject.toml
case_dir = os.path.join('.', "Folder_with_vtk_files")  
vtk_files = glob.glob(os.path.join(case_dir, "*.vtk"))
if vtk_files:
    vtk_path = vtk_files[0]
    config = {
        "cmap": "coolwarm",
        "u_fol_prefix": "U_FOL_",
        "u_fe_prefix": "U_HFE_",
        "output_image": "overview2d.png",
        "warp_factor_2d": 1.2,       #  
        "scalar_bar_args": {            #  
            "title": "",
            "vertical": True,
            "label_font_size": 20,
            "height": .9,
            "width": 0.09,
        },
        "zoom": 1.2,
        "clip": False,
        "show_edges": True,
        "window_size": (1600, 1000),
    }


    plotter = Plotter2D(vtk_path=vtk_path, config=config)
    plotter.render_all_panels()
else:
    print("No .vtk file found to visualize.")
Copy link
Owner

@RezaNajian RezaNajian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerrypaulvarghese Thanks for extending the plot function to 2D. I believe hyper_elasticity_2d.py was added by accident—please remove it. Also, could you add a test for the 2D plotter?

- Test 2D mesh validation (rejects non-flat meshes)
- Test initialization and configuration
- Test best sample selection by minimum error
- Test magnitude field creation from vector fields
- Test mesh warping functionality
- Test panel rendering (single and all panels)
- Test warp factor configuration
- Test error handling for missing required fields

All 9 tests passing successfully.
@jerrypaulvarghese jerrypaulvarghese changed the title PR: added 2D plotter for handling also 2d .vtk files Add Plotter2D class for 2D visualization with comprehensive tests Nov 5, 2025
@jerrypaulvarghese
Copy link
Collaborator Author

@jerrypaulvarghese Thanks for extending the plot function to 2D. I believe hyper_elasticity_2d.py was added by accident—please remove it. Also, could you add a test for the 2D plotter?

@RezaNajian : Thank you very much for the review, I have revised the changes and I created the tests also, removed the hyper_elasticity_2d.py file mentioned. Kindly consider.

Removed the plot_solver_convergence function and its documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants