Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
334caa50
Commit
334caa50
authored
Oct 12, 2017
by
Mark OLESEN
Browse files
TUT: script cleanup, provide cleanCase0 for commonly used operation
parent
58d09dd5
Changes
460
Hide whitespace changes
Inline
Side-by-side
applications/utilities/surface/surfaceBooleanFeatures/Allwmake
View file @
334caa50
...
...
@@ -15,4 +15,4 @@ fi
wmake
#
-----------------------------------------------------------------
end-of-file
#
-------------
-----------------------------------------------------------------
bin/foamCleanTutorials
View file @
334caa50
...
...
@@ -30,9 +30,7 @@
# and all its subdirectories.
#
#------------------------------------------------------------------------------
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
thisScript
=
$0
if
[
"/
${
thisScript
#/
}
"
!=
"
$thisScript
"
]
...
...
bin/foamRunTutorials
View file @
334caa50
...
...
@@ -30,19 +30,18 @@
# and all its subdirectories.
#
#------------------------------------------------------------------------------
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
# Normally use standard "make"
make
=
"make"
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
thisScript
=
$0
if
[
"/
${
thisScript
#/
}
"
!=
"
$thisScript
"
]
then
thisScript
=
"
$PWD
/
$thisScript
"
fi
unset
passArgs runTests
skipFirst
=
false
# Parse options
...
...
@@ -52,16 +51,15 @@ do
-t
|
-test
)
passArgs
=
"-test"
runTests
=
true
shift
;;
-s
|
-skipFirst
)
skipFirst
=
true
shift
;;
*
)
break
;;
esac
shift
done
# If an argument is supplied do not execute ./Allrun to avoid recursion
...
...
bin/tools/CleanFunctions
View file @
334caa50
...
...
@@ -31,7 +31,7 @@
cleanTimeDirectories
()
{
echo
"Cleaning
$PWD
case
"
echo
"Cleaning
case
$PWD
"
zeros
=
""
while
[
${#
zeros
}
-lt
8
]
do
...
...
@@ -105,15 +105,13 @@ cleanCase()
cleanSnappyFiles
rm
-f
0/cellDist
>
/dev/null 2>&1
if
[
-d
constant
]
then
(
cd
constant
&&
\
rm
-rf
\
cellDecomposition cellToRegion cellLevel
*
pointLevel
*
\
polyMesh tetDualMesh
\
>
/dev/null 2>&1
\
)
fi
(
cd
constant 2>/dev/null
&&
\
rm
-rf
\
cellDecomposition cellToRegion cellLevel
*
pointLevel
*
\
polyMesh tetDualMesh
\
>
/dev/null 2>&1
\
)
if
[
-e
system/blockMeshDict.m4
]
then
...
...
@@ -122,9 +120,17 @@ cleanCase()
}
# Frequently used - cleanCase and rm -rf 0/
cleanCase0
()
{
cleanCase
rm
-rf
0
}
removeCase
()
{
echo
"Removing
${
1
:-
unknown
}
case
"
echo
"Removing
case
${
1
:-
unknown
}
"
[
"$#"
-ge
1
]
&&
rm
-rf
"
$1
"
}
...
...
@@ -143,7 +149,7 @@ cleanUcomponents()
cleanApplication
()
{
echo
"Cleaning
$PWD
application"
echo
"Cleaning application
$PWD
"
wclean
}
...
...
bin/tools/RunFunctions
View file @
334caa50
...
...
@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2015-201
6
OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2015-201
7
OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
...
...
@@ -43,6 +43,7 @@ isParallel()
return
1
}
#
# Look for '-test' in the argument list.
#
...
...
@@ -52,6 +53,7 @@ isTest()
return
1
}
#
# Extract 'numberOfSubdomains' from system/decomposeParDict
# (or alternative location).
...
...
@@ -100,120 +102,139 @@ getApplication()
fi
}
#
# Run given application in serial with logfile output.
# The preexistence of the log file prevents rerunning.
#
runApplication
()
{
APP_RUN
=
LOG_IGNORE
=
false
LOG_APPEND
=
false
LOG_SUFFIX
=
# Parse options and executable
while
[
$#
-gt
0
]
&&
[
-z
"
$APP_RUN
"
]
;
do
key
=
"
$1
"
case
"
$key
"
in
-append
|
-a
)
LOG_IGNORE
=
true
LOG_APPEND
=
true
local
appRun logFile logMode
# Any additional parsed arguments (eg, decomposeParDict)
local
appArgs
# Parse options until executable is encountered
while
[
$#
-gt
0
-a
-z
"
$appRun
"
]
do
case
"
$1
"
in
-a
|
-append
)
logMode
=
append
;;
-overwrite
|
-o
)
LOG_IGNORE
=
tru
e
-o
|
-overwrite
)
logMode
=
overwrit
e
;;
-suffix
|
-s
)
LOG_SUFFIX
=
".
$2
"
-s
|
-suffix
)
logFile
=
".
$2
"
shift
;;
-decomposeParDict
)
appArgs
=
"
$appArgs
$1
$2
"
shift
;;
''
)
;;
*
)
APP_RUN
=
"
$key
"
APP_NAME
=
"
${
key
##*/
}
"
LOG_SUFFIX
=
"
${
APP_NAME
}${
LOG_SUFFIX
}
"
appRun
=
"
$1
"
;;
esac
shift
done
if
[
-f
log.
$LOG_SUFFIX
]
&&
[
"
$LOG_IGNORE
"
=
"false"
]
local
appName
=
"
${
appRun
##*/
}
"
logFile
=
"log.
$appName$logFile
"
if
[
-f
"
$logFile
"
-a
-z
"
$logMode
"
]
then
echo
"
$
APP_NAME
already run on
$PWD
:"
\
"remove log file 'log
.
$LOG_SUFFIX
' to re-run"
echo
"
$
appName
already run on
$PWD
:"
\
"remove log file '
$
log
File
' to re-run"
else
echo
"Running
$APP_RUN
on
$PWD
"
if
[
"
$LOG_APPEND
"
=
"true"
]
;
then
$APP_RUN
"
$@
"
>>
log.
$LOG_SUFFIX
2>&1
echo
"Running
$appRun
on
$PWD
"
if
[
"
$logMode
"
=
append
]
then
$appRun
$appArgs
"
$@
"
>>
$logFile
2>&1
else
$
APP_RUN
"
$@
"
>
log
.
$LOG_SUFFIX
2>&1
$
appRun
$appArgs
"
$@
"
>
$
log
File
2>&1
fi
fi
}
#
# Run given application in parallel with logfile output.
# The preexistence of the log file prevents rerunning.
#
runParallel
()
{
APP_RUN
=
LOG_IGNORE
=
false
LOG_APPEND
=
false
LOG_SUFFIX
=
# Store any parsed additional arguments e.g. decomposeParDict
APP_PARARGS
=
# Initialise number of procs to unset value
nProcs
=
-1
# Parse options and executable
while
[
$#
-gt
0
]
&&
[
-z
"
$APP_RUN
"
]
;
do
key
=
"
$1
"
case
"
$key
"
in
-append
|
-a
)
LOG_IGNORE
=
true
LOG_APPEND
=
true
local
appRun logFile logMode nProcs
# Any additional parsed arguments (eg, decomposeParDict)
local
appArgs
=
"-parallel"
# Parse options until executable is encountered
while
[
$#
-gt
0
-a
-z
"
$appRun
"
]
do
case
"
$1
"
in
-a
|
-append
)
logMode
=
append
;;
-overwrite
|
-o
)
LOG_IGNORE
=
tru
e
-o
|
-overwrite
)
logMode
=
overwrit
e
;;
-suffix
|
-s
)
LOG_SUFFIX
=
".
$2
"
-s
|
-suffix
)
logFile
=
".
$2
"
shift
;;
-n
p
|
-n
)
-n
|
-n
p
)
nProcs
=
"
$2
"
shift
;;
-decomposeParDict
)
appArgs
=
"
$appArgs
$1
$2
"
nProcs
=
$(
getNumberOfProcessors
"
$2
"
)
APP_PARARGS
=
"
$APP_PARARGS
-decomposeParDict
$2
"
shift
;;
''
)
;;
*
)
APP_RUN
=
"
$key
"
APP_NAME
=
"
${
key
##*/
}
"
LOG_SUFFIX
=
"
${
APP_NAME
}${
LOG_SUFFIX
}
"
appRun
=
"
$1
"
;;
esac
shift
done
[
"
$nProcs
"
-eq
-1
]
&&
nProcs
=
$(
getNumberOfProcessors system/decomposeParDict
)
[
-n
"
$nProcs
"
]
||
nProcs
=
$(
getNumberOfProcessors system/decomposeParDict
)
if
[
-f
log.
$LOG_SUFFIX
]
&&
[
"
$LOG_IGNORE
"
=
"false"
]
local
appName
=
"
${
appRun
##*/
}
"
logFile
=
"log.
$appName$logFile
"
if
[
-f
"
$logFile
"
-a
-z
"
$logMode
"
]
then
echo
"
$
APP_NAME
already run on
$PWD
:"
\
"remove log file 'log
.
$LOG_SUFFIX
' to re-run"
echo
"
$
appName
already run on
$PWD
:"
\
"remove log file '
$
log
File
' to re-run"
else
echo
"Running
$APP_RUN
in parallel on
$PWD
using
$nProcs
processes"
if
[
"
$LOG_APPEND
"
=
"true"
]
;
then
(
mpirun
-np
$nProcs
$APP_RUN
$APP_PARARGS
-parallel
"
$@
"
< /dev/null
>>
log.
$LOG_SUFFIX
2>&1
)
echo
"Running
$appRun
(
$nProcs
processes) on
$PWD
"
if
[
"
$logMode
"
=
append
]
then
(
mpirun
-np
$nProcs
$appRun
$appArgs
"
$@
"
</dev/null
>>
$logFile
2>&1
)
else
(
mpirun
-np
$nProcs
$APP_RUN
$APP_PARARGS
-parallel
"
$@
"
< /dev/null
>
log.
$LOG_SUFFIX
2>&1
)
(
mpirun
-np
$nProcs
$appRun
$appArgs
"
$@
"
</dev/null
>
$logFile
2>&1
)
fi
fi
}
compileApplication
()
{
echo
"Compiling
$1
application"
wmake
$1
}
#
# cloneCase srcDir dstDir
#
...
...
@@ -249,6 +270,7 @@ cloneCase()
return
0
}
#
# cloneParallelCase srcDir dstDir [...times]
#
...
...
@@ -312,6 +334,7 @@ cloneParallelCase()
return
0
}
# Overwrite 0/ with the contents of 0.orig/ if it exists.
# The -processor option to do the processor directories instead
#
...
...
@@ -338,4 +361,5 @@ restore0Dir()
fi
}
#------------------------------------------------------------------------------
src/mesh/Allwmake
View file @
334caa50
...
...
@@ -8,4 +8,4 @@ wmake $targetType snappyHexMesh
wmake
$targetType
blockMesh
wmake
$targetType
extrudeModel
#
-----------------------------------------------------------------
end-of-file
#
-------------
-----------------------------------------------------------------
tutorials/DNS/dnsFoam/boxTurb16/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
cleanCase
rm
-f
0/enstrophy
...
...
tutorials/DNS/dnsFoam/boxTurb16/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
runApplication blockMesh
runApplication boxTurb
...
...
tutorials/IO/fileHandler/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
cleanCase
...
...
tutorials/IO/fileHandler/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
runApplication blockMesh
...
...
tutorials/IO/fileHandler/Alltest
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
# Reset the controlDict
if
[
-f
system/controlDict.orig
]
...
...
tutorials/basic/laplacianFoam/flange/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
cleanCase
rm
-rf
Fieldview
>
/dev/null 2>&1
...
...
tutorials/basic/laplacianFoam/flange/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
runAnsysToFoam
()
{
...
...
tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
cleanCase0
cleanCase
rm
-f
constant/polyMesh/boundary
rm
-f
constant/polyMesh/zoneID
rm
-rf
0
#------------------------------------------------------------------------------
tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
./Allrun.pre
...
...
tutorials/basic/overLaplacianDyMFoam/heatTransfer/Allrun.pre
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
runApplication blockMesh
...
...
tutorials/basic/potentialFoam/cylinder/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cleanCase
rm
-rf
0
cleanCase0
#------------------------------------------------------------------------------
tutorials/basic/potentialFoam/cylinder/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
restore0Dir
runApplication blockMesh
...
...
tutorials/basic/potentialFoam/pitzDaily/Allclean
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
# Source tutorial clean functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
cleanCase
rm
-rf
0
cleanCase0
#------------------------------------------------------------------------------
tutorials/basic/potentialFoam/pitzDaily/Allrun
View file @
334caa50
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
restore0Dir
runApplication blockMesh
...
...
Prev
1
2
3
4
5
…
23
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment