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

[swak4Foam] groovyBC for pressureInlet

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 15
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: 4,225
Rep Power: 51
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: 15
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: 4,225
Rep Power: 51
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


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
[swak4Foam] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 08:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 07:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 04:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 08:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 09:49


All times are GMT -4. The time now is 04:37.