Fem: Improve constraint contact - partial fixes #11653

This commit is contained in:
marioalexis
2024-01-26 01:13:59 -03:00
parent f9a9ca2e36
commit 7e5bb7361a
11 changed files with 296 additions and 96 deletions

View File

@@ -33,9 +33,31 @@ PROPERTY_SOURCE(Fem::ConstraintContact, Fem::Constraint)
ConstraintContact::ConstraintContact()
{
/*Note: Initialise parameters here*/
ADD_PROPERTY(Slope, (0.0));
ADD_PROPERTY(Friction, (0.0));
/* */
ADD_PROPERTY_TYPE(Slope,
(0.0),
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Contact stiffness");
ADD_PROPERTY_TYPE(Adjust,
(0.0),
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Node clearance adjustment limit");
ADD_PROPERTY_TYPE(Friction,
(false),
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Enable friction interaction");
ADD_PROPERTY_TYPE(FrictionCoefficient,
(0.0),
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Friction coefficient");
ADD_PROPERTY_TYPE(StickSlope,
(0.0),
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Stick slope");
ADD_PROPERTY_TYPE(Points,
(Base::Vector3d()),
@@ -47,6 +69,7 @@ ConstraintContact::ConstraintContact()
"ConstraintContact",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output),
"Normals where symbols are drawn");
/* */
Points.setValues(std::vector<Base::Vector3d>());
Normals.setValues(std::vector<Base::Vector3d>());
}
@@ -77,3 +100,28 @@ void ConstraintContact::onChanged(const App::Property* prop)
}
}
}
void ConstraintContact::handleChangedPropertyType(Base::XMLReader& reader,
const char* typeName,
App::Property* prop)
{
if (prop == &Slope && strcmp(typeName, "App::PropertyFloat") == 0) {
App::PropertyFloat oldSlope;
oldSlope.Restore(reader);
// old slope value stored as MPa/mm equivalent to 1e3 kg/(mm^2*s^2)
Slope.setValue(oldSlope.getValue() * 1000);
// stick slope internally generated as slope/10
StickSlope.setValue(Slope.getValue() / 10);
}
else if (prop == &Friction && strcmp(typeName, "App::PropertyFloat") == 0) {
App::PropertyFloat oldFriction;
oldFriction.Restore(reader);
FrictionCoefficient.setValue(oldFriction.getValue());
Friction.setValue(oldFriction.getValue() > 0 ? true : false);
}
else {
Constraint::handleChangedPropertyType(reader, typeName, prop);
}
}