modeFRONTIER / Gambit-Fluent tutorial: optimization of dimension and position of baffles

Previous Index Next

2.3. Batch creation, analysis and post-processins of a parametric model




In the two previous chapters you have written the Gambit and Fluent input files which create a model, analyze it and write analysis results in ASCII files (Tecplot format).

Now you have to write scripts running Gambit and Fluent in batch and feed applications with input files. Furthermore you have to automatically process Fluent output files in order to compute the pressure difference between inlet and outlet and the flow uniformity at oulet using the values of the pressure and of the velocity of the nodes at inlet and outlet.

To run the batch Gambit session is very easy and you have just to write the following command line:

     gambit -inp gambit_model.jou
It means, run Gambit in batch and execute all operations defined in the input file gambit_model.jou which has already been available.

To run the analysis and write the results in batch is very easy as well and you have just to write the following command line:

     fluent 2d  -i fluent.jou
It means, run Fluent in batch and execute all operations defined in the input file fluent.jou which has already been available.

The last thing to do is to trasform results from Tecplot format into an ASCII file holding the value of the pressure loss and the flow uniformity at outlet. You can develop your own procedure or do the following (read from the file prex_inlet.txt and vel_outlet.txt, process values and write results in the file result.out):

     
	FILE_PREX="prex_inlet.txt"
	FILE_VEL="vel_outlet.txt"
	N_POINT=41

# pressure post processing

	head -33 ${FILE_PREX} | tail -9 | awk 'BEGIN {FS=" "} { printf ("%e\n%e\n%e\n%e\n%e\n",$1,$2,$3,$4,$5)}' | awk '{x++ ; Zamom[x]= $1 } END {for (i=1;i<=x;i++) {ZamomTOT += Zamom[i]} {ZamomAVE = ZamomTOT/'$N_POINT'} ;  printf"%16.8e %16.8e\n",ZamomTOT,ZamomAVE }' > a
	read tot ave < a 

	head -33 ${FILE_PREX} | tail -9 | awk 'BEGIN {FS=" "} { printf ("%e\n%e\n%e\n%e\n%e\n",$1,$2,$3,$4,$5)}' | awk '{x++ ; Zamom[x]= $1 } END {for (i=1;i<=x;i++) {ZamomTOT += ('$ave'-Zamom[i])*('$ave'-Zamom[i])} {ZamomVAR = ZamomTOT/'$N_POINT'} {ZamomSIGMA = sqrt (ZamomVAR)} ;  printf"%16.8e %16.8e %16.8e\n",ZamomTOT,ZamomVAR,ZamomSIGMA }' > b
	read p_tot p_var p_sigma < b 

	rm result.out

	echo "mean pressure               :  $ave"      > result.out
	echo "pressure standard deviation :  $p_sigma" >> result.out


# velocity post processing

	head -33 ${FILE_VEL} | tail -9 | awk 'BEGIN {FS=" "} { printf ("%e\n%e\n%e\n%e\n%e\n",$1,$2,$3,$4,$5)}' |  awk '{x++ ; Zamom[x]= $1 } END {for (i=1;i<=x;i++) {ZamomTOT += Zamom[i]} {ZamomAVE = ZamomTOT/'$N_POINT'} ;  printf"%16.8e %16.8e\n",ZamomTOT,ZamomAVE }' > c
	read tot ave < c 

	head -33 ${FILE_VEL} | tail -9 | awk 'BEGIN {FS=" "} { printf ("%e\n%e\n%e\n%e\n%e\n",$1,$2,$3,$4,$5)}' | awk '{x++ ; Zamom[x]= $1 } END {for (i=1;i<=x;i++) {ZamomTOT += ('$ave'-Zamom[i])*('$ave'-Zamom[i])} {ZamomVAR = ZamomTOT/'$N_POINT'} {ZamomSIGMA = sqrt (ZamomVAR)} ;  printf"%16.8e %16.8e %16.8e\n",ZamomTOT,ZamomVAR,ZamomSIGMA }' > d
	read  v_tot v_var v_sigma < d 

	head -33 ${FILE_VEL} | tail -9 | awk 'BEGIN {FS=" "} { printf ("%16.12f\n%16.12f\n%16.12f\n%16.12f\n%16.12f\n",$1,$2,$3,$4,$5)}' | sort -n -r | head -1 > e
	read v_max < e

	echo "mean velocity               :  $ave"      >> result.out
	echo "velocity standard deviation :  $v_sigma"  >> result.out
	echo "max velocity                :  $v_max"    >> result.out



Previous Top Next

© ES.TEC.O. S.r.l.- ENGIN SOFT TECNOLOGIE PER L'OTTIMIZZAZIONE

Return to modeFRONTIER Index