Conversation
- add functions for setting initial conditions in particle wrapper
-add additional conditions in reading vertexSets
add test 123_set_initial_condition
There was a problem hiding this comment.
Pull Request Overview
This pull request adds Abaqus input file generator support and related functionality for the EdelweissMPM framework. The changes introduce new test examples and enhance particle constraint handling capabilities.
- Implements Abaqus input file parsing and mesh generation from .inp files
- Adds support for setting initial conditions on Marmot particles (e.g., geostatic stress)
- Enhances vertex-based Dirichlet boundary conditions with support for multiple vertices per particle
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/127_marmot_consistent_weak_formulation_test/marmot_consistent_weak_formulation.py | New test for consistent weak formulation with CWF correction loads |
| examples/126_set_lagrangian_on_vertices_test/set_lagrangian_on_vertices.py | New test for setting Lagrangian constraints on particle vertices |
| examples/125_marmot_set_initial_condition_test/marmot_set_initial_condition.py | New test demonstrating initial condition setting (geostatic stress) |
| examples/124_abq_input_reader_test/abq_input_reader.py | New test for Abaqus input file reader with potato mesh example |
| edelweissmpm/particles/marmot/marmotparticlewrapper.pyx | Implements setInitialCondition method for particle state initialization |
| edelweissmpm/particles/marmot/marmotparticlewrapper.pxd | Adds C++ setInitialCondition method declaration |
| edelweissmpm/models/mpmmodel.py | Adds vertexSets collection to model for vertex-based operations |
| edelweissmpm/constraints/particlelagrangianweakdirichlet.py | Enhances factory to support multiple vertex IDs per constraint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def run_sim(): | ||
| dimension = 2 | ||
|
|
||
| # set nump linewidth to 200: |
There was a problem hiding this comment.
The comment "nump" appears to be a typo for "numpy". This should be corrected to "numpy" for clarity.
| # set nump linewidth to 200: | |
| # set numpy linewidth to 200: |
| def run_sim(): | ||
| dimension = 2 | ||
|
|
||
| # set nump linewidth to 200: |
There was a problem hiding this comment.
The comment "nump" appears to be a typo for "numpy". This should be corrected to "numpy" for clarity.
| # set nump linewidth to 200: | |
| # set numpy linewidth to 200: |
| def run_sim(): | ||
| dimension = 2 | ||
|
|
||
| # set nump linewidth to 200: |
There was a problem hiding this comment.
The comment "nump" appears to be a typo for "numpy". This should be corrected to "numpy" for clarity.
| # set nump linewidth to 200: | |
| # set numpy linewidth to 200: |
| ): | ||
| dimension = 2 | ||
|
|
||
| # set nump linewidth to 200: |
There was a problem hiding this comment.
The comment "nump" appears to be a typo for "numpy". This should be corrected to "numpy" for clarity.
| # set nump linewidth to 200: | |
| # set numpy linewidth to 200: |
| # if reading_surfaces: | ||
| # parts = [p.strip() for p in line.split(',') if p.strip()] | ||
| # surface_elSet = parts[0] | ||
| # surface_orientation = int(parts[1][-1]) | ||
| # if current_surface not in surfaces.keys(): | ||
| # surfaces[current_surface] = {surface_elSet: surface_orientation} | ||
| # else: | ||
| # surfaces[current_surface][surface_elSet] = surface_orientation |
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # if reading_surfaces: | |
| # parts = [p.strip() for p in line.split(',') if p.strip()] | |
| # surface_elSet = parts[0] | |
| # surface_orientation = int(parts[1][-1]) | |
| # if current_surface not in surfaces.keys(): | |
| # surfaces[current_surface] = {surface_elSet: surface_orientation} | |
| # else: | |
| # surfaces[current_surface][surface_elSet] = surface_orientation |
| # for surfaceName, surfaceData in surfaces.items(): | ||
| # modelSurfaceName = f"{name}_{surfaceName}" | ||
| # for elsetName, orientation in surfaceData.items(): | ||
| # print(surfaceName, elsetName, orientation) | ||
| # if modelSurfaceName not in model.surfaces.keys(): | ||
| # model.surfaces[f"{name}_{surfaceName}"] = {orientation: [particles[e-1] for e in elsets[elsetName]]} | ||
| # else: | ||
| # model.surfaces[f"{name}_{surfaceName}"][orientation] = [particles[e-1] for e in elsets[elsetName]] | ||
|
|
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # for surfaceName, surfaceData in surfaces.items(): | |
| # modelSurfaceName = f"{name}_{surfaceName}" | |
| # for elsetName, orientation in surfaceData.items(): | |
| # print(surfaceName, elsetName, orientation) | |
| # if modelSurfaceName not in model.surfaces.keys(): | |
| # model.surfaces[f"{name}_{surfaceName}"] = {orientation: [particles[e-1] for e in elsets[elsetName]]} | |
| # else: | |
| # model.surfaces[f"{name}_{surfaceName}"][orientation] = [particles[e-1] for e in elsets[elsetName]] |
| # for f in theModel.meshfreeKernelFunctions.values(): | ||
| # boundingBox = f.getBoundingBox() | ||
| # boundingBoxMin = boundingBox[0] | ||
| # boundingBoxMax = boundingBox[1] | ||
| # width = boundingBoxMax[0] - boundingBoxMin[0] | ||
| # height = boundingBoxMax[1] - boundingBoxMin[1] | ||
| # #plt.plot(boundingBoxMin[0], boundingBoxMin[1], 'ro', markersize=1) | ||
| # plt.gca().add_patch(plt.Rectangle(boundingBoxMin, width, height, linestyle='-', linewidth=1, edgecolor='r', facecolor='none')) |
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # for f in theModel.meshfreeKernelFunctions.values(): | |
| # boundingBox = f.getBoundingBox() | |
| # boundingBoxMin = boundingBox[0] | |
| # boundingBoxMax = boundingBox[1] | |
| # width = boundingBoxMax[0] - boundingBoxMin[0] | |
| # height = boundingBoxMax[1] - boundingBoxMin[1] | |
| # #plt.plot(boundingBoxMin[0], boundingBoxMin[1], 'ro', markersize=1) | |
| # plt.gca().add_patch(plt.Rectangle(boundingBoxMin, width, height, linestyle='-', linewidth=1, edgecolor='r', facecolor='none')) |
| # for surfaceName, surfaceData in theModel.surfaces.items(): | ||
| # for orientation, particles in surfaceData.items(): | ||
| # #print(surfaceName, orientation, len(particles)) | ||
| # for p in particles: | ||
| # verts = p.getVertexCoordinates() | ||
| # plt.plot(verts[:, 0], verts[:, 1], linestyle='-', linewidth=2, color='b') | ||
|
|
There was a problem hiding this comment.
This comment appears to contain commented-out code.
| # for surfaceName, surfaceData in theModel.surfaces.items(): | |
| # for orientation, particles in surfaceData.items(): | |
| # #print(surfaceName, orientation, len(particles)) | |
| # for p in particles: | |
| # verts = p.getVertexCoordinates() | |
| # plt.plot(verts[:, 0], verts[:, 1], linestyle='-', linewidth=2, color='b') |
| reading_surfaces = True | ||
| current_nset = None | ||
| current_elset = None | ||
| current_surface = line.split("name=")[1].split(",")[0].strip() if "=" in line else "default" |
There was a problem hiding this comment.
Variable current_surface is not used.
| current_surface = line.split("name=")[1].split(",")[0].strip() if "=" in line else "default" |
No description provided.