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

boundaries and patches

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2010, 08:36
Default boundaries and patches
  #1
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Hi all,

I have some questions concerning patches in OpenFOAM.

Is it possible to define a patch which allows the medium (gas, liquid... doesn't matter) to pass through this patch only when the pressure of that medium reaches a certain level, but when the pressure decreases below that certain limit in the time of simulation the patch behaves like a wall again? Of course I would like to prevent either a back flow with this model. Roughly speaking is it possible to model a simple check valve?

The other question is. Is there a type of inlet patch in which I could set up decreasing/increasing flow due to a change of a pressure against time?
piprus is offline   Reply With Quote

Old   March 23, 2010, 10:40
Default
  #2
Senior Member
 
Kevin Smith
Join Date: Mar 2009
Posts: 104
Rep Power: 17
kev4573 is on a distinguished road
Yes, you could probably do both of those with groovyBC fairly easily.
kev4573 is offline   Reply With Quote

Old   March 23, 2010, 12:34
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kev4573 View Post
Yes, you could probably do both of those with groovyBC fairly easily.
First one: yes. Second one only if there is already a field that holds dp/dt (groovy doesn't calculate time derivatives)

Bernhard
gschaider is offline   Reply With Quote

Old   March 23, 2010, 13:06
Default
  #4
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
If you say groovyBC, then ok, but I would appreciate some help from expirienced users of this tool like you I need some more information.

I will focus now on the first idea - the checkValve case:

First of all, in a boundary file I have an 'outlet' which is of type patch, like below:

Code:
    outlet
    {
        type            patch; ....
and which suppose to be a wall for the most time, since the pressure is lower than my assumed value (let say 7e6). My question is, should I keep it as it is or change it to a wall-type (so the groovy could change it later)?

I have a quite simple case, so I'm using only p, U and alpha1 fields in it. Since the outlet now is open those fields are defined in following manner:

Code:
alpha1
outlet
{
        type        inletOutlet;
        inletValue    uniform 0;
        value        uniform 0;
}
Code:
p
outlet
{
    type    fixedValue;
    value    uniform 1e5;
}
Code:
U
outlet
{
        type            pressureInletOutletVelocity;
        value           uniform (0 0 0);
}
How should I change them, assuming that those conditions are valid only when the patch is 'open' for a medium due to its high pressure (over 7e6)?
piprus is offline   Reply With Quote

Old   March 23, 2010, 13:22
Default
  #5
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Quote:
Originally Posted by piprus View Post
My question is, should I keep it as it is or change it to a wall-type (so the groovy could change it later)?
Ok, I feel I wrote something entirely stupid It's obvious that it has to stay as a patch.... Sorry for that I'm just confused!!
piprus is offline   Reply With Quote

Old   March 25, 2010, 12:26
Default
  #6
Senior Member
 
Kevin Smith
Join Date: Mar 2009
Posts: 104
Rep Power: 17
kev4573 is on a distinguished road
You would change all those boundary conditions to use groovyBC, and then write the expressions. You'd probably use the ? : operators to get your check valve operating correctly. Something like p < 7e6 ? closedValue : openValue . If you formulate the expressions right you should be able to create the inletOutlet bc's you need.
kev4573 is offline   Reply With Quote

Old   March 25, 2010, 13:06
Default
  #7
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Quote:
Originally Posted by kev4573 View Post
You would change all those boundary conditions to use groovyBC, and then write the expressions. You'd probably use the ? : operators to get your check valve operating correctly. Something like p < 7e6 ? closedValue : openValue . If you formulate the expressions right you should be able to create the inletOutlet bc's you need.
This is actually what I expected from groovy... I was thinking about that in this way, so I tried to write something like this:

Code:
alpha1 
outlet 
{ 
 type goovyBC; 
 valueExpression "p > 7e6 ? (uniform 0) : (zeroGradient)"; 
}
But this won't work and I didn't really expect it will run in this form :P that's why I'm still asking. I'm so eager to know how to use it though.

Normally when I run the simulation and I want to change the conditions I just stop the process and rerun from the last step under new conditions. But this approach is not really accurate and BTW time consuming when you running in parallel more than one simulation at that time.

But what I was doing by hand was to set up the close-conditions for the outlet in order to allow the system to reach the over pressure level. So it looked like a wall more or less at the beginning:

Code:
    outlet
    {
        type            zeroGradient;
    }
and later like an outlet:

Code:
outlet
    {
        type        inletOutlet;
        inletValue    uniform 0;
        value        uniform 0;
    }
This is of course just an alpha case, but I understand I have to rewrite all of the field-files.

I'm sure it can't be so difficult to apply this tool in my case, but I'm a bit green here.

Thanks for all of the advices you have already given and for all of those that will show up here later, of course hopefully soon
piprus is offline   Reply With Quote

Old   March 25, 2010, 13:42
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by piprus View Post
This is actually what I expected from groovy... I was thinking about that in this way, so I tried to write something like this:

Code:
alpha1 
outlet 
{ 
 type goovyBC; 
 valueExpression "p > 7e6 ? (uniform 0) : (zeroGradient)"; 
}
But this won't work and I didn't really expect it will run in this form :P that's why I'm still asking. I'm so eager to know how to use it though.
You can do that with the fractionExpression (that says whether the BC is a Dirichlet or a Neumann)

Have a look at the second BC in this example:
http://openfoamwiki.net/index.php/Co...ulsedPitzDaily
This should give you an idea hwo to implement your BC
(of course the question is whether you'll want to switch the whole patch at the same time or each face individually, which is the default behaviour, for the whole patch you'll have to use max(p) or something similar)

Bernhard
gschaider is offline   Reply With Quote

Old   March 25, 2010, 14:33
Default
  #9
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Ok, as far as I understood I can't use my conditions explicitly, writing e.g.:
Code:
fractionExpression "(max(p) > 7e6) ? uniform 0 : zeroGradient"
but what I can do is to switch between Dirichlet's or Neumanns conditions. So assuming that when the outlet is closed (there is no gradient) I should have apply Dirichlet's conditions, but when it's open it has to be Neumann. Then my expression should look like this:
Code:
fractionExpression "(max(p) > 7e6) ? 0 : 1"
Is that right?
piprus is offline   Reply With Quote

Old   March 25, 2010, 15:15
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by piprus View Post
Ok, as far as I understood I can't use my conditions explicitly, writing e.g.:
Code:
fractionExpression "(max(p) > 7e6) ? uniform 0 : zeroGradient"
but what I can do is to switch between Dirichlet's or Neumanns conditions. So assuming that when the outlet is closed (there is no gradient) I should have apply Dirichlet's conditions, but when it's open it has to be Neumann. Then my expression should look like this:
Code:
fractionExpression "(max(p) > 7e6) ? 0 : 1"
Is that right?
Yep.

You could add a condition for phi if you expect backflow in the "open"-case (inletOutlet-style)
gschaider is offline   Reply With Quote

Old   March 25, 2010, 15:44
Default
  #11
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Yep.
Looks like there remains only one question to solve, before I run the simulation. I mean how should I define BC for p (pressure)? I want to keep the idea of 1e5 MPa at the outlet when it's open.

Quote:
Originally Posted by gschaider View Post
You could add a condition for phi if you expect backflow in the "open"-case (inletOutlet-style)
I know that I used inletOutlet before, but now it seems to be no longer valid. There won't be any backflow, since it will be a very simple model of a checkValve, but thanks for idea. Will be useful later in a different case.
piprus is offline   Reply With Quote

Old   March 27, 2010, 19:29
Default
  #12
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
I did some changes of the conditions and my outlet looks as shown below:

0/alpha1
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    //valueExpression "zeroGradient"; // (1) Dirichlet
    gradientExpression "0"; // (0) Neumann
    }
0/p
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    //valueExpression "zeroGradient"; // (1) Dirichlet
    gradientExpression "1e5"; // (0) Neumann
    }
0/U
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    valueExpression "vector(0,0,0)"; // (1) Dirichlet
    gradientExpression "vector(0,0,0)"; // (0) Neumann
    value           uniform (0 0 0);
    }
Will this work or should I change something?

I'm asking, cause I tried to run it and I got an error

Code:
Courant Number mean: 0 max: 0
deltaT = 0.001
Time = 0.001

MULES: Solving for alpha1
Liquid phase volume fraction = 0.5110848  Min(alpha1) = 0  Min(alpha2) = 0
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
#0  Foam::error::printStack(Foam::Ostream&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  ?? in "/lib/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#4  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/compressibleInterFoam"
#5  main in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/compressibleInterFoam"
#6  __libc_start_main in "/lib/libc.so.6"
#7  _start at /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception
piprus is offline   Reply With Quote

Old   March 29, 2010, 15:16
Default
  #13
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by piprus View Post
I did some changes of the conditions and my outlet looks as shown below:

0/alpha1
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    //valueExpression "zeroGradient"; // (1) Dirichlet
    gradientExpression "0"; // (0) Neumann
    }
0/p
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    //valueExpression "zeroGradient"; // (1) Dirichlet
    gradientExpression "1e5"; // (0) Neumann
    }
0/U
Code:
    outlet
    {
    type groovyBC;
    fractionExpression "(max(p) > 7e6) ? 0 : 1"
    valueExpression "vector(0,0,0)"; // (1) Dirichlet
    gradientExpression "vector(0,0,0)"; // (0) Neumann
    value           uniform (0 0 0);
    }
Will this work or should I change something?

I'm asking, cause I tried to run it and I got an error

Code:
Courant Number mean: 0 max: 0
deltaT = 0.001
Time = 0.001

MULES: Solving for alpha1
Liquid phase volume fraction = 0.5110848  Min(alpha1) = 0  Min(alpha2) = 0
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
#0  Foam::error::printStack(Foam::Ostream&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  ?? in "/lib/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#4  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/compressibleInterFoam"
#5  main in "/home/piotr/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/compressibleInterFoam"
#6  __libc_start_main in "/lib/libc.so.6"
#7  _start at /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception
My guess (but can't say for sure unless you produce a stack-trace from a debug-version) is that something is divided by zero. My guess is that it is p. Because you don't define a valueExpression for p/Outlet. So groovy implicitly takes "0" if a dirichlet-condition is used

Bernhard
gschaider is offline   Reply With Quote

Old   March 30, 2010, 09:23
Default
  #14
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Quote:
Originally Posted by gschaider View Post
a stack-trace from a debug-version
I haven't been using debug before and as far as I see in the foamDebugSwitches there is a lot of switches. Could you tell me (step-by-step) how should I use it to get some useful information?
piprus is offline   Reply With Quote

Old   March 30, 2010, 12:54
Default
  #15
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by piprus View Post
I haven't been using debug before and as far as I see in the foamDebugSwitches there is a lot of switches. Could you tell me (step-by-step) how should I use it to get some useful information?
Have a look at
http://openfoamwiki.net/index.php/Ma...:Ostream.26.29
and
http://openfoamwiki.net/index.php/HowTo_debugging
But before you start compiling your debug-version make sure that p is not 0 in the case of a Dirichlet-condition, and it will be with the conditions you showed above

Bernhard
gschaider is offline   Reply With Quote

Old   March 30, 2010, 14:16
Default
  #16
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17
piprus is on a distinguished road
Quote:
Originally Posted by gschaider View Post
But before you start compiling your debug-version make sure that p is not 0 in the case of a Dirichlet-condition, and it will be with the conditions you showed above
Thank you so much for this advice, my simulation seems to work now. It has to take some time to check whether it's working as I expect, but if not I will for sure ask more questions :P
piprus is offline   Reply With Quote

Old   March 31, 2010, 03:55
Default hiii
  #17
New Member
 
helenhunt
Join Date: Mar 2010
Posts: 1
Rep Power: 0
helenhunt is on a distinguished road
I can do is to switch between Dirichlet's or Neumanns conditions. So assuming that when the outlet is closed (there is no gradient) I should have apply Dirichlet's conditions, but when it's open it has to be Neumann.

Sealed Lead Acid Battery
helenhunt is offline   Reply With Quote

Old   February 14, 2012, 04:31
Smile
  #18
New Member
 
Gunn Elin
Join Date: Feb 2012
Posts: 2
Rep Power: 0
Gunn_Elin is on a distinguished road
Quote:
Originally Posted by piprus View Post
Thank you so much for this advice, my simulation seems to work now. It has to take some time to check whether it's working as I expect, but if not I will for sure ask more questions :P
Hi!
I'm quite new to the use of openFoam, and is currently trying to simulate a check valve for a patch such as yours. Did this groovyBC presented here work for you, or did you change it?

Is it possible for you to post the final boundary conditions you used for the check valve, if you changed them further from whats written here?

Thanks a lot in advance.
Gunn_Elin is offline   Reply With Quote

Old   February 14, 2012, 10:09
Default
  #19
New Member
 
Gunn Elin
Join Date: Feb 2012
Posts: 2
Rep Power: 0
Gunn_Elin is on a distinguished road
Quote:
Originally Posted by Gunn_Elin View Post
Hi!
I'm quite new to the use of openFoam, and is currently trying to simulate a check valve for a patch such as yours. Did this groovyBC presented here work for you, or did you change it?

Is it possible for you to post the final boundary conditions you used for the check valve, if you changed them further from whats written here?

Thanks a lot in advance.
It look's like the boundaries worked. I'only added the keyword value for alpha1 and the pressure, and the case was running
Gunn_Elin is offline   Reply With Quote

Reply

Tags
boundary condition, patch


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
How to define patches after gmshToFoam ? seb_j OpenFOAM 8 July 13, 2011 10:25
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 13:43
[OpenFOAM] Display internal field together with boundaries gunnar ParaView 4 June 25, 2009 13:00
How to set all X variable to zero at all boundaries sampaio OpenFOAM Running, Solving & CFD 0 June 1, 2006 19:14
unmatched boundaries for sliding grids Markus CFX 1 August 16, 2001 20:06


All times are GMT -4. The time now is 14:02.