CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   sinusoidal velocity inlet tube (https://www.cfd-online.com/Forums/fluent/92793-sinusoidal-velocity-inlet-tube.html)

sinusoidal velocity inlet tube

Dear all
I am modeling sinusoidal velocity in a tube.My frequency is 0.2116, and I used a udf to define my velocity inlet. I chose time step size=1.237237182(s) with number of time steps=24 for one cycle.
my problem is that after velocity amplitude becomes invariant, I plot velocity in outlet of pipe in phase between 180 to 360 degree, the profile is wrong and don't conform the true profile.Despite in phase 0 to 180 degree I got good velocity profile but in phase 180 to 360 degree it was wrong. I changed my mesh and time step size but I still got wrong answer. I really stick in this problem and I don't know what to do. Can anybody suggest me some guideness in this modeling.

 Amir September 26, 2011 03:12

Quote:
 Originally Posted by mohammadkm (Post 325535) Dear all I am modeling sinusoidal velocity in a tube.My frequency is 0.2116, and I used a udf to define my velocity inlet. I chose time step size=1.237237182(s) with number of time steps=24 for one cycle. my problem is that after velocity amplitude becomes invariant, I plot velocity in outlet of pipe in phase between 180 to 360 degree, the profile is wrong and don't conform the true profile.Despite in phase 0 to 180 degree I got good velocity profile but in phase 180 to 360 degree it was wrong. I changed my mesh and time step size but I still got wrong answer. I really stick in this problem and I don't know what to do. Can anybody suggest me some guideness in this modeling. Thanks for your compassionate help in advance. mohammad
If your results seem reasonable between 0-180 and after that they don't, I guess there would be a problem in your outlet boundary condition because between 180-360 the direction of flow changes.

Bests,

Dear amir
Thanks for your reply, I changed my outlet boundary condition from pressure outlet to outflow, but still didn't get right answer.

 Amir October 2, 2011 16:11

Quote:
 Originally Posted by mohammadkm (Post 326433) Dear amir Thanks for your reply, I changed my outlet boundary condition from pressure outlet to outflow, but still didn't get right answer. Thanks again for your help.

I don't know details of your case, when inlet velocity oscillate around a fixed value the flow stream change its direction or not?

Bests,

Dear amir
yes the flow stream changes its direction. I used an UDF to define the velocity inlet. here is my UDF
#include "udf.h"
{
face_t f;
real t = CURRENT_TIME;
{
}
}

 Amir October 3, 2011 04:20

Quote:
 Originally Posted by mohammadkm (Post 326456) Dear amir thanks again for your help, yes the flow stream changes its direction. I used an UDF to define the velocity inlet. here is my UDF #include "udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) =0.013*sin(0.2116*t); } end_f_loop(f, thread) }
Hi,
Probably the issue origins from your outlet BC, outflow in not proper for this purpose because it doesn't proper in reversing direction (refer to Fig. 7.10.1- case A of manual); pressure outlet makes sense but it seems that were your first selection and it faces covergency issues in changing direction. (7.8 second paragraph of manual)
My suggestions:
1) I'm not sure but it may be possible to achieve converged result with pressure outlet (with increasing sub-iterations)
2) You may want to change BCs when the direction changes
3) You can easily do that in other software like OpenFOAM.

Bests,

 Behnam Ghadimi October 3, 2011 05:04

Quote:
 Originally Posted by mohammadkm (Post 326456) Dear amir thanks again for your help, yes the flow stream changes its direction. I used an UDF to define the velocity inlet. here is my UDF #include "udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) =0.013*sin(0.2116*t); } end_f_loop(f, thread) }
why you don't use profile for creating sinusoidal velocity.you can do this like this example:
((sampleprofile transient 5 1)
(time
1
2
3
4
5
)
(u
10
20
30
-20
-10
)
)
the first number(5) in "(sampleprofile transient 5 1)" indicate number of time step in one period, and the second number indicate periodic or nonperiodic boundary condition(1 for periodic and 0 for nonperiodic).
note that when you use sinusoidal velocity ur velocity inlet magnitude becomes negative in some time range so i think u must change your BCs in this range.

 mannudakamal October 3, 2011 06:40

Outflow is not compatible with transient case

Hallo all,

I am dealing with similar problem. What i know for sure (atleast fluent manual :D) that outflow is not to be used with transient case. A pr outlet is more appropriate but then you are imposing a restriction at boundary. I would go for pr-outlet with mass flow rate as density do not change. But in this case you have to write a udf to know the mass flow (equal to velocity inlet) and impose it at the out.

I hope this works though i dont know for sure. Let me know if this works :)

Dear amir,behnam, and mannudakamal
I also checked pressure outlet boundary condition but it didnt work.
mannudakamal, would you please expain what you said?
"But in this case you have to write a udf to know the mass flow (equal to velocity inlet) and impose it at the out."
which BC I should use?
I used an UDF to define the velocity inlet and imposed it to the inlet.
Thanks again for your compassionate help.

 mannudakamal October 3, 2011 17:14

Quote:
 Originally Posted by mohammadkm (Post 326500) mannudakamal, would you please expain what you said? "But in this case you have to write a udf to know the mass flow (equal to velocity inlet) and impose it at the out." which BC I should use? I used an UDF to define the velocity inlet and imposed it to the inlet. Thanks again for your compassionate help.
:rolleyes::rolleyes::rolleyes::rolleyes::rolleyes: :rolleyes::rolleyes::rolleyes:

okey.. this is what i mean..

Put pr outlet and check the box target mass flow rate.
It will open a mass flow box where you can either put a constant value or a udf. The mass flow out must be equal to that of inlet.

thats where i said .. may be you need to write udf if the mass flow at inlet is fluctuating instead of constant.

Dear mannudakamal
I'm so thankful for your reply. I wrote this UDF and hooked in velocity inlet and target mass flow rate, but I still could'nt get right answer in 270 and 360 degree. In 90 and 180 degree velocity profile is right but in 270 and 360 degree it is wrong.
#include "udf.h"
{
face_t f;
real t = CURRENT_TIME;
{
}
}
{
face_t f;
real t = CURRENT_TIME;
{
}
}

 m2montazari October 5, 2011 15:46

hi all,
I think setting velocity inlet for inverse flow direction is wrong. because the characteristics of velocity is toward domain and velocity value should not be set at outlets. because of this, fluent and other softwares dont have velocity outlet. and at the other hand fluent have some errors in setting pressure outlet for inflow direction(however it is theoretically true to set pressure at inlet).
but my suggestion is:
1- use a journal to change boundary condition in 180 degree phase from pressure tp velocity and from velocity to pressure. however setting velocity at the end of the pipe(which should be inlet in phase 180-360) makes a constant value velocity profile. so you may need to change your profile (writing a new udf) to set velocity as a function of time and space. it should be sinusoidal in time and parabolic in space.
2- use periodic BC and use a journal to change the pressure gradient. it can be implemented in fully developed flow at both inlet and oulet.
3- use pressure outlet for both inlet and outlet and ignore some first and last cell threads results. cells of mid threads should have good results.
and about using openfoam instead of fluent, which amir recommends, it has no error in setting static pressure at inlet, but setting velocity for outlet is not correct yet.

and to Amir: گهی زین به پشت و گهی پشت به زین!!!
yours,

Dear m2montazeri
I mailed to the author of paper who used fluent for modeling sinusoidal velocity inlet to the tube. He said I should consider Courant number criterion.
I have not considered that because my model is pressure based and in density based courant number criteria is available.also, I iterate with density based with default courant number in control solution and I got solution diverge in residual monitor and mass flow rate at outlet is zero. can anyone explain what does meaning of Courant number criterion?

 m2montazari October 6, 2011 03:34

hi,
courant no is a non-dimensional number which specifies stability criteria. it is Co=(U*dt)/dx which U is velocity in a cell, dt is timestep size and dx is cell length. in pressure base coupled pressure-velocity coupling model, default courant no in fluent is 200 and it defers with the courant no which is usually set as criteria. but in density based model for explicit model courants lower than 1 is required and for implicit model courant no can be anything theoretically. but as the equations are highly nonlinear, usually Co=2 is set as criteria. however in many cases, setting Co to values lower than 1 (ex. 0.5) for first iterations are needed and when some iterations have done, you can use higher Co upto some values about 20 or 30!
but as I told in previous post, I think it is not the problem and boundary conditions should be changed to correct ones to achieve correct results.
yours,

I'm so thankful for your compassionate help. sorry , what do you from journal and how can I change my Bc?
I used velocity inlet (with udf) ti the inlet of tube and pressure outlet at the outlet of pipe.
in phase 90 and 180 degree I get right velocity profile but in 270 and 360 degree it is false.
I also checked density based but the solution diverge. The flow is incompressible.
It is my thesis and I stick in this problem. I really don't have any idea how to solve this problem.

 m2montazari October 6, 2011 14:37

hi,
fluent has two user interface. one is graphical user interface(GUI) which is the menus and buttons usually we use, and the other is text user interface. you can use TUI by pressing enter in main menu and the text menus will be printed out in it. then typing menu names is what you need. be aware that the categories of TUI and GUI has some differences. check that and read text user interface help of fluent if needed. when you learned how to use TUI to change your BC and other tasks you want to do at the middle of solve procedure, then you can easily type all in a text file(all the things you type in main window of fluent). then go to file->read->journal and read it. it would do all the operations step by step. check and give your results.
yours,