|
[Sponsors] |
March 23, 2010, 08:36 |
boundaries and patches
|
#1 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
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? |
|
March 23, 2010, 10:40 |
|
#2 |
Senior Member
Kevin Smith
Join Date: Mar 2009
Posts: 104
Rep Power: 17 |
Yes, you could probably do both of those with groovyBC fairly easily.
|
|
March 23, 2010, 12:34 |
|
#3 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
||
March 23, 2010, 13:06 |
|
#4 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
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; .... 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); } |
|
March 23, 2010, 13:22 |
|
#5 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
||
March 25, 2010, 12:26 |
|
#6 |
Senior Member
Kevin Smith
Join Date: Mar 2009
Posts: 104
Rep Power: 17 |
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.
|
|
March 25, 2010, 13:06 |
|
#7 | |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
Quote:
Code:
alpha1 outlet { type goovyBC; valueExpression "p > 7e6 ? (uniform 0) : (zeroGradient)"; } 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; } Code:
outlet { type inletOutlet; inletValue uniform 0; value uniform 0; } 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 |
||
March 25, 2010, 13:42 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
March 25, 2010, 14:33 |
|
#9 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
Ok, as far as I understood I can't use my conditions explicitly, writing e.g.:
Code:
fractionExpression "(max(p) > 7e6) ? uniform 0 : zeroGradient" Code:
fractionExpression "(max(p) > 7e6) ? 0 : 1" |
|
March 25, 2010, 15:15 |
|
#10 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
You could add a condition for phi if you expect backflow in the "open"-case (inletOutlet-style) |
||
March 25, 2010, 15:44 |
|
#11 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
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.
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. |
|
March 27, 2010, 19:29 |
|
#12 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
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 } Code:
outlet { type groovyBC; fractionExpression "(max(p) > 7e6) ? 0 : 1" //valueExpression "zeroGradient"; // (1) Dirichlet gradientExpression "1e5"; // (0) Neumann } 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); } 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 |
|
March 29, 2010, 15:16 |
|
#13 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
March 30, 2010, 09:23 |
|
#14 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
||
March 30, 2010, 12:54 |
|
#15 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
March 30, 2010, 14:16 |
|
#16 |
Member
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 67
Rep Power: 17 |
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
|
|
March 31, 2010, 03:55 |
hiii
|
#17 |
New Member
helenhunt
Join Date: Mar 2010
Posts: 1
Rep Power: 0 |
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 |
|
February 14, 2012, 04:31 |
|
#18 | |
New Member
Gunn Elin
Join Date: Feb 2012
Posts: 2
Rep Power: 0 |
Quote:
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. |
||
February 14, 2012, 10:09 |
|
#19 | |
New Member
Gunn Elin
Join Date: Feb 2012
Posts: 2
Rep Power: 0 |
Quote:
|
||
Tags |
boundary condition, patch |
|
|
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 |