UDF to apply a Spanwise velocity wave on a whole 3D rectangular channel domain
Hi guys,
I'm modelling a doubly periodic channel flow of rectangular section, to summerize, it's: orientation: x streamwise (mean flow directionset to periodic) y wall normal (nonslip Boundary condition) z spanwise (periodic) flow direction: x x and z periodic and nonslip condition at the upper and bottom wall, I need some help to write an UDF to impose a spanwise velocity forcing wave travelling downstream which is likely to be coordinate and time dependent like A(z).Sin(Kx.x+Ky.y).Sin(w.t), on the whole domain and update every timestep, I've been looking around but found a 3 yers old thread dealing with roughly the same thing (tank with cg motion). I've already worte UDFs generating waves at the inlet but did that only on Velocity_inlet boundary condition, Is there a way to perform the same thing to a whole domain ie every single node will have its spanwise velocity forcing contribution changing every timestep. I'm wondering if the DEFINE_SOURCE macro is an option for pointing out every cell and adding/updating y momentum? found this on the forum http://www.cfdonline.com/Forums/flu...urceterm.html thanks in advance, best regards. 
thanks trying, need some help please?

here is a shot at it
I've written an udf dealing with the spanwise perturbation as a source of y momentum here is the code based on fluent udf guide page 131:
Code:
#include "udf.h" as I understood from the udf manual, user have to provide the source term derivative with respect to "the momentum source direction" here I have ydirection momentum added One other question: I'm gonna get a time dependent resulting yvelocity since ymomentum is taken in n/m3 this gonna generate a force applied to every volume cell if the cell's mass is m, f the force resulting in the momentum source contribution and gamma the acceleration then according to // m x gamma=f=CellVolume x MomentumSource(n/m3)=== which gives a time dependent velocity is there a way to impose explicitly "kinetically" the velocity rather than a momentum "dynamically" generating a variable velocity? you can see above that I commented the parallel execution directives... should I place these if !rp_host..endif elsewhere ? please would you have a look inside, thank you 
try to help please
hi,
I've read almost all posts related to source term setup, the above udf works it gives a periodic spanwise velocity wave BUT there is a problem regarding magnitude? Could someone please explain to me how to get the desired velocity in m/s value since the momentum source term has a N/m3 volume force dimension Once a again I got confused working on fluent udf manual page 131 "adding xmomentum source y dependent" since they gave a Vx dependent term and the derivative with respect to the xvelocity Vx? thank you 
The term 'dS' is used to accelerating the solution procedure. If you have heard of NewtonRaphson method then it should not be difficult for you to figure out how this term is calculated. It is always safe to assign zero to this term.
I am not sure what you really want to do but for a wavelike equation you should modify the domain of dependence only and not the domain of influence. Try to formulate the physical problem you described into mathematical formulation, then you probably could solve the problem by your own. 
more about the issue
Thanks, finally someone took some time to answer,:)
it's simple I just wanna modify the flow by adding a sinuous perturbation to the usual parabolic profile since the geometry is periodic I have no access to velocity inlet UDF, so instead, I'm trying to find a way to impose every cell's velocity over the whole domain. I have run some tests with the above a modified version of the above udf, but the yvelocity keeps increasing and exceeds the desired perturbation amplitude which means that the source term keeps adding momentum to every cell Vy component, sounds natural since the source is taken in N/m^3 which is a "dynamical" quantity "force/volume" compared to "kinematic" velocity m/s, I think. here is my big question: is there a way to add a fluctuating velocity component while having periodic boundary conditions as described above? Quote:
here's a description of the velocity profile I wanna include: the mean flow is parabolic like Uc*(1z²/h²), h: is the channel half height for the spanwise direction v=A.sin(alpha*x) is the periodically fluctuating component. There was no problem including this profile in a velocity_inlet/pressure_outlet channel but here I'm constrained with the periodicity to develop the sinuous mode instability, I can't do it without using periodic boundaries. thanks trying Blackmask 
It sounds like an eigenvalue problem to me rather than a wave propagation problem as I thought before. Either way I think the disturbance should be introduced from one side of the boundary, say z=1. I am sorry that I can not help you because I am not familiar with this kind of problem.

Nice suggestion
hi Blackmask,
of course you're right it's an eigenvalue problem, usually treated using higher order spectral methods performing dns, here you gave me an idea using the bottom wall, and impose a sinuous velocity across the z=1 wall since this gonna drive the boundary in the same motion. meanwhile I used the DFEINE_SOURCE macro to access the C_V(c,t) which is the y velocity component and set it to sinuous value, the trick generates the sinuous profile but breaks convergence:confused:, here what I did: I set the source term and its derivative to 0, and since fluent loops over all cells it can be possible to give a value to y velocity of every cell by doing: Code:
C_V(c,t)=a*sin(alpha*x)*cos(omega*t); I think I'm gonna start a new thread asking how to access and patch "mem.h" stored variables like C_V(c,t) to get desired velocity profile. best regards 
Finally how did you solve this problem?? Is time dependent cell condition possible to define ? Thanks.

All times are GMT 4. The time now is 17:18. 