Skip to content

Conversation

@arnoldkk13
Copy link

@arnoldkk13 arnoldkk13 commented Nov 19, 2025

I refactored some code in the function do_one_defect_correction_Stokes_step to enhance readability. This includes refactoring repeated, small sections of code into lambda functions.

@arnoldkk13 arnoldkk13 force-pushed the solve_stokes_lambda_refactor branch from 3110ee8 to 38f1d44 Compare November 19, 2025 02:48
Copy link
Contributor

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Yes, nice -- that makes the code less repetitive!

Comment on lines 551 to 557
auto recompute_rhs = [&]()
{
dcr.velocity_residual = system_rhs.block(velocity_block_index).l2_norm();
dcr.pressure_residual = system_rhs.block(pressure_block_index).l2_norm();
dcr.residual = std::sqrt(dcr.velocity_residual * dcr.velocity_residual +
dcr.pressure_residual * dcr.pressure_residual);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this isn't quite the right name for the lambda. You're not actually computing right hand sides, just taking norms. Perhaps call it update_residuals?

@arnoldkk13 arnoldkk13 force-pushed the solve_stokes_lambda_refactor branch from 38f1d44 to aae3c92 Compare November 20, 2025 07:18
Copy link
Member

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

Looks all good to me. I will start the testers, but if they succeed this should be ready to merge.

@gassmoeller
Copy link
Member

/rebuild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants