Refactor PICC study codebase into modular structure to eliminate code duplication#3
Merged
Conversation
Copilot
AI
changed the title
[WIP] créer moi une nouvelle branche et factorise moi le code de ce dépot
Refactor PICC study codebase into modular structure to eliminate code duplication
Aug 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a comprehensive refactoring of the PICC (Plasticity Induced Crack Closure) study codebase to eliminate significant code duplication and improve maintainability.
Problem
The original codebase contained substantial duplication across multiple Abaqus simulation scripts:
picc-automate.py(651 lines)picc_ready.py(666 lines)picc-v2.py(529 lines)picc-plane-stress.py(524 lines)edge_crack_cyclic_loading.py(389 lines)Common patterns were repeated throughout these files, including geometry creation, material definitions, mesh generation, boundary conditions, cyclic loading, and contact surface setup.
Solution
Created a new modular
picc_commonpackage with specialized builder classes:Core Modules
GeometryBuilder- Creates geometric parts, partitions, and sketchesMaterialBuilder- Handles materials and sections with standardized propertiesMeshBuilder- Manages adaptive mesh generation and refinementBoundaryConditionBuilder- Sets up boundary conditions and node setsCyclicLoadingBuilder- Creates configurable cyclic loading patternsContactBuilder- Handles contact surface creation and interactionsOutputBuilder- Manages history and field output requestsPICCModelBuilder- Main orchestrator for complete model creationUsage Examples
Simple complete model creation:
Custom configuration:
Benefits Achieved
Files Added
picc_common/- Complete modular package (8 modules)picc_v3_refactored.py- Demonstrates new usage patternspicc_component_example.py- Shows individual component usageREFACTORING_README.md- Complete migration guidetest_refactoring.py- Validation test suiteBackward Compatibility
All original scripts are preserved for reference. The refactored structure maintains identical functionality while providing a cleaner, more maintainable foundation for future PICC studies.
Testing
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.