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

How to define a dependent boundary condition

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 15, 2016, 11:29
Default How to define a dependent boundary condition
  #1
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
Hi,

i would like to define a boundary condition which is dependent of a quantity which is not the time (but the inlet velocity).

To be clear, i am currently using externalWallHeatFluxTemperature boundary condition and i would like to use a value of h calculated by a function, from the value of the velocity on the inlet of my geometry (a sort of pipe).

Is there a way to use a function of this type or must i create a new boundary condition ?

I think i have to use the nonuniform option and the "include file" command but i don't see any examples of the use of such a function.

If you need more precision to answer this question, ask questions.
Thank you.

Laurent
laurentD is offline   Reply With Quote

Old   June 15, 2016, 14:29
Lightbulb
  #2
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Hi Laurent,

You can use groovyBC for this purpose.
rapierrz is offline   Reply With Quote

Old   June 16, 2016, 04:39
Default
  #3
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
Thx a lot, i will take a look on it.
Laurent
laurentD is offline   Reply With Quote

Old   June 16, 2016, 05:14
Default
  #4
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
So i have looked for informations related to groovyBC.

I have some questions to do what i want to do :
- Do i have to install groovyBC utility ? (i am using OF2.3.1)
- What about swak4Foam ?
- Is there anywhere a tutorial for this kind of boundary conditions (not in my OF files anyway) ?

Thanks everybody who spend some time to help me.

Laurent
laurentD is offline   Reply With Quote

Old   June 16, 2016, 05:28
Default
  #5
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
Quote:
Originally Posted by laurentD View Post
- Do i have to install groovyBC utility ? (i am using OF2.3.1)
- What about swak4Foam ?
Just install swak4Foam, it includes groovyBC
Quote:
Originally Posted by laurentD View Post
- Is there anywhere a tutorial for this kind of boundary conditions (not in my OF files anyway) ?
Look at the openfoam wiki or just search the web, there are tons of presentations describing the topic.

For specific help I fear an actual example (just try to use the BC and see what happens) would be useful.
Astrodan is offline   Reply With Quote

Old   June 17, 2016, 09:22
Default
  #6
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
I have installed swak4Foam, following the commands given by :

https://openfoamwiki.net/index.php/I...tion/swak4Foam

Now i will try to use it to define the value of the h convection coefficient by a function (or a table depending on another quantity which is the velocity on a specific region).

When i look availables examples, the BC used is : groovyBC. For example :
Code:
   atmosphere          
{        
type            groovyBC;        
variables "r1=0.25*(max(pts().x)-min(pts().x));r2=r1*0.2*(1-0.5*cos(54*time()));";        
valueExpression "(sqrt(pow(pos().x-r1*sin(10*time()),2)+pow(pos().z-r1*cos(15*time()),2))<r2) ? 1 : 0";  
value           uniform 0;    
}
In my case i want to use the externalWallHeatFluxTemperature one, with a manual expression for the value of h. My next question is the following :
Can i use the externalWallHeatFluxTemperature linked with the groovyBC ?
Or:
Do i have to extract expressions used by externalWallHeatFluxTemperature and construct a new one with the changes i want ?

Thanks a lot.
Laurent
laurentD is offline   Reply With Quote

Old   June 17, 2016, 09:32
Default
  #7
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
First a small sugesstion, what is rarely shown, but makes things a lot easier to read, reformat the variables section so you can have one variable per line:
Code:
atmosphere          
{
    type            groovyBC;
    variables
    (
        "r1=0.25*(max(pts().x)-min(pts().x));"
        "r2=r1*0.2*(1-0.5*cos(54*time()));"
    );
    valueExpression "(sqrt(pow(pos().x-r1*sin(10*time()),2)+pow(pos().z-r1*cos(15*time()),2))<r2) ? 1 : 0";
    value           uniform 0;
}
For your special purpose I believe you cannot use an existing BC directly, at least that's from I take from this post. So you will probably have to copy the expression used in the BC; however, this should not be too difficult.

Alternatively use any textbook on heat transfer (or you knowledge) to specify a suitable equation yourself. Reading the C++ code can be confusing if you're not used to it.
Astrodan is offline   Reply With Quote

Old   June 17, 2016, 09:57
Default
  #8
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
Thank you for the tip, it is very easier to read.

Quote:
For your special purpose I believe you cannot use an existing BC directly, at least that's from I take from this post. So you will probably have to copy the expression used in the BC; however, this should not be too difficult.
Yes it seems not so difficult, but it was a good thing to verify if there exists a faster way to do. I will try to do that.

Another question : Can i use a function name or a function number for the expression of a variable (h in my case) and fill the function in another file (with a include file i suppose) ?

Last one (for the moment) : Can i use a tabular in place of the expression, with for example a value of h depending on the value of Uinlet ? In this case, the tabular can be written in another file.

Thanks for your time.
laurentD is offline   Reply With Quote

Old   June 17, 2016, 12:39
Default
  #9
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
Quote:
Originally Posted by laurentD View Post
Another question : Can i use a function name or a function number for the expression of a variable (h in my case) and fill the function in another file (with a include file i suppose) ?
No clue, but I guess the #include directive works as before.

Quote:
Originally Posted by laurentD View Post
Last one (for the moment) : Can i use a tabular in place of the expression, with for example a value of h depending on the value of Uinlet ? In this case, the tabular can be written in another file.
http://www.cfd-online.com/Forums/ope...le-values.html
Astrodan is offline   Reply With Quote

Old   June 20, 2016, 07:39
Default
  #10
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
I have read the topic you have indicated to me. It is very useful thank you very much.

Only one thing is still a problem.
Can i use groovyBC but with a lookuptables for a variable and not for the main field ?

For example, in the case :
Code:
ailetteFace
    {
         type            groovyBC;
         variables     ("hBC=50.0;"
                        "Ta=20.0;"
                        "kBC=0.5;");
         valueExpression    "Ta";
         fractionExpression "1.0/(1.0 + kBC/(mag(delta())*hBC))";
         value           uniform 293.15;
    }
i would like to apply a lookuptables to hBC. And i don't know if it is possible. It seems that i am not the first person to ask it but i don't find any answer...

Laurent
laurentD is offline   Reply With Quote

Old   June 20, 2016, 09:04
Default
  #11
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
I think i am on the right road to my objective.
Doing this for example :
Code:
    ailetteFace
    {
         type            groovyBC;
      variables          (//"hBC=50.0;"
                            "Ta=20.0;"
                            "kBC=0.5;");
         lookuptables (
             {
               name data;
               outOfBounds clamp;
               fileName "$FOAM_CASE/data.data";
             }
         );
     valueExpression    "Ta";
         fractionExpression "1.0/(1.0 + kBC/(mag(delta())*data(kBC)))";
         value           uniform 293.15;
    }
and filling the file data.data with
Code:
(
    (0 0)
    (1 0.1)
    (3 0.1)
    (4 -0.1)
)
i think i have succeed to define hBC as a function of a value, which is defined by the tabular included in data.data.
Can anyone confirm it is the good way ?
(don't be affraid about the numerical values, it is completely crazy, i am just trying to build the boundary condition as i want for the moment. I will fulfill the good values and the good dependencies after.)

How can i verify that the value written on the tabular are read correctly ?

Thanks.
Laurent
laurentD is offline   Reply With Quote

Old   June 20, 2016, 09:24
Default
  #12
Senior Member
 
Laurent DASTUGUE
Join Date: May 2014
Location: Chartres, France
Posts: 122
Rep Power: 11
laurentD is on a distinguished road
I think i am on the right road to my objective.
Doing this for example :
Code:
    ailetteFace
    {
         type            groovyBC;
      variables          (//"hBC=50.0;"
                            "Ta=20.0;"
                            "kBC=0.5;");
         lookuptables (
             {
               name data;
               outOfBounds clamp;
               fileName "$FOAM_CASE/data.data";
             }
         );
     valueExpression    "Ta";
         fractionExpression "1.0/(1.0 + kBC/(mag(delta())*data(kBC)))";
         value           uniform 293.15;
    }
and filling the file data.data with
Code:
(
    (0 0)
    (1 0.1)
    (3 0.1)
    (4 -0.1)
)
i think i have succeed to define hBC as a function of a value, which is defined by the tabular included in data.data.
Can anyone confirm it is the good way ?

(don't be affraid about the numerical values, it is completely crazy, i am just trying to build the boundary condition as i want for the moment. I will fulfill the good values and the good dependencies after.)

How can i verify that the value written on the tabular are read correctly ?

Thanks.
Laurent
laurentD is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 10:23
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 12:32
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 13:24


All times are GMT -4. The time now is 01:58.