CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   derivative in CEL expressions (https://www.cfd-online.com/Forums/cfx/82488-derivative-cel-expressions.html)

Matjaz April 6, 2011 09:37

While cfx solver is running, every time step.

singer1812 April 6, 2011 09:38

If you are using User Fortran anyway, why are you bothering with using AV to accumulate the velocity? Do it all within Fortran.

Matjaz April 6, 2011 09:42

Probably i should, till now i haven't found suitable way to accumulate my past values, if i write them to a file, there are about 3000 entries written just for the first time step, then an error occurs, floating point: overflow or so....
Probably i should use MMS, but don't know how.

singer1812 April 6, 2011 09:44

Well, to test out the AV way of doing it, put in a fixed value for delta_velocity (on the order of your expected velocity) and see if velocity rises as it should.

singer1812 April 6, 2011 09:46

Since you are using average velocity anyway, when writing it to a file, do the areaAve of velocity first, assign that to a variable, and write that value out.

From what you describe, it seems, there is no reason to keep the invidual velocities.

Matjaz April 6, 2011 09:53

I will, thank you, it would be also interesting to see how much the fortran routine is sloving the simulation....

marjan June 12, 2011 05:23

second time drivative
 
Dear edmund
Hi,I`ll be grateful if u help me.
How can I create second time derivative in CEL expressions?
I need to use second derivative of temperature with respect to time in heat equation as a source term.
Can i create additional variable of the before additional varible as u described?
Regards

singer1812 June 13, 2011 07:18

On the surface I don't think this is possible, but really haven't given it much thought. Using 2nd order difference for the derivative, you need to store the 2 previous values. If it is possible you need to get pretty tricky with the oldest value needed.

Zaktatir June 17, 2011 05:48

Hello i just tried to use that option of TRANS_LOOP because i want to use and compare old Values of Mean Diameter with the new Ones but at the first Iteration it leads to failre : ERROR #001100279 has occurred in subroutine ErrAction. |
| Message: |
| Stopped in routine MEMERR

singer1812 June 17, 2011 07:14

Run a single iteration run with the AV set at a fixed number. Use that results file to initialize your new run, with the AV set back to what you want it to. I think that will fix your problem.

I think what is happening is your AV has no old value at the first iteration loop. Doing the above will allow it to have one and be called upon.

Zaktatir June 17, 2011 09:23

i made that but still the same problem (i initialize the run with single step run). I am wondering if through the initialization with a finished run the add. variable would be automatically updated?

marjan August 17, 2011 05:28

Second time derivative
 
Dear Edmund,
I will be thankful if u help me,
In continue of previous post for making second time derivative I faced a problem: To use previous value of first time derivative, I created a new variable with value of first time derivative(dT) and add update loop term to library of this new variable, but value of dTold is not value of previous step and it has a little difference with dT. It means added term to library of dT doesn't work, yes?
But I could find previous value of temperature & account dT(first time derivative), with this method easily.
How is solve order?& when this term will lose previous value?

Hemo September 13, 2011 17:49

Temporal pressure gradient
 
Hi Edmund,

I am trying to use the AV approach you have described to get a temporal pressure gradient term at the outlet of my system. I have created an additional variable and applied the "Update Loop= TRANS_LOOP" in the command editor, however, my problem is how to link the AV ('Pprevious') to the Pressure field?

In the default domain tab I selected my 'Pprevious' variable, and set an algebraic expression equal to the Pressure. Is this correct or am I missing something obvious?

The simulation converges fine, but in post-processor when I view the results, my AV has the same values as the pressure, i.e. there is no time delay. I tried the same approach with velocity and got the same result.

Thanks in advance for your assistance

singer1812 September 14, 2011 09:05

You cant post process these. You need to monitor them.

Hemo September 14, 2011 10:11

Hi Edmund, thanks for your reply.
Am I defining the AV correctly then?
I am unclear about what you mean in terms of monitoring the AV.
I'm sorry if this is a bit basic, but I am new to CFX

Thanks

singer1812 September 14, 2011 10:14

I assume you are defining it correct.

You can only monitor while the solution is running using the output monitor. Once the solution completes the additional variable will lose its delay and take on the current value.

Hemo September 14, 2011 17:20

Edmund, you are a legend! Thanks for your help

marjan September 28, 2011 05:27

Quote:

Originally Posted by singer1812 (Post 311756)
On the surface I don't think this is possible, but really haven't given it much thought. Using 2nd order difference for the derivative, you need to store the 2 previous values. If it is possible you need to get pretty tricky with the oldest value needed.

Hi Dear Edmund
I truly appreciate your kind,according your guess it was not possible until now I hope u could help me more, At first I used Update Loop for temperature and I got old value of this value and then created an expression for first time derivative(dT),now it seems UPDATE LOOP for this expression doesn't work because dTold-dT always is zero!!
What do u think about this problem?
regards

Hemo September 28, 2011 06:26

Marjan,

Perhaps you already know this, but how are you monitoring this value?
At the end of each internal loop, the value of dTold will be effectively discarded.

If you set up a monitor in pre (Output control -> Monitor -> Monitor points and expressions) you should be able to see in solver that dTold takes the value of dT from the previous internal loop and remains constant until convergence has been reached for that time step (while dT will be changing).
However, as it seems that the value of dTold is not stored (and thus any calculations based on it) between time steps, I cannot see how a second derivative in time would be achieved.

marjan October 13, 2011 04:48

Thanks dear Hemo,
you are right and I couldn't find any solution for this problem still, Do u know anyone has used user FORTRAN for getting second time derivative and has succeeded?or are there other ways for this problem?
I will be so thankful if u could help me


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