2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
8 #------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 # foamUpgradeTurbulenceProperties
29 # Upgrade the turbulenceProperties dictionary to the new format employed
30 # in OpenFOAM version 1.5
31 # - RAS turbulence models now defined by the RASProperties dictionary,
32 # and RASModel keyword.
33 # - LES turbulence models now defined by the LESProperties dictionary,
34 # and LESModel keyword.
36 #------------------------------------------------------------------------------
41 usage: ${0##*/} <turbulenceProperties>
43 Where <turbulenceProperties> is the full path to the
44 turbulenceProperties dictionary
46 Note: can upgrade several files at once
53 # $1: turbulence model
54 # $2: new properties type
55 # $3: original dictionary
59 echo "Identified $1 turbulence model in '$3'"
60 outputPath
=`dirname $3`
62 if [ -e "$outputPath/$1Properties" ]
64 echo "Error: file already exists $outputPath/$1Properties'" 1>&2
66 sed -e "s/turbulenceProperties/$1Properties/" \
68 -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \
69 $3 > "$outputPath/$1Properties"
71 echo " wrote $outputPath/$1Properties"
79 # Identify type of turbulence model and convert
82 if grep turbulenceModel
$turbDict >/dev
/null
2>&1
84 convertDict RAS turbulenceModel
$turbDict
85 elif grep LESmodel
$turbDict >/dev
/null
2>&1
87 convertDict LES LESmodel
$turbDict
89 echo "Unable to determine turbulence model type in '$turbDict'" 1>&2
90 echo " - nothing changed" 1>&2
93 echo "Error: file '$turbDict' does not exist" 1>&2
97 #------------------------------------------------------------------------------