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

Groovy BC for lookup Table values

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2012, 12:08
Default Groovy BC for lookup Table values
  #1
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
Hello,

i am solving the following problem:

- I have a boundary condition for a scalar field 'E' which is dependent to a scalar field 'C'. A lookup table describes this behaviour of C,E (I just attach the first lines of the table).

// ( C E)
(
( 0.00000000000000e+000 -0.00000000000000e+000 )
( 1.00249993687028e-002 -5.11523952089498e+004 )
( 1.99994949622485e-002 -8.68932017480435e+004 )
( 2.99234867806367e-002 -1.19566441219959e+005 )
( 3.97969748238680e-002 -1.50625905429174e+005 )
( 4.96199590919422e-002 -1.80659748473604e+005 )
( 5.93924395848590e-002 -2.09976653091197e+005 )
( 6.91144163026187e-002 -2.38760349142520e+005 )
( 7.87858892452210e-002 -2.67129314269836e+005 )
---------------------

I guess I need to set this boundary condition using the Groovy BC tool. As far as I know it is possible with this tool to have the boundary condition as a math function for example, but I am wondering how is it possible, during the runtime of the simulation, to make sure that the value of E will be dependent on the value of C. Do you know if there is any tutorial or someone who already solved a problem similar to this?

best regards,

Alex
alessio.nz is offline   Reply With Quote

Old   April 27, 2012, 12:50
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alessio.nz View Post
Hello,

i am solving the following problem:

- I have a boundary condition for a scalar field 'E' which is dependent to a scalar field 'C'. A lookup table describes this behaviour of C,E (I just attach the first lines of the table).

// ( C E)
(
( 0.00000000000000e+000 -0.00000000000000e+000 )
( 1.00249993687028e-002 -5.11523952089498e+004 )
( 1.99994949622485e-002 -8.68932017480435e+004 )
( 2.99234867806367e-002 -1.19566441219959e+005 )
( 3.97969748238680e-002 -1.50625905429174e+005 )
( 4.96199590919422e-002 -1.80659748473604e+005 )
( 5.93924395848590e-002 -2.09976653091197e+005 )
( 6.91144163026187e-002 -2.38760349142520e+005 )
( 7.87858892452210e-002 -2.67129314269836e+005 )
---------------------

I guess I need to set this boundary condition using the Groovy BC tool. As far as I know it is possible with this tool to have the boundary condition as a math function for example, but I am wondering how is it possible, during the runtime of the simulation, to make sure that the value of E will be dependent on the value of C. Do you know if there is any tutorial or someone who already solved a problem similar to this?

best regards,

Alex
Been there. Done that: quickly googling for "groovyBC lookuptables" finds your posting (impressive after 35 minutes) and this presentation I held last year: http://www.openfoamworkshop.org/6th_...der_slides.pdf

To cut a long story short: the feature is already in swak4faom/groovyBC. Have a look at the wobbler-exampleCase that comes with swak4Foam (or the presentation)
gschaider is offline   Reply With Quote

Old   April 27, 2012, 22:02
Default
  #3
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
thanks for the hint! I will have a look soon. best regards!
alessio.nz is offline   Reply With Quote

Old   May 1, 2012, 09:37
Default
  #4
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
Hello Bernhard,

i tried to read the swak4foam slides and I tried to build the script for the boundary condition for the patch 'walls'. The fields which are in the 'table.dat' are first column C and second En. Writing the BC in this way it runs without error but the results are not the expected ones (see below) Do you think I should add some detailsin the script to make sure that during the solving for each value of C it will refer to the appropriate value of En?

thanks a lot, Alex

---------------

walls
{
// type fixedValue;
// value uniform -1757593;

type groovyBC ;

fields
(
C En
);


lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/table.dat";
}
);

}
alessio.nz is offline   Reply With Quote

Old   May 1, 2012, 09:38
Default
  #5
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
Just to make it clear. The BC I am putting regards the patch walls for the field 'En' (C is the lookupvalue and it has other BC).
alessio.nz is offline   Reply With Quote

Old   May 1, 2012, 17:44
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alessio.nz View Post
Hello Bernhard,

i tried to read the swak4foam slides and I tried to build the script for the boundary condition for the patch 'walls'. The fields which are in the 'table.dat' are first column C and second En. Writing the BC in this way it runs without error but the results are not the expected ones (see below) Do you think I should add some detailsin the script to make sure that during the solving for each value of C it will refer to the appropriate value of En?

thanks a lot, Alex

---------------

walls
{
// type fixedValue;
// value uniform -1757593;

type groovyBC ;

fields
(
C En
);


lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/table.dat";
}
);

}
That worked. groovyBC is way to tolerant. At least something like

valueExpression "profile(C)";

should be there, too
gschaider is offline   Reply With Quote

Old   May 3, 2012, 05:12
Default
  #7
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
Now it seems to work! thanks a lot for the help.
alessio.nz is offline   Reply With Quote

Old   May 3, 2012, 06:59
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alessio.nz View Post
Now it seems to work! thanks a lot for the help.
Could you please confirm: The problem was that "valueExpression" was completely missing? Because that is much too tolerant (and I should fix it)
gschaider is offline   Reply With Quote

Old   May 3, 2012, 07:49
Default
  #9
Member
 
alessio.nz's Avatar
 
Alex
Join Date: Apr 2010
Posts: 48
Rep Power: 7
alessio.nz is on a distinguished road
I guess it's this, even if now I am thinking whether the boundary condition should be properly set. My physical problem is to set up the boundary for the enthalpy on the wall of my burner as a function of the progress variable (which is the measure of the combustion progress for my premixed combustion [gas turbine] ). The behaviour of the enthalpy is decreasing (from a set off value 0 till -1.7e+6) as a function of the PV (which has value included between 0 and 1). Due to the decrease of the enthalpy there will be a heat loss, and, as a consequence of this, the stabilized flame is not attached to the inlet but lifted up. I want to reproduce this problem and that's why I am setting the BC for the enthalpy En as a function of the progress variable C. Unfortunately there are still some problems in the results, that's why I am doubting whether I have done the proper script for the groovyBC.

Anyway the script is the following and it doesn't crash (see below). Thanks for the support. alex

-------------------------------------------
walls
{
// type fixedValue;
// value uniform -1757593;

type groovyBC ;

fields
(
C En
);


lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/table.dat";
}
);

valueExpression "profile(C)";
}
alessio.nz is offline   Reply With Quote

Old   May 14, 2012, 08:49
Default
  #10
Member
 
Join Date: Jun 2011
Posts: 35
Rep Power: 6
mikeP is on a distinguished road
Hi,
I have a similar problem. I am trying to impose turbulent kinetic energy values from a dat file on my inlet boundary. But I get an error:

Code:
--> FOAM FATAL ERROR: 
 Parser Error at "1.1-7" :"field profile not existing or of wrong type"
"profile(yc)"
" ^^^^^^^   "
    From function parsingValue
    in file PatchValueExpressionDriver.C at line 192.

FOAM exiting
Inlet
{
type groovyBC;
value uniform 0.0138;
variables "yc=pos().y;";
fields
(
yc k
);
lookuptables (
{
name profile;
outOfBounds clamp;
filename "$FOAM_CASE/k_profile.dat";
}
);
valueExpression "profile(yc)";
}


k_profile.dat:

( // first column: vertical position, second column k
(1 0.1)
(10 0.2)
(100 0.4)
)

ps: I have OpenFOAM v2.0.1 and the latest swak4FOAM
mikeP is offline   Reply With Quote

Old   May 14, 2012, 17:47
Default
  #11
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alessio.nz View Post

Anyway the script is the following and it doesn't crash (see below). Thanks for the support. alex

-------------------------------------------
walls
{
// type fixedValue;
// value uniform -1757593;

type groovyBC ;

fields
(
C En
);


lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/table.dat";
}
);

valueExpression "profile(C)";
}
Quote:
Originally Posted by mikeP View Post
Hi,
I have a similar problem. I am trying to impose turbulent kinetic energy values from a dat file on my inlet boundary. But I get an error:

Code:
--> FOAM FATAL ERROR: 
 Parser Error at "1.1-7" :"field profile not existing or of wrong type"
"profile(yc)"
" ^^^^^^^   "
    From function parsingValue
    in file PatchValueExpressionDriver.C at line 192.

FOAM exiting
Inlet
{
type groovyBC;
value uniform 0.0138;
variables "yc=pos().y;";
fields
(
yc k
);
lookuptables (
{
name profile;
outOfBounds clamp;
filename "$FOAM_CASE/k_profile.dat";
}
);
valueExpression "profile(yc)";
}


k_profile.dat:

( // first column: vertical position, second column k
(1 0.1)
(10 0.2)
(100 0.4)
)

ps: I have OpenFOAM v2.0.1 and the latest swak4FOAM
The boundary conditions look OK to me. One question: what is the purpose of the "fields"-entry? (don't know that for groovyBC and I thought I knew a little bit about swak4Foam)

As I said: the expression looks OK to me. Some hints for finding the problem:
- make sure the lookuptables are really read. For instance remove the "name"-entry. Execution should fail
- try a different name for the lookuptable than "profile" (although this should only be a problem if you have a field called "profile")
gschaider is offline   Reply With Quote

Old   May 15, 2012, 03:53
Default
  #12
Member
 
Join Date: Jun 2011
Posts: 35
Rep Power: 6
mikeP is on a distinguished road
When I comment out "name profile;", I still get the same error. Nothing changes. So you think, it never reads inside lookuptables?

I have seen "fields" entry in this post and decided to try, as well. But I tested it now and it does not have any effects either.
mikeP is offline   Reply With Quote

Old   May 15, 2012, 05:34
Default
  #13
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mikeP View Post
When I comment out "name profile;", I still get the same error. Nothing changes. So you think, it never reads inside lookuptables?
Yep. From the posting I can't tell why. Problem is that lookuptables is optional. So if it doesn't find it (due to a missing ";" , a missspelled keyword ... but your example seems to be alright in that respect) swak doesn't complain

Quote:
Originally Posted by mikeP View Post
I have seen "fields" entry in this post and decided to try, as well. But I tested it now and it does not have any effects either.
That is only needed in utilities that have to be forced to load fields into memory
gschaider is offline   Reply With Quote

Old   September 30, 2012, 19:36
Default
  #14
Senior Member
 
Join Date: Mar 2010
Location: Cape Town, SA
Posts: 150
Rep Power: 8
Jonathan is on a distinguished road
hi Bernhard,

hope you are well! i want to us groovyBC to patch a Fluent inlet profile onto a OF case, and came upon this thread. I guess from above its possible to use a lookup table.

Just a couple things:

1) would you mind posting your slides again - i would be very keen to check them out by the link seems to be dead???
2) have you ever used groovy to patch a (linear / 1D) radial profile (ie such as for a turbine inlet) which can then be rotated across a blade pitch to form a 2D inlet condition???

many thanks and best regards!
sincerely
Jonathan
Jonathan is offline   Reply With Quote

Old   September 30, 2012, 20:06
Default
  #15
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Jonathan View Post
hi Bernhard,

hope you are well! i want to us groovyBC to patch a Fluent inlet profile onto a OF case, and came upon this thread. I guess from above its possible to use a lookup table.

Just a couple things:

1) would you mind posting your slides again - i would be very keen to check them out by the link seems to be dead???
Could you be a bit more specific: which link (on which page)?

Quote:
Originally Posted by Jonathan View Post
2) have you ever used groovy to patch a (linear / 1D) radial profile (ie such as for a turbine inlet) which can then be rotated across a blade pitch to form a 2D inlet condition???
No. But if I understand you correctly it shouldn't be too hard: calculate the radius of a point (distance from the center) and with that go into a lookup table
__________________
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

Last edited by gschaider; September 30, 2012 at 20:08. Reason: Typo
gschaider is offline   Reply With Quote

Old   October 1, 2012, 08:15
Default
  #16
Senior Member
 
Join Date: Mar 2010
Location: Cape Town, SA
Posts: 150
Rep Power: 8
Jonathan is on a distinguished road
Hi Bernhard,

Quote:
Originally Posted by gschaider View Post
Could you be a bit more specific: which link (on which page)?
thanks for your response - i am meaning the link posted earlier ...

http://www.openfoamworkshop.org/6th_...der_slides.pdf

Quote:
No. But if I understand you correctly it shouldn't be too hard: calculate the radius of a point (distance from the center) and with that go into a lookup table
sorry - yes the question was a bit vague ... i have just compiled the utilities and so will have to play around a little bit first, and perhaps if i get stuck, might post a couple more questions ... but essentially, i have a table of:

Code:
Radius     Prof_value
xxx         yyy
xxx         yyy
etc
and i want to apply this across a 18 degree segment of a turbine annulus - i.e. x1 blade pitch, and i was wondering whether you would know whether this would be possible ... but i will play around first and see how i go!

thanks for the response,
best regards
jon
Jonathan is offline   Reply With Quote

Old   October 1, 2012, 09:08
Default
  #17
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Jonathan View Post
Hi Bernhard,



thanks for your response - i am meaning the link posted earlier ...

http://www.openfoamworkshop.org/6th_...der_slides.pdf
That currently won't work (see Martin Beaudoins announcement in the 7th Workshop thread ... I think yesterday). But there is a link (and a copy) to that presentation on the openfoamwiki.net (from the swak-page)

Quote:
Originally Posted by Jonathan View Post
sorry - yes the question was a bit vague ... i have just compiled the utilities and so will have to play around a little bit first, and perhaps if i get stuck, might post a couple more questions ... but essentially, i have a table of:

Code:
Radius     Prof_value
xxx         yyy
xxx         yyy
etc
and i want to apply this across a 18 degree segment of a turbine annulus - i.e. x1 blade pitch, and i was wondering whether you would know whether this would be possible ... but i will play around first and see how i go!

thanks for the response,
best regards
jon
Should be possible. But you'll have to convert the table into a format the OF-inerpolationTable understands. Either OF-native or CSV. Then in the groovyBC you can calculate the radius in the variables with something like

"centerOfRotation=vector(1,0,0);"
"radius=mag(pos()-centerOfRotation);"

and if you specified a lookup-table named profileVsRadius then a valueExpression "profileVsRadius(radius)" should give you the value you want
__________________
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 9, 2013, 05:13
Default n-dim lookup table
  #18
New Member
 
Join Date: Dec 2012
Posts: 12
Rep Power: 4
Vesposo is on a distinguished road
Hi,

is there a possibility to use a n-dimensional lookup table? For expample a 3-dim like

(
(xx0 yy0 zz0)
(xx1 yy0 zz0)
(xx2 yy0 zz0)
...
(xx0 yy1 zz0)
(xx1 yy1 zz0)
(xx2 yy1 zz0)
...
)

Thanks and regards
Vesposo is offline   Reply With Quote

Old   July 9, 2013, 05:52
Default
  #19
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Vesposo View Post
Hi,

is there a possibility to use a n-dimensional lookup table? For expample a 3-dim like

(
(xx0 yy0 zz0)
(xx1 yy0 zz0)
(xx2 yy0 zz0)
...
(xx0 yy1 zz0)
(xx1 yy1 zz0)
(xx2 yy1 zz0)
...
)

Thanks and regards
You mean you want a lookup zz(xx,yy)? Currently not possible. Mainly because the interpolation would have to be implemented from scratch (see also https://sourceforge.net/apps/mantisb...view.php?id=43). So I don't see myself doing that in the foreseeable future. Contributions accepted
__________________
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 21, 2013, 12:32
Default
  #20
New Member
 
sebastian n
Join Date: Nov 2012
Posts: 17
Rep Power: 4
gruenertee is on a distinguished road
Hi foamers,

first of all i want to thank everybody who keeps runing this forum; i want to implement a Robin Boundary condition via the groovy Boundary condition, but Tinf should be read out of a .dat file (lookuptable)
(Openfoam2.2.0)

wall
{
type groovyBC;
variables "k=0.8;alpha=15;Tinf=65;f=1/(1+k(alpha*mag(delta())));";
valueExpression "Tinf";
gradientExpression "0";
fractionExpression "f";
value uniform 0;
}

I am asking myself how to tell "Tinf" to read the inlet.dat file How to combine the type groovyBC with the lookuptables for Tinf?

lookuptables (
{
name inlet;
outOfBounds clamp;
fileName "$FOAM_CASE/inlet.dat";
}

Thank you
gruenertee 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
Numerical errors in nested domain with pre-calculated boundary values Arnoldinho OpenFOAM Running, Solving & CFD 3 April 4, 2012 10:31
max node values exceed max element values in contour plot jason_t FLUENT 0 August 19, 2009 11:32
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 13:04
Generating table values in a loop Jarrod Sinclair CD-adapco 1 November 26, 2003 20:26


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