CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Phoenics (
-   -   How to implement source term? (

Amit Gupta May 5, 2006 02:03

How to implement source term?
Hi everyone,

I am a student of Metallurgical & Materials Engineering, Indian Institute of Technology Kanpur, India.

Can anybody tell me that how to implement the source term like d/dx(k(d(phi)/dx)) where phi is other variable than c1,c3.. provided by phoenics.

Is that i have to give whole term as a source in each cell by giving patch type cell....or i have to discritize it and give it as flux on east and west face (patch type east or west)

If i have to discritize this source term then its unit will be changed. One more thing i am working on a trasient problem.

Please help me!! Thanks in advance

Amit Gupta

Mike May 10, 2006 12:06

Re: How to implement source term?
It is not clear. What variable is being solved? Is it phi itself, or is the phi in the source term the subject of another transport equation? Also, what does the source term represent physically?

The term looks diffusive in nature, but what does the term physically represent? In any event, you will need to represent the term by constructing fluxes into and out of the cell on the west and east faces, as appropriate.

Amit Gupta May 10, 2006 23:04

Re: How to implement source term?
Thanks for the answer Mike ! I got your point that i have to specify source term as fluxes on east and west face but still I have some doubt.

In my problem i am solving variable C1, that subject to a transport equation. In which i am using a source term k(d2(C3)/dx2), the subject of another transport equation for C3. (where k is some constant to maintain the unit consistency)

You are absolutely right that it is diffusive in nature. How can I convert this term in fluxes into and out of the cell on the west and east faces. Please specify the term which i have to input as flux on east and west faces.

Also please tell me how to linearize this type of term?

Thanks again!


Mike May 11, 2006 05:18

Re: How to implement source term?
Off the top of my head:

source = De*(C3,E-C3,P) + Dw*(C3,W-C3,P) (1)

where E, W and P denote the east node, west node and current node location. The De and Dw are diffusive exchange coefficients evaluated at the east and west cell-faces, respectively.

For example, De = k*area,e/(X,E-X,P)where k is the actual diffusion coefficient evaluated at the cell face by averaging from the nodal values of k. If k is uniform, then obviously no averaging is required.

Equation (1) is already in the required form for linearisation, ie SOURCE=CO*(VAL-phi,p)*TYPE. Therefore, in the PHOENICS linearisation can be achieved by putting CO=De and VAL=C3,E, etc

There are several ways to implement this in PHOENICS, but without much thought as to the detail, I can imagine two PATCHes, of say area type, with CO=GRND and VAL=GRND. In GROUND, you then set CO and VAL as required.

Mike May 11, 2006 08:07

Re: How to implement source term?
No, my proposed linearisation is not right, because obviously phi,p=C1,P, and not =C3,P. I think you can probably linearise each face term by checking on the sign, and if it is negative, use CO=face term/(C1,lim-C1,P) & VAL=C1,lim. Since C1,lim is a concentration, an obvious choice for the C1,lim is zero. This might prove stiff numerically if C1,P tends to a small concentration. If the flux term is +ve, you can simply introduce the flux term explicity, iei CO=FIXFLU and VAL=flux term.

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