-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add physics for fully coupled k-epsilon #27614
base: next
Are you sure you want to change the base?
Conversation
Job Documentation on 54e2eb3 wanted to post the following: View the site here This comment will be updated on new commits. |
Job Coverage on 2c3e6e5 wanted to post the following: Framework coverage
Modules coverageNavier stokes
Full coverage reportsReports
Warnings
This comment will be updated on new commits. |
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.
Some very minor comments in case they help. They are mostly oriented at not deteriorating the performance of the linear solver. Nice work!
destruction += destruction_visc; | ||
destruction += destruction_visc + 0 * destruction_log; | ||
else | ||
destruction += destruction_log; | ||
destruction += destruction_log + 0 * destruction_visc; |
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.
Please note that this is adding unneessary computational burden to the SIMPLE-like solvers. Please add a switch to identify if we are trying to solve these equations with a simple solve. If we are, please don't do the multiplication by 0.
mooseAssert(distance_vec.size(), "Should have found a distance vector"); | ||
mooseAssert(distance_vec.size() == face_info_vec.size(), | ||
"Should be as many distance vectors as face info vectors"); | ||
|
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.
Why are these cehck needed at this point? It seems to be adding computational burden every time that the kernel is called
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.
asserts are removed from opt mode. It only affects devel builds, in a very minor way. They are a good practice
|
||
for (unsigned int i = 0; i < distance_vec.size(); i++) | ||
{ | ||
const auto distance = distance_vec[i]; | ||
mooseAssert(distance > 0, "Should be at a non-zero distance"); |
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.
Is this check needed at this point? It seems to justbe adding computational burden every time that we call this kernel. Please advise
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.
same here. It does not hurt
@@ -148,7 +155,7 @@ INSFVTKEDSourceSink::computeQpResidual() | |||
destruction += 2.0 * TKE * wall_mut / Utility::pow<2>(distance_vec[i]) / tot_weight; | |||
} | |||
else | |||
destruction += std::pow(_C_mu, 0.75) * rho * std::pow(TKE, 1.5) / | |||
destruction += std::pow(_C_mu, 0.75) * rho * std::pow(std::max(ADReal(0), TKE), 1.5) / |
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.
TKE should be always positive by the conservation properties of the k epsilon mode. This capping may be unnecessary
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.
the nonlinear solver was making it negative. It's unfortunate but it happens with Newton methods
@@ -24,7 +24,8 @@ kEpsilonViscosityAux::validParams() | |||
params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction."); | |||
params.addParam<MooseFunctorName>("v", "The velocity in the y direction."); | |||
params.addParam<MooseFunctorName>("w", "The velocity in the z direction."); | |||
params.addRequiredParam<MooseFunctorName>(NS::TKE, "Coupled turbulent kinetic energy."); | |||
params.addRequiredParam<MooseFunctorName>("k", "Coupled turbulent kinetic energy."); |
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.
To keep it consistent, please only use variable names in the NS namespace
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 am deprecating the old name "k" and replacing it with the new NS::TKE (= tke)
@@ -20,7 +20,8 @@ INSFVMixingLengthTKEDBC::validParams() | |||
params.addClassDescription("Adds inlet boundary condition for the turbulent kinetic energy " | |||
"dissipation rate based on characteristic length."); | |||
params.addParam<MooseFunctorName>("C_mu", 0.09, "Coupled turbulent kinetic energy closure."); | |||
params.addRequiredParam<MooseFunctorName>(NS::TKE, "The turbulent kinetic energy."); |
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.
Same here. Please try to only use variable names in the NS namespace
@@ -26,7 +26,8 @@ INSFVTKEDWallFunctionBC::validParams() | |||
params.addRequiredParam<MooseFunctorName>(NS::density, "Density"); | |||
params.addRequiredParam<MooseFunctorName>(NS::mu, "Dynamic viscosity."); | |||
params.addRequiredParam<MooseFunctorName>(NS::mu_t, "The turbulent viscosity."); | |||
params.addRequiredParam<MooseFunctorName>(NS::TKE, "The turbulent kinetic energy."); |
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.
Please try to only use variable names in the NS namespace
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.
see first comment, this is using NS but NS got changed so we have to code "k" as the deprecated parameter
@@ -82,14 +84,16 @@ INSFVTKEDWallFunctionBC::boundaryValue(const FaceInfo & fi) const | |||
if (y_plus <= 5.0) // sub-laminar layer | |||
{ | |||
const auto laminar_value = 2.0 * weight * TKE * mu / std::pow(dist, 2); | |||
return laminar_value.value(); | |||
// Additional zero term to make sure new derivatives are not introduced as y_plus changes | |||
return laminar_value + 0 * _mu_t(makeElemArg(&_current_elem), state); |
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.
This is adding unnecessary computational burden to the linear solver. Please add a switch between linear and nonlinear if this is needed for the nonlinear solver
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.
those are mostly removed
} | ||
else if (y_plus >= 30.0) // log-layer | ||
{ | ||
const auto turbulent_value = weight * _C_mu(makeElemArg(&_current_elem), state) * | ||
std::pow(std::abs(TKE), 1.5) / | ||
(_mu_t(makeElemArg(&_current_elem), state) * dist); | ||
return turbulent_value.value(); | ||
// Additional zero term to make sure new derivatives are not introduced as y_plus changes | ||
return turbulent_value + 0 * mu; |
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.
Same for this one. This is adding unnecessary computational burden to the linear solver. Please add a switch between linear and nonlinear if this is needed for the nonlinear solver
8f806c8
to
022d722
Compare
- not deriving from scalar advection because two variables that dont have exactly the same equation - not doing a derived class for now, until maybe we turn Turbulence into a meta-action refs idaholab#9007
Add names of variables as member attributes refs idaholab#9007
Add support for using a functor material for mu_t, preserving derivatives refs idaholab#9007
612ff4e
to
6905537
Compare
Add deprecated 'k' parameter to k-eps objects
- dont shed mu_t derivatives - use NS::computeSpeed to survive negative init - add 0 x other branch for y_plus selections of code (y_plus can change during the nonlinear solve)
better than turbulence as it simplifies boundary-checking logic
…ore cleanly and be able to check walls between heat and flow equations for lid-driven cavities
- compare to full results as the 'short' tests do not converge the solution We still expect some minor differences between segregated and fully coupled (relaxation coeffs dependence for example)
terms for sparsity pattern preservation
Add support for C_pl coeff in tubrulence physics
…to linearized) Fixup kt aux-variable creation in turb physics
Add matching outputs to segregated inputs Try bounds on k and epsilon
…d objects Clarify lagged/not lagged terms a bit. Limit number of functor evaluations
TODO:
It might take a bit to finish this. There's a lot, and a lot of options that don't work together.
I ll get back to Components