PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
wallfunction.h
Go to the documentation of this file.
1#ifndef WALLFUNCTION_H
2#define WALLFUNCTION_H
3
4#include <petscpf.h>
5#include <petscdmswarm.h>
6#include <stdlib.h>
7#include <time.h>
8#include <math.h>
9#include <petsctime.h>
10#include <petscsys.h>
11#include <petscdmcomposite.h>
12#include <petscsystypes.h>
13
14// Include additional headers
15#include "variables.h" // Shared type definitions
16#include "ParticleSwarm.h" // Particle swarm functions
17#include "walkingsearch.h" // Particle location functions
18#include "grid.h" // Grid functions
19#include "logging.h" // Logging macros
20#include "io.h" // Data Input and Output functions
21#include "interpolation.h" // Interpolation routines
22#include "ParticleMotion.h" // Functions related to motion of particles
23#include "Boundaries.h" // Functions related to Boundary condition
24
25// ===========================================================================
26// Function Declarations
27// ===========================================================================
28
29/**
30 * @brief Applies no-slip wall boundary condition with linear interpolation
31 *
32 * This function enforces a no-slip boundary condition (zero velocity at the wall)
33 * by linearly interpolating between the wall velocity (typically zero) and the
34 * velocity at a reference point in the flow.
35 *
36 * MATHEMATICAL FORMULATION:
37 * For a point at distance sb from the wall, with a reference velocity Uc
38 * at distance sc from the wall:
39 * U_boundary = U_wall + (U_reference - U_wall) * (sb / sc)
40 *
41 * PHYSICAL INTERPRETATION:
42 * This provides a first-order approximation assuming linear velocity variation
43 * in the near-wall region, which is valid in the viscous sublayer.
44 *
45 * @param[in] user Simulation context (unused but required for interface)
46 * @param[in] distance_reference Wall-normal distance to reference point (sc)
47 * @param[in] distance_boundary Wall-normal distance to boundary point (sb)
48 * @param[in] velocity_wall Velocity at the wall (Ua), typically zero
49 * @param[in] velocity_reference Velocity at reference point (Uc)
50 * @param[out] velocity_boundary Computed velocity at boundary point (Ub)
51 * @param[in] normal_x X-component of wall normal vector
52 * @param[in] normal_y Y-component of wall normal vector
53 * @param[in] normal_z Z-component of wall normal vector
54 *
55 * @note For moving walls, velocity_wall would be non-zero
56 * @note The normal vector should point INTO the fluid domain
57 */
58void noslip(UserCtx *user,
59 double distance_reference, double distance_boundary,
60 Cmpnts velocity_wall, Cmpnts velocity_reference,
61 Cmpnts *velocity_boundary,
62 double normal_x, double normal_y, double normal_z);
63
64/**
65 * @brief Applies free-slip wall boundary condition
66 *
67 * Free-slip conditions allow tangential flow but enforce zero normal velocity.
68 * This is appropriate for inviscid walls or symmetry planes where there is
69 * no shear stress but flow cannot penetrate the boundary.
70 *
71 * DECOMPOSITION:
72 * Velocity is decomposed into normal and tangential components:
73 * U = U_n * n + U_t
74 * where U_n = U · n (normal component)
75 * U_t = U - U_n * n (tangential component)
76 *
77 * BOUNDARY CONDITIONS:
78 * - Normal component: Interpolated from interior (∂U_n/∂n ≠ 0)
79 * - Tangential component: Extrapolated from interior (∂U_t/∂n = 0)
80 *
81 * @param[in] user Simulation context
82 * @param[in] distance_reference Wall-normal distance to reference point
83 * @param[in] distance_boundary Wall-normal distance to boundary point
84 * @param[in] velocity_wall Velocity at the wall
85 * @param[in] velocity_reference Velocity at reference point
86 * @param[out] velocity_boundary Computed velocity at boundary point
87 * @param[in] normal_x X-component of wall normal vector
88 * @param[in] normal_y Y-component of wall normal vector
89 * @param[in] normal_z Z-component of wall normal vector
90 */
91void freeslip(UserCtx *user,
92 double distance_reference, double distance_boundary,
93 Cmpnts velocity_wall, Cmpnts velocity_reference,
94 Cmpnts *velocity_boundary,
95 double normal_x, double normal_y, double normal_z);
96
97/**
98 * @brief Computes roughness-modified log-law coefficient E
99 *
100 * The coefficient E accounts for wall roughness effects on the log-law:
101 * u+ = (1/κ) ln(E * y+)
102 *
103 * ROUGHNESS REGIMES:
104 * 1. Hydraulically smooth (ks+ < 2.25): E = exp(κ*B), no roughness effect
105 * 2. Transitional (2.25 < ks+ < 90): Smooth interpolation between regimes
106 * 3. Fully rough (ks+ > 90): E modified by roughness height
107 * where ks+ = u_τ * ks / ν (roughness Reynolds number)
108 *
109 * @param[in] friction_velocity Friction velocity u_τ
110 * @param[in] roughness_height Equivalent sand grain roughness height ks
111 * @param[in] kinematic_viscosity Kinematic viscosity ν
112 * @return Roughness-modified log-law coefficient E
113 *
114 * @note This follows the Nikuradse sand grain roughness correlation
115 */
116double E_coeff(double friction_velocity, double roughness_height, double kinematic_viscosity);
117
118/**
119 * @brief Computes velocity from log-law for rough walls
120 *
121 * Calculates the tangential velocity at a given wall distance using
122 * the roughness-modified log-law of the wall.
123 *
124 * APPLICABLE REGIMES:
125 * - Viscous sublayer (y+ < 11.53): u+ = y+
126 * - Log-layer (11.53 < y+ < 300): u+ = (1/κ) ln(E * y+)
127 * - Outer layer (y+ > 300): Returns -1 (invalid, wake region)
128 *
129 * @param[in] kinematic_viscosity Kinematic viscosity ν
130 * @param[in] wall_distance Distance from wall y
131 * @param[in] friction_velocity Friction velocity u_τ
132 * @param[in] roughness_height Equivalent sand grain roughness ks
133 * @return Tangential velocity u_t, or -1 if outside valid range
134 *
135 * @note The upper limit y+ < 300 ensures we stay within the log-layer
136 * @note For y+ > 300, wake effects become important and log-law is invalid
137 */
138double u_hydset_roughness(double kinematic_viscosity, double wall_distance,
139 double friction_velocity, double roughness_height);
140
141/**
142 * @brief Residual function for friction velocity equation (log-law with roughness)
143 *
144 * This function computes the residual for Newton-Raphson iteration:
145 * f(u_τ) = u_predicted(u_τ) - u_known
146 * where u_predicted comes from the log-law or linear law depending on y+.
147 *
148 * @param[in] kinematic_viscosity Kinematic viscosity
149 * @param[in] known_velocity Known velocity at distance y
150 * @param[in] wall_distance Distance from wall
151 * @param[in] friction_velocity_guess Current guess for u_τ
152 * @param[in] roughness_height Wall roughness height
153 * @return Residual value (should be zero at solution)
154 */
155double f_hydset(double kinematic_viscosity, double known_velocity,
156 double wall_distance, double friction_velocity_guess,
157 double roughness_height);
158
159/**
160 * @brief Numerical derivative of residual function
161 *
162 * Computes df/du_τ using finite differences for Newton-Raphson iteration.
163 *
164 * @param[in] kinematic_viscosity Kinematic viscosity
165 * @param[in] known_velocity Known velocity
166 * @param[in] wall_distance Distance from wall
167 * @param[in] friction_velocity_guess Current guess for u_τ
168 * @param[in] roughness_height Wall roughness
169 * @return Derivative df/du_τ
170 */
171double df_hydset(double kinematic_viscosity, double known_velocity,
172 double wall_distance, double friction_velocity_guess,
173 double roughness_height);
174
175/**
176 * @brief Solves for friction velocity using Newton-Raphson iteration
177 *
178 * Given a known velocity at a known distance from the wall, this function
179 * iteratively solves for the friction velocity u_τ that satisfies the
180 * roughness-modified log-law or linear law.
181 *
182 * ALGORITHM:
183 * Newton-Raphson: u_τ^(n+1) = u_τ^n - f(u_τ^n) / f'(u_τ^n)
184 * Convergence criterion: |u_τ^(n+1) - u_τ^n| < 1e-7
185 *
186 * @param[in] kinematic_viscosity Kinematic viscosity
187 * @param[in] known_velocity Velocity at reference point
188 * @param[in] wall_distance Distance from wall to reference point
189 * @param[in] initial_guess Initial guess for u_τ
190 * @param[in] roughness_height Wall roughness height
191 * @return Converged friction velocity u_τ
192 *
193 * @note Maximum 30 iterations; warns if convergence not achieved
194 * @note Typical convergence in 3-5 iterations for good initial guess
195 */
196double find_utau_hydset(double kinematic_viscosity, double known_velocity,
197 double wall_distance, double initial_guess,
198 double roughness_height);
199
200
201/**
202 * @brief Computes turbulent eddy viscosity ratio (ν_t / ν)
203 *
204 * Uses the mixing length model with van Driest damping:
205 * ν_t / ν = κ * y+ * [1 - exp(-y+ / A+)]²
206 * where A+ ≈ 19 is the damping coefficient.
207 *
208 * PHYSICAL INTERPRETATION:
209 * - Near wall (y+ → 0): ν_t → 0 (viscous effects dominate)
210 * - Far from wall (y+ >> A+): ν_t ~ κ * y+ (mixing length theory)
211 * - Damping function smoothly transitions between these limits
212 *
213 * @param[in] yplus Normalized wall distance y+ = y * u_τ / ν
214 * @return Eddy viscosity ratio ν_t / ν
215 *
216 * @note This is the standard mixing length model with van Driest damping
217 * @note Valid in the inner layer (y+ < 50-100)
218 */
219double nu_t(double yplus);
220
221/**
222 * @brief Integrates eddy viscosity profile from wall to distance y
223 *
224 * Computes integrals needed for non-equilibrium wall functions:
225 * If mode=0: ∫[0 to y] dy / (ν + ν_t)
226 * If mode=1: ∫[0 to y] y dy / (ν + ν_t)
227 *
228 * These integrals appear in the solution of the momentum equation
229 * with pressure gradients in the near-wall region.
230 *
231 * NUMERICAL METHOD:
232 * - Trapezoidal rule with 30 integration points
233 * - Higher-order correction at endpoints for accuracy
234 *
235 * @param[in] kinematic_viscosity Kinematic viscosity ν
236 * @param[in] wall_distance Distance from wall y
237 * @param[in] friction_velocity Friction velocity u_τ
238 * @param[in] integration_mode 0 for F integral, 1 for Fy integral
239 * @return Value of the integral
240 *
241 * @note Used in Cabot wall function for pressure gradient effects
242 */
243double integrate_1(double kinematic_viscosity, double wall_distance,
244 double friction_velocity, int integration_mode);
245
246/**
247 * @brief Computes wall shear stress with pressure gradient effects
248 *
249 * Solves the integrated momentum equation in the near-wall region:
250 * τ_w = (u - dp/dx * F_y) / F_1
251 * where F_1 and F_y are integrals of the effective viscosity profile.
252 *
253 * This accounts for non-equilibrium effects due to streamwise pressure gradients.
254 *
255 * @param[in] kinematic_viscosity Kinematic viscosity
256 * @param[in] friction_velocity Friction velocity u_τ
257 * @param[in] wall_distance Distance from wall
258 * @param[in] velocity Velocity at wall_distance
259 * @param[in] pressure_gradient_tangent Tangential pressure gradient dp/ds
260 * @return Wall shear stress τ_w
261 *
262 * @note This is more accurate than equilibrium wall functions in separated flows
263 */
264double taw(double kinematic_viscosity, double friction_velocity,
265 double wall_distance, double velocity, double pressure_gradient_tangent);
266
267/**
268 * @brief Computes velocity using Cabot wall function
269 *
270 * Reconstructs velocity from wall shear stress and pressure gradient:
271 * u = τ_w * F1 + (dp/dx) * Fy
272 *
273 * @param[in] kinematic_viscosity Kinematic viscosity
274 * @param[in] wall_distance Distance from wall
275 * @param[in] friction_velocity Friction velocity
276 * @param[in] pressure_gradient_tangent Tangential pressure gradient
277 * @param[in] wall_shear_stress Wall shear stress
278 * @return Velocity at wall_distance
279 */
280double u_Cabot(double kinematic_viscosity, double wall_distance,
281 double friction_velocity, double pressure_gradient_tangent,
282 double wall_shear_stress);
283
284/**
285 * @brief Residual function for Cabot wall function
286 *
287 * Computes: f(u_τ) = u_τ - sqrt(|τ_w(u_τ)|)
288 * This enforces consistency between u_τ and τ_w.
289 *
290 * @param[in] kinematic_viscosity Kinematic viscosity
291 * @param[in] velocity Velocity
292 * @param[in] wall_distance Distance from wall
293 * @param[in] friction_velocity_guess Guess for u_τ
294 * @param[in] pressure_gradient_tangent Tangential pressure gradient
295 * @param[in] pressure_gradient_normal Normal pressure gradient (currently unused)
296 * @return Residual value
297 */
298double f_Cabot(double kinematic_viscosity, double velocity, double wall_distance,
299 double friction_velocity_guess, double pressure_gradient_tangent,
300 double pressure_gradient_normal);
301
302/**
303 * @brief Numerical derivative for Cabot wall function
304 *
305 * @param kinematic_viscosity Parameter `kinematic_viscosity` passed to `df_Cabot()`.
306 * @param velocity Parameter `velocity` passed to `df_Cabot()`.
307 * @param wall_distance Parameter `wall_distance` passed to `df_Cabot()`.
308 * @param friction_velocity_guess Parameter `friction_velocity_guess` passed to `df_Cabot()`.
309 * @param pressure_gradient_tangent Parameter `pressure_gradient_tangent` passed to `df_Cabot()`.
310 * @param pressure_gradient_normal Parameter `pressure_gradient_normal` passed to `df_Cabot()`.
311 * @return Scalar value produced by `df_Cabot()`.
312 */
313double df_Cabot(double kinematic_viscosity, double velocity, double wall_distance,
314 double friction_velocity_guess, double pressure_gradient_tangent,
315 double pressure_gradient_normal);
316
317/**
318 * @brief Solves for friction velocity using Cabot wall function
319 *
320 * This non-equilibrium wall function accounts for pressure gradient effects,
321 * making it more accurate in separated or strongly accelerating/decelerating flows.
322 *
323 * @param[in] kinematic_viscosity Kinematic viscosity
324 * @param[in] velocity Velocity at reference point
325 * @param[in] wall_distance Distance from wall
326 * @param[in] initial_guess Initial guess for u_τ
327 * @param[in] pressure_gradient_tangent Tangential pressure gradient
328 * @param[in] pressure_gradient_normal Normal pressure gradient
329 * @param[out] friction_velocity Converged friction velocity
330 * @param[out] wall_shear_velocity Wall shear stress for velocity
331 * @param[out] wall_shear_normal Wall shear stress for normal pressure gradient
332 */
333void find_utau_Cabot(double kinematic_viscosity, double velocity, double wall_distance,
334 double initial_guess, double pressure_gradient_tangent,
335 double pressure_gradient_normal, double *friction_velocity,
336 double *wall_shear_velocity, double *wall_shear_normal);
337
338/**
339 * @brief Computes velocity using Werner-Wengle wall function
340 *
341 * Algebraic wall function that provides explicit relation:
342 * u+ = y+ for y+ < 11.81 (viscous sublayer)
343 * u+ = A * (y+)^B for y+ ≥ 11.81 (power law)
344 * where A = 8.3, B = 1/7 are empirical constants.
345 *
346 * ADVANTAGES:
347 * - Explicit (no iteration required)
348 * - Computationally cheap
349 * - Reasonable accuracy for equilibrium boundary layers
350 *
351 * LIMITATIONS:
352 * - Less accurate than log-law for high Reynolds numbers
353 * - No pressure gradient effects
354 *
355 * @param[in] kinematic_viscosity Kinematic viscosity
356 * @param[in] wall_distance Distance from wall
357 * @param[in] friction_velocity Friction velocity
358 * @return Tangential velocity
359 */
360double u_Werner(double kinematic_viscosity, double wall_distance,
361 double friction_velocity);
362
363
364/**
365 * @brief Residual function for Werner-Wengle iteration
366 *
367 * Computes residual: f(u_τ) = u_τ² - g(u, y, ν)
368 * where g is derived from the velocity profile inversion.
369 *
370 * @param[in] kinematic_viscosity Kinematic viscosity
371 * @param[in] velocity Known velocity
372 * @param[in] wall_distance Distance from wall
373 * @param[in] friction_velocity Guess for friction velocity
374 * @return Residual value
375 */
376double f_Werner(double kinematic_viscosity, double velocity,
377 double wall_distance, double friction_velocity);
378
379/**
380 * @brief Numerical derivative for Werner-Wengle iteration
381 *
382 * @param kinematic_viscosity Parameter `kinematic_viscosity` passed to `df_Werner()`.
383 * @param velocity Parameter `velocity` passed to `df_Werner()`.
384 * @param wall_distance Parameter `wall_distance` passed to `df_Werner()`.
385 * @param friction_velocity Parameter `friction_velocity` passed to `df_Werner()`.
386 * @return Scalar value produced by `df_Werner()`.
387 */
388double df_Werner(double kinematic_viscosity, double velocity,
389 double wall_distance, double friction_velocity);
390
391/**
392 * @brief Solves for friction velocity using Werner-Wengle wall function
393 *
394 * @param[in] kinematic_viscosity Kinematic viscosity
395 * @param[in] velocity Velocity at reference point
396 * @param[in] wall_distance Distance from wall
397 * @param[in] initial_guess Initial guess for u_τ
398 * @return Converged friction velocity
399 */
400double find_utau_Werner(double kinematic_viscosity, double velocity,
401 double wall_distance, double initial_guess);
402
403/**
404 * @brief Computes velocity using simple log-law (smooth wall with roughness offset)
405 *
406 * Simple logarithmic profile:
407 * u = (u_τ / κ) * ln((y + y0) / y0)
408 * where y0 is a roughness length scale.
409 *
410 * @param[in] wall_distance Distance from wall
411 * @param[in] friction_velocity Friction velocity
412 * @param[in] roughness_length Roughness length scale y0
413 * @return Velocity
414 *
415 * @note This is a simplified model; use u_hydset_roughness for better accuracy
416 */
417double u_loglaw(double wall_distance, double friction_velocity, double roughness_length);
418
419/**
420 * @brief Solves for friction velocity using simple log-law (explicit formula)
421 *
422 * Explicit inversion: u_τ = κ * u / ln((y + y0) / y0)
423 *
424 * @param[in] velocity Known velocity
425 * @param[in] wall_distance Distance from wall
426 * @param[in] roughness_length Roughness length scale
427 * @return Friction velocity
428 */
429double find_utau_loglaw(double velocity, double wall_distance, double roughness_length);
430
431/**
432 * @brief Applies standard wall function with Werner-Wengle model
433 *
434 * This is a high-level interface that:
435 * 1. Decomposes velocity into normal/tangential components
436 * 2. Applies wall function to tangential velocity
437 * 3. Interpolates normal velocity
438 * 4. Reconstructs total velocity
439 *
440 * @param[in] user Simulation context
441 * @param[in] distance_reference Distance to reference point
442 * @param[in] distance_boundary Distance to boundary point
443 * @param[in] velocity_wall Wall velocity
444 * @param[in] velocity_reference Reference velocity
445 * @param[out] velocity_boundary Output boundary velocity
446 * @param[out] friction_velocity Output friction velocity
447 * @param[in] normal_x X-component of wall normal
448 * @param[in] normal_y Y-component of wall normal
449 * @param[in] normal_z Z-component of wall normal
450 */
451void wall_function(UserCtx *user, double distance_reference, double distance_boundary,
452 Cmpnts velocity_wall, Cmpnts velocity_reference,
453 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
454 double normal_x, double normal_y, double normal_z);
455
456/**
457 * @brief Applies log-law wall function with roughness correction
458 *
459 * This is the recommended wall function interface for most applications.
460 * It uses the roughness-corrected log-law which is accurate for both
461 * smooth and rough walls.
462 *
463 * @param[in] user Simulation context
464 * @param[in] roughness_height Wall roughness height ks
465 * @param[in] distance_reference Distance to reference point
466 * @param[in] distance_boundary Distance to boundary point
467 * @param[in] velocity_wall Wall velocity (typically zero)
468 * @param[in] velocity_reference Reference velocity
469 * @param[out] velocity_boundary Output boundary velocity
470 * @param[out] friction_velocity Output friction velocity u_τ
471 * @param[in] normal_x X-component of wall normal
472 * @param[in] normal_y Y-component of wall normal
473 * @param[in] normal_z Z-component of wall normal
474 *
475 * @note Sets velocity to reference value if y+ > 300 (outside log-layer)
476 */
477void wall_function_loglaw(UserCtx *user, double roughness_height,
478 double distance_reference, double distance_boundary,
479 Cmpnts velocity_wall, Cmpnts velocity_reference,
480 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
481 double normal_x, double normal_y, double normal_z);
482
483/**
484 * @brief Applies Cabot non-equilibrium wall function with pressure gradients
485 *
486 * This wall function accounts for pressure gradient effects and is most
487 * accurate in separated or strongly accelerating/decelerating flows.
488 *
489 * @param[in] user Simulation context
490 * @param[in] roughness_height Wall roughness (currently unused in this version)
491 * @param[in] distance_reference Distance to reference point
492 * @param[in] distance_boundary Distance to boundary point
493 * @param[in] velocity_wall Wall velocity
494 * @param[in] velocity_reference Reference velocity
495 * @param[out] velocity_boundary Output boundary velocity
496 * @param[out] friction_velocity Output friction velocity
497 * @param[in] normal_x X-component of wall normal
498 * @param[in] normal_y Y-component of wall normal
499 * @param[in] normal_z Z-component of wall normal
500 * @param[in] pressure_gradient_x X-component of pressure gradient
501 * @param[in] pressure_gradient_y Y-component of pressure gradient
502 * @param[in] pressure_gradient_z Z-component of pressure gradient
503 * @param[in] iteration_count Current iteration count
504 *
505 * @note Only updates friction velocity every 5 iterations for stability
506 * @note Normal pressure gradient currently set to zero
507 */
508void wall_function_Cabot(UserCtx *user, double roughness_height,
509 double distance_reference, double distance_boundary,
510 Cmpnts velocity_wall, Cmpnts velocity_reference,
511 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
512 double normal_x, double normal_y, double normal_z,
513 double pressure_gradient_x, double pressure_gradient_y,
514 double pressure_gradient_z, int iteration_count);
515
516#endif // WALLFUNCTION_H
Header file for Particle Motion and migration related functions.
Header file for Particle Swarm management functions.
Public interface for grid, solver, and metric setup routines.
Public interface for data input/output routines.
Logging utilities and macros for PETSc-based applications.
Main header file for a complex fluid dynamics solver.
A 3D point or vector with PetscScalar components.
Definition variables.h:100
User-defined context containing data specific to a single computational grid level.
Definition variables.h:811
Header file for particle location functions using the walking search algorithm.
double df_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity_guess, double pressure_gradient_tangent, double pressure_gradient_normal)
Numerical derivative for Cabot wall function.
double f_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity_guess, double pressure_gradient_tangent, double pressure_gradient_normal)
Residual function for Cabot wall function.
void wall_function_loglaw(UserCtx *user, double roughness_height, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z)
Applies log-law wall function with roughness correction.
double find_utau_loglaw(double velocity, double wall_distance, double roughness_length)
Solves for friction velocity using simple log-law (explicit formula)
double u_Werner(double kinematic_viscosity, double wall_distance, double friction_velocity)
Computes velocity using Werner-Wengle wall function.
double u_hydset_roughness(double kinematic_viscosity, double wall_distance, double friction_velocity, double roughness_height)
Computes velocity from log-law for rough walls.
void wall_function(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z)
Applies standard wall function with Werner-Wengle model.
double taw(double kinematic_viscosity, double friction_velocity, double wall_distance, double velocity, double pressure_gradient_tangent)
Computes wall shear stress with pressure gradient effects.
double find_utau_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double initial_guess, double roughness_height)
Solves for friction velocity using Newton-Raphson iteration.
double u_Cabot(double kinematic_viscosity, double wall_distance, double friction_velocity, double pressure_gradient_tangent, double wall_shear_stress)
Computes velocity using Cabot wall function.
double df_Werner(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity)
Numerical derivative for Werner-Wengle iteration.
double f_Werner(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity)
Residual function for Werner-Wengle iteration.
double u_loglaw(double wall_distance, double friction_velocity, double roughness_length)
Computes velocity using simple log-law (smooth wall with roughness offset)
void wall_function_Cabot(UserCtx *user, double roughness_height, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z, double pressure_gradient_x, double pressure_gradient_y, double pressure_gradient_z, int iteration_count)
Applies Cabot non-equilibrium wall function with pressure gradients.
void noslip(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, double normal_x, double normal_y, double normal_z)
Applies no-slip wall boundary condition with linear interpolation.
void find_utau_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double initial_guess, double pressure_gradient_tangent, double pressure_gradient_normal, double *friction_velocity, double *wall_shear_velocity, double *wall_shear_normal)
Solves for friction velocity using Cabot wall function.
double integrate_1(double kinematic_viscosity, double wall_distance, double friction_velocity, int integration_mode)
Integrates eddy viscosity profile from wall to distance y.
double f_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double friction_velocity_guess, double roughness_height)
Residual function for friction velocity equation (log-law with roughness)
double E_coeff(double friction_velocity, double roughness_height, double kinematic_viscosity)
Computes roughness-modified log-law coefficient E.
double nu_t(double yplus)
Computes turbulent eddy viscosity ratio (ν_t / ν)
double df_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double friction_velocity_guess, double roughness_height)
Numerical derivative of residual function.
double find_utau_Werner(double kinematic_viscosity, double velocity, double wall_distance, double initial_guess)
Solves for friction velocity using Werner-Wengle wall function.
void freeslip(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, double normal_x, double normal_y, double normal_z)
Applies free-slip wall boundary condition.