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

[swak4Foam] parabolic velocity profile with fluctuations (groovyBC?)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2013, 11:53
Default parabolic velocity profile with fluctuations (groovyBC?)
  #1
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
I would like to implement a parabolic inlet velocity profile, with fluctuation scale specified (like in turbulentInlet).

I tried using groovyBC as below (since I think turbulentInlet allows flat profile only), but am not sure how to specify the fluctuation scale (if possible?):

type groovyBC;
variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();";
valueExpression "15*para";
value uniform (15 0 0);

Has any one encountered a similar problem or has suggestions on how to proceed? I tried searching the forum but am not sure if including fluctuation scale in groovyBC has been discussed (though there were some posts on parabolic profile).

If not groovyBC, is there another way to implement this? I use OF 1.7.1

Many thanks,
amit


PS. This implementation is required as we are trying to match the experimental conditions which show a parabolic inlet profile and high fluctuations as well...

Last edited by newOFuser; June 17, 2013 at 14:00.
newOFuser is offline   Reply With Quote

Old   June 18, 2013, 13:05
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 newOFuser View Post
I would like to implement a parabolic inlet velocity profile, with fluctuation scale specified (like in turbulentInlet).

I tried using groovyBC as below (since I think turbulentInlet allows flat profile only), but am not sure how to specify the fluctuation scale (if possible?):

type groovyBC;
variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();";
valueExpression "15*para";
value uniform (15 0 0);

Has any one encountered a similar problem or has suggestions on how to proceed? I tried searching the forum but am not sure if including fluctuation scale in groovyBC has been discussed (though there were some posts on parabolic profile).

If not groovyBC, is there another way to implement this? I use OF 1.7.1

Many thanks,
amit


PS. This implementation is required as we are trying to match the experimental conditions which show a parabolic inlet profile and high fluctuations as well...
You mean you want to add a random value to the profile? See the Reference-documentation that comes with the sources for the 4 random-number functions available with swak and pick the one that suits you. Then there is only the question whether you want to apply it absolute or relative, but that is something you must judge from your data
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 19, 2013, 12:54
Default
  #3
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Thanks so much, I'll look into the swak4Foam implementation.

amit

Last edited by newOFuser; June 28, 2013 at 13:38.
newOFuser is offline   Reply With Quote

Old   June 20, 2013, 15:28
Default
  #4
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Hello,

I am trying to install swak4Foam in OF 1.7.1 and get this error (tried both, the svn link file, and the tar file):

make: *** [Make/linux64GccDPOpt/FieldValueExpressionParser.o] Error 1
Parser library did not compile OK. No sense continuing as everything else depends on it
Requirements for Library not satisfied. I see no sense in going on


Configuration:

No 'swakConfiguration'. Python etc won't work
Checking swak4Foam-version and generating file
Bison is version 2.4.1
Flex is version 2.5.35 (Minor version: 35)
OpenFOAM-version: Major 1 Minor 7 Patch 1
No change to swak4FoamParsers/foamVersion4swak.H

Any suggestions?
newOFuser is offline   Reply With Quote

Old   June 20, 2013, 21:18
Default
  #5
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 newOFuser View Post
Hello,

I am trying to install swak4Foam in OF 1.7.1 and get this error (tried both, the svn link file, and the tar file):

make: *** [Make/linux64GccDPOpt/FieldValueExpressionParser.o] Error 1
Parser library did not compile OK. No sense continuing as everything else depends on it
Requirements for Library not satisfied. I see no sense in going on


Configuration:

No 'swakConfiguration'. Python etc won't work
Checking swak4Foam-version and generating file
Bison is version 2.4.1
Flex is version 2.5.35 (Minor version: 35)
OpenFOAM-version: Major 1 Minor 7 Patch 1
No change to swak4FoamParsers/foamVersion4swak.H

Any suggestions?
The Python-message is not a problem.

As for the error message: you've got to give me a bit more information to work with
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 20, 2013, 21:35
Default
  #6
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Thanks for the prompt reply!

Enclosed is the log file.
Attached Files
File Type: txt make_log.txt (37.8 KB, 16 views)
newOFuser is offline   Reply With Quote

Old   June 20, 2013, 22:02
Default
  #7
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 newOFuser View Post
Thanks for the prompt reply!

Enclosed is the log file.
I'm travelling and can't look into details. Seems there is a problem wit pointFields of vectors. Try the following: for all lines like
Code:
../FieldValueExpressionParser.yy:4777
go to the file FieldValueExpressionParser.yy and comment out line 4777. Most likely you're not going to need them anyway.

If you want a permanent fix write a report on the Mantis at openfoam-extend
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 20, 2013, 22:11
Default
  #8
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Thanks again! I'll look into this.

Pleasant travels!
newOFuser is offline   Reply With Quote

Old   June 21, 2013, 11:22
Default
  #9
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
It compiled!

All those lines were this statement:
$$ = new Foam:ointSymmTensorField(*$1 - *$3);

Now, to see how the inlet velocity specification works out...

Thanks again,
amit
newOFuser is offline   Reply With Quote

Old   June 21, 2013, 15:32
Default
  #10
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Another quick question:

Here is what I am trying, based on
http://www.cfd-online.com/Forums/ope...b-mesh-10.html

inlet
{
type groovyBC;
variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();para_rms=1-0.5*para;";
valueExpression "15*para + 0.15*15*randNormal()*para_rms";
value uniform (15 0 0);
}

Since rms profile shown above is a reverse parabola, I am trying 1 - 0.5*para as the parabolic equation that gives a parabola with x=1 at Ymax and Ymin and x=1/2 at Ymiddle. (Later multiplied by random number and magnitude).

But this gives an error:
--> FOAM FATAL ERROR:
Parser Error for driver PatchValueExpressionDriver at "1.11-10" :"syntax error, unexpected $end"
"1-0.5*para"

Probably because the 1 in "1 - 0.5*para" should to be defined at each y (?)

How should this 'unity value at each point' be implemented in the valueExpression term?

Sorry if the question is vague or silly!

Thanks.
newOFuser is offline   Reply With Quote

Old   June 23, 2013, 06:37
Default
  #11
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 newOFuser View Post
It compiled!

All those lines were this statement:
$$ = new Foam:ointSymmTensorField(*$1 - *$3);

Now, to see how the inlet velocity specification works out...

Thanks again,
amit
Had a look: it seems that this is in theory already taken care of by the FOAM_INCOMPLETE_OPERATORS-define. The thing is that this is no longer needed in 1.7.x (but obviously in 1.7.1 and 1.7). So the alternative would have been a
Code:
#define FOAM_INCOMPLETE_OPERATORS
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 23, 2013, 06:40
Default
  #12
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 newOFuser View Post
Another quick question:

Here is what I am trying, based on
http://www.cfd-online.com/Forums/ope...b-mesh-10.html

inlet
{
type groovyBC;
variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();para_rms=1-0.5*para;";
valueExpression "15*para + 0.15*15*randNormal()*para_rms";
value uniform (15 0 0);
}

Since rms profile shown above is a reverse parabola, I am trying 1 - 0.5*para as the parabolic equation that gives a parabola with x=1 at Ymax and Ymin and x=1/2 at Ymiddle. (Later multiplied by random number and magnitude).

But this gives an error:
--> FOAM FATAL ERROR:
Parser Error for driver PatchValueExpressionDriver at "1.11-10" :"syntax error, unexpected $end"
"1-0.5*para"

Probably because the 1 in "1 - 0.5*para" should to be defined at each y (?)

How should this 'unity value at each point' be implemented in the valueExpression term?

Sorry if the question is vague or silly!

Thanks.
para is a vector. 1 is a scalar. Would be thankful for a description how to do this mathematically correctly
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 25, 2013, 19:49
Default
  #13
New Member
 
EG
Join Date: Jun 2013
Posts: 3
Rep Power: 13
Evariste is on a distinguished road
Hi guys

I am a very new user of OpenFoam and I am interested in a similar problem as GK. I would like to implement some random fluctuations to a parabolic profile. I have already implemented a parabolic profile as an extra utility based on another thread. (http://openfoamwiki.net/index.php/Tu....28OF-1.4.1.29)

For this I provide at the input file 0/U)


type parabolicVelocity;
n (1 0 0);
y (0 1 0);
maxValue 1;
value (0 0 0); // Dummy for paraFoam, which will NOT show a correct profile at time 0.


I know that Open foam has implemented already an utility called turbulent Inlet so I guess that a first quick fix would be some how try to combine these two.

I need one extra line at the inlet that will give the level of fluctuations something like

fluctuationScale ( 0.1 0.001 0.001 );

and change my code file so for every value of the parabolic profile I add an extra term such as 0.1*Umax*random_number which I guess is already calculated in the turbulent inlet utility.

I was wondering if anyone has already done something like this. My C++ knowledge is not great (I come from a fortran background) so if anyone has any advice would be very useful. Which parts of the turbulent inlet utility I need to add to my parabolic profile utility?

Thanks
Evariste is offline   Reply With Quote

Old   June 26, 2013, 04:57
Default
  #14
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 Evariste View Post
Hi guys

I am a very new user of OpenFoam and I am interested in a similar problem as GK. I would like to implement some random fluctuations to a parabolic profile. I have already implemented a parabolic profile as an extra utility based on another thread. (http://openfoamwiki.net/index.php/Tu....28OF-1.4.1.29)

For this I provide at the input file 0/U)


type parabolicVelocity;
n (1 0 0);
y (0 1 0);
maxValue 1;
value (0 0 0); // Dummy for paraFoam, which will NOT show a correct profile at time 0.


I know that Open foam has implemented already an utility called turbulent Inlet so I guess that a first quick fix would be some how try to combine these two.

I need one extra line at the inlet that will give the level of fluctuations something like

fluctuationScale ( 0.1 0.001 0.001 );

and change my code file so for every value of the parabolic profile I add an extra term such as 0.1*Umax*random_number which I guess is already calculated in the turbulent inlet utility.

I was wondering if anyone has already done something like this. My C++ knowledge is not great (I come from a fortran background) so if anyone has any advice would be very useful. Which parts of the turbulent inlet utility I need to add to my parabolic profile utility?
I think you're in the wrong thread: the point of groovyBC/swak4Foam is to avoid programming C++ for boundary-conditions etc especially if they are very specific for one case
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 26, 2013, 17:11
Default
  #15
New Member
 
EG
Join Date: Jun 2013
Posts: 3
Rep Power: 13
Evariste is on a distinguished road
Hi Bernhard

Thanks for your reply. Sorry if I am in the wrong thread but what I want to do is to use a parabolic profile with fluctuations which is the title of the thread. However you are right I do not want to use groovy because to be honest I see this task a bit as good opportunity to get some programming practice in C++ . Any suggestions are welcome.
Evariste is offline   Reply With Quote

Old   July 15, 2013, 15:38
Default
  #16
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
I was able to implement the velocity profile as desired, using swak4Foam.

I have a minor query:
The value expression is defined as:
valueExpression "15*para + 0.15*15*randNormal()*para_rms";

Is there a way by which I can specify valueExpression as "15*para" for time < 0.1s, and "15*para + 0.15*15*randNormal()*para_rms" for time > 0.1s ?

thanks so much!
amit


Quote:
Originally Posted by gschaider View Post
para is a vector. 1 is a scalar. Would be thankful for a description how to do this mathematically correctly
newOFuser is offline   Reply With Quote

Old   July 15, 2013, 18:15
Default
  #17
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 newOFuser View Post
I was able to implement the velocity profile as desired, using swak4Foam.

I have a minor query:
The value expression is defined as:
valueExpression "15*para + 0.15*15*randNormal()*para_rms";

Is there a way by which I can specify valueExpression as "15*para" for time < 0.1s, and "15*para + 0.15*15*randNormal()*para_rms" for time > 0.1s ?

thanks so much!
amit
Yep. There is: the ?:-operator (the semantics of this operator have been explained for approximately 1243 times)
Code:
"15*para + time()<0.1 ? vector(0,0,0) : 0.15*15*randNormal()*para_rms"
or (a bit more elegant) with a variable
Code:
variables (
... other variables
"factor=time()<0.1 ? 0 : 0.15*15*randNormal();"
);
valueExpression "15*para+para_rms*factor";
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 15, 2013, 18:27
Default
  #18
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
thanks^1243
newOFuser 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 in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 11:03
codeDict Error Parabolic Power Law Inlet Velocity Profile Sindibad OpenFOAM Running, Solving & CFD 0 January 1, 2017 20:53
codeDict Error Parabolic Power Law Inlet Velocity Profile Sindibad OpenFOAM Bugs 0 January 1, 2017 20:51
3D parabolic velocity profile for channel flow seetaratnam FLUENT 1 August 10, 2016 04:08
Parabolic velocity profile at vertical entrance ztp911 FLUENT 2 September 3, 2013 07:10


All times are GMT -4. The time now is 17:13.