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

View File

@ -94,7 +94,7 @@ getNumberOfProcessors()
getApplication()
{
# 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 ]
then

View File

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

View File

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

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -16,6 +16,7 @@
# Description
# 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
@ -29,21 +30,30 @@ then
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2
fi
if command -v _foamAddPath >/dev/null 2>&1 # Normal sourcing
if command -v _foamAddLibAuto > /dev/null 2>&1
then
# If *_ARCH_PATH does not end with '-system' or '-none',
# it is located within ThirdParty, or a central installation
# outside of ThirdParty and should be added to the path.
# Normal sourcing (not makeADIOS)
# - but only add if the directory really exists
ending="${ADIOS2_ARCH_PATH##*-}"
if [ "$ending" != none -a "$ending" != system ]
if _foamAddLibAuto $ADIOS2_ARCH_PATH
then
# PATH was already cleaned by etc/bashrc caller
_foamAddPath $ADIOS2_ARCH_PATH/bin
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
#------------------------------------------------------------------------------

View File

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

View File

@ -330,7 +330,6 @@ Foam::functionObjects::vtkCloud::vtkCloud
fvMeshFunctionObject(name, runTime, dict),
writeOpts_(vtk::formatType::INLINE_BASE64),
printf_(),
useTimeName_(false),
useVerts_(false),
selectClouds_(),
selectFields_(),
@ -394,7 +393,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
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);
@ -436,11 +435,18 @@ bool Foam::functionObjects::vtkCloud::write()
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 =
(
useTimeName_
? time_.timeName()
: printf_.empty()
printf_.empty()
? Foam::name(time_.timeIndex())
: word::printf(printf_, time_.timeIndex())
);

View File

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

View File

@ -47,19 +47,7 @@ runTimeModifiable true;
functions
{
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);
}
#include "forces"
}
// ************************************************************************* //

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
#------------------------------------------------------------------------------