CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

totalPressure Inlet boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2020, 06:37
Default totalPressure Inlet boundary condition
  #1
New Member
 
LouisDS
Join Date: Dec 2019
Posts: 12
Rep Power: 6
loewieke53 is on a distinguished road
Dear OpenFOAM users,

Situation sketch: I am modelling a ship propeller in a canal. The ship is under bullard pull condition, so the inlet velocity has to be equal to 0 m/s. The inlet is far upstream of the propeller and as a consequence it doesn't feel any influence of the propeller. This means the pressure close to inlet has to be equal to the ambient pressure ( p = 0)

I am using the totalPressure boundary condition and I have put p0 at a value equal to zero. For U, I am using the pressureInletVelocity (uniform (0 0 0)) boundary condition. My goal is to get the ambient pressure at the inlet and an inlet velocity equal to 0 m/s.

However, with this BC combination and by looking at my results, the totalpressure is not zero at the inlet boundary and the velocity is also not equal to zero.

Is there any way to make both the pressure and the velocity equal to zero at the inlet? I have tried fixedValue for both U an p, but this also does not work.

Thanks in advance and kind regards,

Louis
Attached Files
File Type: zip 0.zip (4.5 KB, 9 views)

Last edited by loewieke53; April 17, 2020 at 15:02.
loewieke53 is offline   Reply With Quote

Old   April 16, 2020, 08:05
Default
  #2
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 65
Rep Power: 15
thiagopl is on a distinguished road
Hi loewieke53,


I am having the same problem with this boundary condition too, but in a buoyancy driven flow. Try to clarify better your case (a figure maybe) showing where exactly you are trying to set the totalPressure.


Have you tried fixedFluxPressure for p and inletOutlet for U with inletValue (0 0 0)?
This way you force zero velocity at the inlet, but I don't know whether this satisfies the physics of your case.
__________________
Fields of interest: buoyantFoam, chtMultRegionFoam.
thiagopl is offline   Reply With Quote

Old   April 16, 2020, 08:45
Default
  #3
New Member
 
LouisDS
Join Date: Dec 2019
Posts: 12
Rep Power: 6
loewieke53 is on a distinguished road
Hi Thiago,

Currently my result closest to my final goal is when I use:

- fixedValue (0 0 0) for U
- zeroGradient for p

My screenshots show the resulting velocity and pressure distribution in a side view of the canal. The small propeller with a diameter of 7.5 cm is located at 1.51 m from the inlet. The plot shows the values of the velocity/pressure on a line trough the propeller centerline.

As you can see, with these BCs. I managed to put the velocity at the inlet to 0 m/s. But the pressure assymptotically goes to a value under 0. In reality it would go assymptotically to a value of 0 (ambient pressure) as here no influence of the propeller is felt.

With the totalPressure BC, both velocity and pressure are not zero at the boundary. If you want me to add these results please tell me.

I will now try your boundary condition and check the results. Thank you very much!
Attached Images
File Type: png 0Velocity.png (45.9 KB, 36 views)
File Type: png 0Pressure.png (32.6 KB, 22 views)

Last edited by loewieke53; April 16, 2020 at 11:27.
loewieke53 is offline   Reply With Quote

Old   April 16, 2020, 10:49
Default
  #4
New Member
 
LouisDS
Join Date: Dec 2019
Posts: 12
Rep Power: 6
loewieke53 is on a distinguished road
Dear Thiago,

I have tried your boundary conditions but I get the following error:

[3] --> FOAM FATAL ERROR:
[3] updateCoeffs(const scalarField& snGradp) MUST be called before updateCoeffs() or evaluate() to set the boundary gradient.
[3]
[3] From function fixedFluxPressureFvPatchScalarField::updateCoeffs( )
[3] in file fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C at line 151.

Do you know what could be wrong? I am running in OpenFOAM 2.4. My case is added as a attachment.
Attached Files
File Type: zip CDF_forum.zip (13.6 KB, 4 views)
loewieke53 is offline   Reply With Quote

Old   April 16, 2020, 14:57
Default
  #5
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 65
Rep Power: 15
thiagopl is on a distinguished road
Hi loewieke53,

I ran your case in OpenFoam 7 and got no errors message (see bellow).
Your domain is a channel with a inlet, outlet and the top surface is openned to the atmosphere, right?
Once you have a propeller within the channel, zero velocity should not be expected at inlet nor outlet. Try zeroGradient for velocity on both, noSlip on walls and slip condition on the top patch ('bed').
For pressure I would try fixedFluxPressure on walls and zeroGradient on inlet, outlet and the top surface and see what happens... Another try is the combination of totalPressure and pressureInletOutlet velocity also on inlet, outlet and top surface. But I am having a lot of troubles with that in a buoyancy solver.
Note: something is not going well with your pressure, see the number of interations.

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 7-1ff648926f77
Exec   : simpleFoam -parallel
Date   : Apr 16 2020
Time   : 14:33:28
Host   : "thiago"
PID    : 8613
I/O    : uncollated
Case   : /home/thiago/OpenFOAM/thiago-6/run/CDF_forum
nProcs : 4
Slaves : 
3
(
"thiago.8614"
"thiago.8615"
"thiago.8616"
)

Pstream initialized with:
    floatTransfer      : 0
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

// using new solver syntax:
p
{
    solver          PCG;
    preconditioner  DIC;
    tolerance       1e-06;
    relTol          0.01;
}

// using new solver syntax:
U
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0.1;
}

// using new solver syntax:
k
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0.1;
}

// using new solver syntax:
epsilon
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0.1;
}

// using new solver syntax:
R
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0.1;
}

// using new solver syntax:
nuTilda
{
    solver          PBiCG;
    preconditioner  DILU;
    tolerance       1e-05;
    relTol          0.1;
}


SIMPLE: No convergence criteria found

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model realizableKE
RAS
{
    RASModel        realizableKE;
    turbulence      on;
    printCoeffs     on;
    A0              4;
    C2              1.9;
    sigmak          1;
    sigmaEps        1.2;
}

No MRF models present

No finite volume options present

Starting time loop

Time = 1

DILUPBiCG:  Solving for Ux, Initial residual = 1, Final residual = 0.0100108, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 0.00284327, Final residual = 4.51522e-05, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 0.000303705, Final residual = 2.72132e-05, No Iterations 1
DICPCG:  Solving for p, Initial residual = 1, Final residual = 0.00999426, No Iterations 579
time step continuity errors : sum local = 1.05153e-13, global = 3.50588e-16, cumulative = 3.50588e-16
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0645732, Final residual = 0.00425372, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 1, Final residual = 0.0911234, No Iterations 1
ExecutionTime = 39.54 s  ClockTime = 45 s

Time = 2

DILUPBiCG:  Solving for Ux, Initial residual = 0.355491, Final residual = 0.00515955, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 0.67132, Final residual = 0.00362789, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 0.673923, Final residual = 0.00409022, No Iterations 2
DICPCG:  Solving for p, Initial residual = 0.413749, Final residual = 0.00397229, No Iterations 580
time step continuity errors : sum local = 2.48489e-12, global = -6.52431e-15, cumulative = -6.17372e-15
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0147397, Final residual = 0.00122171, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 0.724191, Final residual = 0.00615031, No Iterations 2
ExecutionTime = 73.88 s  ClockTime = 83 s

Time = 3

DILUPBiCG:  Solving for Ux, Initial residual = 0.201439, Final residual = 0.0146159, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.543944, Final residual = 0.0412652, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.545317, Final residual = 0.00242244, No Iterations 2
DICPCG:  Solving for p, Initial residual = 0.0181324, Final residual = 0.000169874, No Iterations 561
time step continuity errors : sum local = 4.55376e-12, global = -1.58739e-14, cumulative = -2.20476e-14
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0195868, Final residual = 0.00126217, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 0.102215, Final residual = 0.000705285, No Iterations 2
ExecutionTime = 107.02 s  ClockTime = 123 s

Time = 4

DILUPBiCG:  Solving for Ux, Initial residual = 0.229894, Final residual = 0.00674323, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.318536, Final residual = 0.0101073, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.256109, Final residual = 0.011179, No Iterations 1
DICPCG:  Solving for p, Initial residual = 0.0103171, Final residual = 9.64873e-05, No Iterations 565
time step continuity errors : sum local = 3.63496e-12, global = -2.45663e-14, cumulative = -4.66139e-14
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0204973, Final residual = 0.00143584, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 0.058776, Final residual = 0.0041336, No Iterations 1
ExecutionTime = 141.38 s  ClockTime = 163 s
__________________
Fields of interest: buoyantFoam, chtMultRegionFoam.

Last edited by thiagopl; April 16, 2020 at 15:01. Reason: Grammar and note.
thiagopl is offline   Reply With Quote

Old   April 16, 2020, 17:16
Default
  #6
New Member
 
LouisDS
Join Date: Dec 2019
Posts: 12
Rep Power: 6
loewieke53 is on a distinguished road
Hi Thiago,

I still cannot use the fixedFluxPressure bc. This part in the "fixedFluxPressureFvPatchScalarField.C" file is causing my error. Do you know how to fix it maybe? That would be a great help



void Foam::fixedFluxPressureFvPatchScalarField::updateC oeffs()
{
if (updated())
{
return;
}

if (curTimeIndex_ != this->db().time().timeIndex())
{
FatalErrorIn("fixedFluxPressureFvPatchScalarField: :updateCoeffs()")
<< "updateCoeffs(const scalarField& snGradp) MUST be called before"
" updateCoeffs() or evaluate() to set the boundary gradient."
<< exit(FatalError);
}
}

Thank you in advance and kind regards




UPDATE: I have now tried the freestreamPressure boundary condition (together with freestream uniform ( 0 0 0) for U) and this one works. According to the .H file this is the definition of the boundary

"This boundary condition provides a free-stream condition for pressure.
It is a zero-gradient condition that constrains the flux across the patch
based on the free-stream velocity."


So in my opinion it will do the same as the fixedFluxPressure bc, or am I wrong?

Last edited by loewieke53; April 17, 2020 at 05:12.
loewieke53 is offline   Reply With Quote

Old   April 17, 2020, 08:29
Default
  #7
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 65
Rep Power: 15
thiagopl is on a distinguished road
loewieke53,

I suggest you to upgrade your OpenFoam to version 7. Your case runs on it, so. Instead of fixedFluxPressure you can use zeroGradient also. According to the User Guide:
Quote:
In the above example, it can be seen that all the wall boundaries use a boundary condition named fixedFluxPressure. This boundary condition is used for pressure in situations where zeroGradient is generally used, but where body forces such as gravity and surface tension are present in the solution equations. The condition adjusts the gradient accordingly.
The freeStream is normally used when your domain cuts a region of the same fluid. As on the air (free stream) boundaries of an airfoil simulation. Your case is a bit different because your top patch is an interface of two fluids. But once you are not interested on what happens with this surface, I think it may work.
Quote:
This boundary condition provides a free-stream condition. It is a ’mixed’ condition derived from the inletOutlet condition, whereby the mode of operation switches between fixed (free stream) value and zero gradient based on the sign of the flux
__________________
Fields of interest: buoyantFoam, chtMultRegionFoam.
thiagopl is offline   Reply With Quote

Old   April 18, 2020, 04:35
Default
  #8
New Member
 
LouisDS
Join Date: Dec 2019
Posts: 12
Rep Power: 6
loewieke53 is on a distinguished road
Thiago,

I updated to OpenFOAM 7 an also adapted the simpleFoam solver to let it recognize the actuator Disc region of the propeller.
source:

http://www.tfd.chalmers.se/~hani/kur...ningReport.pdf

This was btw the reason why I worked in such an old version of Openfoam, because I followed this tutorial (you had to adapt the simpleFoam solver and this didn't work for OF7, untill now)

After updating and running my older script (with zeroGradient, see screenshots above) I saw that my maximal velocity increased with about 16 %. This is something very strange, because I only updated to OF7 and didn't change anything else. OF7 also makes a Q-variable and an omega-variable, which I did not saw in the older versions, is this normal?

The good news is that I managed to implement the fixedFluxPressure BC. For the inlet, I used inletoutlet for U and fixedFluxPressure for p. The result is added as a screenshot. Sadly the pressure still asymptotically goes to a value under 0. I will try some other BCs and let you now.

A last question: As you also noticed, I get a high number of iterations for p. Do you maybe have an explanation for this phenomenon? That would be a great help.

Kind regards,

Louis
Attached Images
File Type: png OF7_p_U.png (42.8 KB, 9 views)
loewieke53 is offline   Reply With Quote

Old   April 21, 2020, 09:29
Default
  #9
Member
 
Thiago Parente Lima
Join Date: Sep 2011
Location: Diamantina, Brazil.
Posts: 65
Rep Power: 15
thiagopl is on a distinguished road
Louis,

I changed the p solver to the common setup used in tutorials:
Code:
//    p PCG
//    {
//        preconditioner   DIC;
//        tolerance        1e-06;
//        relTol           0.01;
    p
    {    
        solver          GAMG;
        tolerance       1e-6;
        relTol          0.01;
        smoother        GaussSeidel;

    };
The number of iterations decreased drastically, although it seems to be oscillating. At this point I don't know why (or whether this is a problem).
Code:
Time = 26

DILUPBiCG:  Solving for Ux, Initial residual = 0.0110521, Final residual = 0.000533473, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.012833, Final residual = 8.69934e-05, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 0.0097166, Final residual = 0.000112887, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0270312, Final residual = 0.000256905, No Iterations 21
time step continuity errors : sum local = 1.54414e-12, global = -5.92451e-13, cumulative = 6.42263e-13
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0108551, Final residual = 0.000472, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 0.0186211, Final residual = 0.000416674, No Iterations 1
ExecutionTime = 294.26 s  ClockTime = 334 s

Time = 27

DILUPBiCG:  Solving for Ux, Initial residual = 0.0105428, Final residual = 0.000411424, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.0120645, Final residual = 8.76166e-05, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 0.00937806, Final residual = 0.000115178, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0291473, Final residual = 0.000254077, No Iterations 5
time step continuity errors : sum local = 1.51797e-12, global = -5.11688e-13, cumulative = 1.30575e-13
DILUPBiCG:  Solving for epsilon, Initial residual = 0.0111433, Final residual = 0.0004658, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 0.0182348, Final residual = 0.000407091, No Iterations 1
 ExecutionTime = 299.51 s  ClockTime = 340 s

P.S.: the spam filter of the forum is really annoying and blocks every message I try to post.
__________________
Fields of interest: buoyantFoam, chtMultRegionFoam.
thiagopl 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
Acoustic boundary condition with pressure perturbation at inlet hand90 CFX 2 August 10, 2018 08:36
UDF fluent:Change boundary condition. determination inlet and outlet boundary in "t" gzamiri@gmail.com FLUENT 0 September 27, 2015 06:32
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05


All times are GMT -4. The time now is 21:20.