CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   How to pass variable value obtained in iteration n to iteration n+1 (https://www.cfd-online.com/Forums/cfx/216546-how-pass-variable-value-obtained-iteration-n-iteration-n-1-a.html)

lostking18 April 11, 2019 05:56

How to pass variable value obtained in iteration n to iteration n+1
 
Hello, guys

I am running a steady state simulation and have defined an additional variable X. If I need to use X obtained in n_th iteration/time-step for the simulation of the n+1_th iteration/time-step, how can I pass/inherit this value, X(n), to the next iteration?

One way I can think of is to run the simulation for just one time step each time and use the correspondingly generated .res file to output the X(n). But clearly this will be extremely computational inefficient. I’m wondering if there is any way that we can pass/inherit the variables between iterations without stopping the simulation. Can User Fortran/Junction Box do that?

Thank you very much!

ghorrocks April 11, 2019 07:29

Yes, that would be very inefficient.

Do a search of the forum for TRANS_LOOP. This is a unsupported feature which allows some variables to be accessed from the previous coefficient loop. But note it is notoriously unstable and does not always work (which is why it is not a supported feature).

Opaque April 11, 2019 13:56

It would great if you can explain why you need access to the previous iteration variable in a steady-state simulation.

In principle, previous values of a non-converged solution do not have great value unless is used for some kind on convergence improvement, so I assume you must be up to something, correct?

lostking18 April 11, 2019 14:00

Hi, Glenn

Thank you very much for your reply. It seems to work for me!
Can I also confirm one thing with you: if I use Trans_loop for my variable X, at the first step will this X use the value of the initial guess? What if in the initial guess X is not define?

ghorrocks April 11, 2019 17:07

I have no idea, it is not documented. You just have to try it and work it out.

lostking18 April 12, 2019 06:27

Thanks! I've tried. it works in that way ;)


All times are GMT -4. The time now is 23:14.