From fa694ff4c5ef3530f414420a26e52dfbc1bd5a0b Mon Sep 17 00:00:00 2001 From: FEA-eng <59876896+FEA-eng@users.noreply.github.com> Date: Fri, 18 Jul 2025 16:56:39 +0200 Subject: [PATCH] FEM: Add hard contact with CalculiX (#22513) --- src/Mod/Fem/App/FemConstraintContact.cpp | 5 +++++ src/Mod/Fem/App/FemConstraintContact.h | 1 + .../Fem/femsolver/calculix/write_constraint_contact.py | 9 ++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Mod/Fem/App/FemConstraintContact.cpp b/src/Mod/Fem/App/FemConstraintContact.cpp index 126365f744..3975c4339f 100644 --- a/src/Mod/Fem/App/FemConstraintContact.cpp +++ b/src/Mod/Fem/App/FemConstraintContact.cpp @@ -68,6 +68,11 @@ ConstraintContact::ConstraintContact() "ConstraintContact", App::PropertyType(App::Prop_None), "Thermal contact conductance"); + ADD_PROPERTY_TYPE(HardContact, + (false), + "ConstraintContact", + App::PropertyType(App::Prop_None), + "Enable hard contact"); } App::DocumentObjectExecReturn* ConstraintContact::execute() diff --git a/src/Mod/Fem/App/FemConstraintContact.h b/src/Mod/Fem/App/FemConstraintContact.h index 4e7c26cab5..416c105954 100644 --- a/src/Mod/Fem/App/FemConstraintContact.h +++ b/src/Mod/Fem/App/FemConstraintContact.h @@ -53,6 +53,7 @@ public: App::PropertyStiffnessDensity StickSlope; App::PropertyBool EnableThermalContact; App::PropertyStringList ThermalContactConductance; + App::PropertyBool HardContact; // etc /* */ diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py b/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py index 99135ada6e..f602af6ba6 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_contact.py @@ -81,9 +81,12 @@ def write_constraint(f, femobj, contact_obj, ccxwriter): dep_surf = "DEP" + contact_obj.Name f.write(f"{dep_surf}, {ind_surf}\n") f.write(f"*SURFACE INTERACTION, NAME=INT{contact_obj.Name}\n") - f.write("*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=LINEAR\n") - slope = contact_obj.Slope.getValueAs("MPa/mm").Value - f.write(f"{slope:.13G}\n") + if contact_obj.HardContact: + f.write("*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=HARD\n") + else: + f.write("*SURFACE BEHAVIOR, PRESSURE-OVERCLOSURE=LINEAR\n") + slope = contact_obj.Slope.getValueAs("MPa/mm").Value + f.write(f"{slope:.13G}\n") if contact_obj.Friction: f.write("*FRICTION\n") friction = contact_obj.FrictionCoefficient