problem with changing the source term of energy equation

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

problem with changing the source term of energy equation

Post by chengan.wang »

Hello every,
Now I am working with coupled problem between natural convection and radiation. For the radiation part I have a code written in fortran which can deal real gas(coefficient of absorption change with position). So I just need to change the source term of energy equation with adding -div(Qr),which is divergence of radiative flux and calculated in code of "radiation.f90".

in the subroutine "ustssc.f90", I add the following:
!*************************************************
if (iscal.eq.1) then

do iel = 1, ncel
crvimp(iel) = 0
enddo
do j=1,jmax
do i=1,imax
iel=(jmax-j)*imax+i
crvexp(iel) = -volume(iel)*divQr(i,j) !(1)
!crvexp(iel) = -volume(iel)*divQr(i,j)/1017.24d0 !(2)
enddo
enddo
endif
!****************************************************
I'm working on the 2D square geometry, i,j are the cordinates of the cell center. imax*jmax=ncel, the total cell number."1017.24d0" is the thermal capicity Cp.
If I select the (1) I find the result of Code_saturne couldn't converge. If I seclet the second one, the radiation seems no influence to the convection. There are not problems with the transfer of varibles between Code_Saturne and code of radiation.
If somebody could give me some suggestion?

Thanks
Attachments
cordiates.JPG
(10.91 KiB) Downloaded 63 times
Yvan Fournier
Posts: 4083
Joined: Mon Feb 20, 2012 3:25 pm

Re: problem with changing the source term of energy equation

Post by Yvan Fournier »

Hello,

Natural convection can be quite tricky to model, so difficulties in convergence might not be due to an error in the source term (which I'll let you and others cross-check), but to other causes.

Are you running a steady or a transient calculation ? (try transient if steady does not work)
Is your time step/CFD reasonable ?

If the radiative source term is very high, you may try to start with a smaller source term, then increase it to the required level over several hundred time steps.

Best regards,

Yvan
chengan.wang

Re: problem with changing the source term of energy equation

Post by chengan.wang »

Hello Yvan,
Thank you very much for your reply.
I'm working on a steady cas (Ra=5x10^6) and I use a transient method to calculate. I use 0.1s time step and upwinding scheme. Here, I have two small questions:

1) When we change the source term of energy equation, the term we add could be directly used or should be divided by the Cp (thermal capicity)? if the energy equation is exactly the same formulation as described as in page 15 of "Theory and Programmer's Guide"

2)If I use the DOM model of radiation developed by Code_Saturne, the angular space is discretized in which kind of method, SN or PCA? If we can calculate the real gas, the absorption varies with space (x,y,z) and specral lambda?

Thank you again.

Chengan
Yvan Fournier
Posts: 4083
Joined: Mon Feb 20, 2012 3:25 pm

Re: problem with changing the source term of energy equation

Post by Yvan Fournier »

Hello,

I do not have time today to check all details relative to your first question, but I can add the following:

The energy equation should be that of the theory guide, but when in doubt, the comments and examples at the beginning of the user subroutine should help (if in conflict with the theory documentation, I would give priority to the examples)

As the source term requires multiplication by the cell volume, it seems that it is an integral value for that control volume; I would expect you can use the term directly.

You may adapt the example in usproj.f90 to compute a thermal balance; this may help you check for consistency between what you expect and what you get.

I do not know the answers to question 2, so if you did not find it in the documentation, and cannot determine this from a quick look at from src/lagr/raysol.f90 and src/lagr/raydom.f90, then I'll have to check with colleagues.

Best regards,

Yvan
Post Reply