CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Siemens (
-   -   Question about bcdefw.f for wall temperature bc. (

Jimmy March 13, 2008 14:49

Question about bcdefw.f for wall temperature bc.
Hello friends,

I am working on cooling flow simulation with given wall temperature distribution. It looks like that the user subroutine bcdefw.f is more efficient to set up the wall temperature bc than a table.

With the subroutine bcdefw.f, I need to apply the given wall temperatures to certain cells on the wall. Now my questions are:

(1) The wall temperature needs to be assigned to the cell-face center of a corresponding fluid cell near the wall. There is no problem for me to find those fluid cells near the wall. But I don't know how to obtain the information of the cell-face centers of those cells. Please help me with it.

(2) I am thinking to use the following line to assign the temperature to a fluid cell near the wall:


Here ncell is the fluid cell no. near the wall, temp is the temperature given on the wall where the cell is located at. Is this correct?



A March 14, 2008 05:51

Re: Question about bcdefw.f for wall temperature b
I'm not sure what it is you're trying to do. Why are you assining the Temperature to the adjacent fluid cell and not the boundary itself? I just read your previous posts about mapping a given tempertur field to a boundary. To do so you need to find the corresponding boundary for each of your coordinates and not the corresponding fluid cell for each of your boundaries. Is this still the same problem your working on? If yes I could provide you some sample coding on how to map Temperatures in bcdefw.

Jimmy March 14, 2008 09:50

Re: Question about bcdefw.f for wall temperature b
Good morning,

I just realized that I made a mistake with the Star-CD user subroutine. Now torhf should be just for one cell, but not an array in bcdefw.f. You are right that I just need to map the given temperatures to one particular boundary. If you can provide me with the sample subroutine, it will be great. My email is:

Thank you in advance,


vladimir March 15, 2008 12:40

Re: Question about bcdefw.f for wall temperature b
I am not sure what are you trying to achieve, but the tutorial code is always in the subroutine itself. Just look at the commented lines (starting with C).

A March 17, 2008 06:24

Re: Question about bcdefw.f for wall temperature b
Hi Jimmy,

here's the coding. I'll post it here in case anyone wants to contribute. It reads a file I called T.inp containing your coordinate and temperatures. You need to add the number of meassurent points as a heading in this file.

c number of meassurement points

integer nb

c nearest boundary

integer bndnear

c parameter has to be greater than the number of meassurement points:

integer pnb

parameter (pnb=200000)

c coordinates and temperatures of measurement points

real xf, yf, zf, tamb

c distance measurement point-boundary

real dist, mindist

dimension xf(pnb), yf(pnb), zf(pnb)

dimension tamb(pnb)


c reads in file (T.inp)

if (ireg.eq.1) then

if (intflg(1).ne.1) then ! makes sure T.inp is only read once


read(90,*) nb ! number of Temperatures to be read

do 100 k=1,nb

read(90,*) xf(k),yf(k),zf(k),tamb(k)

c scale to millimeters




100 continue





c finds nearest boundary



do 250 k=1,nb


& +(y-yf(k))**2

& +(z-zf(k))**2)

if( then




250 continue



Unfortunately the editor messes up the format before posting. 6 blanks have to be added before every uncommented line. Contact me any time if you got further questions.

regards andreas

Jimmy March 17, 2008 14:56

Re: Question about bcdefw.f for wall temperature b
Hi Andras,

Thanks for your subroutine. It really works with my case. The only problem may be that this subroutine needs to open and read the data file for each wall cell in each iteration, which takes a lot of computer time when the data file is large and the wall has a lot of cells.

Thanks again,


Jimmy March 17, 2008 15:03

Re: Question about bcdefw.f for wall temperature b
Hi Andras,

I didn't notice that you are using "intflg(1).ne.1" to make sure the file is only read once. So, there should be no problem with it. Sorry about it.


A March 18, 2008 03:28

Re: Question about bcdefw.f for wall temperature b
Hi Jimmy,

yes the soubroutine reads the file only once. I used an intflg statement instead of an iter statement so the subroutine can be called at any time of the run. Glad it works.


Jimmy March 18, 2008 10:13

Re: Question about bcdefw.f for wall temperature b

It seems that the subroutine trys to find the nearest FEA node and assign wall temperature in every iteration. Therefore, it takes a lot of computation, especially for my case with a lot of boundary cells, in repeating the same process with the iteration. I am thinking how to improve this.


A March 18, 2008 11:02

Re: Question about bcdefw.f for wall temperature b
Hi Jimmy,

you're right. I had no model to check the subroutine, so I overlooked that. Try to expand the if(intflg(1).ne.1) statement also to the mapping algorith. Alternatively add an if( statement to the mapping algorithm.

Regards Andreas

Jimmy March 18, 2008 16:28

Re: Question about bcdefw.f for wall temperature b

Thanks for the advice. I will try it, and let you know for sure.


All times are GMT -4. The time now is 08:36.