CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Sine wave expression at inlet- please help

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2023, 11:34
Exclamation Sine wave expression at inlet- please help
  #1
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
I am running a 2-D transient axisymmetric simulation, which is a rectangle of 5m length, 2.5m height, and on this height line at the bottom ( near the centre axis )there is a inlet line of 0.075m. This velocity-inlet is blowing air (as an ideal gas) essentially into a box. I am looking to see at what distance the velocity reaches 0. I am usinng the turbulent RNG-epsilon model.
My issue:
I am trying to have a sine wave at the inlet of my simulation. The sine wave should start at 0, reach +7.7 then dip to -7.7 and then return to 0 in 4s, this will be done for a total of 3 waves ( so 12 seconds).
The formula I have been using at the inlet is below.
(7.7[m/s])*(sin(((2*PI)/4[s])*(Time)))
My issue is, no matter what my simulations do, they will not allow this velocity to drop below 0, instead it will start at 0 and rise to +7.7, drop to 0 and then rise to 7.7 again instead of dropping to -7.7.
I have tried importing a .txt file in 2 different formats and loading them at the inlet. this table can be seen below
time vel
0 0
0.25 2.945246129
0.5 5.442553895
0.75 7.112111252
1 7.699997559
1.25 7.116802008
1.5 5.451221997
1.75 2.956573257
2 0.012263427
2.25 -2.93391153
2.5 -5.433871987
2.75 -7.107402455
3 -7.699978027
3.25 -7.121474713
3.5 -5.459876271
3.75 -2.967892886
4 -0.024526824
4.25 2.922569489
4.5 5.425176297
4.75 7.102675631
5 7.699938964
5.25 7.126129353
5.5 5.468516697
5.75 2.979204987
6 0.036790158
6.25 -2.911220035
6.5 -5.416466845
6.75 -7.09793079
7 -7.69988037
7.25 -7.130765917
7.5 -5.477143251
7.75 -2.990509531
8 -0.049053399
8.25 2.899863196
8.5 5.407743654
8.75 7.093167944
9 7.699802245
9.25 7.135384394
9.5 5.485755913
9.75 3.001806489
10 0.061316515
10.25 -2.888499001
10.5 -5.399006746
10.75 -7.088387107
11 -7.699704589
11.25 -7.139984772
11.5 -5.494354659
11.75 -3.013095833
12 -0.073579476
Something in the simulation is seemingly not allowing it to ever dip below the x axis into negatives. When alter the formula to make the wave stay above the x axis the sine wave performs as it should.
Any help would be greatly appreciated as i truly am puzzled.
Thanks
(attached is the output displaying the sine wave being bounced back
Attached Images
File Type: png Capture.PNG (33.6 KB, 15 views)
glenmcl is offline   Reply With Quote

Old   March 30, 2023, 16:43
Default
  #2
Senior Member
 
Join Date: Jun 2009
Location: Technische Universität Chemnitz
Posts: 107
Rep Power: 16
NickFL is on a distinguished road
Do you have the inlet boundary condition set to normal to boundary? What happens if you specify the x and y components of velocity directly?

Keep in mind when the flow is negative at the inlet it is pulling air in from the (defined) outlet. Since we really don't know the conditions at this point, make sure you make it far enough away that any air from it does not interact where you are interested.

You should be able to add the formula in Fluent using a Named Expression. This will save a step in the setup. Plus when you adjust the time step down, as I am sure 0.25 is much too large, you won't have to regenerate a new text file.
NickFL is offline   Reply With Quote

Old   March 31, 2023, 01:11
Default
  #3
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,676
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Velocity magnitude is an always positive quantity. You need to plot x-velocity, y-velocity- or z-velocity if you want to see negative numbers. As an additional sanity check, make a vector plot.
LuckyTran is online now   Reply With Quote

Old   March 31, 2023, 02:38
Default
  #4
Senior Member
 
Join Date: Jun 2009
Location: Technische Universität Chemnitz
Posts: 107
Rep Power: 16
NickFL is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Velocity magnitude is an always positive quantity. You need to plot x-velocity, y-velocity- or z-velocity if you want to see negative numbers. As an additional sanity check, make a vector plot.

Good catch! Didn't notice that on the plot.
NickFL is offline   Reply With Quote

Old   March 31, 2023, 08:26
Default
  #5
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by NickFL View Post
Do you have the inlet boundary condition set to normal to boundary? What happens if you specify the x and y components of velocity directly?

Keep in mind when the flow is negative at the inlet it is pulling air in from the (defined) outlet. Since we really don't know the conditions at this point, make sure you make it far enough away that any air from it does not interact where you are interested.

You should be able to add the formula in Fluent using a Named Expression. This will save a step in the setup. Plus when you adjust the time step down, as I am sure 0.25 is much too large, you won't have to regenerate a new text file.
I have tried both normal to boundary and of components, when use of components it only gives me actions for axial components or radial components. As i have tried it with this the same thing keeps happening, my velocity bounces back above the x axis instead of dipping below. And yes i have been using the formula as a named expression thank you.
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 08:29
Default
  #6
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Velocity magnitude is an always positive quantity. You need to plot x-velocity, y-velocity- or z-velocity if you want to see negative numbers. As an additional sanity check, make a vector plot.
So is this an issue with my graph and not necessarily anything else? I am new to ansys so could you give me rough steps to plotting x,y and z velocity. And i will google how to make a vector plot now. As my simulation is 2D axisymmetric i dont believe i have a z axis. I have seen elsewhere of people loading into the z axis and it working but again i dont believe i will have this.

Thank you for your reply and looking forward to your next response. All this help is much appreciated.
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 08:45
Default
  #7
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Velocity magnitude is an always positive quantity. You need to plot x-velocity, y-velocity- or z-velocity if you want to see negative numbers. As an additional sanity check, make a vector plot.
This is an example of essentially what i am looking for.
https://youtu.be/ELhFPG95o9s
I will attach my geometry.
This example is a sine wave to emulate breathing, a gust of wind out at 7.7, then a breath in to -7.7
ITs getting this negative number that has been my issue

I currently do not have an outlet set, but i have placed one on the opposite wall to the inlet and it has made no difference.
Attached Images
File Type: png Picture1.png (11.4 KB, 10 views)
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 10:09
Default
  #8
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Velocity magnitude is an always positive quantity. You need to plot x-velocity, y-velocity- or z-velocity if you want to see negative numbers. As an additional sanity check, make a vector plot.
It turns out you are indeed correct. So up until this point i had been running these simulations for a number of days and my belief was that somewhere in my method was the problem. Instead it appears to by that i had been over looking my interpretation of the results. Magnitude will never give a negative number, and this had been what was bogging me down

Thanks for all your help i appear to be on the right track now
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 11:11
Default
  #9
Senior Member
 
Join Date: Jun 2009
Location: Technische Universität Chemnitz
Posts: 107
Rep Power: 16
NickFL is on a distinguished road
Nice that you had it right all along. I will say that you should have an outlet on the outer boundaries for a person breathing into the environment. What would be most appropriate for this case would be a far field pressure. Without an outlet the pressure would artificially increase, think of it like breathing into a paper bag and the bag expanding.



It is always good to remember that velocity is a vector (therefore magnitude AND direction) and pressure is a scalar (single value). I probably say that daily when teaching the introductory fluids course.
NickFL is offline   Reply With Quote

Old   March 31, 2023, 11:42
Default
  #10
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by glenmcl View Post
I have tried both normal to boundary and of components, when use of components it only gives me actions for axial components or radial components. As i have tried it with this the same thing keeps happening, my velocity bounces back above the x axis instead of dipping below. And yes i have been using the formula as a named expression thank you.
Thanks for all your help i think i am on the right track now
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 11:43
Default
  #11
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by NickFL View Post
Nice that you had it right all along. I will say that you should have an outlet on the outer boundaries for a person breathing into the environment. What would be most appropriate for this case would be a far field pressure. Without an outlet the pressure would artificially increase, think of it like breathing into a paper bag and the bag expanding.



It is always good to remember that velocity is a vector (therefore magnitude AND direction) and pressure is a scalar (single value). I probably say that daily when teaching the introductory fluids course.
Perfect thank you
glenmcl is offline   Reply With Quote

Old   March 31, 2023, 20:01
Default
  #12
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,676
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
If you have you have only x-velocity and y-velocity then you don't have a z-velocity in 2D.


Still, it would be extremely naive of me to assume that your two velocity components are in x and y. Not everybody does CFD the same way. If I say x and y velocity when you have an x and z then you would be upset that I give you the wrong hint.
LuckyTran is online now   Reply With Quote

Old   February 6, 2024, 13:02
Default
  #13
New Member
 
Cian Daly
Join Date: Feb 2024
Posts: 1
Rep Power: 0
CianDaly is on a distinguished road
Quote:
Originally Posted by glenmcl View Post
I am running a 2-D transient axisymmetric simulation, which is a rectangle of 5m length, 2.5m height, and on this height line at the bottom ( near the centre axis )there is a inlet line of 0.075m. This velocity-inlet is blowing air (as an ideal gas) essentially into a box. I am looking to see at what distance the velocity reaches 0. I am usinng the turbulent RNG-epsilon model.
My issue:
I am trying to have a sine wave at the inlet of my simulation. The sine wave should start at 0, reach +7.7 then dip to -7.7 and then return to 0 in 4s, this will be done for a total of 3 waves ( so 12 seconds).
The formula I have been using at the inlet is below.
(7.7[m/s])*(sin(((2*PI)/4[s])*(Time)))
My issue is, no matter what my simulations do, they will not allow this velocity to drop below 0, instead it will start at 0 and rise to +7.7, drop to 0 and then rise to 7.7 again instead of dropping to -7.7.
I have tried importing a .txt file in 2 different formats and loading them at the inlet. this table can be seen below
time vel
0 0
0.25 2.945246129
0.5 5.442553895
0.75 7.112111252
1 7.699997559
1.25 7.116802008
1.5 5.451221997
1.75 2.956573257
2 0.012263427
2.25 -2.93391153
2.5 -5.433871987
2.75 -7.107402455
3 -7.699978027
3.25 -7.121474713
3.5 -5.459876271
3.75 -2.967892886
4 -0.024526824
4.25 2.922569489
4.5 5.425176297
4.75 7.102675631
5 7.699938964
5.25 7.126129353
5.5 5.468516697
5.75 2.979204987
6 0.036790158
6.25 -2.911220035
6.5 -5.416466845
6.75 -7.09793079
7 -7.69988037
7.25 -7.130765917
7.5 -5.477143251
7.75 -2.990509531
8 -0.049053399
8.25 2.899863196
8.5 5.407743654
8.75 7.093167944
9 7.699802245
9.25 7.135384394
9.5 5.485755913
9.75 3.001806489
10 0.061316515
10.25 -2.888499001
10.5 -5.399006746
10.75 -7.088387107
11 -7.699704589
11.25 -7.139984772
11.5 -5.494354659
11.75 -3.013095833
12 -0.073579476
Something in the simulation is seemingly not allowing it to ever dip below the x axis into negatives. When alter the formula to make the wave stay above the x axis the sine wave performs as it should.
Any help would be greatly appreciated as i truly am puzzled.
Thanks
(attached is the output displaying the sine wave being bounced back
Hi Glen, I am doing my thesis in Tu Dublin, and I am doing the 3d version of this. did you manage to get it to work?
CianDaly is offline   Reply With Quote

Old   February 6, 2024, 13:25
Default
  #14
New Member
 
glenmcl
Join Date: Mar 2023
Posts: 8
Rep Power: 3
glenmcl is on a distinguished road
Quote:
Originally Posted by CianDaly View Post
Hi Glen, I am doing my thesis in Tu Dublin, and I am doing the 3d version of this. did you manage to get it to work?
Hi Cian
I sent you a message on linkedin
glenmcl is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
attachmentPt for floating body at each time step for overInterDyMFoam solver mahsankhan OpenFOAM Running, Solving & CFD 0 January 24, 2022 11:13
Fluent UDF for AUV sine wave movement conthula FLUENT 1 January 19, 2020 21:33
Dambreak initial condition sine wave joshmccraney OpenFOAM Pre-Processing 2 August 8, 2019 17:00
Convergence problem with tetrahedral grids Tarak OpenFOAM Running, Solving & CFD 22 June 25, 2018 19:09
Create rectified square wave inlet flow profile mhw2015 Fluent UDF and Scheme Programming 0 November 18, 2015 12:30


All times are GMT -4. The time now is 16:07.