To create transient Ensight case and data files from data files which were saved at discrete time steps.

In FLUENT 6.0.20, transient Ensight case and data files cannot be exported.
If there are case and data files saved at discrete time steps in FL6.0.20, these data files
can be used to generate transient Ensight case and data files. This will save rerunning the simulation
in FL6.1, which has the option of exporting transient case and data files in Ensight format.
Here is a scheme file which will read the case file and then read one by one data
file and export the Ensight data file for each data file which was saved
earlier. The scheme file is developed for FLUENT 6.1.18, and export data for
Ensight Case Gold and writes only one function "Static Pressure". Major part of the scheme file is taken from solution 229.

Following procedure can be used to create the transient Ensight case and data files:

1) Keep the files test1-auto.cas.gz and test1-auto0001.dat.gz, test1-auto0002.dat.gz etc. have been saved at discrete time steps in FLUENT 6.0.20 in the directory along with write-ensg.scm file.
2) Open prerelease version of FLUENT (6.1.18), and read the scheme file.
3) This file will write, auto-ensg*.geo, .vel and .scl1, and .encas files the function written here is static pressure.
4) Create a file "begin", which contains following line:
5) Create a file "end" which contains following line:

Following steps will append all .geo to one .geo file
a)Each .geo file should be modified to match the format of unsteady file using following unix command
cat begin auto-ensg0001.geo end > 1.geo
Repeat this step for all the .geo files, which were written using the scheme file.
b)Let say with each cat command files like 1.geo, 2.goe #.geo were created, to append
all these files to a single file use following command:
cat 1.geo 2.geo 3.geo ..... #.geo > append.geo

Steps a and b should be performed for all the .vel and .scl1, .scl2 if any.
Finally there will be one .geo file, .vel file and .scl1, .scl2 files.
File .encas should be created manually, which will correspond to the format of file written out by FLUENT for Ensight case.

After doing all the above steps file test.encas, test.geo, test.vel, test.scl1 and test.scl2
can be used to read in Ensight or if these files are need to be further appended, then
it can be done through FLUENT by selecting the Transient option in Export panel, specify test under File Name.
************************Scheme File****************************
;; This scheme program reads automaticaly the data files stored
;; from an unsteady simulation.
;; Usually the data files names are composed both, by an alphabetical
;; string (constant for all the files) and a numerical string
;; that changes from one file to another based on some rule, e.g.,
;; the number at the end of the data file name could indicate
;; the timestep number
;; This code takes the following files as input:
;; filename.cas
;; filename5.dat
;; filename10.dat
;; filename15.dat
;; ... etc.
;; (where the user is allowed to specify a different name in
;; place of "filename")
;; The code creates an animation by preparing a hardcopy of the exact
;; same view of with each data file.

;; Test it with tutorial number 18

;; STEPS to follow:
;; 1. Edit values in the following code as indicated at seven places
;; 2. Launch a Fluent session. Read your case file. Read the first
;; data filie
;; 3. Through the DISPLAY menu, display contour plot, etc. that
;; you want to create an animation of and set the desired view
;; in the graphics window.
;; 4. Through FILE->READ->SCHEME read this scheme file

;;; FIRST value to be modified by user ;;;;;
;; Number of dat files you want to use
(define iMax 5)
;;;; SECOND value to be modified by user ;;;;
;; Autosave-step that has been set in the case file
;; i.e. the increment between the numerical suffixes of
;; two consecutive data files
(define autosavestep 1)

;;;; THIRD value to be modified by user ;;;;
;; The numerical suffix of the first data file
(define num 0000)

;;;; FOURTH value to be modified by the user ;;;;
;; The length of the numerical suffix of each data file
;; E.g. if your data file has suffixes such as
;; 0012 and 0013 then the numlength is 4
;; NOTE: numlength can only have the values: 1, 2, 3, or 4
(define numlength 4)

;;;; FIFTH value to be modified by user ;;;;
;; Beginning of the data filename.
(define string1 "test1-auto")

;;;; SIXTH value to be modified by user ;;;;
;; Beginning of the output filename.
(define string6 "auto-ensg")

;;;; SEVENTH value to be modified by user ;;;;
;; change this to the extension of your case and data
;; files. If the files are not compressed the
;; extensions will be .cas and .dat If they are
;; compressed (unix) the extensions could be
;; .cas.gz and .dat.gz
;; Also change the name of the output file name
;; to what you want e.g. .tif or .tiff
;; (NOTE: .jpg, .gif, etc. will not work)
(define string3 ".cas.gz")
(define string4 ".dat.gz")
(define string5 ".tiff")
(define zer 0)
(define string0 (number->string zer))
(define string00 (string-append (number->string zer) string0))
(define string000 (string-append string00 string0))
(define string0000 (string-append string000 string0))
;; FileNameDat = string1 + string2 + string4
;; **********************************************
;; Example:
;; FileNameDat = slide1005.dat.gz
;; **********************************************

(define FileNameCas (string-append string1 string3))
(cx-gui-do cx-activate-item "MenuBar*ReadSubMenu*Case...")
(cx-gui-do cx-activate-item "Select File*Apply")
(cx-gui-do cx-set-text-entry "Select File*Text" FileNameCas)
(cx-gui-do cx-activate-item "Select File*OK")

(do ((i 0 (+ i 1)))
((= i iMax))
(set! num (+ num autosavestep))
(display num)
(display "n")
(display i)
(define string2 (number->string num))

(define FileNameDat "temporary")

(if (= numlength 1) (set! FileNameDat (string-append string1 string2 string4)))
(if (= numlength 2)
(if (< num 10) (set! FileNameDat (string-append string1 string0 string2 str
(set! FileNameDat (string-append string1 string2 string4))
(if (= numlength 3)
(if (< num 10) (set! FileNameDat (string-append string1 string00 string2 st
(if (< num 100) (set! FileNameDat (string-append string1 string0 string
2 string4))
(set! FileNameDat (string-append string1 string2 string
(if (= numlength 4)
(if (< num 10) (set! FileNameDat (string-append string1 string000 string2 s
(if (< num 100) (set! FileNameDat (string-append string1 string00 strin
g2 string4))
(if (< num 1000) (set! FileNameDat (string-append string1 string0 s
tring2 string4))
(set! FileNameDat (string-append string1 string2 s

(cx-gui-do cx-activate-item "MenuBar*ReadSubMenu*Data...")
(cx-gui-do cx-activate-item "Select File*Apply")
(cx-gui-do cx-set-text-entry "Select File*Text" FileNameDat)
(cx-gui-do cx-activate-item "Select File*OK")

(define GraphicFileName "tempg")

(if (= numlength 1) (set! GraphicFileName (string-append string6 string2 )))
(if (= numlength 2)
(if (< num 10) (set! GraphicFileName (string-append string6 string0 string2
(set! GraphicFileName (string-append string6 string2 ))
(if (= numlength 3)
(if (< num 10) (set! GraphicFileName (string-append string6 string00 string
2 ))
(if (< num 100) (set! GraphicFileName (string-append string6 string0 st
ring2 ))
(set! GraphicFileName (string-append string6 string2 ))
(if (= numlength 4)
(if (< num 10) (set! GraphicFileName (string-append string6 string000 string2 ))
(if (< num 100) (set! GraphicFileName (string-append string6 string00 string2 ))
(if (< num 1000) (set! GraphicFileName (string-append string6 string0 string2 ))
(set! GraphicFileName (string-append string6 string2 ))

;;This part can be modified to write more functions
(cx-gui-do cx-activate-item "MenuBar*FileMenu*Export...")
(cx-gui-do cx-set-toggle-button "Export*Frame1(File Type)*ToggleBox1(File Type)*Fieldview Case+Data" #t)
(cx-gui-do cx-activate-item "Export*Frame1(File Type)*ToggleBox1(File Type)*Fieldview Case+Data")
(cx-gui-do cx-set-toggle-button "Export*Frame1(File Type)*ToggleBox1(File Type)*EnSight Case Gold" #f)
(cx-gui-do cx-activate-item "Export*Frame1(File Type)*ToggleBox1(File Type)*EnSight Case Gold")
(cx-gui-do cx-set-toggle-button "Export*Frame2()*Table2()*Frame7(Format)*ToggleBox7(Format)*Binary" #t)
(cx-gui-do cx-activate-item "Export*Frame2()*Table2()*Frame7(Format)*ToggleBox7(Format)*Binary")
(cx-gui-do cx-set-toggle-button "Export*Frame2()*Table2()*Frame7(Format)*ToggleBox7(Format)*ASCII" #f)
(cx-gui-do cx-activate-item "Export*Frame2()*Table2()*Frame7(Format)*ToggleBox7(Format)*ASCII")
(cx-gui-do cx-set-list-selections "Export*Frame2()*Table2()*Frame5*List5(Functions to Write)" '( 0))
(cx-gui-do cx-activate-item "Export*Frame2()*Table2()*Frame5*List5(Functions to Write)")
(cx-gui-do cx-activate-item "Export*PanelButtons*PushButton1(OK)")
(cx-gui-do cx-set-text-entry "Select File*FilterText" "*")
(cx-gui-do cx-activate-item "Select File*Apply")
(cx-gui-do cx-set-text-entry "Select File*Text" GraphicFileName)
(cx-gui-do cx-activate-item "Select File*OK")
(cx-gui-do cx-activate-item "Export*PanelButtons*PushButton1(Cancel)")



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