1 #include "turbulent_channel_flow_skin_friction_check.h" 2 #include "flow_solver/flow_solver_factory.h" 3 #include "flow_solver/flow_solver_cases/channel_flow.h" 4 #include "physics/physics_factory.h" 9 template <
int dim,
int nspecies,
int nstate>
12 const dealii::ParameterHandler ¶meter_handler_input)
14 , parameter_handler(parameter_handler_input)
15 , half_channel_height(parameters_input->flow_solver_param.turbulent_channel_domain_length_y_direction/2.0)
16 , xvelocity_initial_condition_type(parameters_input->flow_solver_param.xvelocity_initial_condition_type)
19 , normal_vector_top_wall(-1.0)
20 , normal_vector_bottom_wall(1.0)
25 parameters_navier_stokes_channel_flow_constant_source_term_wall_model.
pde_type = PDE_enum::navier_stokes_channel_flow_constant_source_term_wall_model;
32 if(turbulent_channel_mesh_stretching_function_type == turbulent_channel_mesh_stretching_function_enum::uniform_mesh_no_stretching) this->
check_wall_model =
true;
36 template <
int dim,
int nspecies,
int nstate>
39 double x_velocity = 0.0;
64 const double kappa = 0.38;
69 const double density = 1.0;
72 const double friction_velocity = reynolds_number_based_on_friction_velocity/reynolds_number_inf;
73 const double y_plus = reynolds_number_inf*density*friction_velocity*dist_from_wall/viscosity_coefficient;
74 const double u_plus = (1.0/kappa)*log(1.0+kappa*y_plus) + (C - (1.0/kappa)*log(kappa))*(1.0 - exp(-y_plus/11.0) - (y_plus/11.0)*exp(-y_plus/3.0));
75 x_velocity = u_plus*friction_velocity;
81 template <
int dim,
int nspecies,
int nstate>
84 double x_velocity_gradient = 0.0;
121 const double kappa = 0.38;
122 const double C = 4.1;
126 const double density = 1.0;
129 const double friction_velocity = reynolds_number_based_on_friction_velocity/reynolds_number_inf;
130 const double y_plus = reynolds_number_inf*density*friction_velocity*dist_from_wall/viscosity_coefficient;
132 const double duplus_dyplus = (1.0/kappa)*(kappa/(1.0+kappa*y_plus)) + (C - (1.0/kappa)*log(kappa))*((1.0/11.0)*exp(-y_plus/11.0)+((y_plus-3.0)/33.0)*exp(-y_plus/3.0));
135 const double du_duplus = friction_velocity;
136 const double dyplus_dy = reynolds_number_inf*friction_velocity*density/viscosity_coefficient;
139 x_velocity_gradient = du_duplus*duplus_dyplus*dyplus_dy;
141 return x_velocity_gradient;
144 template <
int dim,
int nspecies,
int nstate>
152 const double average_wall_shear_stress = 0.5*(wall_shear_stress_top_wall + wall_shear_stress_bottom_wall);
153 return average_wall_shear_stress;
156 template <
int dim,
int nspecies,
int nstate>
173 const double kappa = 0.38;
174 const double C = 4.1;
178 value = ((1.0/kappa + y_plus)*log(1.0+kappa*y_plus) - y_plus)/kappa;
179 value += (C - (1.0/kappa)*log(kappa))*(y_plus + 11.0*exp(-y_plus/11.0) + (3.0/11.0)*(y_plus+3.0)*exp(-y_plus/3.0));
184 template <
int dim,
int nspecies,
int nstate>
187 double bulk_velocity = 0.0;
197 const double density = 1.0;
200 const double friction_velocity = reynolds_number_based_on_friction_velocity/reynolds_number_inf;
201 const double y_plus_max = reynolds_number_inf*density*friction_velocity*1.0/viscosity_coefficient;
202 const double y_plus_min = 0.0;
204 const double dyplus_dy = reynolds_number_inf*friction_velocity*density/viscosity_coefficient;
205 const double integrand_wrt_y = integrand_wrt_yplus/dyplus_dy;
211 const double domain_volume = domain_length_x*domain_length_y*domain_length_z;
213 const double volume_integral = integrand_wrt_y*domain_length_x*domain_length_z;
215 bulk_velocity = friction_velocity*volume_integral/domain_volume;
219 return bulk_velocity;
222 template <
int dim,
int nspecies,
int nstate>
227 const double bulk_density = 1.0;
229 const double skin_friction_coefficient = 2.0*avg_wall_shear_stress/(bulk_density*bulk_velocity*bulk_velocity);
230 return skin_friction_coefficient;
233 template <
int dim,
int nspecies,
int nstate>
237 const double density = 1.0;
238 const double delta = 1.0;
242 const double wall_shear_stress = density*pow((reynolds_number_based_on_friction_velocity*viscosity_coefficient/(reynolds_number_inf*density*delta)),2.0);
243 return wall_shear_stress;
246 template <
int dim,
int nspecies,
int nstate>
250 pcout <<
" - distance_from_wall_for_wall_model_input_velocity = " << distance_from_wall_for_wall_model_input_velocity << std::endl;
251 const double y_position_for_wall_model_input_velocity = -this->
half_channel_height + distance_from_wall_for_wall_model_input_velocity;
252 const double wall_parallel_velocity =
get_x_velocity(y_position_for_wall_model_input_velocity);
253 const double density = 1.0;
257 get_wall_shear_stress_magnitude(wall_parallel_velocity,
258 distance_from_wall_for_wall_model_input_velocity,
259 viscosity_coefficient,
261 reynolds_number_inf);
262 return wall_shear_stress;
265 template <
int dim,
int nspecies,
int nstate>
270 static_cast<void>(flow_solver->run());
273 std::unique_ptr<FlowSolver::ChannelFlow<dim, nspecies, nstate>> flow_solver_case = std::make_unique<FlowSolver::ChannelFlow<dim,nspecies,nstate>>(this->
all_parameters);
274 double computed_wall_shear_stress = 0.0;
275 if(this->
all_parameters->
using_wall_model) computed_wall_shear_stress = flow_solver_case->get_average_wall_shear_stress_from_wall_model(*(flow_solver->dg));
276 else computed_wall_shear_stress = flow_solver_case->get_average_wall_shear_stress(*(flow_solver->dg));
278 const double relative_error_wall_shear_stress = abs(computed_wall_shear_stress - expected_wall_shear_stress);
279 pcout <<
"computed wall shear stress is " << computed_wall_shear_stress << std::endl;
280 pcout <<
"expected wall shear stress is " << expected_wall_shear_stress <<
282 pcout <<
"error is " << relative_error_wall_shear_stress << std::endl;
285 flow_solver_case->set_bulk_flow_quantities(*(flow_solver->dg));
286 const double computed_bulk_velocity = flow_solver_case->get_bulk_velocity();
287 const double computed_skin_friction_coefficient = flow_solver_case->get_skin_friction_coefficient_from_average_wall_shear_stress(computed_wall_shear_stress);
290 const double relative_error_bulk_velocity = abs(computed_bulk_velocity - expected_bulk_velocity);
291 const double relative_error_skin_friction_coefficient = abs(computed_skin_friction_coefficient - expected_skin_friction_coefficient);
292 pcout <<
"computed bulk velocity is " << computed_bulk_velocity << std::endl;
293 pcout <<
"expected bulk velocity is " << expected_bulk_velocity << std::endl;
294 pcout <<
"error is " << relative_error_bulk_velocity << std::endl;
299 pcout <<
"computed skin friction coefficient is " << computed_skin_friction_coefficient << std::endl;
300 pcout <<
"expected skin friction coefficient is " << expected_skin_friction_coefficient << std::endl;
301 pcout <<
"error is " << relative_error_skin_friction_coefficient << std::endl;
302 pcout <<
"emperical estimate for skin friction coefficient is " << emperical_estimate_for_skin_friction_coefficient << std::endl;
303 const double percent_emperical_estimate_error = 100.0*abs(computed_skin_friction_coefficient - emperical_estimate_for_skin_friction_coefficient)/emperical_estimate_for_skin_friction_coefficient;
304 pcout <<
"percent error with computed is " << percent_emperical_estimate_error <<
" %" << std::endl;
305 if(percent_emperical_estimate_error > 30.0) {
306 pcout <<
"Warning: considerable difference with empirical estimate for skin friction coefficient value." << std::endl;
312 pcout <<
"Wall model checks: " << std::endl;
314 pcout <<
" - manually computed wall shear stress from wall model: " << computed_wall_shear_stress_wall_model << std::endl;
315 pcout <<
" - expected wall shear stress is " << expected_wall_shear_stress <<
317 const double percent_error_wall_shear_stress_wall_model = 100.0*abs(computed_wall_shear_stress_wall_model - expected_wall_shear_stress)/expected_wall_shear_stress;
318 pcout <<
" - percent error is " << percent_error_wall_shear_stress_wall_model <<
" %" << std::endl;
319 const double percent_error_wall_shear_stress_wall_model_vs_manual = 100.0*abs(computed_wall_shear_stress - computed_wall_shear_stress_wall_model)/computed_wall_shear_stress_wall_model;
320 pcout <<
" - percent error between computed and manually computed wall shear stress from wall model is " << percent_error_wall_shear_stress_wall_model_vs_manual <<
" %" << std::endl;
321 pcout <<
" - NOTE: computed wall shear stress without using wall model yields: " << flow_solver_case->get_average_wall_shear_stress(*(flow_solver->dg)) << std::endl;
322 if(percent_error_wall_shear_stress_wall_model > 5.0) {
323 pcout <<
"Error: considerable difference between wall model shear stress and expected value." << std::endl;
326 pcout <<
" Test passed, wall model metrics are within specified tolerance." << std::endl;
332 if (relative_error_wall_shear_stress > 1.0e-9) {
333 pcout <<
"Computed wall shear stress is not within specified tolerance with respect to expected value." << std::endl;
334 pcout <<
"Error is : " << relative_error_wall_shear_stress << std::endl;
336 }
else if (relative_error_bulk_velocity > 1.0e-9) {
337 pcout <<
"Computed bulk velocity is not within specified tolerance with respect to expected value." << std::endl;
338 pcout <<
"Error is : " << relative_error_bulk_velocity << std::endl;
340 }
else if (relative_error_skin_friction_coefficient > 1.0e-9) {
341 pcout <<
"Computed skin friction coefficient is not within specified tolerance with respect to expected value." << std::endl;
342 pcout <<
"Error is : " << relative_error_skin_friction_coefficient << std::endl;
345 pcout <<
" Test passed, computed wall shear stress, skin friction coefficient, and bulk velocity are within specified tolerance." << std::endl;
PartialDifferentialEquation pde_type
Store the PDE type to be solved.
FlowSolverParam flow_solver_param
Contains the parameters for simulation cases (flow solver test)
double get_x_velocity(const double y) const
returns x-velocity
double turbulent_channel_domain_length_y_direction
For channel flow, domain length in y-direction.
TurbulentChannelMeshStretchingFunctionType
For turbulent channel flow, selects the type of mesh stretching function.
double get_skin_friction_coefficient() const
returns skin friction coefficient
double turbulent_channel_friction_velocity_reynolds_number
For channel flow, channel Reynolds number based on wall friction velocity.
PartialDifferentialEquation
Possible Partial Differential Equations to solve.
Files for the baseline physics.
double get_bulk_velocity() const
returns bulk velocity
double nondimensionalized_constant_viscosity
Flag for using constant viscosity.
TurbulentChannelFlowSkinFrictionCheck(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler ¶meter_handler_input)
Constructor.
const double y_top_wall
y-value for top wall
double reynolds_number_inf
Farfield Reynolds number.
double get_x_velocity_gradient(const double y) const
returns x-velocity gradient
static std::unique_ptr< FlowSolver< dim, nspecies, nstate > > select_flow_case(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler ¶meter_handler_input)
Factory to return the correct flow solver given input file.
double get_wall_shear_stress_from_wall_model() const
returns wall shear stress from wall model
const double normal_vector_bottom_wall
normal vector for bottom wall
std::shared_ptr< Physics::NavierStokes_ChannelFlowConstantSourceTerm_WallModel< dim, nspecies, dim+2, double > > navier_stokes_channel_flow_constant_source_term_wall_model_physics
Pointer to Navier-Stokes physics object for computing things on the fly.
Main parameter class that contains the various other sub-parameter classes.
const dealii::ParameterHandler & parameter_handler
Parameter handler for storing the .prm file being ran.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
NavierStokesParam navier_stokes_param
Contains parameters for the Navier-Stokes equations non-dimensionalization.
double get_wall_shear_stress() const
returns wall shear stress
double turbulent_channel_domain_length_z_direction
For channel flow, domain length in z-direction.
double turbulent_channel_domain_length_x_direction
For channel flow, domain length in x-direction.
bool check_wall_model
Flag for checking wall model (true if uniform grid)
int run_test() const override
Run test.
const double y_bottom_wall
y-value for bottom wall
const double half_channel_height
Half channel height.
double get_wall_shear_stress_from_friction_reynolds_number() const
returns wall shear stress from friction Reynolds number
TurbulentChannelMeshStretchingFunctionType turbulent_channel_mesh_stretching_function_type
Selected DensityInitialConditionType from the input file.
Navier-Stokes equations with constant physical source term for the turbulent channel flow case and wa...
static std::shared_ptr< PhysicsBase< dim, nspecies, nstate, real > > create_Physics(const Parameters::AllParameters *const parameters_input, std::shared_ptr< ModelBase< dim, nspecies, nstate, real > > model_input=nullptr)
Factory to return the correct physics given input file.
const XVelocityInitialConditionEnum xvelocity_initial_condition_type
Turbulent channel x-velocity initial condition type.
dealii::ConditionalOStream pcout
ConditionalOStream.
Turbulent Channel Flow Skin Friction Check.
double get_integral_of_x_velocity(const double y_plus) const
returns integral of x-velocity
Base class of all the tests.
bool using_wall_model
Flag for using wall model (initialized as false)