CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Source term in energy equation (

macdidi June 7, 2006 08:50

Source term in energy equation
Hello I'm modelling heat transfer between fluid domain and solid. I've to add a souce term in energy equation of solid, This term depend on temperature, time and other variable. I do it using fortran subroutine. But I've this error message in Pre:

The variable 'T' referenced in parameter 'Source' in object '/FLOW/DOMAIN:Product/SUBDOMAIN:Subdomain 1/SOURCES/EQUATION SOURCE:energy' does not have one of the required prefixes: phase or particle.

PS: I define my solid as CHT

opaque June 7, 2006 09:00

Re: Source term in energy equation
Dear macdidi,

The preprocessor is being "picky" that it should.. Just add the prefix to the variable T.. For example, if your solid list includes Copper, just pass the Copper.T variable to your User Fortran.

If that works, please let everyone here knows.

Good luck,


Joe June 7, 2006 09:02

Re: Source term in energy equation
You need to disambiguate which phase the T refers too. I cant remember the exact syntax offhand but its something equivalent to: phase1.T rather than just T.

macdidi June 7, 2006 10:58

Re: Source term in energy equation
Thanks I try youre sugestion and now it's working Thanks a lot

mariema April 15, 2017 06:33

hi could tell me what is the expression of term source in the equation of energy please ? i am modeling temperature in fortran too but i can't find the right form of term source

ghorrocks April 15, 2017 18:53

Digging up an 11 year old thread.... You are lucky some of us old timers are still around.

If you want to set a source term from fortran then use your fortran to set a CEL variable and set the source term to that variable in CFX-Pre.

mariema April 17, 2017 18:13

thanks for replying Ghorroks.. Actually i don't use CFX-Pre. is there any way to write that subroutine in Fortran without using CFX-Pre?

Opaque April 17, 2017 18:38

ANSYS CFX User Fortran is the last resource when it comes to custom models like a source term.

How complex is your source that requires UserFortran ? Does it require control logic ? Usage of internal variables, or not readily available functionality ?

CEL is the most common form to customize ANSYS CFX.

mariema April 18, 2017 12:27

1 Attachment(s)
i am looking for a simple expression of the source term due to chemical reaction.Normally it is dependant of the variables that I calculated in the same code like temperature,the reaction rate; the enthalpy of formation. it's like the expression above but it must depend of reaction rate not of mass flow :confused:

Opaque April 19, 2017 08:18

Say, you have a mixture named Mixture compose of 4 materials: Mat1, Mat2, Mat3 and Mat4, you can write the source term as

MySource = (Mat1.Static Enthalpy * Mat1.Molar Mass +
Mat2.Static Enthalpy * Mat2.Molar Mass +
Mat3.Static Enthalpy * Mat3.Molar Mass +
Mat4.Static Enthalpy * Mat4.Molar Mass) /
(Mixture.Density * Mixture.Cp)

No UserFortran needed.

mariema April 19, 2017 11:58

1 Attachment(s)
i am calculating the temperature in reactive medium of the methan combustion so i have to use the source term of the species conservation equation (that i already calculated) to calculate the source term in energy equation. but i don't find big change in the temperature profile when it's supposed to climb from 300 K to 1600 K.

Opaque April 19, 2017 15:53

If you are using ANSYS CFX for combustion, why do you need to reimplement the reaction mechanism ?

Are you solving a separate energy equation yourself ? ANSYS CFX does not solve for Temperature, but for Static Enthalpy and there is no need for reaction source terms whatsoever.

You are also trying to re-implement the Eddy Dissipation model which requires careful linearization..

As per writing the CEL you want, you need Mixture.Density, Mat1.Mass Fraction, Mat2.Mass Fraction.. A careful look at the ANSYS CFX documentation for CEL variables will list the available variables and how to prefix them for multi-component flows.

mariema April 20, 2017 04:46

Indeed, I'm writing a code in fortran i don't use ansys CFX So, the better way is to look at the Ansys CFX documenetation to check all variables.
If there any recommandation to a specific manual or link that demonstrate the Eddy Dissipation Model linearisation?

mariema April 22, 2017 04:52

Finally, i find the solution i didn't multiply the source term by the volume :p. Thanks for your instructions Opaque that give a result :)

cfx_ws1992 May 8, 2017 23:47

decomposition reaction
I am modeling a decomposition reaction of methane hydrate in CFX.But I donot find a relevant model in CFX .What can I do let me achieve this reaction.:confused::confused::confused:

cfx_ws1992 May 9, 2017 20:23

decomposition reaction
I am modeling a decomposition reaction of methane hydrate in CFX.But I donot find a relevant model in CFX .What can I do let me achieve this reaction.
I am trying to use interphase mass transfer to simulate chemical reaction.But I have no sucesse.

All times are GMT -4. The time now is 03:24.