-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Shape opt] water drain response function #12830
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DSchmoelz, nice feature! I have only minor comments and one suggestion to implement a FD test for a new response.
class KRATOS_API(SHAPE_OPTIMIZATION_APPLICATION) WaterDrainResponseFunctionUtility | ||
{ | ||
public: | ||
///@name Type Definitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to add some description and documentation to the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some descriptions :)
|
||
mGravityDirection = ResponseSettings["gravity_direction"].GetVector(); | ||
const double direction_norm = norm_2(mGravityDirection); | ||
KRATOS_ERROR_IF(direction_norm < std::numeric_limits<double>::epsilon()) << "WaterDrainResponseFunctionUtility: 'main_direction' vector norm is 0!" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::numeric_limits::epsilon() might be too small, consider use 1e-16 or so ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to 1e-16
KRATOS_TRY; | ||
|
||
BuiltinTimer timer; | ||
KRATOS_INFO("ShapeOpt::WaterDrain") << "Starting LeveVolumes..." << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KRATOS_INFO("ShapeOpt::WaterDrain") << "Starting LeveVolumes..." << std::endl; | |
KRATOS_INFO("ShapeOpt::WaterDrain") << "Starting LevelVolumes..." << std::endl; |
BuiltinTimer timer; | ||
KRATOS_INFO("ShapeOpt::WaterDrain") << "Starting LeveVolumes..." << std::endl; | ||
|
||
for (std::vector<Kratos::Volume>::size_type i = 0; i<mListOfVolumes.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Id it possible to parallelize such loops?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've parallelized the nested loop over the nodes inside this loop. The number of volumes/ponds is usually much smaller than the amount of nodes.
fyi: the response takes in total around 0.5s for a model with 120000 nodes. That is much faster than the matrix free vm mapper needs to do the mapping.
I agree with @Igarizza. I would add an FD test. This PR has 30k lines due to that large |
Thank you @Igarizza @sunethwarna for reviewing very quickly! I've shrunk the test so that it only consists of 139 nodes, reducing the size of As discussed with @sunethwarna, a FD sensitivity test is right now not possible, because the derivatives of the nodal area are neglected. Additionally, one needs to take into account that the response function can only compute sensitivities for the infeasible nodes (nodes which are "under water"). Hence, a FD sensitivity test should also just be applied on these only. |
📝 Description
Introduces a new geometrical response function which avoids ponding. Includes a node search to detect the ponds and their water volume. The response function value can be chosen as the water volume of the pond or the product of the water volume with the water level ("quadratic_height_penalization").
Example: Cosinus shaped shell - no filtering, using raw sensitivities
water_drain.mp4
Example: Initial flat shell, corner supported, vertical point load, objective strain energy, constraint water drain
left: constrained optimization, right: unconstrained optimization
water_drain_flat_shell.mp4
🆕 Changelog