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

Heat loss calculated on cell-by-cell basis for sidewalls

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2015, 05:26
Default Heat loss calculated on cell-by-cell basis for sidewalls
  #1
New Member
 
Mick McGill
Join Date: Jun 2015
Posts: 16
Rep Power: 11
mick223 is on a distinguished road
Hi everyone,

I am working with a case that is a flat topped pyramid, with Qin and Qout at the top and bottom respectively. The case is modeled with meltFoam, and gradually solidifies. Heat loss through the side walls is calculated with groovyBC lookup tables, with average temperatures applied to 6 vertical patches for each sidewall. This is not accurate enough, as convection driven melting leading to non-perpendicularites, and varying temperatures along the horizontal planes.

What I am looking to do is to set boundary conditions to each cell, such that heat flux is calculated on a cell-by-cell basis, so as to remove this issue. Is this possible, or am I better of continuing as it is but increasing the number of patches on each sidewall?

Thanks.
mick223 is offline   Reply With Quote

Old   August 13, 2015, 04:51
Default
  #2
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
Hi Mick,

I am not sure I understand your question completely, but maybe this will help.

It is possible to calculate the heat loss on a cell-by-cell basis using groovyBC, I have done this before for convection and radiative heat losses from a surface with the following entry in the 0/T file:

Code:
   
curves
    {
        type groovyBC;
        variables "htot=50.0;Tinf=273.15;rho_steel=7735.0;k=-0.0419*T+73.2;sigma=5.6e-8;E=0.8;";
        gradientExpression "-htot/k*(T-Tinf)-(sigma/k)*E*(pow(T,4)-pow(Tinf,4))";
        fractionExpression "0";
    }
Nicole is offline   Reply With Quote

Old   August 16, 2015, 09:25
Default
  #3
New Member
 
Mick McGill
Join Date: Jun 2015
Posts: 16
Rep Power: 11
mick223 is on a distinguished road
Hi Nicole,

Thanks for the help. How can I use apply a similar condition but using lookup tables instead of an equation to calculate the heat loss?

Thanks again.
mick223 is offline   Reply With Quote

Old   August 17, 2015, 05:28
Default
  #4
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
Hi Mick,

Sorry, I have no idea. You could try your best guess and see if the error messages are helpful enough. Good luck!
Nicole is offline   Reply With Quote

Old   August 20, 2015, 02:08
Default
  #5
New Member
 
Mick McGill
Join Date: Jun 2015
Posts: 16
Rep Power: 11
mick223 is on a distinguished road
Hi Nicole,

No worries, I should be able to use equations instead. At what point is the value 'T' calculated for in the equation, is it the temperature on the cell boundary, or an average of an area? The code I am building on at the moment currently applies the heat loss formula using temperatures as averages of slices taken vertically, and then applying a gradient. This obviously is not as accurate. Could you possible upload the whole 0/T file so I can better understand how it's working?

Thanks again, this has been very helpful.
mick223 is offline   Reply With Quote

Old   August 20, 2015, 04:03
Default
  #6
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
Hi Mick,

I am still not completely sure what you are trying to do. So I am going to say a couple of things that may be obvious to you, just to make sure we are on the same page:

1) We are solving discretised equations in OpenFOAM, therefore we only calculate the values for a volScalarField such as T, at cell centres.
2) At the boundaries, T at the cell centre adjacent to the boundary face is interpolated from the value at the centre of the cell face by some interpolation scheme that you have specified in fvSchemes.
3) My code gives OpenFOAM an equation for T at the cell face (instead of just making it a fixedValue boundary condition), therefore this will be worked into the larger set of equations on a cell-by-cell basis.

I am not sure why you are using slices and tables, perhaps this relates to your physical problem. But if you have one equation that holds for an entire boundary patch then I recommend using groovyBC rather. (or consider breaking your geometry up into patches that have the same equation on each of them) The point of swak4foam is to save everyone from having to do the coding that Bernhard (who is probably much smarter than most of us) has already done. I am slowly learning (the hard way) that it is better to use as much as possible of other people's code than try to develop my own.

I'm not sure what I have done with the T file. But the other boundaries just have regular zeroGradient or fixedValue boundary conditions so you won't learn much form it. I think you also have to #include the groovyBC or swak4foam library, you can just Google an example, which is probably more correct than the way I did it in any case.

I hope this helps, but I still have pretty much no idea what you are trying to do. If this isn't helpful perhaps you could post some of your files or code so I can try to understand your work better. I am by no means an expert though, only just learning myself
Nicole is offline   Reply With Quote

Old   August 21, 2015, 01:54
Default
  #7
New Member
 
Mick McGill
Join Date: Jun 2015
Posts: 16
Rep Power: 11
mick223 is on a distinguished road
Hi Nicole,

It might just be easiest if I post the relevant section of code that I meant to be changing so you can see. Disregard the "thingtop", as is fine and will stay the same, it is leftwall1-6, rightwall1-6 etc that I need to adjust.

Code:
dimensions
[0 0 0 1 0 0 0];
internalField
uniform %s; //body_temp
boundaryField
{
thingtop
{
type
groovyBC;
variables (
"Toutlet{thingtop}=T;" //temperature of surface at inlet
);
gradientExpression "-function(Toutlet)"; //heat loss formula
fractionExpression "0";
lookuptables (
{
name function;
outOfBounds clamp;
fileName "$FOAM_CASE/lookupfunction.data";
}
);
value
uniform %s;
}
leftWall1
{
// type fixedGradient;
// gradient uniform 100000;
type
groovyBC;
variables (
"h=10.0;" //W.m^-2.K^-1 CONVECTION COEFF
"A=%s;" //m^2 AREA-SEE BLOCKMESH
"T_inf=297.0;" //K AMBIENT TEMP
"T_surr=297.0;" //K Surrounding air temperature
"esp=0.7;" //surface emissivity 0<esp<1
"sig=5.67e-8;" //stefan-boltzmann constant for q_rad
"ks=20;"
"kl=60;"
"Toutlet{leftWall1}=oldTime(T);" //temperature of surface at inlet
);
gradientExpression "(Toutlet > 1680) ? ((-(h*A*(Toutlet-
T_inf)+esp*A*sig*(pow(Toutlet,4)-pow(T_surr,4))))/kl) : ((-(h*A*(Toutlet-
T_inf)+esp*A*sig*(pow(Toutlet,4)-pow(T_surr,4))))/ks) "; //heat loss formula
fractionExpression "0";
value uniform %s;
}
I had my wires crossed before, and the lookup tables are actually only in the thingtop section, and the heat loss through the walls is defined by the equation.

I can't actually see much difference in you code and this, and so possible this is already calculating it on a cell-by-cell basis and I have simply been misinformed?
mick223 is offline   Reply With Quote

Old   August 21, 2015, 05:10
Default
  #8
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
Hi Mick,

The difference that I can see is when you say "Toutlet{leftWall1}=oldTime(T);" and then use Toutlet, whereas I simply used T directly in the gradient expression. I'm afraid I'm not sure what your extra step is doing, whether Toutlet will be a field of an averaged value on the patch?

So, see if my logic is right: You are using Toutlet which is at the previous time step, therefore an actual value for the gradient is calculated, whereas my code used T directly, therefore I used the gradient as a function of T (at the current time step).

Perhaps you can use Toutlet at the old time for the if statement condition (if this will introduce a small enough error) and then T directly in your gradientExpression equations?
Nicole is offline   Reply With Quote

Old   August 23, 2015, 10:14
Default
  #9
New Member
 
Mick McGill
Join Date: Jun 2015
Posts: 16
Rep Power: 11
mick223 is on a distinguished road
Hi Nicole,

The reason for the extra expression "Toutlet{leftWall1}=oldTime(T)" is to ensure that oldTime(T) is used rather than just T, the reason being that when the solver uses multiple iterations, it will by default use the result of the last iteration rather than the values at the last time step. This is an issue, as meltFoam iterates several times for each time step.

So to you, does it appear that it already does calculate the heat loss on a cell by cell basis? And so each cell has it's boundary condition calculated using it's own average temperature. To me it seems that it should function the same as your code does already.
mick223 is offline   Reply With Quote

Reply

Tags
boundary conditions, heat losses, patches


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
interFoam running blowing up sandy13 OpenFOAM Running, Solving & CFD 2 May 5, 2015 08:16
heat source in one cell only! David UTFSM MEC Fluent UDF and Scheme Programming 1 October 15, 2013 18:14
Heat loss through walls franzdrs Main CFD Forum 2 September 30, 2009 07:33
Pressure loss in PEM cell with different profiles rodrigoscf FloEFD, FloWorks & FloTHERM 1 April 14, 2009 11:00
heat loss ss Siemens 0 February 19, 2004 01:07


All times are GMT -4. The time now is 16:02.