CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CD-adapco (http://www.cfd-online.com/Forums/cd-adapco/)
-   -   Question about bcdefw.f for wall temperature bc. (http://www.cfd-online.com/Forums/cd-adapco/56515-question-about-bcdefw-f-wall-temperature-bc.html)

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:

torhf(ncell)=temp

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?

Thanks,

Jimmy


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: jimmyfox205@yahoo.com.

Thank you in advance,

Jimmy


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----------------------------------------------

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

open(unit=90,file=T.inp)

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

xf(k)=xf(k)/1000.

yf(k)=yf(k)/1000.

zf(k)=zf(k)/1000.

100 continue

close(90)

intflg(1)=1

endif

c--------------------------------------------------

c finds nearest boundary

mndist=1.0e10

bndnear(ibp)=0

do 250 k=1,nb

dist=sqrt((x-xf(k))**2

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

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

if(dist.lt.mndist) then

mndist=dist

bndnear(ibp)=k

endif

250 continue

TORHF=tamb(bndnear(ibp))

endif

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


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.

Jimmy

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.

andreas

Jimmy March 18, 2008 10:13

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

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.

Jimmy

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(iter.lt.1) statement to the mapping algorithm.

Regards Andreas

Jimmy March 18, 2008 16:28

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

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

Jimmy


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