CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Is there any provision for sinusoidal velocity inlet b.c in openFoam 4.1?

Register Blogs Community New Posts Updated Threads Search

Like Tree15Likes
  • 8 Post By Bloerb
  • 6 Post By Bloerb
  • 1 Post By hiuluom

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2017, 10:19
Default Is there any provision for sinusoidal velocity inlet b.c in openFoam 4.1?
  #1
New Member
 
Vivekananda
Join Date: May 2017
Location: Cardiff, UK
Posts: 27
Rep Power: 9
sinhavivekananda318 is on a distinguished road
Hello,
I am trying to incorporate a sinusoidal velocity profile at the inlet boundary. recently I came across the "oscillatingFixedValue" bc in a tutorial. but I am unable to find this bc in the derived bc in the finite volume patch fields. I have done my further research and came to know that OF v 4.1 does not have this bc.

Is friends there any way to have this sinusoidal velocity inlet in OF 4.1?

regards
vivek
sinhavivekananda318 is offline   Reply With Quote

Old   May 3, 2017, 17:58
Default
  #2
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
Use a boundary condition with Function1. Example:

{
type uniformFixedValue;
uniformValue constant 0.2;
}

Instead of constant you can use polynomial or sinus, a table file etc...
Bloerb is offline   Reply With Quote

Old   May 3, 2017, 18:12
Default
  #3
New Member
 
Vivekananda
Join Date: May 2017
Location: Cardiff, UK
Posts: 27
Rep Power: 9
sinhavivekananda318 is on a distinguished road
thanku sir for your kind reply. In my case I hve to use a velocity profile which has the following expression: U=a*f*Cos( 2*Pi*a*f*t).
Here, a=amplitude;f=frequency; and t=time;
In this case how should I specify my amplitude , frequency and time?
please give me some advice..

regards
vivek
sinhavivekananda318 is offline   Reply With Quote

Old   May 4, 2017, 17:57
Default
  #4
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
Function1 is located here:
https://github.com/OpenFOAM/OpenFOAM...ions/Function1

Inside sine.h you'll find:

Code:
 Templated sine function with support for an offset level.
        \f[
            a sin(2 \pi f (t - t_0)) s + l
        \f]
    where
    \vartable
        symbol  | Description       | Data type
        a       | Amplitude         | Function1<scalar>
        f       | Frequency [1/s]   | Function1<scalar>
        s       | Type scale factor | Function1<Type>
        l       | Type offset level | Function1<Type>
        t_0     | Start time [s]    | scalar
        t       | Time [s]          | scalar
    \endvartable
    Example for a scalar:
    \verbatim
        <entryName> sine;
        <entryName>Coeffs
        {
            frequency 10;
            amplitude 0.1;
            scale     2e-6;
            level     2e-6;
        }
    \endverbatim
    Example for a vector:
    \verbatim
        <entryName> sine;
        <entryName>Coeffs
        {
            frequency 10;
            amplitude 1;
            scale     (1 0.1 0);
            level     (10 1 0);
        }
    \endverbatim
SourceFiles
    Sine.C
One example can be found here
https://github.com/OpenFOAM/OpenFOAM...hVectorField.H

Simply check which boundary conditions contain function1. It should be loaded at the top of the .h file. Most boundary conditions can be found here:
https://github.com/OpenFOAM/OpenFOAM...Fields/derived

I have not tested this, but this should work with minor tweaking:

Code:
inlet
{
type uniformFixedValue;
uniformValue sine;
        uniformValueCoeffs
        {
            frequency 10;
            amplitude 1;
            scale     (1 0 0); 
            level     (0 0 0); // offset
            t0  0; // shift this for a Cosinus
        }
}
This is the exact definition:
Code:
        amplitude_->value(t)
       *sin(constant::mathematical::twoPi*frequency_->value(t)*(t - t0_))
       *scale_->value(t)
      + level_->value(t);
Bloerb is offline   Reply With Quote

Old   May 5, 2017, 01:00
Default
  #5
New Member
 
Vivekananda
Join Date: May 2017
Location: Cardiff, UK
Posts: 27
Rep Power: 9
sinhavivekananda318 is on a distinguished road
thank you sir...yesterday i generated a sinusoidal inlet profile with uniformfixedvalue. Its coming nice. but sir I have some doubts. I have tried to find out what an offset is. It is defined as the vertical distance of the base line. and in the syntaxes, it is written as (10 1 0). What these three value stand for? similar doubt for scale as well. scale is a factor by which the signal is amplified. but what are these three values in the syntax of scale? and sir I also did not understand the "t0 0 ; // shift this for cosinus" line.Please explain

regards
vivek
sinhavivekananda318 is offline   Reply With Quote

Old   May 5, 2017, 03:26
Default
  #6
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
As I have already shown the formula is:
Code:
        scale*amplitude*sin(2*Pi*frequency*(t - t0)) + level
Since you have chosen a boundary condition that expects a vector your profile needs to be a vector. Hence scale and level are vectors.
Example:
Code:
        (1 0 0)^T*amplitude*sin(2*Pi*frequency*(t - t0)) + (0 1 0)^T
will give you an oscilation in x direction with a constant y velocity.

Now you want U=a*f*Cos( 2*Pi*a*f*t). Hence level is (0 0 0). Since amplitude is also inside your cos set it to 1 and use the amplitude inside scale. If your inlet is in x direction you should format your values in this fashion:
Code:
inlet
{
type uniformFixedValue;
uniformValue sine;
        uniformValueCoeffs
        {
            frequency a*f;
            amplitude 1;
            scale     (a*f 0 0); 
            level     (0 0 0); // offset
            t0  0.25/(a*f); // shift this for a Cosinus
        }
}
t0 results from the fact that sin(x+pi/2)=cos(x)
Bloerb is offline   Reply With Quote

Old   April 3, 2019, 06:25
Default
  #7
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
I think t0 = -0.25/(a*f) because:

2pi*a*f*(t-t0) = pi/2 + 2pi*a*f*t => t0 = -0.25/(a*f)

based on sin(pi/2 + x) = cos (x)
yinchuanfeng likes this.
hiuluom is offline   Reply With Quote

Old   May 1, 2019, 09:13
Default Sinusoidal wave input in interDyMFoam model
  #8
New Member
 
Daan
Join Date: Feb 2019
Posts: 4
Rep Power: 7
FloatingSolar is on a distinguished road
hey,

I am trying to create a multiphase model of a floating object which is subjected to a sinusoidal wave input. Would anybody be able to explain to me how I can achieve this? I have tried using a 'uniformFixedValue' inlet with a sine as 'uniformValue', but I can't get it to work properly. (I get very weird waves if any at all.) Any directions on how to set up the boundary conditions would be much appreciated!

Kind regards,
Daan
FloatingSolar 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
Pressure problems with inlet variable velocity jaimesdiegop CFX 2 September 1, 2016 03:31
flow around a circular cylinder with velocity inlet and outflow outlet shuoxue OpenFOAM 1 March 3, 2014 11:42
velocity inlet and ideal gas simultaneously-what's wrong? preetam69 FLUENT 0 September 28, 2013 05:51
Inlet Velocity in CFX aeroman CFX 12 August 6, 2009 19:42
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


All times are GMT -4. The time now is 09:44.