Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenFOAM-plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Development
OpenFOAM-plus
Commits
f714c9c5
Commit
f714c9c5
authored
7 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add cloneParallelCase function into bin/tools/RunFunctions
parent
25c74188
No related branches found
No related tags found
1 merge request
!121
Merge develop into master for v1706 release
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/tools/RunFunctions
+85
-16
85 additions, 16 deletions
bin/tools/RunFunctions
tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
+0
-20
0 additions, 20 deletions
tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
with
85 additions
and
36 deletions
bin/tools/RunFunctions
+
85
−
16
View file @
f714c9c5
...
...
@@ -219,28 +219,97 @@ compileApplication()
#
cloneCase
()
{
if
[
-e
"
$2
"
]
local
src
=
$1
local
dst
=
$2
shift
2
if
[
-e
"
$dst
"
]
then
echo
"Case already cloned: remove case directory
$2
to clone"
elif
[
-d
"
$1
"
]
echo
"Case already cloned: remove case directory
$dst
prior to cloning"
return
1
elif
[
!
-d
"
$src
"
]
then
echo
"Cloning
$2
case from
$1
"
mkdir
$2
# These must exist, so do not hide error messages
for
f
in
system constant
do
\c
p
-r
$1
/
$f
$2
done
echo
"Error: no directory to clone:
$src
"
return
1
fi
echo
"Cloning
$dst
case from
$src
"
mkdir
$dst
# These must exist, so do not hide error messages
for
f
in
constant system
do
\c
p
-r
$src
/
$f
$dst
done
# Either (or both) may exist, so error messages may be spurious
for
f
in
0 0.orig
# Either (or both) may exist, so error messages may be spurious
for
f
in
0 0.orig
do
\c
p
-r
$src
/
$f
$dst
2>/dev/null
done
return
0
}
#
# cloneParallelCase srcDir dstDir [...times]
#
# If any times are specified, they will be used for the cloning.
# Otherwise the entire processor* directories are cloned
cloneParallelCase
()
{
local
src
=
$1
local
dst
=
$2
shift
2
if
[
-e
"
$dst
"
]
then
echo
"Case already cloned: remove case directory
$dst
prior to cloning"
return
1
fi
[
-d
"
$src
"
]
||
{
echo
"Error: no directory to clone:
$src
"
return
1
}
echo
"Cloning
$dst
parallel case from
$src
"
mkdir
$dst
# These must exist, so do not hide error messages
for
f
in
constant system
do
\c
p
-r
$src
/
$f
$dst
done
[
-d
$src
/processor0
]
||
{
echo
"Does not appear to be a parallel case"
return
1
}
if
[
"$#"
-eq
0
]
then
# Copy all processor directories
echo
" clone processor* directories"
\c
p
-r
$src
/processor
*
$dst
else
# Only copy some time directories
echo
" clone processor directories with
$#
times:
$@
"
for
proc
in
$(
cd
$src
&&
\l
s
-d
processor
*
)
do
\c
p
-r
$1
/
$f
$2
2>/dev/null
srcProc
=
$src
/
$proc
dstProc
=
$dst
/
$proc
mkdir
$dstProc
cp
-r
$srcProc
/constant
$dstProc
/
for
time
do
[
-d
$srcProc
/
$time
]
&&
cp
-r
$srcProc
/
$time
$dstProc
/
done
done
else
echo
"Error: cannot clone from non-existent directory"
echo
"
$1
"
fi
return
0
}
# Overwrite 0/ with the contents of 0.orig/ if it exists.
...
...
This diff is collapsed.
Click to expand it.
tutorials/incompressible/pisoFoam/LES/motorBike/Allrun
+
0
−
20
View file @
f714c9c5
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Source tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
cloneParallelCase
()
{
if
[
-d
$2
]
then
echo
"Case already cloned: remove case directory
$2
to clone"
else
echo
"Cloning
$2
case from
$1
in parallel mode"
mkdir
$2
cpfiles
=
"processor* system constant"
for
f
in
$cpfiles
do
cp
-r
$1
/
$f
$2
done
fi
}
# Do the Spalart-Allmaras steady-state case
(
cd
motorBike
&&
foamRunTutorials
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment