CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to repeat to read the same case without saving case and data file?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2012, 01:54
Default How to repeat to read the same case without saving case and data file?
  #1
New Member
 
Chenguang Li
Join Date: Sep 2011
Posts: 15
Rep Power: 15
lcg44 is on a distinguished road
Hi, everyone.
I'm trying to do a loop. The velocity of dynamic mesh is adjusted every time step. If the result is not good enough then I need to read the case and data of last good result again to let the mesh back to the beginning of this time step. If the result is good enough then the date and case will be saved.I write a scheme file as following. But the problem is it doesn't read the case again when it has been read. It only calculate 5 step (as I set x max value is 5) after a case file is read in, which means the mesh has kept moving during the 5 steps. It is not I want.
Can you help me to find the problem?

Thank you very much.



yours,
Chenguang
(rp-var-define 'mlcg 1.0 'real #f)
(rp-var-define 'klcg 0.0 'real #f)
(rp-var-define 'nlcg 0.0 'real #f)
(rp-var-define 'setao 1.57 'real #f)
(rp-var-define 'omegao 0.0 'real #f)
(rp-var-define 'domegao 0.0 'real #f)
(rp-var-define 'mo 0.0 'real #f)
(define x 1)
(define y 0)
(format #f "heartvalve~03d~03d" y x)
(do ((x 1 (+ x 1)) ) ((> x 5))
(format #f "heartvalve~03d~03d" y x)
(ti-menu-load-string (format #f "file/read-case-data heartvalve~03d" y))
(ti-menu-load-string "solve/set/time-step 0.00245")
(ti-menu-load-string "solve/dual-time-iterate 1")
(ti-menu-load-string "file/write-case-data heartvalveo")
(if (> (rpgetvar 'mlcg) 0)
(begin
(set! y (+ y 1))
(ti-menu-load-string (format #f "file/write-case-data heartvalve~03d" y)))))
lcg44 is offline   Reply With Quote

Old   November 22, 2012, 02:30
Default RP variables are initialed everytime
  #2
New Member
 
Chenguang Li
Join Date: Sep 2011
Posts: 15
Rep Power: 15
lcg44 is on a distinguished road
Hi, everyone. I add a save command at the end of every time step. Then it can read the case again every time.
But I found these RP variables are initialed every time? Why?
I didn't put the define and initial command in the loop.

Please help me.


yours,
Chenguang
lcg44 is offline   Reply With Quote

Old   November 22, 2012, 03:13
Default RP variables are defined in case file
  #3
New Member
 
Chenguang Li
Join Date: Sep 2011
Posts: 15
Rep Power: 15
lcg44 is on a distinguished road
Now I understand RP variables are defined and saved in case file. Its value are different depending on different cases like pressure, velocity. Is that right?

So my problem is more difficult. Which kind of variables can exist along the FLUENT and keep the stored value until its value is changed. If there is not such kind of variables ,than I can write them to a data file and read them at the beginning of next step.

Is there any better way? I hope somebody can help me.


your,
Chenguang
lcg44 is offline   Reply With Quote

Old   November 22, 2012, 03:34
Default How to transfer the value from a Rp variable to a global variable?
  #4
New Member
 
Chenguang Li
Join Date: Sep 2011
Posts: 15
Rep Power: 15
lcg44 is on a distinguished road
How to transfer the value from a Rp variable to a global variable?
And from a global variable to a Rp variable?
Anyone can give me an answer?
Thank you very much.
lcg44 is offline   Reply With Quote

Old   November 22, 2012, 11:45
Default
  #5
New Member
 
Chenguang Li
Join Date: Sep 2011
Posts: 15
Rep Power: 15
lcg44 is on a distinguished road
Hi, now I add these transfers between rp variables and global variables as following. But there is an error:
Error: %prf-set-var: invalid flonum
Error Object: #[compound-procedure]
what's the problem?

(rp-var-define 'mlcg 0 'real #f)
(rp-var-define 'klcg 0 'real #f)
(rp-var-define 'nlcg 0 'real #f)
(rp-var-define 'setao 0 'real #f)
(rp-var-define 'omegao 0 'real #f)
(rp-var-define 'domegao 0 'real #f)
(rp-var-define 'mo 0 'real #f)
(define x 1)
(define y 0)
(define mg 0)
(define kg 0)
(define ng 0)
(define setag 1.57)
(define omegag 0)
(define domegag 0)
(define mog 0)
(do ((x 1 (+ x 1)) ) ((> x 5))
(ti-menu-load-string (format #f "file/read-case-data heartvalve~05d" y))
(rpsetvar'mlcg mg)
(rpsetvar 'klcg kg)
(rpsetvar 'nlcg ng)
(rpsetvar 'setao setag)
(rpsetvar 'omegao omegag)
(rpsetvar 'domegao domegag)
(rpsetvar 'mo mog)
(ti-menu-load-string "solve/set/time-step 0.00245")
(ti-menu-load-string "solve/dual-time-iterate 1")
(set! mg rpgetvar('mlcg))
(set! kg rpgetvar('klcg))
(set! ng rpgetvar('nlcg))
(set! setag rpgetvar('setao))
(set! omegag rpgetvar('omegao))
(set! domegag rpgetvar('domegao))
(set! mog rpgetvar('mo))
(ti-menu-load-string (format #f "file/write-case-data heartvalve~07d" x))
(if (> (rpgetvar 'mlcg) 0)
(begin
(set! y (+ y 1))
(ti-menu-load-string (format #f "file/write-case-data heartvalve~05d" y)))))
lcg44 is offline   Reply With Quote

Reply


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
Error while saving the case and data file Sri FLUENT 6 September 2, 2015 10:55
read saved case and data error NAD FLUENT 0 November 20, 2012 06:45
FLUENT can not read data file jing113cn FLUENT 0 December 6, 2010 10:06
Changing the grid on the same set-up Katya FLUENT 7 October 8, 2009 17:31
Saving particle (DPM) data to file? Philip FLUENT 2 June 12, 2006 02:41


All times are GMT -4. The time now is 17:34.