Compare commits

...

14 Commits

Author SHA1 Message Date
28d24fefbc CONFIG: bump patch level 2020-03-12 11:34:14 +01:00
161c66df17 BUG: incorrect EnSight lagrangian fields in parallel (fixes #1629) 2020-03-12 11:13:23 +01:00
418248709f BUG: Corrected update of T field for energyJump[AMI]FvPatchScalarField. See #1624 2020-03-11 17:47:19 +00:00
6f230a8b67 COMP: Corrections for icc compiler. Fixes #1608 2020-03-03 17:00:35 +00:00
ca28377642 BUG: Resolve circular call to ::write(Ostream&). See #1617 2020-03-03 11:17:11 +00:00
79cf72d573 BUG: foamListTimes does not remove collated directories (fixes #1588)
- also now report any verbosity on stderr

- fix similar collated directories issue for foamRestoreFields
2020-02-14 17:44:49 +01:00
a65b9fdd7c BUG: file format mangled by collated format (fixes #1587)
- incorrectly set BINARY format in the construction of the received
  data (a side-effect of the parameter ordering).

  Now use the same default parameters as IFstream and set the correct
  filename subsequent to construction.
2020-02-13 09:04:13 +01:00
92214eb4af CONFIG: misedit of csh mpi settings with foamConfigurePaths 2020-02-12 21:28:30 +01:00
ff19bedbc3 BUG: SPDP mode: guaranteeing initial value. Fixes #1590.
In differing precisions the PrecisionAdaptor will copy
the input array element by element and this can trigger
NaN detection.
2020-02-12 16:54:05 +00:00
49e63378f8 TUT: corrected link to online case. Fixes #1584 2020-02-10 11:44:20 +00:00
a100b49606 BUG: csh ignores additional parameters (fixes #1582) 2020-02-05 10:27:38 +01:00
e53419c025 ENH: Pstream: use native reduce in SPDP mode. Fixes #1574. 2020-02-03 11:29:06 +00:00
81015889f2 CONFIG: provide separate default settings for clang/gcc (fixes #1566)
- the foamConfigurePaths script is quite simplistic and aggressive in
  what it changes. This was particularly evident when using it to
  change gcc/clang versions.

  Restructured the corresponding compiler settings to define default
  versions (eg, "default_gcc_version") that limits the scope of
  changes performed by foamConfigurePaths and makes it easier to
  understand if changing manually.
2020-02-03 11:05:04 +01:00
d3bcc71b64 COMP: avoid -Wstringop-truncation warning
- the gcc c++/9 includes now inline strncpy, which obliterates
  the previous method of suppressing the warning.
  Now simply allocate additional space for the nul character.

COMP: silence some icc warnings
2020-01-31 13:32:24 +01:00
26 changed files with 562 additions and 155 deletions

View File

@ -1,2 +1,2 @@
api=1912
patch=200129
patch=200312

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,7 +39,7 @@ Usage
Options:
- \par -processor
List times from processor0/ directory
Times from processor0/ directory
- \par -rm
Remove selected time directories
@ -58,9 +58,30 @@ Note
#include "profiling.H"
#include "timeSelector.H"
#include "TimePaths.H"
#include "ListOps.H"
#include "stringOps.H"
using namespace Foam;
// Many ways to name processor directories
//
// Uncollated | "processor0", "processor1" ...
// Collated (old) | "processors"
// Collated (new) | "processors<N>"
// Host collated | "processors<N>_<low>-<high>"
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
bool isProcessorDir(const string& dir)
{
return
(
dir.starts_with("processor")
&& (dir == "processors" || matcher.match(dir))
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
@ -95,7 +116,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const bool removeFiles(args.found("rm"));
const bool verbose(args.found("verbose"));
bool verbose(args.found("verbose"));
// Get times list from the master processor and subset based on
@ -116,6 +137,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
// Obtain time directory names from "processor0/" only
timePaths = autoPtr<TimePaths>::New
(
args.rootPath(),
@ -140,10 +162,34 @@ int main(int argc, char *argv[])
{
if (nProcs)
{
fileNameList procDirs
(
Foam::readDir
(
args.path(),
fileName::DIRECTORY,
false, // No gzip anyhow
false // Do not follow linkts
)
);
inplaceSubsetList(procDirs, isProcessorDir);
// Perhaps not needed
/// Foam::sort(procDirs, stringOps::natural_sort());
if (verbose)
{
Info<< "Removing " << nTimes
<< " processor time directories" << endl;
InfoErr
<< "Removing " << nTimes
<< " times in " << procDirs.size()
<< " processor directories" << endl;
}
// No processor directories? - silence verbosity
if (procDirs.empty())
{
verbose = false;
}
forAllReverse(timeDirs, timei)
@ -152,25 +198,15 @@ int main(int argc, char *argv[])
if (verbose)
{
Info<< " rm " << timeName
InfoErr
<< " rm " << timeName
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
<< endl;
}
fileName path(args.path()/"processors"/timeName);
rmDir(path, true);
for (label proci=0; proci<nProcs; ++proci)
for (const fileName& procDir : procDirs)
{
path =
(
args.path()
/ ("processor" + Foam::name(proci))
/ timeName
);
rmDir(path, true);
rmDir(args.path()/procDir/timeName, true);
}
}
}
@ -178,7 +214,8 @@ int main(int argc, char *argv[])
{
if (verbose)
{
Info<< "Removing " << nTimes
InfoErr
<< "Removing " << nTimes
<< " time directories" << endl;
}
@ -188,7 +225,8 @@ int main(int argc, char *argv[])
if (verbose)
{
Info<< " rm " << timeName
InfoErr
<< " rm " << timeName
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
<< endl;
}
@ -199,6 +237,7 @@ int main(int argc, char *argv[])
}
else
{
// List times: one per line
for (const instant& t : timeDirs)
{
Info<< t.name() << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,7 +30,7 @@ Group
grpMiscUtilities
Description
Restore field names by removing the ending.
Adjust (restore) field names by removing the ending.
The fields are selected automatically or can be specified as optional
command arguments.
@ -63,9 +63,30 @@ Usage
#include "timeSelector.H"
#include "Enum.H"
#include "TimePaths.H"
#include "ListOps.H"
#include "stringOps.H"
using namespace Foam;
// Many ways to name processor directories
//
// Uncollated | "processor0", "processor1" ...
// Collated (old) | "processors"
// Collated (new) | "processors<N>"
// Host collated | "processors<N>_<low>-<high>"
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
bool isProcessorDir(const string& dir)
{
return
(
dir.starts_with("processor")
&& (dir == "processors" || matcher.match(dir))
);
}
//- The known and support types of operations
enum restoreMethod
{
@ -311,7 +332,6 @@ int main(int argc, char *argv[])
}
// Obtain time directory names from "processor0/" only
timePaths = autoPtr<TimePaths>::New
(
args.rootPath(),
@ -329,10 +349,77 @@ int main(int argc, char *argv[])
const instantList timeDirs(timeSelector::select(timePaths->times(), args));
fileNameList procDirs;
label leadProcIdx = -1;
if (timeDirs.empty())
{
Info<< "no times selected" << nl;
Info<< "No times selected" << nl;
}
else if (nProcs)
{
procDirs =
Foam::readDir
(
args.path(),
fileName::DIRECTORY,
false, // No gzip anyhow
false // Do not follow linkts
);
inplaceSubsetList(procDirs, isProcessorDir);
// Perhaps not needed
Foam::sort(procDirs, stringOps::natural_sort());
// Decide who will be the "leading" processor for obtaining names
// - processor0
// - processors<N>
// - processors<N>_0-<high>
// Uncollated
leadProcIdx = procDirs.find("processor0");
if (!procDirs.empty())
{
if (leadProcIdx < 0)
{
// Collated (old)
leadProcIdx = procDirs.find("processors");
}
if (leadProcIdx < 0)
{
// Collated (new)
leadProcIdx = procDirs.find("processors" + Foam::name(nProcs));
}
if (leadProcIdx < 0)
{
// Host-collated
const std::string prefix
(
"processors" + Foam::name(nProcs) + "_0-"
);
forAll(procDirs, idx)
{
if (procDirs[idx].starts_with(prefix))
{
leadProcIdx = idx;
break;
}
}
}
// Just default to anything (safety)
if (leadProcIdx < 0)
{
leadProcIdx = 0;
}
}
}
for (const instant& t : timeDirs)
{
@ -341,28 +428,28 @@ int main(int argc, char *argv[])
Info<< "\nTime = " << timeName << nl;
label count = 0;
wordList files;
if (nProcs)
{
const wordHashSet files
(
getFiles(args.path()/"processor0", timeName)
);
if (leadProcIdx >= 0)
{
files = getFiles(args.path()/procDirs[leadProcIdx], timeName);
}
for (label proci=0; proci < nProcs; ++proci)
for (const fileName& procDir : procDirs)
{
count += restoreFields
(
method,
args.path()/("processor" + Foam::name(proci))/timeName,
files,
args.path()/procDir/timeName,
wordHashSet(files),
targetNames
);
}
}
else
{
wordList files;
if (Pstream::master())
{
files = getFiles(args.path(), timeName);

View File

@ -7,11 +7,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# foamConfigurePaths
@ -39,8 +38,8 @@ Basic
Compiler
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
-gcc VER specify 'gcc_version' for ThirdParty Gcc
-clang VER specify 'clang_version' for ThirdParty Clang
-gcc VER specify 'default_gcc_version' for ThirdParty Gcc
-clang VER specify 'default_clang_version' for ThirdParty Clang
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
@ -346,19 +345,19 @@ do
## Compiler ##
-clang)
# Replace clang_version=...
# Replace default_clang_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/compiler clang_version "$optionValue"
replace etc/config.csh/compiler clang_version "$optionValue"
replace etc/config.sh/compiler default_clang_version "$optionValue"
replace etc/config.csh/compiler default_clang_version "$optionValue"
adjusted=true
shift
;;
-gcc)
# Replace gcc_version=...
# Replace default_gcc_version=...
optionValue=$(getOptionValue "$@")
replace etc/config.sh/compiler gcc_version "$optionValue"
replace etc/config.csh/compiler gcc_version "$optionValue"
replace etc/config.sh/compiler default_gcc_version "$optionValue"
replace etc/config.csh/compiler default_gcc_version "$optionValue"
adjusted=true
shift
;;
@ -391,22 +390,22 @@ do
gmp-[4-9]* | gmp-system)
# gcc-related package
replace etc/config.sh/compiler gmp_version "$1"
replace etc/config.csh/compiler gmp_version "$1"
replace etc/config.sh/compiler default_gmp_version "$1"
replace etc/config.csh/compiler default_gmp_version "$1"
adjusted=true
;;
mpfr-[2-9]* | mpfr-system)
# gcc-related package
replace etc/config.sh/compiler mpfr_version "$1"
replace etc/config.csh/compiler mpfr_version "$1"
replace etc/config.sh/compiler default_mpfr_version "$1"
replace etc/config.csh/compiler default_mpfr_version "$1"
adjusted=true
;;
mpc-[0-9]* | mpc-system)
# gcc-related package
replace etc/config.sh/compiler mpc_version "$1"
replace etc/config.csh/compiler mpc_version "$1"
replace etc/config.sh/compiler default_mpc_version "$1"
replace etc/config.csh/compiler default_mpc_version "$1"
adjusted=true
;;
@ -417,7 +416,7 @@ do
# Explicitly set WM_MPLIB=...
optionValue=$(getOptionValue "$@")
replace etc/bashrc WM_MPLIB "$optionValue"
replaceCsh etc/bashrc WM_MPLIB "$optionValue"
replaceCsh etc/cshrc WM_MPLIB "$optionValue"
optMpi=system
adjusted=true
shift

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/compiler
@ -24,14 +23,19 @@
switch ("$WM_COMPILER_TYPE")
case ThirdParty:
# Default versions of GMP, MPFR, MPC - override as necessary
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
set gmp_version=gmp-system
set mpfr_version=mpfr-system
set mpc_version=mpc-system
set default_clang_version=llvm-3.7.1
set default_gcc_version=gcc-4.8.5
set default_gmp_version=gmp-system
set default_mpfr_version=mpfr-system
set default_mpc_version=mpc-system
switch ("$WM_COMPILER")
case Gcc:
set gcc_version="$default_gcc_version"
breaksw
case Gcc48*:
set gcc_version=gcc-4.8.5
breaksw
@ -95,7 +99,10 @@ case ThirdParty:
case Gcc92*:
set gcc_version=gcc-9.2.0
breaksw
case Clang:
set clang_version="$default_clang_version"
breaksw
case Clang37*:
set clang_version=llvm-3.7.1
breaksw
@ -126,6 +133,7 @@ case ThirdParty:
case Clang90*:
set clang_version=llvm-9.0.0
breaksw
default:
/bin/cat << UNKNOWN_COMPILER
===============================================================================
@ -143,4 +151,7 @@ UNKNOWN_COMPILER
breaksw
endsw
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------

View File

@ -9,15 +9,17 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.csh/example/compiler
# - sourced by OpenFOAM-*/etc/config.csh/settings
#
# Description
# Example of fine tuning ThirdParty compiler settings for OpenFOAM
# Older example of fine tuning compiler settings for OpenFOAM
#
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
# in one of the etc/ directories.
#
#------------------------------------------------------------------------------
@ -26,7 +28,7 @@ eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -config -mode=o compiler`
# Modify/override compiler settings
switch ("$WM_COMPILER")
case Gcc70:
case Gcc70*:
set gcc_version=gcc-7.0.0
set gmp_version=gmp-6.1.2
set mpfr_version=mpfr-3.1.5

View File

@ -0,0 +1,28 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.csh/example/compiler-Gcc92
# - sourced by OpenFOAM-*/etc/config.csh/compiler
#
# Description
# Example of fine tuning compiler settings with a hook
#
#------------------------------------------------------------------------------
# Modify/override compiler settings
set gcc_version=gcc-9.2.0
set gmp_version=gmp-6.2.0
set mpfr_version=mpfr-4.0.2
set mpc_version=mpc-1.1.0
#------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/setup
@ -89,7 +88,7 @@ endif
# Capture and evaluate any command-line parameters
# These can be used to set/unset values, specify additional files etc.
setenv FOAM_SETTINGS "${*}"
setenv FOAM_SETTINGS "$argv[*]"
while ( $#argv > 0 )
switch ($argv[1])

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/compiler
@ -24,13 +23,21 @@
case "$WM_COMPILER_TYPE" in
ThirdParty)
# Default versions of GMP, MPFR, MPC - override as necessary
gmp_version=gmp-system
mpfr_version=mpfr-system
mpc_version=mpc-system
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
default_clang_version=llvm-3.7.1
default_gcc_version=gcc-4.8.5
default_gmp_version=gmp-system
default_mpfr_version=mpfr-system
default_mpc_version=mpc-system
gmp_version="$default_gmp_version"
mpfr_version="$default_mpfr_version"
mpc_version="$default_mpc_version"
case "$WM_COMPILER" in
Gcc |\
Gcc) gcc_version="$default_gcc_version" ;;
Gcc48*) gcc_version=gcc-4.8.5 ;;
Gcc49*) gcc_version=gcc-4.9.4 ;;
Gcc51*) gcc_version=gcc-5.1.0 ;;
@ -54,7 +61,7 @@ ThirdParty)
Gcc91*) gcc_version=gcc-9.1.0 ;;
Gcc92*) gcc_version=gcc-9.2.0 ;;
Clang |\
Clang) clang_version="$default_clang_version" ;;
Clang37*) clang_version=llvm-3.7.1 ;;
Clang38*) clang_version=llvm-3.8.1 ;;
Clang39*) clang_version=llvm-3.9.1 ;;
@ -83,4 +90,7 @@ UNKNOWN_COMPILER
;;
esac
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------

View File

@ -9,15 +9,17 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.sh/example/compiler
# - sourced by OpenFOAM-*/etc/config.sh/settings
#
# Description
# Example of fine tuning compiler versions and settings for OpenFOAM
# Older example of fine tuning compiler settings for OpenFOAM.
#
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
# in one of the etc/ directories.
#
#------------------------------------------------------------------------------
@ -26,18 +28,12 @@ eval $($WM_PROJECT_DIR/bin/foamEtcFile -sh -config -mode=o compiler)
# Modify/override compiler settings
case "$WM_COMPILER" in
Gcc70)
Gcc70*)
gcc_version=gcc-7.0.0
gmp_version=gmp-6.1.2
mpfr_version=mpfr-3.1.5
mpc_version=mpc-1.0.3
;;
Gcc48u)
# Example of using the system GCC 4.8 in Ubuntu 15.10. Keep in mind you
# will also need to create the respective directory in "wmake/rules"
export CC='gcc-4.8'
export CXX='g++-4.8'
;;
esac
#------------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.sh/example/compiler-Gcc92
# - sourced by OpenFOAM-*/etc/config.sh/compiler
#
# Description
# Example of fine tuning compiler settings with a hook
#
#------------------------------------------------------------------------------
# Modify/override compiler settings
gcc_version=gcc-9.2.0
gmp_version=gmp-6.2.0
mpfr_version=mpfr-4.0.2
mpc_version=mpc-1.1.0
#------------------------------------------------------------------------------

View File

@ -6,11 +6,10 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd.
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/cshrc
@ -176,7 +175,7 @@ endif
# Finalize setup of OpenFOAM environment
if ( -d "$WM_PROJECT_DIR" ) then
if ($?FOAM_VERBOSE && $?prompt) echo "source $WM_PROJECT_DIR/etc/config.csh/setup"
source "$WM_PROJECT_DIR/etc/config.csh/setup" "${*}"
source "$WM_PROJECT_DIR/etc/config.csh/setup" $argv[*]
else
echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION"
echo "No directory: $WM_PROJECT_DIR"

View File

@ -200,6 +200,50 @@ void reduce
);
#if defined(WM_SPDP)
void reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void sumReduce
(
solveScalar& Value,
label& Count,
const int tag = Pstream::msgType(),
const label comm = UPstream::worldComm
);
void reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm,
label& request
);
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2018 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -723,17 +723,15 @@ Foam::fileOperations::masterUncollatedFileOperation::read
Pout<< "masterUncollatedFileOperation::readStream :"
<< " Done reading " << buf.size() << " bytes" << endl;
}
const fileName& fName = filePaths[Pstream::myProcNo(comm)];
isPtr.reset
(
new IListStream
(
std::move(buf),
IOstream::BINARY,
IOstream::currentVersion,
fName
)
);
// A local character buffer copy of the Pstream contents.
// Construct with same parameters (ASCII, current version)
// as the IFstream so that it has the same characteristics.
isPtr.reset(new IListStream(std::move(buf)));
// With the proper file name
isPtr->name() = filePaths[Pstream::myProcNo(comm)];
if (!io.readHeader(isPtr()))
{
@ -2415,6 +2413,8 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
const fileName& filePath
) const
{
autoPtr<ISstream> isPtr;
if (Pstream::parRun())
{
// Insert logic of filePath. We assume that if a file is absolute
@ -2497,10 +2497,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
if (Pstream::master(Pstream::worldComm))
{
// Read myself
return autoPtr<ISstream>
(
new IFstream(filePaths[Pstream::masterNo()])
);
isPtr.reset(new IFstream(filePaths[Pstream::masterNo()]));
}
else
{
@ -2522,26 +2519,23 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
<< " Done reading " << buf.size() << " bytes" << endl;
}
// Note: IPstream is not an IStream so use a IStringStream to
// convert the buffer. Note that we construct with a string
// so it holds a copy of the buffer.
return autoPtr<ISstream>
(
new IListStream
(
std::move(buf),
IOstream::BINARY,
IOstream::currentVersion,
filePath
)
);
// A local character buffer copy of the Pstream contents.
// Construct with same parameters (ASCII, current version)
// as the IFstream so that it has the same characteristics.
isPtr.reset(new IListStream(std::move(buf)));
// With the proper file name
isPtr->name() = filePath;
}
}
else
{
// Read myself
return autoPtr<ISstream>(new IFstream(filePath));
isPtr.reset(new IFstream(filePath));
}
return isPtr;
}

View File

@ -82,15 +82,18 @@ void Foam::primitiveMesh::makeCellCentresAndVols
{
typedef Vector<solveScalar> solveVector;
// Clear the fields for accumulation. Note1: we're doing this before
// any precision conversion since this might complain about illegal numbers.
// Note2: zero is a special value which is perfectly converted into zero
// in the new precision
cellCtrs_s = Zero;
cellVols_s = 0.0;
PrecisionAdaptor<solveVector, vector> tcellCtrs(cellCtrs_s);
Field<solveVector>& cellCtrs = tcellCtrs.ref();
PrecisionAdaptor<solveScalar, scalar> tcellVols(cellVols_s);
Field<solveScalar>& cellVols = tcellVols.ref();
// Clear the fields for accumulation
cellCtrs = Zero;
cellVols = 0.0;
const labelList& own = faceOwner();
const labelList& nei = faceNeighbour();

View File

@ -96,6 +96,51 @@ void Foam::reduce(scalar&, const sumOp<scalar>&, const int, const label, label&)
{}
#if defined(WM_SPDP)
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm
)
{}
void Foam::reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag,
const label comm
)
{}
void Foam::reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag,
const label comm
)
{}
void Foam::sumReduce
(
solveScalar& Value,
label& Count,
const int tag,
const label comm
)
{}
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label comm,
label& request
)
{}
#endif
void Foam::UPstream::allToAll
(
const labelUList& sendData,

View File

@ -40,10 +40,15 @@ License
#include <cstdlib>
#include <csignal>
#if defined(WM_SP) || defined(WM_SPDP)
#if defined(WM_SP)
#define MPI_SCALAR MPI_FLOAT
#define MPI_SOLVESCALAR MPI_FLOAT
#elif defined(WM_SPDP)
#define MPI_SCALAR MPI_FLOAT
#define MPI_SOLVESCALAR MPI_DOUBLE
#elif defined(WM_DP)
#define MPI_SCALAR MPI_DOUBLE
#define MPI_SOLVESCALAR MPI_DOUBLE
#endif
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -478,6 +483,132 @@ void Foam::reduce
}
#if defined(WM_SPDP)
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 1, MPI_SOLVESCALAR, MPI_SUM, bop, tag, communicator);
}
void Foam::reduce
(
solveScalar& Value,
const minOp<solveScalar>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 1, MPI_SOLVESCALAR, MPI_MIN, bop, tag, communicator);
}
void Foam::reduce
(
Vector2D<solveScalar>& Value,
const sumOp<Vector2D<solveScalar>>& bop,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
allReduce(Value, 2, MPI_SOLVESCALAR, MPI_SUM, bop, tag, communicator);
}
void Foam::sumReduce
(
solveScalar& Value,
label& Count,
const int tag,
const label communicator
)
{
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
{
Pout<< "** reducing:" << Value << " with comm:" << communicator
<< " warnComm:" << UPstream::warnComm
<< endl;
error::printStack(Pout);
}
Vector2D<solveScalar> twoScalars(Value, solveScalar(Count));
reduce(twoScalars, sumOp<Vector2D<solveScalar>>(), tag, communicator);
Value = twoScalars.x();
Count = twoScalars.y();
}
void Foam::reduce
(
solveScalar& Value,
const sumOp<solveScalar>& bop,
const int tag,
const label communicator,
label& requestID
)
{
#ifdef MPIX_COMM_TYPE_SHARED
// Assume mpich2 with non-blocking collectives extensions. Once mpi3
// is available this will change.
MPI_Request request;
solveScalar v = Value;
MPIX_Ireduce
(
&v,
&Value,
1,
MPI_SOLVESCALAR,
MPI_SUM,
0, //root
PstreamGlobals::MPICommunicators_[communicator],
&request
);
requestID = PstreamGlobals::outstandingRequests_.size();
PstreamGlobals::outstandingRequests_.append(request);
if (UPstream::debug)
{
Pout<< "UPstream::allocateRequest for non-blocking reduce"
<< " : request:" << requestID
<< endl;
}
#else
// Non-blocking not yet implemented in mpi
reduce(Value, bop, tag, communicator);
requestID = -1;
#endif
}
#endif
void Foam::UPstream::allToAll
(
const labelUList& sendData,

View File

@ -166,19 +166,15 @@ Foam::Ostream& Foam::ensightFile::write
Foam::Ostream& Foam::ensightFile::write(const char* value)
{
// Parentheses around strncpy to silence the GCC -Wstringop-truncation
// warning, which is spurious here.
// The max-size and buffer-size *are* identical, which means the buffer
// may not have a nul terminator. However, this is properly handled in
// the subsequent binary write and the ASCII write explicitly adds
// a nul terminator.
// Output 80 chars, but allocate for trailing nul character
// to avoid -Wstringop-truncation warnings/errors.
char buf[80];
(strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller
char buf[80+1];
strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
if (format() == IOstream::BINARY)
{
write(buf, sizeof(buf));
write(buf, 80);
}
else
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -96,11 +96,11 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
const vector nf(computePatchNormal());
// Find the second local coordinate direction
direction minCmpt = -1;
scalar minMag = VGREAT;
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt)
direction minCmpt = 0;
scalar minMag = mag(nf[minCmpt]);
for (direction cmpt = 1; cmpt < pTraits<vector>::nComponents; ++cmpt)
{
scalar s = mag(nf[cmpt]);
const scalar s = mag(nf[cmpt]);
if (s < minMag)
{
minMag = s;
@ -110,7 +110,7 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Create the second local coordinate direction
vector e2(Zero);
e2[minCmpt] = 1.0;
e2[minCmpt] = 1;
// Remove normal component
e2 -= (nf&e2)*nf;
@ -147,17 +147,14 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::patchIndexPairs()
// Compute virtual-actual patch index pairs
List<Pair<label>> indexPairs(this->size(), Pair<label>(Zero, Zero));
// Virtual turbulence plane indices
label j = 0;
label k = 0;
forAll(*this, facei)
{
const scalar& centre0 = localPos[facei][0];
const scalar& centre1 = localPos[facei][1];
j = label((centre0 - localMinPt[0])*invDelta_[0]);
k = label((centre1 - localMinPt[1])*invDelta_[1]);
// Virtual turbulence plane indices
const label j = label((centre0 - localMinPt[0])*invDelta_[0]);
const label k = label((centre1 - localMinPt[1])*invDelta_[1]);
indexPairs[facei] = Pair<label>(facei, k*n[0] + j);
}

View File

@ -162,7 +162,7 @@ public:
//- Destructor
~weightedFlux();
virtual ~weightedFlux();
// Member Functions

View File

@ -118,7 +118,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
{
label nbrCelli =
(
cell() == mesh().faceOwner()[face()]
this->cell() == mesh().faceOwner()[face()]
? mesh().faceNeighbour()[face()]
: mesh().faceOwner()[face()]
);
@ -135,7 +135,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
// Change into nbrCell. No need to change tetFace, tetPt.
//Pout<< " crossed from cell:" << celli_
// << " into " << nbrCelli << endl;
cell() = nbrCelli;
this->cell() = nbrCelli;
patchInteraction(cloud, td, trackFraction);
}
else

View File

@ -76,7 +76,7 @@ bool Foam::ensightOutput::writeCloudField
IPstream fromSlave(comm, slave);
Field<Type> recv(fromSlave);
for (Type val : field) // <-- working on a copy
for (Type val : recv) // <-- working on a copy
{
if (mag(val) < 1e-90) // approximately root(ROOTVSMALL)
{

View File

@ -121,7 +121,7 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs()
const_cast<fixedJumpFvPatchScalarField&>(TbPatch);
// force update of jump
Tbp.updateCoeffs();
Tbp.evaluate(Pstream::commsTypes::blocking);
const labelUList& faceCells = this->patch().faceCells();

View File

@ -121,7 +121,7 @@ void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs()
const_cast<fixedJumpAMIFvPatchScalarField&>(TbPatch);
// force update of jump
Tbp.updateCoeffs();
Tbp.evaluate(Pstream::commsTypes::blocking);
const labelUList& faceCells = this->patch().faceCells();

View File

@ -122,7 +122,7 @@ void Foam::gradientEnergyFvPatchScalarField::updateCoeffs()
void Foam::gradientEnergyFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
os.writeEntry("value", *this);
this->writeEntry("value", os);
}

View File

@ -13,5 +13,4 @@ Eddy Simulation (IDDES) model
For further details please visit:
openfoam.com/documentation/cpp-guide/html/verification-validation-turbulent-surface-mounted-cube.html
https://www.openfoam.com/documentation/guides/latest/doc/verification-validation-turbulent-surface-mounted-cube.html