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

Get residual in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2012, 14:52
Default Get residual in UDF
  #1
New Member
 
Erica
Join Date: Jul 2012
Location: Mountain View, CA
Posts: 14
Rep Power: 14
Magneto is on a distinguished road
Hi, does anyone know if there's a way to access the most recent residual values in define macros? I'm trying to write an Execute at End macro that checks whether the solution is properly converged or is just moving on to the next time step after reaching its maximum number of iterations.

Thanks!
Magneto is offline   Reply With Quote

Old   June 21, 2016, 04:59
Default
  #2
New Member
 
Join Date: Sep 2015
Posts: 9
Rep Power: 11
H.R.D. is on a distinguished road
Hi,
I am seeking for the same thing!
did you find any way?
H.R.D. is offline   Reply With Quote

Old   June 21, 2016, 06:55
Default
  #3
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by H.R.D. View Post
Hi,
I am seeking for the same thing!
did you find any way?
This is a piece of a code I found on internet. You can use rpsetvar and rpgetvar to obtain the

Code:
(let ((old-rc client-read-case))
(set! client-read-case
(lambda args
(apply old-rc args)
(if (cx-gui?)
(begin
;; Do your customization here
(rpsetvar 'residuals/plot? #t)
(rpsetvar 'residuals/settings '(
(continuity #t 0 #f 0.001)
(x-velocity #t 0 #f 0.001)
(y-velocity #t 0 #f 0.001)
(z-velocity #t 0 #f 0.001)
(energy #t 0 #f 1e-06)
(k #t 0 #f 0.001)
(epsilon #t 0 #f 0.001)))
(rpsetvar 'mom/relax 0.4)
(rpsetvar 'pressure/relax 0.5)
(rpsetvar 'realizable-epsilon? #t)
(cxsetvar 'vector/style "arrow")
;; You can add more settings here
make couple of test and you can solve your problem.
Bruno Machado is offline   Reply With Quote

Old   June 22, 2016, 21:04
Default
  #4
New Member
 
Join Date: Sep 2015
Posts: 9
Rep Power: 11
H.R.D. is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
This is a piece of a code I found on internet. You can use rpsetvar and rpgetvar to obtain the

Code:
(let ((old-rc client-read-case))
(set! client-read-case
(lambda args
(apply old-rc args)
(if (cx-gui?)
(begin
;; Do your customization here
(rpsetvar 'residuals/plot? #t)
(rpsetvar 'residuals/settings '(
(continuity #t 0 #f 0.001)
(x-velocity #t 0 #f 0.001)
(y-velocity #t 0 #f 0.001)
(z-velocity #t 0 #f 0.001)
(energy #t 0 #f 1e-06)
(k #t 0 #f 0.001)
(epsilon #t 0 #f 0.001)))
(rpsetvar 'mom/relax 0.4)
(rpsetvar 'pressure/relax 0.5)
(rpsetvar 'realizable-epsilon? #t)
(cxsetvar 'vector/style "arrow")
;; You can add more settings here
make couple of test and you can solve your problem.
Thanks for your reply.

Do you think there might be any UDF-way? Because I am not good much at Scheme Programming.
H.R.D. is offline   Reply With Quote

Old   June 23, 2016, 09:39
Default
  #5
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by H.R.D. View Post
Thanks for your reply.

Do you think there might be any UDF-way? Because I am not good much at Scheme Programming.
I dont think there is any macro to use directly in your UDF. What you can do is look if there is a RP variable for the scalar, then you can read the variable in your udf by using

RP_Get_Integer("XXXXXXXXXX")
RP_Get_Double("XXXXXXXXXX")
RP_Get_Real("XXXXXXXXXX")
Bruno Machado is offline   Reply With Quote

Old   June 23, 2016, 18:05
Default
  #6
New Member
 
Join Date: Sep 2015
Posts: 9
Rep Power: 11
H.R.D. is on a distinguished road
Thanks a lot!
H.R.D. 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
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 14:40
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 06:24
Differences between serial and parallel runs carsten OpenFOAM Bugs 11 September 12, 2008 12:16
Unknown error sivakumar OpenFOAM Pre-Processing 9 September 9, 2008 13:53


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