BUG: potentialFoam/cylinder: indexing into non-existing patch in parallel
[OpenFOAM-2.0.x.git] / bin / foamUpgradeTurbulenceProperties
blobcbdc3fd04577baa6a3ebb8186db01b1efd365841
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 # \\/ M anipulation |
8 #------------------------------------------------------------------------------
9 # License
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
20 # for more details.
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/>.
25 # Script
26 # foamUpgradeTurbulenceProperties
28 # Description
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 #------------------------------------------------------------------------------
38 usage() {
39 cat<<USAGE
41 Usage: ${0##*/} <turbulenceProperties>
43 Where <turbulenceProperties> is the full path to the
44 turbulenceProperties dictionary
46 Note: can upgrade several files at once
48 USAGE
49 exit 1
53 # $1: turbulence model
54 # $2: new properties type
55 # $3: original dictionary
57 convertDict()
59 echo "Identified $1 turbulence model in '$3'"
60 outputPath=`dirname $3`
62 if [ -e "$outputPath/$1Properties" ]
63 then
64 echo "Error: file already exists $outputPath/$1Properties'" 1>&2
65 else
66 sed -e "s/turbulenceProperties/$1Properties/" \
67 -e "s/$2/$1Model/" \
68 -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \
69 $3 > "$outputPath/$1Properties"
71 echo " wrote $outputPath/$1Properties"
75 [ $# -ge 1 ] || usage
77 for turbDict
79 # Identify type of turbulence model and convert
80 if [ -f $turbDict ]
81 then
82 if grep turbulenceModel $turbDict >/dev/null 2>&1
83 then
84 convertDict RAS turbulenceModel $turbDict
85 elif grep LESmodel $turbDict >/dev/null 2>&1
86 then
87 convertDict LES LESmodel $turbDict
88 else
89 echo "Unable to determine turbulence model type in '$turbDict'" 1>&2
90 echo " - nothing changed" 1>&2
92 else
93 echo "Error: file '$turbDict' does not exist" 1>&2
95 done
97 #------------------------------------------------------------------------------