Skip to content

Geo/soil test direct shear#13566

Merged
indigocoral merged 36 commits intomasterfrom
geo/soil_test_direct_shear
Jul 4, 2025
Merged

Geo/soil test direct shear#13566
indigocoral merged 36 commits intomasterfrom
geo/soil_test_direct_shear

Conversation

@indigocoral
Copy link
Contributor

@indigocoral indigocoral commented Jun 26, 2025

📝 Description
The GUI for the Element test has already been created. The triaxial test has also been added earlier. This issue aims at creating a direct shear test and also adding it to the GUI and being able to see the results plots.

🆕 Changelog

  • Build Direct Simple Shear test
  • Enabling the GUI to run the Direct Simple Shear test
  • Plotting the results
  • Reformat the file structures to be more generalized
  • Remove the tmp folder once the plotting is finished
  • Added Kratos logo to the UI
  • Added tests icon pictures to the UI
  • Added a label.py file to contain all the constants
  • Added pre-release license agreement
  • Added functionality to store the one-time agreement of the user
  • Added File and Help menu at the top
  • Added About section to the Help menu with Kratos and Deltares logos
  • Added title and the version number

@indigocoral indigocoral requested a review from a team as a code owner June 26, 2025 09:35
@indigocoral indigocoral self-assigned this Jun 26, 2025
@indigocoral indigocoral added the GeoMechanics Issues related to the GeoMechanicsApplication label Jun 26, 2025
@indigocoral indigocoral requested review from WPK4FEM and rfaasse June 26, 2025 09:36
WPK4FEM
WPK4FEM previously approved these changes Jun 26, 2025
Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

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

Hi Marjan,
Thank you for all the good stuff here and for putting the used labels in a file and reusing them. I have some small comments in the test file setup and a remark about the direct shear picture. The code for the UI I have tried to understand, but failed due to my lack of experience with such programming. Luckily you have asked Richard to look at that too.
Regards, Wijtze Pieter

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder about the tau_xy indication in the picture. tau_xy is the shear stress that would appear on the contact of the 2 moving boxes in the picture. The test works with either a force or a prescribed displacement on the side which leads to a shear stress in the contact zone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try to fix that in the next PR.

"PERMEABILITY_YY" : 4.5e-30,
"PERMEABILITY_XY" : 0.0,
"DYNAMIC_VISCOSITY" : 8.9e-07,
"THICKNESS" : 1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Thickness is not needed in this plane strain computation.
Tables is empty and probably redundant.

Comment on lines +118 to +124
"model_part_name" : "PorousDomain.Top_load",
"variable_name" : "NORMAL_CONTACT_STRESS",
"active" : [true,false],
"value" : [0.0,0.0],
"fluid_pressure_type" : "Uniform",
"table" : [1,0]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As we have verically constrained the movement of the top nodes, this load disappears straight into the supports. We might omit it. The vertical stress comes from the next apply_initial_uniform_stress_field process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines +158 to +164
"nodal_nonhistorical_results" : [],
"gauss_point_results" : ["CAUCHY_STRESS_TENSOR","VON_MISES_STRESS","MEAN_EFFECTIVE_STRESS","ENGINEERING_STRAIN_TENSOR"]
},
"point_data_configuration" : []
},
"output_name" : "gid_output/output"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the empty placeholders, I think we do not use them.

Copy link
Contributor

@rfaasse rfaasse left a comment

Choose a reason for hiding this comment

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

Nicely done, it works nicely and looking at the code it was added in a generic way (I expect adding the oedometer test would not be too difficult due to how extendible its setup is👍 ).

I have some suggestions, but nothing major. For me it's also still quite difficult to review due to being unfamiliar with the framework.


def update_middle_maximum_strain(self, maximum_strain):
pattern = r'\$middle_maximum_strain\b'
prescribed_middle_displacement = (-maximum_strain / 2) / 100
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my understanding, is this the average between the max and 0? To me it's not clear why we need a minus sign and why we need to divide by 100.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah.. yeah probably not a very clear coding from my side :D
The maximum strain will be taken from the user as an input in percentage. We need to divide by 100 to get the value. And then a minus sign (in Triaxial) was because we were applying compression. But here in the Direct Shear, I don't think it matters much which direction it gets applied because it is applied in X direction and we don't have any condition on the other side to make it matter from which side it should be applied. I won't change it now but will take a note to remember to maybe generalize it later.
Also, about the averaging, yes indeed. When setting up the Direct shear test, you have to apply the shear stress to the top half part of the soil model. We basically mimic that by applying the half amount of the shear strain to the middle points. Hope this is clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

The shear strain and shear stress ( like any other strain or stress ) are uniform in these tests. To get such a uniform strain the motion of the nodes is prescribed such that the bottom nodes do not move, the top nodes move all with the same distance and the nodes at half the height of the specimen move half the distance of the top nodes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Clear, I missed the '%' that is clearly there in the GUI and the rest is clear from both your explanations

rfaasse
rfaasse previously approved these changes Jul 3, 2025
Copy link
Contributor

@rfaasse rfaasse left a comment

Choose a reason for hiding this comment

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

Thanks for processing the review comments! I have a few comments left, but most of them are not for changes that need to be done right now.

I think after this v0.1.0 release, we should have a discussion with the team to determine what exactly the direction and our requirements are for this GUI and the extensions we want to make. There are for example design patterns regarding GUIs to make it more maintainable and split the logic (of running and calculating things) with displaying everything (these are patterns like Model-View-Control or Model-View-Viewmodel).

Right now I don't have the overview (both on direction and the current code) on if it would be necessary to do some restructuring there or if it's already fit for everything we want it to be able to do (mainly in the future).

For now, well done, I think we're almost there!

self.test_type_menu = ttk.Combobox(
parent,
textvariable=self.test_type_var,
values=["Drained"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not too sure if we need to have this drop-down with a single value (since we've only got 'Drained'). Given the time-frame, let's leave it as is for now, but in general my opinion it's better not to add more functionality than needed in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was requested and it is to show the user what type of test this is. For now we have "Drained" only, but more options will have to be added later, like: "Undrained", etc...




def show_license_agreement():
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for now, but I'd prefer to have this in a separate plain resource txt file somewhere in a later PR

Comment on lines +250 to +251
if not os.path.exists(LICENSE_FLAG_PATH):
show_license_agreement()
Copy link
Contributor

Choose a reason for hiding this comment

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

This means it doesn't really matter what's in the file right? I'm not sure if that would matter. Of course people can circumvent this by just creating that file themselves, but I don't think that should be an issue, since they also would just have access to the python files, so they can do what they want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean... Yes :D

license_window.destroy()

def decline():
messagebox.showinfo("Exit", "You must accept the license agreement to use this software.")
Copy link
Contributor

Choose a reason for hiding this comment

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

If you close the license popup, the application will crash instead of showing this exit message (not a blocker, but maybe something to fix in the future)

license_window.destroy()

def decline():
messagebox.showinfo("Exit", "You must accept the license agreement to use this software.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Also it's interesting you can decline it after you already accepted it before, but that's also fine for now in my opinion


def update_middle_maximum_strain(self, maximum_strain):
pattern = r'\$middle_maximum_strain\b'
prescribed_middle_displacement = (-maximum_strain / 2) / 100
Copy link
Contributor

Choose a reason for hiding this comment

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

Clear, I missed the '%' that is clearly there in the GUI and the rest is clear from both your explanations

Copy link
Contributor

@rfaasse rfaasse left a comment

Choose a reason for hiding this comment

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

Good to go!

@indigocoral indigocoral merged commit bde18dc into master Jul 4, 2025
21 of 22 checks passed
@indigocoral indigocoral deleted the geo/soil_test_direct_shear branch July 4, 2025 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GeoMechanics Issues related to the GeoMechanicsApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants