Fluent6.1: Scheme function for creating file name based on flow time

If you are saving information during the calculation in the form of files, such as tiff files for animation, then it is desirable that the file name also contains the iteration, time step or flow time at which it was created. Fluent provides operators such as %t and %i using which you can add number of time step or iteration to the file name. But this is not available for flow time.

The scheme function provided below creates a file named 'flow-time-xyz'. Here 'xyz' is the value of flow time. Suppose flow time is 0.0037 seconds then the file name would be 'flow-time-0.0037'. Current scheme only saves the value of flow time in the file 'flow-time-xyz' as an example but this can be changed according to need.
; This scheme function will create a file "flow-time-xyz"
; "xyz" is the current value of flow time in seconds
; Currently this function just appends the current flow time value in this file as an example
; It can be modified according to the use
; To call this function write (fn1) in Solve-> Execute Commands panel and can be called based on require
; We can change filename by changing the value of variable 'name'. Please refer to the line marked with **********

(define (fn1)
(define name "flow-time-") ;; ********** change file name **********
(define fullname (string-append name (number->string (rpgetvar 'flow-time))))
(append-file fullname '(lambda(port)(format port "~an" (rpgetvar 'flow-time)))))

Show Form
No comments yet. Be the first to add a comment!