how to output the temperature on the boundary?

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
chengan.wang

how to output the temperature on the boundary?

Post by chengan.wang »

Hello everyone

I have a small question here:

Now I'm working on the coupled problem between natural convection and radiation. I want to use the temperature in the domain and on the boundary. Here, I try to ouput the temperature on the hot wall, on which the temperature is constant. But the result got by the following code is variable.(The cordinates are correct)

!***************************************
open(21,file="chaud.dat")
do ilelt = 1, nlelt

ifac = lstelt(ilelt)
iel = ifabor(ifac) ! associated boundary cell
write(21,*)cdgfbo(1,ifac),cdgfbo(3,ifac),rtpa(iel,ivar)
enddo
close(21)
!***************************************

I guess I couldn't use "rtpa(iel,ivar)" to get teh temperature on the boundary face. If somebody knows how to deal with it?

Thank you!
Attachments
cordiates.JPG
(10.91 KiB) Downloaded 79 times
Jacques Fontaine
Posts: 118
Joined: Mon Feb 20, 2012 2:07 pm

Re: how to output the temperature on the boundary?

Post by Jacques Fontaine »

Hello,

There is an example (true if there is no wall function) in usproj (v2.2):

Code: Select all

! Compute reconstructed value in boundary cells

    compute grad T with grdcell -> gradT

    do ifac = 1, nfabor (loop on boundary faces)
      iel = ifabor(ifac)  (boundary faces -> cell connectivity)
      diipbx = diipb(1,ifac) (compute vector II', cf: theory guide) 
      diipby = diipb(2,ifac)
      diipbz = diipb(3,ifac)
      TempIp(ifac) =   rtp(iel,isca(iscalt))              &
                    + diipbx*gradT(iel,1)                   &
                    + diipby*gradT(iel,2)                   &
                    + diipbz*gradT(iel,3)
    enddo
So we have:


Next, you need to reconstruct the value at the face (cf: theory guide (condli)):


Code: Select all

iclvar = iclrtp(isca(iscalt), icoef) 

do ifac = 1, nfabor (loop on boundary faces)
  TempF(ifac) = coefa(ifac, iclvar) + coefb(ifac, iclvar)*TempIp(ifac)
enddo 
To output the result, it is quite simple in sequential mode, in parallel you have to be prudent and to use synchronization functions (in this case paragv).

Best regards,
chengan.wang

Re: how to output the temperature on the boundary?

Post by chengan.wang »

Thank you for your answer.
In fact, I use orthogonal mesh and I have two kinds of boundary conditions, one is Dirichlet, left and right wall, I can use "coefa" directly to get temperature; I apply the Neumann condition on the top and bottom walls, if I can also calculate the temperature the same way you show me?

Sincerely,

Chengan WANG
Jacques Fontaine
Posts: 118
Joined: Mon Feb 20, 2012 2:07 pm

Re: how to output the temperature on the boundary?

Post by Jacques Fontaine »

If you use orthogonal meshes you can use coefa and coefb directly. Same way for Neuman/Dirichlet BC.

In my previous post please note my edit in the 2nd "Code box" (iclvar added).

Best regards,
chengan.wang

Re: how to output the temperature on the boundary?

Post by chengan.wang »

Hello,
If there is wall function (when I use LES), what should I do for ouput the exact temperature?
Best regardes
Chengan
Post Reply