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

Different inlet mediums at different times

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By wyldckat
  • 2 Post By wyldckat
  • 1 Post By koscfd
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2016, 04:59
Default Different inlet mediums at different times
  #1
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Dear All,

Would it be possible please to help me with the below issue.

I need to perform CFD transient analysis in a pipe section and insert three different mediums (oil and gas and water) at different times.

For example:

Initial state: t=0s / The pipe is full of water (density: 1025kg/m3)
From t=1s to t=5s / Oil enters the pipe (density: 800kg/m3, u: 1.5m/s)
From t=5s to t=10s / Gas enters the pipe (density: 400kg/m3, u: 1.5m/s)
From t=10s to t=15s / Oil enters the pipe (density: 800kg/m3, u: 1.5m/s)
From t=15s to t=20s / Gas enters the pipe (density: 400kg/m3, u: 1.5m/s)

Is this feasible in OpenFOAM? Could you please give me some advice on how to implement this sequence?
I am using InterFoam solver for my analysis.
I can provide the run files if needed.

Thank you in advance.
koscfd is offline   Reply With Quote

Old   January 31, 2016, 14:33
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by koscfd View Post
Is this feasible in OpenFOAM? Could you please give me some advice on how to implement this sequence?
I am using InterFoam solver for my analysis.
Quick answers:
  1. Can be done with OpenFOAM.
  2. The only one I can remember right now is groovyBC: http://openfoamwiki.net/index.php/Contrib/groovyBC - it's part of swak4Foam: http://openfoamwiki.net/index.php/Contrib/swak4Foam
  3. interFoam is explicitly for only 2 fluids, you cannot use a 3rd fluid. You must use one of the multiphase solvers, namely multiphaseEulerFoam or multiphaseInterFoam.
koscfd likes this.
__________________
wyldckat is offline   Reply With Quote

Old   January 31, 2016, 16:59
Default
  #3
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Dear wyldckat,

Thank you very much for your informative reply. I will follow your advice and come back with results!

Best Regards
koscfd is offline   Reply With Quote

Old   February 17, 2016, 10:16
Default
  #4
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Hello wyldckat,

I think I managed to install swak4foam. For information, the “swak4foam” folder is now located in my OpenFOAM’s “tutorials” folder.

Once I type “funkySetFields”, while being into the “swak4foam” folder, I get the message below.
Code:
 
[ofuser@boot2docker swak4Foam]$ funkySetFields
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.0-6abec57f5449
Exec   : funkySetFields
Date   : Feb 17 2016
Time   : 11:39:23
Host   : "boot2docker"
PID    : 10036
Case   : /home/ofuser/OpenFOAM/ofuser-3.0.0/run/tutorials/swak4Foam
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMas
ter
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
swakVersion: 0.4.0 (Release date: Next release)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
I setup a test case using the groovyBC to check the installation, and it runs fine.
In the test case's inlet field, I have included: From t=0s to t=3s, the velocity is 3m/s, otherwise the velocity is 0m/s. OpenFOAM zeros the velocity at 3s, as intended.

Code:
internalField   uniform (3 0 0);
boundaryField
{
    inlet1
    {
        type            groovyBC;
        valueExpression "(time()< 3?vector(3,0,0):vector(0,0,0))";
        value uniform   (3 0 0);
    }
However, this was only a test. What I am trying to achieve is,

From t=0s to t=5s, oil comes from my inlet
From t=5s to t=10s, gas comes from my inlet
From t=10s to t=15s, oil comes from my inlet
…… and so on.

Would it be possible please to advise me if there is a way to use the groovyBC for this sequence? For simplicity, I currently use water and air as my phases.
Since my velocity is same for both phases, I would assume that the “U” file would not need the groovyBC and it can be in the form:

Code:
internalField   uniform (3 0 0);
boundaryField
{
    inlet1
    {
        type            fixedValue;
        value           uniform (3 0 0);
    }
Do I need to use the groovyBC in my “transportProperties” file or in my "alpha.water" file?
At the moment, I have only a “alpha.water” file in my “0” folder. Would I need a “alpha.air” file as well?
How could I link the different times to each phase?

I also tried the UniformFixedValue command in the transportProperties file (without using groovyBC) but unfortunately with no success.
Would it be possible please to show me an example on how to use this command for my purpose?
Does this command need to be used in conjunction with swak4foam?

Apologies for the long message.

Thank you,

Best Regards
koscfd
koscfd is offline   Reply With Quote

Old   February 21, 2016, 15:27
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: OK, this is a good start:
Quote:
Originally Posted by koscfd View Post
Code:
internalField   uniform (3 0 0);
boundaryField
{
    inlet1
    {
        type            groovyBC;
        valueExpression "(time()< 3?vector(3,0,0):vector(0,0,0))";
        value uniform   (3 0 0);
    }
However, this was only a test. What I am trying to achieve is,

From t=0s to t=5s, oil comes from my inlet
From t=5s to t=10s, gas comes from my inlet
From t=10s to t=15s, oil comes from my inlet
…… and so on.
Then the idea is simple. If you want to change the velocity depending on the current time, you can do the following time of chained inline if's:
Code:
internalField   uniform (3 0 0);
boundaryField
{
    inlet1
    {
        type            groovyBC;
        valueExpression "(time()<5.0?vector(3,0,0):(time()<10.0?vector(2,0,0):(time()<15.0?vector(1,0,0):vector(0,0,0))))";
        value uniform   (3 0 0);
    }
Similarly, you can do the following for the phases:
  • For alpha.oil:
    Code:
         inlet1
        {
            type            groovyBC;
            valueExpression  "((time()<5.0 || (10.0<=time() && time()<15.0)) ? 1.0 : 0.0)";
            value uniform   0;
        }
  • For alpha.gas:
    Code:
         inlet1
        {
            type            groovyBC;
            valueExpression  "((5.0<=time() && time()<10.0) ? 1.0 : 0.0)";
            value uniform   0;
        }
wayne14 and koscfd like this.
__________________
wyldckat is offline   Reply With Quote

Old   February 24, 2016, 05:05
Default
  #6
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Dear wyldckat,

Your help was phenomenal!
Thank you very much.
I need to run a few cases to finalise my desired result, however, OpenFOAM/Swak runs fine with the syntax you provided.

In the meantime, I also managed to achieve this sequence with your alternative suggestion, i.e., by typing the code below in the alpha.water:

Code:
boundaryField
{
inlet1
{
type uniformFixedValue;
uniformValue table (
(0.0 1.0)
(3.999 1.0)
(4.0 0.0)
(7.999 0.0)
(8.0 1.0)
(11.999 1.0)
(12.0 0.0)
);
}
Many thanks once again for this huge support!
I will come back with more results.

Kind Regards
koscfd
wyldckat likes this.
koscfd is offline   Reply With Quote

Old   March 17, 2016, 06:09
Default
  #7
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Dear wyldckat,

I finalised the model and I am now in the post-processing stage where I need to extract the pressure profile along the pipe.

In my "0" folder, the input field relevant to pressure is the "p_rgh" which I have set as below:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [1 -1 -2 0 0 0 0];
internalField   uniform 0;
boundaryField
{
    inlet
    {
        type            zeroGradient;
    }
    outlet
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    defaultFaces
    {
        type            empty;
    }
}
// ************************************************************************* //
In my output, for each time-step of the transient analysis, I get "p" and "p_rgh" fields, both measured in Pa units.
  • According to this link, "p" is the static pressure and "p_rgh" is the static-rgh. Therefore, would it be correct to take the "p" as my total pressure (i.e. pressure including rgh)? What I need is the total pressure acting on each cell in time.
  • In the pipe bend section, I get positive pressure in the outer region (approx. 5000Pa), and negative in the inner region (approx. -17000Pa). What is the sign convention? I was expecting to get almost 0 pressure in the inner region but this looks like I get suction. Would a negative pressure be an indication that my mesh is too coarse?
I have attached a screenshot and comparison graphs for "p" and "p_rgh". For info, the velocity is 5m/s and the time sequence is:
0s-4s Oil
4s-8s Gas
8s-12s Oil
12s onwards Gas

Thank you,

Kind Regards,
Koscfd
Attached Images
File Type: jpg bend.jpg (70.0 KB, 18 views)
File Type: jpg p and p_rgh.jpg (111.9 KB, 22 views)
koscfd is offline   Reply With Quote

Old   March 28, 2016, 13:48
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Koscfd,

I've finally managed to take a look into your questions.

Quote:
Originally Posted by koscfd View Post
According to this link, "p" is the static pressure and "p_rgh" is the static-rgh. Therefore, would it be correct to take the "p" as my total pressure (i.e. pressure including rgh)? What I need is the total pressure acting on each cell in time.
Code:
p_rgh = p - rho * g * height
This means that the "p_rgh" is the pressure field without the hydrostatic pressure term.
In principle, yes, the "p" field is the pressure field you're looking for. Problem is that (as far as I can remember) this "p" pressure field doesn't include the dynamic pressure... but usually this term is very small.

Quote:
Originally Posted by koscfd View Post
In the pipe bend section, I get positive pressure in the outer region (approx. 5000Pa), and negative in the inner region (approx. -17000Pa). What is the sign convention? I was expecting to get almost 0 pressure in the inner region but this looks like I get suction. Would a negative pressure be an indication that my mesh is too coarse?
What happens is that since you defined the internal field as "0" for both "p" and "p_rgh", this means that these pressure fields are related to a reference pressure. The reference pressure can be almost anything, may it be 1 atmosphere (101325 Pa) or 10 atm or 0.5 atm.
Therefore, the values you are getting are related to the reference pressure level of 0 Pascal.
If your actual reference pressure is 1 atm, then the values you are getting are in fact:
  • 101325 + 5000
  • 101325 - 17000
Knowing only the pressure levels alone is probably not enough to diagnose the mesh validity. You either need to do a mesh study, or have experimental data with which you can compare to.

Quote:
Originally Posted by koscfd View Post
I have attached a screenshot and comparison graphs for "p" and "p_rgh". For info, the velocity is 5m/s and the time sequence is:
I don't know which side is the inlet and which one is the outlet, nor which way does gravity point to... so, this only looks like a pretty graph to me

Although... hold on... now that I think about it, the range of 5 to -17 kPa seems to be a lot. Maybe you've got the units wrong for the pipe dimensions?
Then again, the mesh does look like it's a bit coarse. Again, you might want to do a bit of a mesh resolution study, to get a better notion of what you're getting.

Best regards,
Bruno
koscfd likes this.
__________________
wyldckat is offline   Reply With Quote

Old   April 4, 2016, 09:36
Default
  #9
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Dear wyldckat,

Thank you very much for your input! It was really helpful!
I have already started a mesh resolution study.

Best Regards,
koscfd
koscfd is offline   Reply With Quote

Old   May 6, 2016, 07:31
Default
  #10
New Member
 
Join Date: Dec 2015
Posts: 15
Rep Power: 10
koscfd is on a distinguished road
Greetings wyldckat,

In my model, I have set the multiphase flow as we discussed above with an inlet velocity of 13.25m/s.
What I would need is to also set operating pressure in the pipe. This would mean that my flow would run inside the pipe with a velocity of 13.25m/s and at a pressure of say 100bar.
I ran a few sensitivity cases and noticed that when I set pressure to “zero gradient” at inlet, outlet and walls, the flow speed is constant and unaffected. However, when I set the pressure to 100bar, the flow speed seems to gradually slow down for both phases.
Could you please advise me if this is the correct way to define the operating pressure in the pipe?

U Field:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (13.25 0 0);
boundaryField
{
inlet
{
type pressureInletOutletVelocity;
value uniform (13.25 0 0);
}
outlet
{
type zeroGradient;
}
walls
{
type fixedValue;
value uniform (0 0 0);
}
defaultFaces
{
type empty;
}
}

// ************************************************************************* //
p_rgh Field:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [1 -1 -2 0 0 0 0];
internalField   uniform 1.0E7;
boundaryField
{
    inlet
    {
        type            uniformFixedValue;
        uniformValue constant 1.0E7;
    }
    outlet
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    defaultFaces
    {
        type            empty;
    }
}
// ************************************************************************* //
alpha.oil Field:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      alpha.oil;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 0 0 0 0];
internalField   uniform 0;
boundaryField
{
    inlet
    {
  type groovyBC;
                valueExpression  "((time()<7.925 || (12.861<=time() && time()<20.786) || (25.722<=time() && time()<33.647) || (38.583<=time() && time()<46.508) || (51.444<=time() && time()<59.369)) ? 1.0 : 0.0)";
                value uniform   0;
    }
    outlet
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    defaultFaces
    {
        type            empty;
    }
}
// ************************************************************************* //
Many thanks in advance,

Kind Regards,
koscfd
koscfd is offline   Reply With Quote

Reply

Tags
time dependent, transient analysis


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
setting the correct format of nonuniform List<vector> for inlet in 0 Folder cfdonline2mohsen OpenFOAM Running, Solving & CFD 8 July 18, 2019 09:03
Total pressure and mass flow boundary condition at inlet bscphil OpenFOAM Pre-Processing 3 July 9, 2017 15:39
velocity inlet and ideal gas simultaneously-what's wrong? preetam69 FLUENT 0 September 28, 2013 05:51
benchmark: flow over a circular cylinder goodegg Main CFD Forum 12 January 22, 2013 12:47
length scales at inlet for internal flows Anne-Marie Giroux Main CFD Forum 3 July 5, 1999 22:28


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