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

[swak4Foam] About groovyBC to set distributed fixedGradient values for each cell boundary patch

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2014, 21:45
Default About groovyBC to set distributed fixedGradient values for each cell boundary patch
  #1
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Hi,

I need to set a distributed fixedGradient value for each cell boundary patch, the boundary setting is as follows:

top
{
type groovyBC;
fields
(
gt
)
gradientExpression "gt";
fractionExpression "0" //gradientExpression is used
lookuptables (
{
name gt;
outOfBounds clamp;
fileName "$FOAM_CASE/gt.data";
}
);
}



and my gt.data is

(
(0.0950554)
(0.035402)
(0.0456968)
(0.0371096)
(0.0382265)
(0.0358306)
(0.0355109)
(0.0347807)
(0.0347118)
(0.0342635)
(0.0336614)
....
)


I have 4608 Faces in the top patch, and when I running this code, I got the following warning

No value defined for T on top therefore using 4608{0}

Looked like the boundary patch haven't read my defined value, can anyone have a look at my setting?

Cheers,
Kan
nwpukaka is offline   Reply With Quote

Old   August 6, 2014, 01:42
Default
  #2
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
A few comments to my post,

The error is the reason that I didn't set "value", which is used at Startup.

My scalar is based on radius and angle, so then I change my input data into
(
(2.544053e-02 4.090615e-03 1904.18)
(2.544053e-02 1.227185e-02 709.182)
(2.544053e-02 2.045308e-02 915.406)
(2.544053e-02 2.863431e-02 743.38)
(2.544053e-02 3.681554e-02 765.746)
(2.544053e-02 4.499677e-02 717.741)
(2.544053e-02 5.317800e-02 711.326)
(2.544053e-02 6.135923e-02 696.685)
...................
)

The boundary setting changes as well,
top
{
type groovyBC;
value $internalField
variables (
"radius=sqrt(pow(pos().x,2)+pow(pos().x,2));"
"angle=atan(pos().y/pos().x);"
);
fields
(
radius angle grad
)
gradientExpression "gt(radius angle)";
fractionExpression "0" //gradientExpression is used
lookuptables (
{
name gt;
outOfBounds clamp;
fileName "$FOAM_CASE/gt.data";
}
);
}

Not sure if GroovyBC can do that???

Cheers,
Kan
nwpukaka is offline   Reply With Quote

Old   August 6, 2014, 05:56
Default
  #3
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 nwpukaka View Post
A few comments to my post,

The error is the reason that I didn't set "value", which is used at Startup.

My scalar is based on radius and angle, so then I change my input data into
(
(2.544053e-02 4.090615e-03 1904.18)
(2.544053e-02 1.227185e-02 709.182)
(2.544053e-02 2.045308e-02 915.406)
(2.544053e-02 2.863431e-02 743.38)
(2.544053e-02 3.681554e-02 765.746)
(2.544053e-02 4.499677e-02 717.741)
(2.544053e-02 5.317800e-02 711.326)
(2.544053e-02 6.135923e-02 696.685)
...................
)

The boundary setting changes as well,
top
{
type groovyBC;
value $internalField
variables (
"radius=sqrt(pow(pos().x,2)+pow(pos().x,2));"
"angle=atan(pos().y/pos().x);"
);
fields
(
radius angle grad
)
gradientExpression "gt(radius angle)";
fractionExpression "0" //gradientExpression is used
lookuptables (
{
name gt;
outOfBounds clamp;
fileName "$FOAM_CASE/gt.data";
}
);
}

Not sure if GroovyBC can do that???

Cheers,
Kan
Enlighten me: the entry "field" serves which purpose?

Anyway: lookuptables only work with one independent variable (so something of the form "gt(radius)" would work). Interpolation from more than one independent variable is currently on my "Nice to have" list (which means it gets done when I need it or when or when someone who pays me needs it. Of course that assumes that I have to implement it. Which is not necessarily the case)

If you can separate your function into two independent functions similar to gt(radius,angle)=gtr(radius)*gta(angle) then you're in business again
__________________
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   August 6, 2014, 23:11
Default
  #4
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Enlighten me: the entry "field" serves which purpose?

Anyway: lookuptables only work with one independent variable (so something of the form "gt(radius)" would work). Interpolation from more than one independent variable is currently on my "Nice to have" list (which means it gets done when I need it or when or when someone who pays me needs it. Of course that assumes that I have to implement it. Which is not necessarily the case)

If you can separate your function into two independent functions similar to gt(radius,angle)=gtr(radius)*gta(angle) then you're in business again
Hi Bernhard,

Thank you for your reply. The reason that I have the fields entry is I followed this thread here:
http://www.cfd-online.com/Forums/ope...le-values.html
Is that "fields entry" necessary to groovyBC?

I though this is used to set the index to each column at input data file, as you can see, I have my calculated radius and angle, I was wondering I can look-up my input data based on column 1 and 2, However, you said that lookup tables only work with one independent variable, but my value depends on two independent variables.

Then, I have also tried to set nonuniform List<scalar> to my boundary patch, which is now working.

Cheers,
Kan
nwpukaka is offline   Reply With Quote

Old   August 7, 2014, 15:31
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 nwpukaka View Post
Hi Bernhard,

Thank you for your reply. The reason that I have the fields entry is I followed this thread here:
http://www.cfd-online.com/Forums/ope...le-values.html
Is that "fields entry" necessary to groovyBC?
No. According to this post it is only needed for utilities that can't assume the field is yet loaded into memory (groovyBC doesn't fall into this category):

http://www.cfd-online.com/Forums/ope...tml#post361133

Quote:
Originally Posted by nwpukaka View Post
I though this is used to set the index to each column at input data file, as you can see, I have my calculated radius and angle, I was wondering I can look-up my input data based on column 1 and 2, However, you said that lookup tables only work with one independent variable, but my value depends on two independent variables.

Then, I have also tried to set nonuniform List<scalar> to my boundary patch, which is now working.

Cheers,
Kan
__________________
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   August 12, 2014, 03:46
Default
  #6
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Quote:
Originally Posted by gschaider View Post
No. According to this post it is only needed for utilities that can't assume the field is yet loaded into memory (groovyBC doesn't fall into this category):

http://www.cfd-online.com/Forums/ope...tml#post361133
Hi Bernard,

For this groovy BC, if I need to calculate gradient for boundary patch based heat transfer coefficient and ambient temperature. see below:

type groovyBC;
value $internalField
gradientExpression "gt";
fractionExpression "0" //gradientExpression is used
variables (
"ratational_speed = 50000;" // rotational speed
"radius=sqrt(pow(pos().x,2)+pow(pos().x,2));"
"vel_rotor = ratational_speed * radius;"
"hfc = 30;" // heat transfer coefficient
"T_ambinet = 290;" // ambient temperature
"k = 16;" // thermal conductivity of solid pad
"gt = hfc*(T-T_ambinet)/k"
);

at the last euqation, hfc is heat transfer coefficient, T_ambient is ambient temperature, k is thermal conductivity, I assumed that T is the boundary temperature, is that right?

Cheers,
Kan
nwpukaka is offline   Reply With Quote

Old   August 12, 2014, 07:34
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 nwpukaka View Post
Hi Bernard,

For this groovy BC, if I need to calculate gradient for boundary patch based heat transfer coefficient and ambient temperature. see below:

type groovyBC;
value $internalField
gradientExpression "gt";
fractionExpression "0" //gradientExpression is used
variables (
"ratational_speed = 50000;" // rotational speed
"radius=sqrt(pow(pos().x,2)+pow(pos().x,2));"
"vel_rotor = ratational_speed * radius;"
"hfc = 30;" // heat transfer coefficient
"T_ambinet = 290;" // ambient temperature
"k = 16;" // thermal conductivity of solid pad
"gt = hfc*(T-T_ambinet)/k"
);

at the last euqation, hfc is heat transfer coefficient, T_ambient is ambient temperature, k is thermal conductivity, I assumed that T is the boundary temperature, is that right?

Cheers,
Kan
Yep. T is the current values on the boundary faces. Next cell would be internalField(T) (but you don't want that)

BTW: For large hfc/k (almost instantaneous heating) a gradient-Formulation would overshoot. Consider blending (with fractionExpression) to a T=T_ambient in that case

BTW2: The variables till vel_rotor are not used. This is on purpose?
__________________
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

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
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 08:30
Radiation interface hinca CFX 15 January 26, 2014 18:11
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


All times are GMT -4. The time now is 12:39.