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

0/T two boundary conditions on one wall

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By powabna

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 4, 2024, 14:31
Default 0/T two boundary conditions on one wall
  #1
New Member
 
Ibrahim I
Join Date: Feb 2024
Posts: 5
Rep Power: 2
Ibrahim_I is on a distinguished road
Hi, in my 0/T folder on one wall I need a heat flux (W/m^2) and convective heat flux (W/m^2K). I tried defining these conditions separately for the same wall or putting it in the same bracket but openfoam only uses one of them not both. Is there a way of doing this without using swak4foam? Example code below in which openfoam only uses the second condition.

top_wall
{
type externalWallHeatFluxTemperature;
value $internalField;
q uniform 1000.0;
mode flux;
kappaMethod solidThermo;
qr none;
kappa none;
thicknessLayers ();
kappaLayers ();
}

top_wall
{
type externalWallHeatFluxTemperature;
mode coefficient;
Ta constant 313.0;
h uniform 17.0;
value $internalField;
}
Ibrahim_I is offline   Reply With Quote

Old   February 9, 2024, 19:40
Default
  #2
New Member
 
Join Date: Apr 2023
Posts: 2
Rep Power: 0
powabna is on a distinguished road
Hi!

I don't know if you found a solution, but... I faced similar challenges with BC on a wall. I've experimented with some OF options and at the end codedMixed worked just fine.

Link to documentation, it has a nice simple example:
https://www.openfoam.com/documentati...atchField.html

If you would have any questions feel free to ask!
olesen likes this.
powabna is offline   Reply With Quote

Old   February 13, 2024, 05:14
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Ibrahim_I View Post
Hi, in my 0/T folder on one wall I need a heat flux (W/m^2) and convective heat flux (W/m^2K). I tried defining these conditions separately for the same wall or putting it in the same bracket but openfoam only uses one of them not both. Is there a way of doing this without using swak4foam? Example code below in which openfoam only uses the second condition.

top_wall
{
type externalWallHeatFluxTemperature;
value $internalField;
q uniform 1000.0;
mode flux;
kappaMethod solidThermo;
qr none;
kappa none;
thicknessLayers ();
kappaLayers ();
}

top_wall
{
type externalWallHeatFluxTemperature;
mode coefficient;
Ta constant 313.0;
h uniform 17.0;
value $internalField;
}
What you are attempting simply does not make sense and will not work. The OpenFOAM files are essentially the same as a dictionary format, which means that the second entry will partly overwrite the first entry and partly be merged into it.

If you test with the following, you will see what OpenFOAM itself sees:
Code:
foamDictionary -expand 0/T
Your only option will be to write your own coded (mixed) BC, use an expressions BC - both of which mean lots of copy/paste from the externalWallHeatFluxTemperature code. Alternatively, if you can cleanly formulate what your new mode should be called and how it works, can consider opening a request for enhancement:
https://develop.openfoam.com/Develop...foam/-/issues/
olesen is offline   Reply With Quote

Old   February 13, 2024, 05:22
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by powabna View Post
Hi!

I don't know if you found a solution, but... I faced similar challenges with BC on a wall. I've experimented with some OF options and at the end codedMixed worked just fine.

Link to documentation, it has a nice simple example:
https://www.openfoam.com/documentati...atchField.html

If you would have any questions feel free to ask!
For many in-between cases, it may also be possible to use "uniformMixed" BC
(https://api.openfoam.com/2312/classF...atchField.html) which allows you to use a PatchFunction1 for each of the three constituent parts.
This can be especially convenient (compared to a complete coded mixed BC) since you can potentially specify some parts as constant or some other PatchFunction1, which include expressions and coded.
IMO it is probably the best of both worlds - it offers full flexibility without necessarily needing to compile additional code.
olesen is offline   Reply With Quote

Old   February 15, 2024, 03:54
Default
  #5
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
If you check the Code off that BC you Will see that you can use several BC for that wall, you just need to add all the needed parameters in the same boundary.
agustinvo is offline   Reply With Quote

Old   February 19, 2024, 15:09
Default
  #6
New Member
 
Ibrahim I
Join Date: Feb 2024
Posts: 5
Rep Power: 2
Ibrahim_I is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
If you check the Code off that BC you Will see that you can use several BC for that wall, you just need to add all the needed parameters in the same boundary.
Hi, how should I do this? I tried this but it only did the 1k flux and not the convection, because I compared it by removing convection parts and it gave same result

topWall
{
type externalWallHeatFluxTemperature;
mode coefficient;
mode flux;
Ta constant 313;
h uniform 17;
q uniform 1000.0;
value $internalField;
kappaMethod solidThermo;
qr none;
kappa none;
thicknessLayers ();
kappaLayers ();
}
Ibrahim_I is offline   Reply With Quote

Old   February 19, 2024, 15:10
Default
  #7
New Member
 
Ibrahim I
Join Date: Feb 2024
Posts: 5
Rep Power: 2
Ibrahim_I is on a distinguished road
Quote:
Originally Posted by powabna View Post
Hi!

I don't know if you found a solution, but... I faced similar challenges with BC on a wall. I've experimented with some OF options and at the end codedMixed worked just fine.

Link to documentation, it has a nice simple example:
https://www.openfoam.com/documentati...atchField.html

If you would have any questions feel free to ask!
Hi, I'm not sure how to make heatflux and convection in codedMixed. Do you know how to?
Ibrahim_I is offline   Reply With Quote

Old   February 19, 2024, 18:24
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,689
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Ibrahim_I View Post
Hi, I'm not sure how to make heatflux and convection in codedMixed. Do you know how to?

Can you at least write out what your BC is supposed to look like in mathematical form in terms of value and gradient of temperature??
olesen is offline   Reply With Quote

Old   February 20, 2024, 12:59
Default
  #9
New Member
 
Ibrahim I
Join Date: Feb 2024
Posts: 5
Rep Power: 2
Ibrahim_I is on a distinguished road
Quote:
Originally Posted by olesen View Post
Can you at least write out what your BC is supposed to look like in mathematical form in terms of value and gradient of temperature??
The equation for that boundary is: q+h(Tinf-T)=-k*dT/dx

where q is flux W/m^2, h is HTC W/m^2K, k is thermal conductivity W/mK. Tinf is the ambient temperature, T is the boundary temperature.

An article posted this code for groovyBC for this type of boundary:
boundary
{
type groovyBC;
variables "h=10.0;Tinf=100.0;k=10.0;q=150.0;";
valueExpression "Tinf";
fractionExpression "1.0/(1.0 + k/(mag(delta())*h))";
value uniform 100;
gradientExpression "q/k";
}
I'm struggling to get swak4foam on Mac, so I'm trying to use this as codedMixed, but I get error saying delta is undeclared identifier. How do I define delta?
Ibrahim_I is offline   Reply With Quote

Old   March 11, 2024, 18:16
Default
  #10
New Member
 
Join Date: Apr 2023
Posts: 2
Rep Power: 0
powabna is on a distinguished road
Quote:
Originally Posted by Ibrahim_I View Post
The equation for that boundary is: q+h(Tinf-T)=-k*dT/dx

where q is flux W/m^2, h is HTC W/m^2K, k is thermal conductivity W/mK. Tinf is the ambient temperature, T is the boundary temperature.

An article posted this code for groovyBC for this type of boundary:
boundary
{
type groovyBC;
variables "h=10.0;Tinf=100.0;k=10.0;q=150.0;";
valueExpression "Tinf";
fractionExpression "1.0/(1.0 + k/(mag(delta())*h))";
value uniform 100;
gradientExpression "q/k";
}
I'm struggling to get swak4foam on Mac, so I'm trying to use this as codedMixed, but I get error saying delta is undeclared identifier. How do I define delta?


Hey, in my case I used deltaCoeffs(), it's a variable of a boundary patch that can be accessed
Over here you can find a definition: (https://openfoamwiki.net/index.php/O...n;;deltaCoeffs)

I hope that helps!
powabna 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
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05


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