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
526759f3
Commit
526759f3
authored
Jun 24, 2019
by
sergio
Browse files
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
parents
519471ce
aa9aea1e
Changes
16
Hide whitespace changes
Inline
Side-by-side
applications/test/copyFile/Make/files
0 → 100644
View file @
526759f3
Test-copyFile.C
EXE = $(FOAM_USER_APPBIN)/Test-copyFile
applications/test/copyFile/Make/options
0 → 100644
View file @
526759f3
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */
applications/test/copyFile/Test-copyFile.C
0 → 100644
View file @
526759f3
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Test atomic copyFile as per timeActivatedFileUpdate
\*---------------------------------------------------------------------------*/
#include
"argList.H"
#include
"OSspecific.H"
#include
"Switch.H"
using
namespace
Foam
;
#ifdef _WIN32
#undef DebugInfo // Windows name clash with OpenFOAM messageStream
#define WIN32_LEAN_AND_MEAN
#include
<windows.h>
// Prefix '\\?\' for extended-length path
inline
std
::
string
longName
(
const
std
::
string
&
file
)
{
std
::
string
longName
;
longName
.
reserve
(
4
+
file
.
length
());
longName
.
append
(
"
\\\\
?
\\
"
);
longName
.
append
(
file
);
return
longName
;
}
bool
win_cp
(
const
fileName
&
src
,
const
fileName
&
dst
)
{
const
std
::
string
srcName
(
longName
(
src
));
const
std
::
string
dstName
(
longName
(
dst
));
return
::
CopyFile
(
srcName
.
c_str
(),
dstName
.
c_str
(),
false
);
}
bool
win_mv
(
const
fileName
&
src
,
const
fileName
&
dst
)
{
const
std
::
string
srcName
(
longName
(
src
));
const
std
::
string
dstName
(
longName
(
dst
));
return
::
MoveFile
(
srcName
.
c_str
(),
dstName
.
c_str
());
}
#else
bool
win_cp
(
const
fileName
&
src
,
const
fileName
&
dst
)
{
Info
<<
"No Windows cp, using Foam::cp"
<<
nl
;
return
Foam
::
cp
(
src
,
dst
);
}
bool
win_mv
(
const
fileName
&
src
,
const
fileName
&
dst
)
{
Info
<<
"No Windows mv, using Foam::mv"
<<
nl
;
return
Foam
::
mv
(
src
,
dst
);
}
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noBanner
();
argList
::
noParallel
();
argList
::
noFunctionObjects
();
argList
::
addNote
(
"Test atomic copyFile methods"
);
#ifdef _WIN32
argList
::
addBoolOption
(
"win1"
,
"Foam cp, Windows mv"
);
argList
::
addBoolOption
(
"win2"
,
"Windows cp, Foam mv"
);
argList
::
addBoolOption
(
"win3"
,
"Windows cp, Windows mv"
);
#endif
argList
::
addArgument
(
"srcFile"
);
argList
::
addArgument
(
"dstFile"
);
#include
"setRootCase.H"
const
fileName
srcFile
(
fileName
::
validate
(
args
[
1
]));
const
fileName
dstFile
(
fileName
::
validate
(
args
[
2
]));
const
fileName
tmpFile
(
dstFile
+
Foam
::
name
(
pid
()));
Info
<<
"src : "
<<
srcFile
<<
nl
<<
"tmp : "
<<
tmpFile
<<
nl
<<
"dst : "
<<
dstFile
<<
nl
<<
nl
;
bool
cpOk
=
false
,
mvOk
=
false
;
if
(
args
.
found
(
"win1"
))
{
const
auto
usage
=
argList
::
optionUsage
.
cfind
(
"win1"
);
if
(
usage
.
good
())
{
Info
<<
" "
<<
(
*
usage
).
c_str
()
<<
nl
;
}
cpOk
=
Foam
::
cp
(
srcFile
,
tmpFile
);
mvOk
=
win_mv
(
tmpFile
,
dstFile
);
}
else
if
(
args
.
found
(
"win2"
))
{
const
auto
usage
=
argList
::
optionUsage
.
cfind
(
"win2"
);
if
(
usage
.
good
())
{
Info
<<
" "
<<
(
*
usage
).
c_str
()
<<
nl
;
}
cpOk
=
win_cp
(
srcFile
,
tmpFile
);
mvOk
=
Foam
::
mv
(
tmpFile
,
dstFile
);
}
else
if
(
args
.
found
(
"win3"
))
{
const
auto
usage
=
argList
::
optionUsage
.
cfind
(
"win3"
);
if
(
usage
.
good
())
{
Info
<<
" "
<<
(
*
usage
).
c_str
()
<<
nl
;
}
cpOk
=
win_cp
(
srcFile
,
tmpFile
);
mvOk
=
win_mv
(
tmpFile
,
dstFile
);
}
else
{
Info
<<
" Foam cp, Foam mv"
<<
nl
;
cpOk
=
Foam
::
cp
(
srcFile
,
tmpFile
);
mvOk
=
Foam
::
mv
(
tmpFile
,
dstFile
);
}
Info
<<
nl
<<
"cp: "
<<
Switch
(
cpOk
)
<<
nl
<<
"mv: "
<<
Switch
(
mvOk
)
<<
nl
;
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
src/OpenFOAM/db/Time/Time.C
View file @
526759f3
...
...
@@ -952,7 +952,7 @@ bool Foam::Time::stopAt(const stopAtControls stopCtrl) const
bool
Foam
::
Time
::
isAdjustTimeStep
()
const
{
return
controlDict_
.
lookupOrDefault
(
"adjustTimeStep"
,
false
)
?
true
:
false
;
return
controlDict_
.
lookupOrDefault
(
"adjustTimeStep"
,
false
);
}
...
...
tutorials/verificationAndValidation/turbulentInflow/0.orig/U
.DFSEM
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/U
View file @
526759f3
...
...
@@ -41,12 +41,9 @@ boundaryField
}
inlet
{
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
value uniform (0 0 0);
}
#include "inlet/U"
outlet
{
type inletOutlet;
...
...
tutorials/verificationAndValidation/turbulentInflow/0.orig/
U.digitalFilter
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/
inlet.DFSEM/U
View file @
526759f3
...
...
@@ -10,52 +10,16 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
inlet
{
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
topWall
{
type fixedValue;
value uniform (0 0 0);
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type turbulentDigitalFilterInlet;
variant digitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
value uniform (0 0 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
type turbulentDFSEMInlet;
delta 2;
nCellPerEddy 1;
mapMethod nearestCell;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/0.orig/
U.reducedD
igitalFilter
→
tutorials/verificationAndValidation/turbulentInflow/0.orig/
inlet.d
igitalFilter
/U
View file @
526759f3
...
...
@@ -10,52 +10,18 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
inlet
{
bottomWall
{
type fixedValue;
value uniform (0 0 0);
}
topWall
{
type fixedValue;
value uniform (0 0 0);
}
sides_half0
{
type cyclic;
}
sides_half1
{
type cyclic;
}
inlet
{
type turbulentDigitalFilterInlet;
variant reducedDigitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
value uniform (0 0 0);
}
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
type turbulentDigitalFilterInlet;
variant digitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/0.orig/inlet.reducedDigitalFilter/U
0 → 100644
View file @
526759f3
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inlet
{
type turbulentDigitalFilterInlet;
variant reducedDigitalFilter;
planeDivisions ( 64 70 );
L ( 0.78035508 0.31085352 0.342261 0.1728125 0.171875
0.22459375 0.172787596 0.171889998 0.224578995 );
patchNormalSpeed 20.133;
}
// ************************************************************************* //
tutorials/verificationAndValidation/turbulentInflow/Allclean
View file @
526759f3
#!/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
cleanCase0
\r
m
-rf
results
\r
m
-rf
constant/boundaryData/inlet 2>/dev/null
\r
m
-rf
results 2>/dev/null
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/Allrun
View file @
526759f3
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
# Compute test case with different synthetic inflow models
declare
-a
Models
=(
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Test with different synthetic inflow models
modelTypes
=
"reducedDigitalFilter digitalFilter DFSEM"
# Collect data in 'results' directory
[
-d
"results"
]
||
mkdir
results
restore0Dir
runApplication blockMesh
restore0Dir
# Compute (serial) and collect data
for
modelType
in
$modelTypes
do
echo
echo
"Running with model:
$modelType
"
(
cd
0
&&
ln
-sf
"inlet.
$modelType
"
inlet
)
(
cd
constant/boundaryData
&&
ln
-sf
"inlet.
$modelType
"
inlet
)
runApplication
-s
"
$modelType
"
pimpleFoam
./createGraphs
# Collect data in 'results' directory
results
=
"results/
$modelType
"
echo
"Placing summary in
$results
"
mkdir
-p
"
$results
"
mv
-f
log.
*
*
.png postProcessing
"
$results
"
2>/dev/null
# Compute and collect data
for
val
in
${
Models
[@]
}
;
do
echo
"Running the case with the model:
$val
"
\c
p 0/U.
$val
0/U
\r
m
-rf
constant/boundaryData/inlet
\c
p
-r
constant/boundaryData/inlet.
$val
constant/boundaryData/inlet
runApplication pimpleFoam
gnuplot plot.patch
gnuplot plot.cell
mv
postProcessing results/postProcessing.
$val
mv
stress
*
results/postProcessing.
$val
/.
mv
log
*
results/postProcessing.
$val
/.
cleanTimeDirectories
cleanTimeDirectories
\r
m
-rf
processor
*
>
/dev/null 2>&1
done
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/Allrun-parallel
View file @
526759f3
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
cd
${
0
%/*
}
||
exit
1
# Run from this directory
.
$WM_PROJECT_DIR
/bin/tools/RunFunctions
# Tutorial run functions
.
$WM_PROJECT_DIR
/bin/tools/CleanFunctions
# Tutorial clean functions
# Compute test case with different synthetic inflow models
declare
-a
Models
=(
"reducedDigitalFilter"
"digitalFilter"
"DFSEM"
)
# Test with different synthetic inflow models
modelTypes
=
"reducedDigitalFilter digitalFilter DFSEM"
# Collect data in 'results' directory
[
-d
"results"
]
||
mkdir
results
restore0Dir
runApplication blockMesh
restore0Dir
# Compute parallel and collect data
for
val
in
${
Models
[@]
}
;
do
echo
"Running the case with the model:
$val
"
\r
m
-f
0/U
*
\c
p 0.orig/U.
$val
0/U
\r
m
-rf
constant/boundaryData/inlet
\c
p
-r
constant/boundaryData/inlet.
$val
constant/boundaryData/inlet
runApplication decomposePar
runParallel pimpleFoam
gnuplot plot.patch
gnuplot plot.cell
mv
postProcessing results/postProcessing.
$val
mv
stress
*
results/postProcessing.
$val
/.
mv
log
*
results/postProcessing.
$val
/.
cleanTimeDirectories
\r
m
-rf
processor
*
>
/dev/null 2>&1
# Compute (parallel) and collect data
for
modelType
in
$modelTypes
do
echo
echo
"Running with model:
$modelType
"
(
cd
0
&&
ln
-sf
"inlet.
$modelType
"
inlet
)
(
cd
constant/boundaryData
&&
ln
-sf
"inlet.
$modelType
"
inlet
)
runApplication
-s
"
$modelType
"
decomposePar
runParallel
-s
"
$modelType
"
pimpleFoam
./createGraphs
# Collect data in 'results' directory
results
=
"results/
$modelType
"
echo
"Placing summary in
$results
"
mkdir
-p
"
$results
"
mv
-f
log.
*
*
.png postProcessing
"
$results
"
2>/dev/null
cleanTimeDirectories
\r
m
-rf
processor
*
>
/dev/null 2>&1
done
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/
plot.patch
→
tutorials/verificationAndValidation/turbulentInflow/
createGraphs
View file @
526759f3
#!/bin/sh
cd
${
0
%/*
}
||
exit
1
# Run from this directory
# Require gnuplot
command
-v
gnuplot
>
/dev/null 2>&1
||
{
echo
"gnuplot not found - skipping graph creation"
1>&2
exit
1
}
# The latestTime in postProcessing/inletSampling
timeDir
=
$(
foamListTimes
-case
postProcessing/inletSampling
-latestTime
2>/dev/null
)
[
-n
"
$timeDir
"
]
||
{
echo
"No postProcessing/inletSampling found - skipping graph creation"
1>&2
exit
2
}
timeDir
=
"postProcessing/inletSampling/
$timeDir
"
echo
"Creating graphs"
gnuplot
<<
GNUPLOT
set terminal png size 1000,800 enhanced font "Helvetica,24"
set output 'stress-patch.png'
set xrange [0:1]
set yrange [-1:8]
...
...
@@ -19,8 +42,26 @@ set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
set title "Stress in cell"
input = "
$timeDir
/inletCell_UPrime2Mean.xy"
set output 'stress-cell.png'
plot
\
input u 1:2 w lines t "<uu>" lt 1,
\
input u 1:5 w lines t "<vv>" lt 2,
\
input u 1:7 w lines t "<ww>" lt 3,
\
input u 1:3 w lines t "<uv>" lt 4
set title "Stress on patch"
input = "
$timeDir
/inletPatch_UPrime2Mean.xy"
set output 'stress-patch.png'
plot
\
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:2 w lines t "<uu>" lt 1, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:5 w lines t "<vv>" lt 2, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:7 w lines t "<ww>" lt 3, \
"postProcessing/inletSampling/85/inletPatch_UPrime2Mean.xy" u 1:3 w lines t "<uv>" lt 4
input u 1:2 w lines t "<uu>" lt 1,
\
input u 1:5 w lines t "<vv>" lt 2,
\
input u 1:7 w lines t "<ww>" lt 3,
\
input u 1:3 w lines t "<uv>" lt 4
GNUPLOT
#------------------------------------------------------------------------------
tutorials/verificationAndValidation/turbulentInflow/plot.cell
deleted
100755 → 0
View file @
519471ce
set terminal png size 1000,800 enhanced font "Helvetica,24"
set output 'stress-cell.png'
set xrange [0:1]
set yrange [-1:8]
set xlabel "Channel height"
set ylabel "<u_i u_i>"
set offset .05, .05
set style data linespoints
set grid
set linetype 1 lc rgb 'black' lw 2
set linetype 2 lc rgb 'red' lw 2
set linetype 3 lc rgb 'blue' lw 2
set linetype 4 lc rgb 'green' lw 2
set linetype 5 lc rgb 'black' pi -8 pt 4 ps 1.5
set linetype 6 lc rgb 'red' pi -8 pt 4 ps 1.5
set linetype 7 lc rgb 'blue' pi -8 pt 4 ps 1.5
set linetype 8 lc rgb 'green' pi -8 pt 4 ps 1.5
plot \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:2 w lines t "<uu>" lt 1, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:5 w lines t "<vv>" lt 2, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:7 w lines t "<ww>" lt 3, \
"postProcessing/inletSampling/85/inletCell_UPrime2Mean.xy" u 1:3 w lines t "<uv>" lt 4
tutorials/verificationAndValidation/turbulentInflow/system/controlDict
View file @
526759f3
...
...
@@ -45,59 +45,14 @@ timePrecision 8;
runTimeModifiable false;
adjustTimeStep false;
adjustTimeStep false;
// Allow 10% run-up before calculating mean
timeStart #calc #{ 0.1 * ${/endTime} #};
functions
{
fieldAverage1
{
type fieldAverage;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
timeStart 8.5;
restartOnRestart false;
fields
(
U
{
mean on;
prime2Mean on;
base time;