Merge branch 'develop-pre-release' of develop.openfoam.com:Development/OpenFOAM-plus into develop-pre-release

This commit is contained in:
sergio
2018-06-19 11:23:36 -07:00
12 changed files with 250 additions and 76 deletions

View File

@ -144,13 +144,9 @@ label restoreFields
} }
} }
if (dryrun) if (verbose)
{ {
Info<< "dry-run: " << dirName << nl; Info<< "directory " << dirName.name() << nl;
}
else if (verbose)
{
Info<< "directory " << dirName << nl;
} }
// Count of files moved, including backups // Count of files moved, including backups
@ -296,7 +292,7 @@ int main(int argc, char *argv[])
// command-line options // command-line options
label nProcs = 0; label nProcs = 0;
instantList times; wordList timeDirs;
if (args.found("processor") && !Pstream::parRun()) if (args.found("processor") && !Pstream::parRun())
{ {
@ -310,8 +306,11 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
// Obtain times from "processor0/" only // Obtain time directory names from "processor0/" only
times = timeSelector::select
timeDirs = ListOps::create<word>
(
timeSelector::select
( (
Time Time
( (
@ -320,31 +319,34 @@ int main(int argc, char *argv[])
args.caseName()/"processor0" args.caseName()/"processor0"
).times(), ).times(),
args args
),
[](const instant& t){ return t.name(); }
); );
} }
else else
{ {
if (Pstream::master()) timeDirs = ListOps::create<word>
{ (
times = timeSelector::select timeSelector::select
( (
Time(Time::controlDictName, args).times(), Time(Time::controlDictName, args).times(),
args args
),
[](const instant& t){ return t.name(); }
); );
}
Pstream::scatter(times); Pstream::scatter(timeDirs);
} }
if (times.empty()) if (timeDirs.empty())
{ {
Info<< "no times selected" << nl; Info<< "no times selected" << nl;
} }
for (const instant& inst : times) for (const word& dirName : timeDirs)
{ {
Info<< "\nTime = " << inst.name() << nl; Info<< "\nTime = " << dirName << nl;
label count = 0; label count = 0;
@ -352,7 +354,7 @@ int main(int argc, char *argv[])
{ {
const wordHashSet files const wordHashSet files
( (
getFiles(args.path()/"processor0", inst.name()) getFiles(args.path()/"processor0", dirName)
); );
for (label proci=0; proci < nProcs; ++proci) for (label proci=0; proci < nProcs; ++proci)
@ -360,7 +362,7 @@ int main(int argc, char *argv[])
count += restoreFields count += restoreFields
( (
method, method,
args.path()/("processor" + Foam::name(proci))/inst.name(), args.path()/("processor" + Foam::name(proci))/dirName,
files, files,
targetNames targetNames
); );
@ -371,14 +373,14 @@ int main(int argc, char *argv[])
wordList files; wordList files;
if (Pstream::master()) if (Pstream::master())
{ {
files = getFiles(args.path(), inst.name()); files = getFiles(args.path(), dirName);
} }
Pstream::scatter(files); Pstream::scatter(files);
count += restoreFields count += restoreFields
( (
method, method,
args.path()/inst.name(), args.path()/dirName,
wordHashSet(files), wordHashSet(files),
targetNames targetNames
); );

View File

@ -94,7 +94,7 @@ getNumberOfProcessors()
getApplication() getApplication()
{ {
# Re-use positional parameters for automatic whitespace elimination # Re-use positional parameters for automatic whitespace elimination
set -- $(foamDictionary -disableFunctionEntries -entry application -value system/controlDict) set -- $(foamDictionary -disableFunctionEntries -entry application -value system/controlDict 2>/dev/null)
if [ "$#" -eq 1 ] if [ "$#" -eq 1 ]
then then

View File

@ -158,6 +158,7 @@ _foamEtc -config vtk
_foamEtc -config ensight _foamEtc -config ensight
_foamEtc -config gperftools _foamEtc -config gperftools
## _foamEtc -config ADIOS ## _foamEtc -config ADIOS
## _foamEtc -config ADIOS2
_foamEtc -config CGAL _foamEtc -config CGAL
_foamEtc -config scotch _foamEtc -config scotch
_foamEtc -config FFTW _foamEtc -config FFTW

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -28,16 +28,12 @@ if ($?FOAM_VERBOSE && $?prompt) then
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH"
endif endif
# If *_ARCH_PATH does not end with '-system' or '-none', # - only add if the directory really exists
# it is located within ThirdParty, or a central installation _foamAddLibAuto $ADIOS2_ARCH_PATH
# outside of ThirdParty and should be added to the path. if ($status == 0) then
set ending="${ADIOS2_ARCH_PATH:t}"
if ( "$ending" != "adios-none" && "$ending" != "adios-system" ) then
# PATH was already cleaned by etc/cshrc caller
_foamAddPath $ADIOS2_ARCH_PATH/bin _foamAddPath $ADIOS2_ARCH_PATH/bin
endif endif
unset adios_version ending unset adios2_version
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -16,6 +16,7 @@
# Description # Description
# Setup for ADIOS2 include/libraries (usually ThirdParty installation). # Setup for ADIOS2 include/libraries (usually ThirdParty installation).
# #
# Use with -force when sourcing directly from the command-line
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade # USER EDITABLE PART: Changes made here may be lost with the next upgrade
@ -29,21 +30,30 @@ then
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2 echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddPath >/dev/null 2>&1 # Normal sourcing if command -v _foamAddLibAuto > /dev/null 2>&1
then then
# If *_ARCH_PATH does not end with '-system' or '-none', # Normal sourcing (not makeADIOS)
# it is located within ThirdParty, or a central installation # - but only add if the directory really exists
# outside of ThirdParty and should be added to the path.
ending="${ADIOS2_ARCH_PATH##*-}" if _foamAddLibAuto $ADIOS2_ARCH_PATH
if [ "$ending" != none -a "$ending" != system ]
then then
# PATH was already cleaned by etc/bashrc caller
_foamAddPath $ADIOS2_ARCH_PATH/bin _foamAddPath $ADIOS2_ARCH_PATH/bin
fi fi
unset adios2_version ending unset adios2_version
elif [ "$1" = "-force" ]
then
# Forced command-line sourcing
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $ADIOS2_ARCH_PATH 2>/dev/null)"
then
eval "$output"
PATH="$ADIOS2_ARCH_PATH/bin:$PATH"
fi
unset adios2_version output
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -200,6 +200,7 @@ _foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation
_foamEtc -config vtk _foamEtc -config vtk
_foamEtc -config ensight _foamEtc -config ensight
## _foamEtc -config ADIOS ## _foamEtc -config ADIOS
## _foamEtc -config ADIOS2
_foamEtc -config CGAL _foamEtc -config CGAL
_foamEtc -config FFTW _foamEtc -config FFTW

View File

@ -330,7 +330,6 @@ Foam::functionObjects::vtkCloud::vtkCloud
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeOpts_(vtk::formatType::INLINE_BASE64), writeOpts_(vtk::formatType::INLINE_BASE64),
printf_(), printf_(),
useTimeName_(false),
useVerts_(false), useVerts_(false),
selectClouds_(), selectClouds_(),
selectFields_(), selectFields_(),
@ -394,7 +393,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
printf_ = "%0" + std::to_string(padWidth) + "d"; printf_ = "%0" + std::to_string(padWidth) + "d";
} }
useTimeName_ = dict.lookupOrDefault<bool>("timeName", false); // useTimeName_ = dict.lookupOrDefault<bool>("useTimeName", false);
useVerts_ = dict.lookupOrDefault<bool>("cellData", false); useVerts_ = dict.lookupOrDefault<bool>("cellData", false);
@ -436,11 +435,18 @@ bool Foam::functionObjects::vtkCloud::write()
return true; // skip - not available return true; // skip - not available
} }
// const word timeDesc =
// (
// useTimeName_
// ? time_.timeName()
// : printf_.empty()
// ? Foam::name(time_.timeIndex())
// : word::printf(printf_, time_.timeIndex())
// );
const word timeDesc = const word timeDesc =
( (
useTimeName_ printf_.empty()
? time_.timeName()
: printf_.empty()
? Foam::name(time_.timeIndex()) ? Foam::name(time_.timeIndex())
: word::printf(printf_, time_.timeIndex()) : word::printf(printf_, time_.timeIndex())
); );

View File

@ -28,7 +28,8 @@ Group
grpUtilitiesFunctionObjects grpUtilitiesFunctionObjects
Description Description
This functionObject writes cloud(s) in VTK format. This functionObject writes cloud(s) in VTK PolyData format
(.vtp extension) with the time information saved in a '.series' file.
Example of function object specification: Example of function object specification:
\verbatim \verbatim
@ -38,11 +39,11 @@ Description
libs ("liblagrangianFunctionObjects.so"); libs ("liblagrangianFunctionObjects.so");
writeControl writeTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
format binary; format ascii;
cloud myCloud; cloud myCloud;
width 12;
fields (T U rho); fields (T U rho);
width 4; // file-padding
} }
\endverbatim \endverbatim
@ -57,20 +58,19 @@ Usage
cellData | Emit cellData instead of pointData | no | false cellData | Emit cellData instead of pointData | no | false
directory | The output directory name | no | VTK directory | The output directory name | no | VTK
width | Padding width for file name | no | 8 width | Padding width for file name | no | 8
timeName | Use time-name instead of time-index | no | false
format | ascii or binary format | no | binary format | ascii or binary format | no | binary
writePrecision | write precision in ascii | no | same as IOstream writePrecision | write precision in ascii | no | same as IOstream
\endtable \endtable
The output filename and fields are added to the cloud's \c OutputProperties The output filename and fields are added to the functionObjectProperties
dictionary. For the previous example specification: information. For the previous example specification:
\verbatim \verbatim
cloudWrite1 cloudWrite1
{ {
myCloud myCloud
{ {
file "<case>/VTK/myCloud_00001.vtp"; file "<case>/VTK/myCloud_0001.vtp";
fields (T U rho); fields (T U rho);
} }
} }
@ -122,9 +122,6 @@ class vtkCloud
//- The printf format for zero-padding names //- The printf format for zero-padding names
string printf_; string printf_;
//- Use time-name instead of time-index
bool useTimeName_;
//- Write lagrangian as cell data (verts) instead of point data //- Write lagrangian as cell data (verts) instead of point data
bool useVerts_; bool useVerts_;

View File

@ -1,4 +1,10 @@
// -*- C++ -*- /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
ensightWrite ensightWrite
{ {

View File

@ -47,19 +47,7 @@ runTimeModifiable true;
functions functions
{ {
forces #include "forces"
{
type forces;
libs ("libforces.so");
writeControl timeStep;
writeInterval 10;
patches (wing);
rho rhoInf;
log true;
rhoInf 1;
CofR (0.4974612746 -0.01671895744 0.125);
}
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
forces
{
type forces;
libs ("libforces.so");
writeControl timeStep;
writeInterval 10;
log false;
patches (wing);
rho rhoInf;
rhoInf 1;
CofR (0.4974612746 -0.01671895744 0.125);
}
// ************************************************************************* //

143
wmake/scripts/have_adios2 Normal file
View File

@ -0,0 +1,143 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# have_adios2
#
# Description
# Detection/setup of ADIOS2
#
# Requires
# ADIOS2_ARCH_PATH
#
# Functions provided
# have_adios2, no_adios2, echo_adios2
#
# Variables set on success
# HAVE_ADIOS2
# ADIOS2_ARCH_PATH
# ADIOS2_INC_DIR
# ADIOS2_LIB_DIR
#
#------------------------------------------------------------------------------
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
#------------------------------------------------------------------------------
# Reset variables
no_adios2()
{
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR
return 0
}
# Report
echo_adios2()
{
echo "adios2=${HAVE_ADIOS2:-false}"
echo "root=$ADIOS2_ARCH_PATH"
echo "include=$ADIOS2_INC_DIR"
echo "library=$ADIOS2_LIB_DIR"
}
# On success, return 0 and export variables
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2()
{
local header library static label settings warn
# warn="==> skip adios2"
# Basic setup/checks
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2) || {
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
return 1
}
. $settings
if isNone "$ADIOS2_ARCH_PATH"
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
fi
# Header/library names
header="adios2.h"
library="libadios2$extLibso"
if hasAbsdir "$ADIOS2_ARCH_PATH"
then
header=$(findFirstFile $ADIOS2_ARCH_PATH/include/$header)
# FOAM_EXT_LIBBIN is allowed to be unset
library=$(findFirstFile \
$FOAM_EXT_LIBBIN/$library \
$ADIOS2_ARCH_PATH/lib/$library \
$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
)
elif isSystem "$ADIOS2_ARCH_PATH"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
else
unset header library
fi
# Header found?
[ -n "$header" ] || {
[ -n "$warn" ] && echo "$warn (no header)"
return 2
}
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
return 2
}
header="${header%/*}" # Strip one-level (include/adios2/...)
export HAVE_ADIOS2=true
export ADIOS2_ARCH_PATH
export ADIOS2_INC_DIR="${header%/*}" # Basename
export ADIOS2_LIB_DIR="${library%/*}" # Basename
}
# Force reset of old variables
no_adios2
# Testing
if [ "$1" = "-test" ]
then
have_adios2
echo_adios2
fi
#------------------------------------------------------------------------------