CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

bulk temperature about a Area

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

Like Tree5Likes
  • 1 Post By henrik
  • 1 Post By henrik
  • 3 Post By nimasam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2009, 13:05
Default bulk temperature about a Area
  #1
New Member
 
Valentin Mayer
Join Date: Jul 2009
Posts: 5
Rep Power: 16
splif is on a distinguished road
Hello

I new in OpenFoam user and I try to get the bulk temperautre about a area.

the theory: my problem

tbulk = integration(U*T*dA) / integration(U*dA)

the nummerical:

I'm not really sure how to sovle this problem.
Postprocessing or ?
I think that you need a summation about the area,like:
sum = sum + T(n)*U(n)*dy (Fortran 2D)
How can i fixed this problem?
Have somebody a idea?

Thanks
valentin
splif is offline   Reply With Quote

Old   July 6, 2009, 05:32
Default
  #2
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Dear Valentin,

There are two issues. How to define the area and how to parallelise.

I would also advise you to use the flux rather than the velocity since it is guaranteed to be conservative.

Neglecting parallelisation issues and assuming that you want to work with patch (iP) the following will the job:

Code:
heatFlux = 
    sum(T.boundaryField()[iP]*phi.boundaryField()[iP])/sum(phi.boundaryField()[iP]);
Henrik
milad653279 likes this.
henrik is offline   Reply With Quote

Old   July 6, 2009, 13:30
Default
  #3
New Member
 
Valentin Mayer
Join Date: Jul 2009
Posts: 5
Rep Power: 16
splif is on a distinguished road
Hi Henrik,

sorry for this Question. But i'm not in used to work with openFoam.
what means [ip] ? It is for direction, like [x].

I'm not sure if i get you wrong:
Your equation mean:

q=sum(t*flux)/sum(flux)=sum(t*rho*U)/sum((rho*U)) ?
Is there no multiply wirh dy and dx?

Thanks
Valentin
splif is offline   Reply With Quote

Old   July 6, 2009, 15:51
Default
  #4
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 splif View Post
sorry for this Question. But i'm not in used to work with openFoam.
what means [ip] ? It is for direction, like [x].
Quote:
Originally Posted by splif View Post

No. It is the index of the patch. For an example on how to get the index if you got the name of the patch have a look at the sources of $FOAM_UTILITIES/postProcessing/patch/patchIntegrate
I'm not sure if i get you wrong:
Your equation mean:

q=sum(t*flux)/sum(flux)=sum(t*rho*U)/sum((rho*U)) ?
Is there no multiply wirh dy and dx?
No. The is all included in phi (that is the flux Henrik was talking about). For the definition of phi look elsewhere (it's been discussed zillions of times)

Bernhard
gschaider is offline   Reply With Quote

Old   July 7, 2009, 09:34
Default
  #5
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Dear Valentin,

thanks for your private message (in German). I hope you don't mind if I repeat what I understand is what you are trying to do.

Valentin is seeking to evaluate the local Nusselt number and needs the bulk temperature to do so. The local Nusselt number would be per wall face (additional averaging may apply) and the bulk temperature is a function of the axial position in the pipe (x-coordinate in his case).

The problem is now to evaluate the bulk temperature for a given axial position.

Is this correct?

Henrik
henrik is offline   Reply With Quote

Old   July 7, 2009, 11:23
Default
  #6
New Member
 
Valentin Mayer
Join Date: Jul 2009
Posts: 5
Rep Power: 16
splif is on a distinguished road
Hello Hendriks,

that's right. I search for a summation (lilke (sum(sum( T.yz*U.yz*dy)dz)each Cells) about an area (yz).And every summation should go every cells in x-> direction.
Perhaps somebody has an idea.

Thanks
Valentin
splif is offline   Reply With Quote

Old   July 7, 2009, 12:22
Default
  #7
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Dear Valentin,

Okay. I would try the following. Create a lookup table for T_bulk as a function of x. To do so, you need a function that maps x into an index.

Code:
scalarField vol(nCellsx, 0.0);
scalarField Tbulk(nCellsx, 0.0);
forAll(T, cellI)
{
    if ( inBulkRegion(mesh.C()[cellI]) )
    {
         label index = floor(mesh.C()[cellI].x()/length*nCellsx);
         vol[index] += mesh.V()[cellI];
         Tbulkl[index] += T[cellI]*mesh.V()[cellI];
    }
}

Tbulk /= vol;
Then walk over the wall patch to calculate the local Nusselt number and use the same index function to look up Tbulk (but calculated with the face center's x-coordinate).

This is by no means elegant, it will not parallelise easily and there are better ways of doing this. However, this will get you a long way.

Henrik
Luttappy likes this.
henrik is offline   Reply With Quote

Old   July 7, 2009, 13:19
Default
  #8
New Member
 
Valentin Mayer
Join Date: Jul 2009
Posts: 5
Rep Power: 16
splif is on a distinguished road
Hello Hendrik,

thanks a lot.Have a nice evening (in German).

Bye
Valentin
splif is offline   Reply With Quote

Old   August 11, 2011, 18:26
Default
  #9
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
hi
could you calculate bulk temperature along pipe axis ? i search for it too
nimasam is offline   Reply With Quote

Old   August 13, 2011, 16:46
Default bulk Temperature + cell selection
  #10
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
Code:
    label patchii = mesh.boundaryMesh().findPatchID("fixedWall");
    const Foam::fvsPatchField<Foam::Vector<double> > Cpatches = mesh.Cf().boundaryField()[patchii];

    scalar nCellsx = Cpatches.size();
    labelListList inBulkRegionList (nCellsx);
    
    forAll(Cpatches, cellj)
    {
      label nSelectedCell = 1;
      forAll(mesh.C(), celli)
      {
        if ( (Cpatches[cellj]).z() == (mesh.C()[celli]).z())
          {
       inBulkRegionList[cellj].setSize(nSelectedCell,celli);
       nSelectedCell ++;
          }
      }
    }

hi dear foamer
i have a pipe! its axismyetric and it is 40*160! i want to have the cells in each cross section means the cells with the same highth!
so i should have a list, this list has 160 sublist, each sublist contains the cell IDs of in each highth! so it should be 40!
i wrote above code to make a list of list!!! it compiles well but the result is some how strange and it dose not return all cell selections in each height i expected it returns 40 cells in each height but you can see the results.can anybody tell me why?

labelListList:
160
(

19 // it should be 40 cells!
(
2
6
7
9
10
11
13
14
16
18
19
20
21
23
24
27
33
35
37
)


18
(
43
47
50
51
52
53
57
58
59
63
64
66
68
69
70
73
74
79
)

5(84 85 87 117 119)

11
(
123
125
129
130
136
139
140
141
143
149
152
)


20
(
160
161
166
167
169
170
172
173
176
177
178
180
181
182
185
190
195
196
197
199
)


13
(
200
201
205
209
210
217
221
222
224
229
232
235
238
)

8(244 246 247 262 265 266 275 278)
....
)
milad653279, Bana and ancipdp like this.
nimasam is offline   Reply With Quote

Old   December 4, 2015, 14:51
Default Bulk temperature
  #11
Member
 
Mohammad Reza
Join Date: Sep 2015
Posts: 44
Rep Power: 10
Bana is on a distinguished road
Hi nima sam and Bruno
I need the answer to this question, my case is an axisymetric heated pipe too, I need to calculate bulk temperature at each cross section ,tbulk = integration(U*T*dA) / integration(U*dA) to compute nusselt number.additionally it is needed for fully developed condition of T at the outlet of pipe!!
any help or hint would be appreciated!
Thanks in advance
Bana is offline   Reply With Quote

Old   December 7, 2015, 03:59
Default
  #12
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
you should write some pieces of code to gather cells in each section and then return the value of them for calculation, above structure give you hints how to go forward.
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   December 7, 2015, 14:18
Default
  #13
Member
 
Mohammad Reza
Join Date: Sep 2015
Posts: 44
Rep Power: 10
Bana is on a distinguished road
Dear Nima Sam
Thanks for your reply, your code was very inspiring for me but why it didn't get anticipated 2d array?
maybe "size()" member function returns the number of neighbour cells for a cell but in this case we need to access patches which are normal to each wall patch.Is it the problem or anything else?
bests,
MohammadReza
Bana is offline   Reply With Quote

Old   July 30, 2016, 17:59
Default
  #14
Member
 
Milad Setareh
Join Date: Oct 2012
Location: Tehran, Iran
Posts: 35
Rep Power: 13
milad653279 is on a distinguished road
Quote:
Originally Posted by nimasam View Post
Code:
    label patchii = mesh.boundaryMesh().findPatchID("fixedWall");
    const Foam::fvsPatchField<Foam::Vector<double> > Cpatches = mesh.Cf().boundaryField()[patchii];

    scalar nCellsx = Cpatches.size();
    labelListList inBulkRegionList (nCellsx);
    
    forAll(Cpatches, cellj)
    {
      label nSelectedCell = 1;
      forAll(mesh.C(), celli)
      {
        if ( (Cpatches[cellj]).z() == (mesh.C()[celli]).z())
          {
       inBulkRegionList[cellj].setSize(nSelectedCell,celli);
       nSelectedCell ++;
          }
      }
    }
hi dear foamer
i have a pipe! its axismyetric and it is 40*160! i want to have the cells in each cross section means the cells with the same highth!
so i should have a list, this list has 160 sublist, each sublist contains the cell IDs of in each highth! so it should be 40!
i wrote above code to make a list of list!!! it compiles well but the result is some how strange and it dose not return all cell selections in each height i expected it returns 40 cells in each height but you can see the results.can anybody tell me why?

labelListList:
160
(

19 // it should be 40 cells!
(
2
6
7
9
10
11
13
14
16
18
19
20
21
23
24
27
33
35
37
)


18
(
43
47
50
51
52
53
57
58
59
63
64
66
68
69
70
73
74
79
)

5(84 85 87 117 119)

11
(
123
125
129
130
136
139
140
141
143
149
152
)


20
(
160
161
166
167
169
170
172
173
176
177
178
180
181
182
185
190
195
196
197
199
)


13
(
200
201
205
209
210
217
221
222
224
229
232
235
238
)

8(244 246 247 262 265 266 275 278)
....
)
Dear foamer
the above code have been written by nimasam is very good but must be corrected till it works well. for reformation, if clause must be written as following:

Quote:
if ( float Cpatches[cellj].z() == float mesh.C()[celli].z() )
as you see, the float type must be added.

Best regards,
Milad
milad653279 is offline   Reply With Quote

Old   November 3, 2016, 13:50
Default
  #15
Member
 
Mirage
Join Date: Jul 2012
Posts: 43
Rep Power: 13
Mirage is on a distinguished road
Quote:
Originally Posted by nimasam View Post
Code:
    label patchii = mesh.boundaryMesh().findPatchID("fixedWall");
    const Foam::fvsPatchField<Foam::Vector<double> > Cpatches = mesh.Cf().boundaryField()[patchii];

    scalar nCellsx = Cpatches.size();
    labelListList inBulkRegionList (nCellsx);
    
    forAll(Cpatches, cellj)
    {
      label nSelectedCell = 1;
      forAll(mesh.C(), celli)
      {
        if ( (Cpatches[cellj]).z() == (mesh.C()[celli]).z())
          {
       inBulkRegionList[cellj].setSize(nSelectedCell,celli);
       nSelectedCell ++;
          }
      }
    }
hi dear foamer
i have a pipe! its axismyetric and it is 40*160! i want to have the cells in each cross section means the cells with the same highth!
so i should have a list, this list has 160 sublist, each sublist contains the cell IDs of in each highth! so it should be 40!
i wrote above code to make a list of list!!! it compiles well but the result is some how strange and it dose not return all cell selections in each height i expected it returns 40 cells in each height but you can see the results.can anybody tell me why?

labelListList:
160
(

19 // it should be 40 cells!
(
2
6
7
9
10
11
13
14
16
18
19
20
21
23
24
27
33
35
37
)


18
(
43
47
50
51
52
53
57
58
59
63
64
66
68
69
70
73
74
79
)

5(84 85 87 117 119)

11
(
123
125
129
130
136
139
140
141
143
149
152
)


20
(
160
161
166
167
169
170
172
173
176
177
178
180
181
182
185
190
195
196
197
199
)


13
(
200
201
205
209
210
217
221
222
224
229
232
235
238
)

8(244 246 247 262 265 266 275 278)
....
)
Hi Guys

I would like to use the code to compute my Tbulk. But It is for me not clear, how does this code compute Tbulk and Where should I write the code?

Thanks for your help
Mirage 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
UDF or any approach for Bulk Temperature calculation vemps FLUENT 0 May 1, 2009 02:09
how to find bulk temperature plot and results in fluent cadcamvijay Main CFD Forum 2 March 21, 2009 01:36
CFX Solver Memory Error mike CFX 1 March 19, 2008 08:22
Bulk temperature for HTC extimation Italy CFX 4 July 12, 2007 01:05
bulk temperature calculation Yogesh FLUENT 0 February 18, 2005 16:37


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