CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

groovyBC for pressureInlet

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 23, 2011, 09:39
Default groovyBC for pressureInlet
  #1
New Member
 
Join Date: Apr 2011
Location: Magdeburg, Germany
Posts: 23
Rep Power: 5
Nico A. is on a distinguished road
Hello,

I got a two phase flow in a plate with two inlets. The second inlet should open at a specified time like:
Code:
inlet
 {
 type            totalPressure;
        p0              uniform 100000;
        U               U;
        phi             phi;
        rho             rho;
        psi             none;
        gamma           1;
        value           uniform 0;
 }
 inlet2
 {
 type                 groovyBC;
 valueExpression  "(time()<t0) ? 0 : 1*(pinlet)";           //zeroGradient for time()<t0 (wall), constant value for time()>t0 (pressureInlet)
 variables            "t0=0.1;pinlet@inlet=p;p=100000;";
 value uniform      100000;
 }
 outlet
 {
  type fixedValue;
  value uniform 0.000000;
 }
 outlet2
 {
  type fixedValue;
  value uniform 0.000000;
 }
 
 wall
 {
  type zeroGradient;
 }
 frontback
 {
  type empty;
 }
This case works fine. Now I want to open inlet2 depending on a field value like pressure, alpha volume fraction etc. Is that possible in some way? Thanks for any advice.

Kind regards, Nico
Nico A. is offline   Reply With Quote

Old   November 23, 2011, 14:59
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,889
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Nico A. View Post
Hello,

I got a two phase flow in a plate with two inlets. The second inlet should open at a specified time like:
Code:
inlet
 {
 type            totalPressure;
        p0              uniform 100000;
        U               U;
        phi             phi;
        rho             rho;
        psi             none;
        gamma           1;
        value           uniform 0;
 }
 inlet2
 {
 type                 groovyBC;
 valueExpression  "(time()<t0) ? 0 : 1*(pinlet)";           //zeroGradient for time()<t0 (wall), constant value for time()>t0 (pressureInlet)
 variables            "t0=0.1;pinlet@inlet=p;p=100000;";
 value uniform      100000;
 }
 outlet
 {
  type fixedValue;
  value uniform 0.000000;
 }
 outlet2
 {
  type fixedValue;
  value uniform 0.000000;
 }
 
 wall
 {
  type zeroGradient;
 }
 frontback
 {
  type empty;
 }
This case works fine. Now I want to open inlet2 depending on a field value like pressure, alpha volume fraction etc. Is that possible in some way? Thanks for any advice.

Kind regards, Nico
a) from the syntax I see that you're using oldSchool-standalone-groovyBC. Just a remark. If it is sufficient for you, fine

b) I think your comment with inlet2 is incorrect. To get that kind of behaviour you should manipulate fractionExpression

c) I don't see the problem with dependence of fields. Instead of the time-condition "time()<t0" write something like "max(pInlet)>pThres" and off you go (to have a "valve" that stays open once the condition is reached - even if the pressure drops afterwards - you'll need the stored variables in the swak-veriosn of groovBC)
gschaider is offline   Reply With Quote

Old   November 24, 2011, 09:53
Default
  #3
New Member
 
Join Date: Apr 2011
Location: Magdeburg, Germany
Posts: 23
Rep Power: 5
Nico A. is on a distinguished road
Hello Bernhard,
at first, thank you for your reply. Sorry, I posted the wrong code, I actually used that for inlet2, like you already said:
Code:
inlet2
{      type groovyBC;
        valueExpression "1*(pinlet)";
        fractionExpression "(time()<t0) ? 0 : 1";
        variables       "t0=0.1;pinlet@inlet=p;p=100000;";
        timelines       ( )
}
re a) up to now the oldSchool-groovyBC was sufficient for me, but for the next tasks I am not sure.

re c) the problem is that I can only adress the whole field, is that right? I need to extract a specific value of the field, for example a face value at the inlet patch.
Nico A. is offline   Reply With Quote

Old   November 24, 2011, 18:07
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,889
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Nico A. View Post
Hello Bernhard,
at first, thank you for your reply. Sorry, I posted the wrong code, I actually used that for inlet2, like you already said:
Code:
inlet2
{      type groovyBC;
        valueExpression "1*(pinlet)";
        fractionExpression "(time()<t0) ? 0 : 1";
        variables       "t0=0.1;pinlet@inlet=p;p=100000;";
        timelines       ( )
}
re a) up to now the oldSchool-groovyBC was sufficient for me, but for the next tasks I am not sure.

re c) the problem is that I can only adress the whole field, is that right? I need to extract a specific value of the field, for example a face value at the inlet patch.
Just one face should represent the whole inlet instead of (for instance) the average of all the faces on the patch? That's not really what groovyBC was built for, but something like (untested so there may be syntactic problems may be there):

"targetPos=vector(1,2,3);dist=mag(targetPos-pos());minDist=min(dist);pTemp=(dist==minDist) ? p : -1;pUsed=max(pTemp)"

should work.

Hold on.

That won't work exactly like this because as soon as a remote variable is used it is boiled down to a single value. But what should work is

"pUsed@inlet2= ...."

The right hand side you get by substituting the other variables in the expression of the above "recipie". Will be a bit larger, but I guess you get the idea

PS: the "1*(pinlet)" above is necessary? Hopefully not anymore in the swak-Variant of groovy
gschaider is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
groovyBC and funkySetFields married and got a kid named swak4Foam gschaider OpenFOAM 162 December 18, 2014 07:38
GroovyBC problem in the defining inlet velocity iampolaris OpenFOAM Running, Solving & CFD 7 October 18, 2014 10:25
GroovyBC for 2D wave flume! Hisham OpenFOAM Running, Solving & CFD 13 January 20, 2012 06:04
groovyBC and Eqn.setReference() benk OpenFOAM 3 June 2, 2011 09:49
Wall heat transfer using groovyBC (XiFoam solver) usergk OpenFOAM 7 February 4, 2011 14:36


All times are GMT -4. The time now is 05:45.