CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

How to pass variable value obtained in iteration n to iteration n+1

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By ghorrocks
  • 1 Post By Opaque
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 11, 2019, 05:56
Default How to pass variable value obtained in iteration n to iteration n+1
  #1
Member
 
phd
Join Date: Oct 2013
Posts: 76
Rep Power: 12
lostking18 is on a distinguished road
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!
lostking18 is offline   Reply With Quote

Old   April 11, 2019, 07:29
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,749
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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).
lostking18 likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   April 11, 2019, 13:56
Default
  #3
Senior Member
 
Join Date: Jun 2009
Posts: 1,825
Rep Power: 33
Opaque will become famous soon enough
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 likes this.
Opaque is offline   Reply With Quote

Old   April 11, 2019, 14:00
Default
  #4
Member
 
phd
Join Date: Oct 2013
Posts: 76
Rep Power: 12
lostking18 is on a distinguished road
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?
lostking18 is offline   Reply With Quote

Old   April 11, 2019, 17:07
Default
  #5
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,749
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
I have no idea, it is not documented. You just have to try it and work it out.
lostking18 likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   April 12, 2019, 06:27
Default
  #6
Member
 
phd
Join Date: Oct 2013
Posts: 76
Rep Power: 12
lostking18 is on a distinguished road
Thanks! I've tried. it works in that way
lostking18 is offline   Reply With Quote

Reply

Tags
additional variables

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Pass variable from programmable filter to Plot Over Line Filter Jack001 ParaView 0 March 29, 2016 13:18
How to pass variable between macros einandr Fluent UDF and Scheme Programming 1 February 5, 2015 06:34
Best way to pass a scalar variable to a runtime selectionnable class? Yann OpenFOAM Programming & Development 0 October 22, 2014 08:53
Pass a variable from a class to a subequation in the main solver lord_kossity OpenFOAM Running, Solving & CFD 0 September 3, 2009 12:03
How to pass a variable from a define macro... Padian FLUENT 2 May 30, 2008 05:22


All times are GMT -4. The time now is 10:51.