A.5 Authors Software
A.5.1 Shell Scripts
All Shell scripts written for the project. The shell scripts are all executed from a Linux Shell by navigating to the folder containing the script and executing the command: ./ScriptName.sh. FullDataTreatment.sh : This script executes all other scripts for the postprocessing phase. The scripts must be placed as illustrated on figure 4.1 for the shell script to work.
# A s h e l l s c r i p t f o r executing the f u l l post p r o c e s s i n g procedure on a
# CFD- s i m u l a t i o n using Nektar++ f o r the Master Thesis :
# " Advanced CFD- Techiques f o r i d e n t i f i c a t i o n o f s t r u c t u r e s in f l o w s "
## Requirements f o r execution o f the s c r i p t :
## S h e l l s c r i p t s :
# NektarPP . sh
# DomainCropping . sh
# ZeroContour_CriticalPoints . sh
# VorticityExtremaType . sh
# C r i t i c a l P o i n t T r a c e . sh
#
# C++ Programs :
# DomainCropper
#
# Python s c r i p t s :
# ContourAndCriticalPoints . py
# C r i t i c a l P o i n t I d e n t i f i c a t i o n . py
# VTUFormatPointDataCombiner . py
#
# Nektar++ programs :
# C a l c V o r t i c i t y
# CalcGrad
# FldToVtk
## Execution : From Linux S h e l l in the f o l d e r where FullDataTreatment . sh i s placed
# Command: . / FullDataThreatment . sh
##
## Nektar++ Post P r o c e s s i n g . / S h e l l S c r i p t s /NektarPP . sh
## Domain Cropping
. / S h e l l S c r i p t s /DomainCropping . sh
## Q_x = 0 Contour and V o r t i c i t y C r i t i c a l Points . / S h e l l S c r i p t s / ZeroContour_CriticalPoints . sh
## C r i t i c a l Point Type I d e n t i f i c a t i o n . / S h e l l S c r i p t s / VorticityExtremaType . sh
## Tracing the d i f f e r e n t types o f c r i t i c a l p o i n t s . / S h e l l S c r i p t s / C r i t i c a l P o i n t T r a c e . sh
## Arranging f i l e s in s u b f o l d e r s mkdir . . / D a t a f i l e s / FullDataCropped mkdir . . / D a t a f i l e s / ContourVorticityXZero mkdir . . / D a t a f i l e s / V o r t i c i t y C r i t i c a l P o i n t s mkdir . . / D a t a f i l e s / CriticalP ointT ype mkdir . . / D a t a f i l e s / C r i t i c a l P o i n t T r a c e
mv . . / D a t a f i l e s /∗ _cropped . vtu . . / D a t a f i l e s / FullDataCropped /
mv . . / D a t a f i l e s /∗ _Filtered_Contour_QxZero_Vorticity . vtp . . / D a t a f i l e s / ContourVorticityXZero /
mv . . / D a t a f i l e s /∗ _Extrema_Vorticity . vtp . . / D a t a f i l e s / V o r t i c i t y C r i t i c a l P o i n t s / mv . . / D a t a f i l e s /∗_Maxima . vtu . . / D a t a f i l e s / Cri tic alPo int Ty pe /
mv . . / D a t a f i l e s /∗_Minima . vtu . . / D a t a f i l e s / C rit ic alPoi ntTy pe / mv . . / D a t a f i l e s /∗ _Saddle . vtu . . / D a t a f i l e s / Critic al Poi nt Ty pe / mv . . / D a t a f i l e s /∗_Trace . vtu . . / D a t a f i l e s / C r i t i c a l P o i n t T r a c e /
NektarPP.sh : This script executes allNektar++based postprocessing. It is important to modify the script by providing the correct path to theNektar++ programs used.
## This s h e l l s c r i p t e x e c u t e s Nektar++ post p r o c e s s i n g programs which
## c a l c u l a t e s the v o r t i c i t y as w e l l as i t s g r a d i e n t and h e s s i a n matrix .
## F i n a l l y the r e s u l t i n g . f l d f i l e c o n t a i n i n g a l l f i e l d s i s converted to a . vtu
A.5 Authors Software A APPENDIX
## f i l e f o r f u r t h e r post p r o c e s s i n g in Paraview .
##
## WARNING: Only one ( the c o r r e c t ) . xml f i l e i s allowed to be p r e s e n t in the f o l d e r
## WARNING: Only the . chk f i l e s r e l a t e d to the . xml f i l e i s allowed to be p r e s e n t
## WARNING: Use t h i s s c r i p t only f o r 2D- NavierStokes s o l u t i o n s from Nektar++
## c o n t a i n i n g the f i e l d s u , v , p in that order .
##
# Removing any s t r a y . f l d f i l e s in the raw data f o l d e r rm . . / D a t a f i l e s / ∗ . f l d
#### Nektar++ programs ####
# The l o c a t i o n o f your nektar++ v o r t i c i t y c o n v e r t e r
## WARNING: must be changed to f i t your system ##
CONVERTER=/home/rasmus/ Nektar++/b u i l d s / u t i l i t i e s / PostProcessing / Extras / C a l c V o r t i c i t y
## WARNING: must be changed to f i t your system ##
# The l o c a t i o n o f your nektar++ g r a d i e n t c a l c u l a t o r
## WARNING: must be changed to f i t your system ##
CONVERTER2=/home/rasmus/ Nektar++/b u i l d s / u t i l i t i e s / PostProcessing / Extras / CalcGrad
## WARNING: must be changed to f i t your system ##
# the l o c a t i o n o f the FldToVtk r o u t i n e to convert a l l the r e s u l t i n g f l d - f i e l s
# to . vtu format
## WARNING: must be changed to f i t your system ##
CONVERTER3=/home/rasmus/ Nektar++/b u i l d s / u t i l i t i e s / PostProcessing /FldToVtk
## WARNING: must be changed to f i t your system ##
#### Nektar++ programs ####
#### C a l c u l a t i o n o f V o r t i c i t y ####
# The chk f i l e s
CHK=../ D a t a f i l e s / ∗ . chk
# The xml f i l e needed to do the c o n v e r s i o n XML=../ D a t a f i l e s / ∗ . xml
# The c o n v e r s i o n to new . f l d f i l e s c o n t a i n i n g the v o r t i c i t y f o r f in $CHK
do$CONVERTER $XML $ f rm $ f
done
#### C a l c u l a t i o n o f V o r t i c i t y ####
#### C a l c u l a t i o n o f the g r a d i e n t o f the V o r t i c i t y ####
# The newly c r e a t e d . f l d f i l e s now c o n t a i n i n g the v o r t i c i t i e s FLD=../ D a t a f i l e s / ∗ . f l d
# The f i e l d which g r a d i e n t i s to be c a l c u l a t e d FIELDNR=3
# The c o n v e r s i o n to new . f l d f i l e s c o n t a i n i n g the g r a d i e n t o f the v o r t i c i t y
f o r f in $FLD
do$CONVERTER2 $FIELDNR $XML $ f rm $ f
done
#### C a l c u l a t i o n o f the g r a d i e n t o f the V o r t i c i t y ####
#### C a l c u l a t i n g the g r a d i e n t o f each component o f the v o r t i c i t y g r a d i e n t ####
# The newly c r e a t e d . f l d f i l e s now c o n t a i n i n g the v o r t i c i t y and i t s g r a d i e n t
# the ( x , y ) - plane .in FLD2=../ D a t a f i l e s / ∗ . f l d
# The f i e l d f o r which the g r a d i e n t i s to be c a l c u l a t e d FIELDNR2=4
# The c o n v e r s i o n to new . f l d f i l e s c o n t a i n i n g the g r a d i e n t o f u f o r f in $FLD2
do$CONVERTER2 $FIELDNR2 $XML $ f rm $ f
done
# The newly c r e a t e d . f l d f i l e s now c o n t a i n i n g the v o r t i c i t y , i t s g r a d i e n t in
# the ( x , y ) - plane and the g r a d i e n t o f the f i r s t component o f the v o r t i c i t y g r a d i e n t
FLD3=../ D a t a f i l e s / ∗ . f l d FIELDNR3=5
# The c o n v e r s i o n to new . f l d f i l e s c o n t a i n i n g the g r a d i e n t o f v f o r f in $FLD3
do
$CONVERTER2 $FIELDNR3 $XML $ f rm $ f
done
#### C a l c u l a t i n g the g r a d i e n t o f each component o f the v o r t i c i t y g r a d i e n t ####
#### Converting the r e s u l t i n g . f l d f i l e s to . vtu format ####
FLD6=../ D a t a f i l e s / ∗ . f l d
$CONVERTER3 $XML $FLD6
# Cleaning up the . f l d f i l e s rm . . / D a t a f i l e s / ∗ . f l d
#### Converting the r e s u l t i n g . f l d f i l e s to . vtu format ####
DomainCropping.sh : This script executes the C++ program DomainCropper. The script should be modified with the dimensions desired for the cropping.
## S h e l l s c r i p t which e x e c u t e s the C++ program : DomainCropper f o r each o f
## a s e t o f . vtu f i l e s . DomainCropper crops the data in the . vtu f i l e by
## removing elements with no c o o r d i n a t e s i n s i d e the t h r e e i n t e r v a l s :
A.5 Authors Software A APPENDIX
## [ x_min , x_max ] , [ y_min , y_max ] , [ z_min , z_max ] . I t then outputs a new
## . vtu f i l e in the same format without the cropped data .
## WARNING: Set the input parameters to CONVERTER as d e s i r e d X_min=- 2
X_max=10 Y_min=0 Y_max=4 Z_min=- 1 Z_max=1
# The . vtu f i l e s needing cropping VTUCROP=../ D a t a f i l e s / ∗ . vtu
# The l o c a t i o n o f the C++ domain cropping program .
## WARNING: must be changed to f i t your system ##
CONVERTER=./C++Programs/DomainCropper
## WARNING: must be changed to f i t your system ##
# The cropping o f each o f the . vtu f i l e s f o r f in $VTUCROP
do$CONVERTER $ f $X_min $X_max $Y_min $Y_max $Z_min $Z_max rm $ f
done
ZeroContour_CriticalPoints.sh : The script calls the python script ContourAnd-CriticalPoints.pyfor all .vtufiles for a simulation.
#! / bin / sh
# A s e t o f . vtu f i l e s c o n t a i n i n g the f i e l d s
# [ ' u ' , ' v ' , 'p ' , 'Qz ' , 'Qz_x ' , 'Qz_y ' , 'Qz_x_x' , 'Qz_x_y' , 'Qz_y_x' , 'Qz_y_y
# in t h i s order are run through the python s c r i p t to e x t r a c t the' ]
# Qz_x = 0 contour and v o r t i c i t y extrema (Qz_x , Qz_y) = ( 0 , 0 )
# to two s e r i e s o f . vtp f i l e s
# The . vtu f i l e s needing e x t r a c t i o n VTUEXTRACT=../ D a t a f i l e s /∗ _cropped . vtu
# The l o c a t i o n o f the Paraview based python s c r i p t .
## WARNING: must be changed to f i t your system ##
CONVERTER2=./ PythonScripts / ContourAndCriticalPoints . py
## WARNING: must be changed to f i t your system ##
f o r f in $VTUEXTRACT
dopython $CONVERTER2 vtp $ f done
VorticityExtremaType.sh : The script calls the python script CriticalPonitIdenti-fication.py for all .vtufiles containing extrema data for a simulation.
#! / bin / sh
## Copy t h i s s h e l l s c r i p t along with the e x e c u t e a b l e f i l e
## " C r i t i c a l P o i n t T y p e I d e n t i f i c a t i o n . py " to the f o l d e r c o n t a i n i n g your . vtp f i l e s
## with v o r t i c i t y extrema and run i t to obtain t h r e e s e t s o f f i l e s c o n t a i n i n g
## the C r i t i c a l p o i n t s which are saddles , maxima and minima r e s p e c t i v e l y .
# The _Contour_Extrema_Vorticity . vtp f i l e s are run through the python s c r i p t to
# e x t r a c t the extremas o f each o f the t h r e e d i f f e r e n t types to one f i l e each .
# The . vtu f i l e s needing e x t r a c t i o n
VTPEXTRACT=../ D a t a f i l e s /∗ _Extrema_Vorticity . vtp
# The l o c a t i o n o f the Paraview based python s c r i p t to be executed
## WARNING: must be changed to f i t your system ##
CONVERTER2=./ PythonScripts / C r i t i c a l P o i n t I d e n t i f i c a t i o n . py
## WARNING: must be changed to f i t your system ##
f o r f in $VTPEXTRACT
dopython $CONVERTER2 vtu $ f done
CriticalPointTrace.sh : The script calls the python script VTUFormatPointData-Combiner.pyfor all .vtufiles containing data for minima, maxima and saddles.
#! / bin / sh
## WRITE DOCUMENTATION
# The _Contour_Extrema_Vorticity . vtp f i l e s are run through the python s c r i p t
# e x t r a c t the extremas o f each o f the t h r e e d i f f e r e n t types to one f i l e each .to
# The . vtp f i l e s used f o r t r a c i n g VTUMAXIMA=../ D a t a f i l e s /∗_Maxima . vtu VTUMINIMA=../ D a t a f i l e s /∗_Minima . vtu VTUSADDLE=../ D a t a f i l e s /∗ _Saddle . vtu
# The l o c a t i o n o f the VTU f i l e combiner
## WARNING: must be changed to f i t your system ##
CONVERTER2=./ PythonScripts /VTUFormatPointDataCombiner . py
## WARNING: must be changed to f i t your system ##
python $CONVERTER2 $VTUMAXIMA python $CONVERTER2 $VTUMINIMA python $CONVERTER2 $VTUSADDLE
A.5 Authors Software A APPENDIX