CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   USER_FORTRAN call variable at past timestep (

fipellac October 8, 2010 10:41

USER_FORTRAN call variable at past timestep

I implemented already an Additional Variable under the form of a Transport equation. I didnīt get good results and I would like to have full control on the implemented transport equation.
The problem is essentially the presence of the diffusive term in the equation provided by Ansys CFX (I donīt need it) and the presence of the volume fraction in the formulation of each term.

For this reason I decided to implement a new variable linked to User_CEL. Inside the routine then, linearize the system and solve it iteratively.

I would like to receive some information regarding the following aspect:

1) Transient term: d(variable)/dt

Call the previous timestep value in the point using the getvar with where option = īTSTEP-1ī
Call the actual timestep value in the point using the getvar with where option = `latestī
Is it ok?

Thank you in advance,


joey2007 October 8, 2010 13:09

Getvar is internal and undocumented. I attended an extensive user fortran training some years ago. The trainer commented it only on one slide. Getvar requires more arguments than user_getvar (which is reduced version of getvar). There is a when argument, which can be set to TIME-1 and in some cases to TIME-2.

fipellac October 11, 2010 04:36

dear joey2007,

user_getvar with where option = īTime-1ī should be used to call the values at the previous timestep. Is this what you mean in your reply?

joey2007 October 13, 2010 13:50

It is not user_getvar. Please read exactly what I wrote above. I do not have more info. As I stated it was some years ago that I was in Harwell. I guess you have to ask the service.

On the other hand I do not understand why it should not be possible to implement the transport equation via add. var.???? May be you post the transport equation that we can discuss.

guoxj October 14, 2010 02:59

The problem of inner iteration when calling the subroutine
Hello every.I now encountered a difficult problem.
I want to Calculate for a transient simulation in cfx, and there is a angular velocity need to be defined in the rotational domain.The problem is that angular velocity omega need to be updated every timestep. The defined omega expression is in the form of function which can be called in cfx. The question is that the iteration of omega can not proceed correctly.My aim is to update the omega only once every timestep,but in actual calculation, the omega function is just called dozens per inner iteration.I eager to konw how to achieve my goal of updating omega correctly.
Thanks in advance.

ghorrocks October 14, 2010 06:23

Can you explain what you are doing?

guoxj October 14, 2010 11:19

Ok! I am simulating the starting behavior of a domain including Impeller, using a Fortran subroutine.The subroutine is used to update the angular velocity of the domain.And I calculate the angular velocity taking into account the torque generated by the blade parts and the inertia of the impeller, and this value is used by the cfx solver to set the angular velocity of the blade. The subroutine is used to calculate angular velocity of the rotational domain in the timestep n by using the value of previous time step.The problem is, when the calculation is proceeding,although the cycle is set to update angular velocity at the start of a new timestep, the subroutine is called many times per inner iteration,not once every timestep. That is angular velocity has been updated dozens of times within each iteration. I want to what is the reason of it? And how to solve this problem?

Looking forward to your reply!

joey2007 October 14, 2010 15:31

Guess it should be easy to capture this by some ifīs in the user fortran routine. BTW: Do not know what the admins say, however isnīt it preferable to open a new thread for new question?

michael_owen October 14, 2010 21:23

Also, unless there's something more complex, there's no reason to use fortran for this.

ghorrocks October 14, 2010 22:24


isnīt it preferable to open a new thread for new question?
Yes, this question should be a new thread. Nobody likes their thread being hijacked. But I have given up trying to enforce it as it happens so much. So generally I only bother taking action when asked or it has some other problem with it (spam, insulting, duplicate, inappropriate etc).

fipellac May 20, 2011 05:33

i got the answer from the customer support for a simple use of user cels.

within USER_CEL Routines you can ask for the time derivative with the Utility routine USER_GETVAR, if you define the operator 'Time Derivative'. See documentation about USER_GETVAR On CFX Expression Level you could use Variable.Time Derivative.

astray June 14, 2012 09:52

So is it possible to get the actual angular velocity of a domain by a USER_GETVAR CALL? Do you have these two lines for me? In my case in doesn't work. Error message says it would only work for field-values.

Many thanks in advance for you.


All times are GMT -4. The time now is 12:06.