[ConvectionDiffusionApplication] Adding crosswind stabilization to Eulerian Convection–Diffusion element#14272
[ConvectionDiffusionApplication] Adding crosswind stabilization to Eulerian Convection–Diffusion element#14272
Conversation
rubenzorrilla
left a comment
There was a problem hiding this comment.
I'm not fully convinced about the elemental cross wind factor calculation. Aside of this, the others are minors.
applications/ConvectionDiffusionApplication/custom_elements/eulerian_conv_diff.cpp
Outdated
Show resolved
Hide resolved
applications/ConvectionDiffusionApplication/custom_elements/eulerian_conv_diff.cpp
Outdated
Show resolved
Hide resolved
applications/ConvectionDiffusionApplication/custom_elements/eulerian_conv_diff.cpp
Outdated
Show resolved
Hide resolved
| const double disc_capturing_coeff = 0.5*C*h*fabs(res/norm_grad); | ||
| BoundedMatrix<double,TDim,TDim> D = disc_capturing_coeff*( IdentityMatrix(TDim)); | ||
| const double norm_vel_squared = norm_vel*norm_vel; | ||
| D += (std::max( disc_capturing_coeff - tau*norm_vel_squared , 0.0) - disc_capturing_coeff)/(norm_vel_squared) * outer_prod(vel_gauss,vel_gauss); |
There was a problem hiding this comment.
Are you sure about this? Shouldn't it involve the viscosity besides the tau?
There was a problem hiding this comment.
@rubenzorrilla, I use tau because I want to remove the contribution in the streamline direction.
The problem with the projected Péclet is that when the velocity and the gradient are aligned, the crosswind contribution disappears, even if oscillations are still present.
This is likely why the original formulation is implemented in this way. For this reason, I think it is better to keep the current approach, since it is more appropriate and robust.
applications/ConvectionDiffusionApplication/tests/cpp_tests/test_eulerian_conv_diff.cpp
Show resolved
Hide resolved
...ons/ConvectionDiffusionApplication/tests/SourceTermTest/SourceTermTestProjectParameters.json
Show resolved
Hide resolved
| const double res = dphi_dt + conv; | ||
|
|
||
| // Projected velocity | ||
| u_proj = (conv/norm_grad) * (grad_phi_halfstep/norm_grad); |
There was a problem hiding this comment.
| u_proj = (conv/norm_grad) * (grad_phi_halfstep/norm_grad); | |
| u_proj = (conv/std::pow(norm_grad,2)) * grad_phi_halfstep; |
Easier to follow
| double density; | ||
| double beta; | ||
| double div_v; | ||
| double C; |
There was a problem hiding this comment.
I'd use a more self-descriptive variable name
| // Residual | ||
| const double res = dphi_dt + conv; | ||
|
|
||
| // Projected velocity |
There was a problem hiding this comment.
| // Projected velocity | |
| // Velocity projected in the direction of the solution gradient |
| // Projected velocity | ||
| u_proj = (conv/norm_grad) * (grad_phi_halfstep/norm_grad); | ||
|
|
||
| // Projected Peclet |
There was a problem hiding this comment.
| // Projected Peclet | |
| // Peclet number projected in the direction of the solution gradient |
| // Residual | ||
| const double res = dphi_dt + conv; |
There was a problem hiding this comment.
Shouldn't this include the source term and diffusion?
There was a problem hiding this comment.
Also the beta term in case we use a compressible flux.
rubenzorrilla
left a comment
There was a problem hiding this comment.
Finally, we agree on having alpha_c = Variables.C as default, but we leave commented current option with the projected Peclet number and limiter. Lets put some comments explaining our discussion.
📝 Description
This pull request introduces a crosswind stabilization term in the
EulerianConvectionDiffusionElementof Kratos.The implementation follows the discontinuity-capturing approach proposed in A discontinuity‑capturing crosswind‑dissipation for the finite element solution of the convection‑diffusion equation by Ramon Codina. The method adds a nonlinear diffusion in the direction orthogonal to the flow in order to reduce the spurious oscillations that may still appear when using streamline-based stabilization techniques.
The stabilization term can be activated through the element settings.
By default
CROSS_WIND_STABILIZATION_FACTORis zero.Additionally, a unit test has been included to verify the correct behaviour of the implementation.
To illustrate the effect of the stabilization, two example simulations are shown below:
Without crosswind stabilization:

Spurious oscillations appear near steep gradients.
With crosswind stabilization:

The oscillations are significantly reduced.
🆕 Changelog