From 7e935bd1916088f2bdb51415f8bd479d4b9ebc22 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 27 Jun 2019 14:59:14 +0200 Subject: [PATCH 01/53] COMP: avoid ref to synchronization for non-MPI VTK build (fixes #1349) --- .../runTimePostProcessing.C | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C index 8d0deb0e2b..128caf7255 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C +++ b/src/functionObjects/graphics/runTimePostProcessing/runTimePostProcessing.C @@ -42,15 +42,14 @@ License #include "vtkSmartPointer.h" #include "vtkLight.h" +#include "vtkDummyController.h" + #ifdef FOAM_USING_VTK_MPI # include "vtkMPICommunicator.h" # include "vtkMPIController.h" +# include "vtkCompositedSynchronizedRenderers.h" +# include "vtkSynchronizedRenderWindows.h" #endif -#include "vtkDummyController.h" - -#include "vtkSynchronizedRenderWindows.h" -#include "vtkCompositedSynchronizedRenderers.h" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -137,27 +136,21 @@ void Foam::functionObjects::runTimePostProcessing::render Log << name() << " render" << endl; } - - // Normal rendering elements - vtkSmartPointer renderer; - vtkSmartPointer renderWindow; - - // Multi-process synchronization - vtkSmartPointer syncWindows; - vtkSmartPointer syncRenderers; - - // Disable any floating point trapping // (some low-level rendering functionality does not like it) sigFpe::ignore sigFpeHandling; //<- disable in local scope + // Normal rendering elements + vtkSmartPointer renderer; + vtkSmartPointer renderWindow; + // Initialise render window if (controller || Pstream::master()) { - renderWindow = vtkSmartPointer::New(); renderer = vtkSmartPointer::New(); + renderWindow = vtkSmartPointer::New(); renderWindow->OffScreenRenderingOn(); renderWindow->SetSize(output_.width_, output_.height_); @@ -174,15 +167,22 @@ void Foam::functionObjects::runTimePostProcessing::render renderWindow->AddRenderer(renderer); } - // Synchronization + + // --------------------- + #ifdef FOAM_USING_VTK_MPI + + // Multi-process synchronization + vtkSmartPointer syncRenderers; + vtkSmartPointer syncWindows; + if (controller) { - syncWindows = - vtkSmartPointer::New(); - syncRenderers = vtkSmartPointer::New(); + syncWindows = + vtkSmartPointer::New(); + syncWindows->SetRenderWindow(renderWindow); syncWindows->SetParallelController(controller); syncWindows->SetIdentifier(1); @@ -193,7 +193,7 @@ void Foam::functionObjects::runTimePostProcessing::render syncRenderers->SetRenderer(renderer); syncRenderers->SetParallelController(controller); } - + #endif // --------------------- scene_.initialise(renderer, output_.name_); From 7d7a3a78a84b489d82f740ee33a198befe0e980c Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Tue, 2 Jul 2019 10:22:50 +0100 Subject: [PATCH 02/53] BUG: DimensionedField - register new field if it does not have the same name as the copy - see #1348 --- .../DimensionedFields/DimensionedField/DimensionedField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C index 16998a13f6..7f4be5496f 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C @@ -299,7 +299,7 @@ Foam::DimensionedField::DimensionedField const DimensionedField& df ) : - regIOobject(newName, df, newName == df.name()), + regIOobject(newName, df, newName != df.name()), Field(df), mesh_(df.mesh_), dimensions_(df.dimensions_), From 53947016fa74978b5e33f77937460899a5c921cc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 4 Jul 2019 17:07:48 +0200 Subject: [PATCH 03/53] BUG: metis PrecisionAdaptor used ref() instead of constCast() - closes #1354 - the scotch interface still uses non-const pointers when passing in values. For the ConstPrecisionAdaptor this means that we need to cheat with a constCast(). Using ref() will rightly trigger complaints about trying to modify a const object. --- src/parallel/decompose/metisDecomp/metisDecomp.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index ba66363e2b..82ef5287a8 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -206,8 +206,8 @@ Foam::label Foam::metisDecomp::decomposeSerial ( &numCells, // num vertices in graph &ncon, // num balancing constraints - xadj_metis.ref().data(), // indexing into adjncy - adjncy_metis.ref().data(), // neighbour info + xadj_metis.constCast().data(), // indexing into adjncy + adjncy_metis.constCast().data(), // neighbour info cellWeights.data(), // vertex wts nullptr, // vsize: total communication vol faceWeights.data(), // edge wts @@ -225,8 +225,8 @@ Foam::label Foam::metisDecomp::decomposeSerial ( &numCells, // num vertices in graph &ncon, // num balancing constraints - xadj_metis.ref().data(), // indexing into adjncy - adjncy_metis.ref().data(), // neighbour info + xadj_metis.constCast().data(), // indexing into adjncy + adjncy_metis.constCast().data(), // neighbour info cellWeights.data(), // vertex wts nullptr, // vsize: total communication vol faceWeights.data(), // edge wts From 79bf4fafb6e4eefc48b63098880894995506591a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 5 Jul 2019 10:29:18 +0200 Subject: [PATCH 04/53] CONFIG: do not touch LD_PRELOAD contents at all (#1357) --- etc/config.csh/setup | 6 +----- etc/config.sh/setup | 6 ------ etc/config.sh/unset | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/etc/config.csh/setup b/etc/config.csh/setup index 8d2833c8c9..a63c3a9353 100644 --- a/etc/config.csh/setup +++ b/etc/config.csh/setup @@ -122,7 +122,7 @@ end # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Prevent local variables from shadowing setenv variables -unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD +unset PATH MANPATH LD_LIBRARY_PATH if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH if (! $?MANPATH ) setenv MANPATH @@ -167,10 +167,6 @@ if ( $?MANPATH ) then setenv MANPATH "${MANPATH}:" endif -if ( $?LD_PRELOAD ) then - _foamClean LD_PRELOAD -endif - # Cleanup temporary information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/config.sh/setup b/etc/config.sh/setup index ed692ec259..03005db42a 100644 --- a/etc/config.sh/setup +++ b/etc/config.sh/setup @@ -153,12 +153,6 @@ then MANPATH="${MANPATH}:" fi -if [ -n "$LD_PRELOAD" ] -then - export LD_PRELOAD - _foamClean LD_PRELOAD -fi - # Cleanup temporary information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/config.sh/unset b/etc/config.sh/unset index a44eaa9671..d2b7e20cd5 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -147,7 +147,6 @@ then fi [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH -[ -n "$LD_PRELOAD" ] || unset LD_PRELOAD [ -n "$MANPATH" ] || unset MANPATH #------------------------------------------------------------------------------ From eaacf0a20ad2cbc99c7f4129979f0ae45f6916c4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 5 Jul 2019 11:04:06 +0200 Subject: [PATCH 05/53] BUG: questionable findInstance handling of constant (related to #1112) - when searching for a file that may not actually exist, the short-cut optimization could lead to the 'constant' directory being ignored. STYLE: simplify logic in points0MotionSolver::points0IO --- .../fileOperation/fileOperation.C | 15 ++-- .../points0/points0MotionSolver.C | 69 ++++++------------- 2 files changed, 28 insertions(+), 56 deletions(-) diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index 1c4e484d50..6611940880 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -757,8 +757,8 @@ Foam::IOobject Foam::fileOperation::findInstance return io; } - // Search back through the time directories to find the time - // closest to and lower than current time + // Search back through the time directories to find the first time + // that is less than or equal to the current time instantList ts = time.times(); label instanceI = ts.size()-1; @@ -771,20 +771,21 @@ Foam::IOobject Foam::fileOperation::findInstance } } - // Continue searching from here + // Found the time, continue from here for (; instanceI >= 0; --instanceI) { + io.instance() = ts[instanceI].name(); + // Shortcut: if actual directory is the timeName we've already tested it if ( - ts[instanceI].name() == startIO.instance() - && ts[instanceI].name() != stopInstance + io.instance() == startIO.instance() + && io.instance() != stopInstance ) { continue; } - io.instance() = ts[instanceI].name(); if (exists(io)) { DebugInFunction @@ -796,7 +797,7 @@ Foam::IOobject Foam::fileOperation::findInstance } // Check if hit minimum instance - if (ts[instanceI].name() == stopInstance) + if (io.instance() == stopInstance) { DebugInFunction << "Hit stopInstance " << stopInstance << endl; diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index aafc2afa12..2fedc2355c 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -48,58 +48,29 @@ Foam::IOobject Foam::points0MotionSolver::points0IO(const polyMesh& mesh) IOobject::READ_IF_PRESENT ); - if (instance != mesh.time().constant()) + IOobject io + ( + "points0", + instance, + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + // If points0 are located in constant directory, verify their existence + // or fallback to a copy of the original mesh points + if + ( + instance == mesh.time().constant() + && !io.typeHeaderOk() + ) { - // points0 written to a time folder - - return - IOobject - ( - "points0", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); + io.rename("points"); } - else - { - // Check that points0 are actually in constant directory - IOobject io - ( - "points0", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (io.typeHeaderOk()) - { - return io; - } - else - { - // Copy of original mesh points - - return - IOobject - ( - "points", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - } - } + return io; } From ff3b9501d9ad63f1a4c5d8acbe50489f643fc5ed Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 13:34:16 +0200 Subject: [PATCH 06/53] COMP: erroneous double definition for long IO on windows (#1360, #1238) - mingw uses 32-bit long regardless of -m32 or -m64 setting --- src/OpenFOAM/primitives/ints/int64/int64.H | 4 ++-- src/OpenFOAM/primitives/ints/int64/int64IO.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 095aa0aa21..9b666528b2 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -119,10 +119,10 @@ inline bool read(const std::string& str, int64_t& val) Istream& operator>>(Istream& is, int64_t& val); Ostream& operator<<(Ostream& os, const int64_t val); -// On Darwin and Windows (mingw): +// On Darwin: // long is not unambiguously (int32_t | int64_t) // - explicitly resolve for input and output -#if defined(__APPLE__) || defined(_WIN32) +#if defined(__APPLE__) Istream& operator>>(Istream& is, long& val); Ostream& operator<<(Ostream& os, const long val); #endif diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C index add4abb455..4e084aff8a 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64IO.C +++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C @@ -125,7 +125,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t val) } -#if defined(__APPLE__) || defined(_WIN32) +#if defined(__APPLE__) Foam::Istream& Foam::operator>>(Istream& is, long& val) { return operator>>(is, reinterpret_cast(val)); From 54ef9beab71fadf418eb4a90d38952d584ae42ca Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 13:53:06 +0200 Subject: [PATCH 07/53] COMP: silence spurious GCC -Wstringop-truncation warning in ensightFile --- src/fileFormats/ensight/file/ensightFile.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fileFormats/ensight/file/ensightFile.C b/src/fileFormats/ensight/file/ensightFile.C index 5163cc0942..168be05044 100644 --- a/src/fileFormats/ensight/file/ensightFile.C +++ b/src/fileFormats/ensight/file/ensightFile.C @@ -165,8 +165,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. + char buf[80]; - strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller + (strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller if (format() == IOstream::BINARY) { From 1159aaa810c0f39fa29cbda1d764428b3d130879 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 14:04:49 +0200 Subject: [PATCH 08/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index 4448e7818b..cf3497f429 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=0 +patch=190708 From 5bd7c4b5bb83454164ec75b3e6ad3c4b10e148b4 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Tue, 9 Jul 2019 11:44:52 +0100 Subject: [PATCH 09/53] BUG: pressure FO - corrected handling of enumeration in calcPressure function. See #1356 --- src/functionObjects/field/pressure/pressure.C | 72 +++++++++---------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/src/functionObjects/field/pressure/pressure.C b/src/functionObjects/field/pressure/pressure.C index df050772ae..312dda2f41 100644 --- a/src/functionObjects/field/pressure/pressure.C +++ b/src/functionObjects/field/pressure/pressure.C @@ -146,44 +146,38 @@ Foam::tmp Foam::functionObjects::pressure::calcPressure const tmp& tp ) const { - switch (mode_) + if (mode_ & TOTAL) { - case TOTAL: - { - return - tp - + dimensionedScalar("pRef", dimPressure, pRef_) - + rhoScale(p, 0.5*magSqr(lookupObject(UName_))); - } - case ISENTROPIC: - { - const basicThermo* thermoPtr = - p.mesh().lookupObjectPtr(basicThermo::dictName); - - if (!thermoPtr) - { - FatalErrorInFunction - << "Isentropic pressure calculation requires a " - << "thermodynamics package" - << exit(FatalError); - } - - const volScalarField gamma(thermoPtr->gamma()); - const volScalarField Mb - ( - mag(lookupObject(UName_)) - /sqrt(gamma*tp.ref()/thermoPtr->rho()) - ); - - return tp()*(pow(1 + (gamma - 1)/2*sqr(Mb), gamma/(gamma - 1))); - } - default: - { - return - tp - + dimensionedScalar("pRef", dimPressure, pRef_); - } + return + tp + + dimensionedScalar("pRef", dimPressure, pRef_) + + rhoScale(p, 0.5*magSqr(lookupObject(UName_))); } + + if (mode_ & ISENTROPIC) + { + const basicThermo* thermoPtr = + p.mesh().lookupObjectPtr(basicThermo::dictName); + + if (!thermoPtr) + { + FatalErrorInFunction + << "Isentropic pressure calculation requires a " + << "thermodynamics package" + << exit(FatalError); + } + + const volScalarField gamma(thermoPtr->gamma()); + const volScalarField Mb + ( + mag(lookupObject(UName_)) + /sqrt(gamma*tp.ref()/thermoPtr->rho()) + ); + + return tp()*(pow(1 + (gamma - 1)/2*sqr(Mb), gamma/(gamma - 1))); + } + + return tp + dimensionedScalar("pRef", dimPressure, pRef_); } @@ -207,10 +201,8 @@ Foam::tmp Foam::functionObjects::pressure::coeff return tpCoeff; } - else - { - return std::move(tp); - } + + return std::move(tp); } From 4b8fabaa4b8dc12208d42bdd4f096f31ab5f31bb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 28 Jun 2019 09:55:25 +0200 Subject: [PATCH 10/53] STYLE: relocate Allwmake-scan to src/ - reduced clutter. Mostly only need to scan source tree. - 00-dummy: use wmake/src/Allmake to get native (not cross-compiled) wmake toolchain binaries --- Allwmake-scan | 12 ------------ applications/test/00-dummy/Allwmake | 2 +- src/Allwmake-scan | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) delete mode 100755 Allwmake-scan create mode 100755 src/Allwmake-scan diff --git a/Allwmake-scan b/Allwmake-scan deleted file mode 100755 index 064ff08459..0000000000 --- a/Allwmake-scan +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# Allwmake with scan-build (clang) - -c_compiler="$(command -v "$(wmake -show-c)")" -cxx_compiler="$(command -v "$(wmake -show-cxx)")" - -set -x - -scan-build --use-cc="$c_compiler" --use-c++="$cxx_compiler" \ - ./Allwmake "$@" - -#------------------------------------------------------------------------------ diff --git a/applications/test/00-dummy/Allwmake b/applications/test/00-dummy/Allwmake index 3b9caf0c72..a860a07515 100755 --- a/applications/test/00-dummy/Allwmake +++ b/applications/test/00-dummy/Allwmake @@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Can never be too certain ... # Compile tools for wmake -( cd "${WM_DIR:-${WM_PROJECT_DIR}/wmake}/src" && make ) +( cd "${WM_DIR:-${WM_PROJECT_DIR}/wmake}/src" && ./Allmake ) #------------------------------------------------------------------------------ diff --git a/src/Allwmake-scan b/src/Allwmake-scan new file mode 100755 index 0000000000..2d12e096bd --- /dev/null +++ b/src/Allwmake-scan @@ -0,0 +1,18 @@ +#!/bin/sh +# Allwmake with scan-build (clang) + +command -v scan-build > /dev/null || { + exec 1>&2 + echo "No scan-build found, stopping" + echo + exit 2 +} + +comp_cc="$(command -v "$(wmake -show-c)")" +comp_cxx="$(command -v "$(wmake -show-cxx)")" + +set -x +scan-build --use-cc="$comp_cc" --use-c++="$comp_cxx" \ + ./Allwmake "$@" + +#------------------------------------------------------------------------------ From eda4cbd55c0d90a45bccefb187f37f09a0facafb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 9 Jul 2019 18:04:23 +0200 Subject: [PATCH 11/53] CONFIG: always allow spaces in fileName for Windows (#1238) - this cannot be left as a configurable value (on windows), since it needs to be enabled even prior to reading the etc/controlDict file, in case the OpenFOAM installation path itself contains spaces. --- etc/controlDict | 4 ++-- src/OpenFOAM/primitives/strings/fileName/fileName.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index 9a7a850176..5be9a11664 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -68,8 +68,8 @@ InfoSwitches allowSystemOperations 1; // Allow space character in fileName (use with caution) - // Default: 0 for non-Windows, 1 for Windows - //// allowSpaceInFileName 0; + // Ignored (always 1) for Windows. + allowSpaceInFileName 0; } diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C index cedfa1cdee..35cdcc0553 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.C +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C @@ -42,7 +42,7 @@ int Foam::fileName::debug(Foam::debug::debugSwitch(fileName::typeName, 0)); int Foam::fileName::allowSpaceInFileName ( #ifdef _WIN32 - Foam::debug::infoSwitch("allowSpaceInFileName", 1) + 1 // Windows: expect spaces to occur #else Foam::debug::infoSwitch("allowSpaceInFileName", 0) #endif From e03c0977f5e430a878745104713159ccbf25acde Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 9 Jul 2019 18:52:06 +0200 Subject: [PATCH 12/53] ENH: support Foam::mv overwrite of existing files on windows (#1238) - the behaviour of std::rename with overwriting an existing file is implementation dependent: - POSIX: it overwrites. - Windows: it does not overwrite. - for Windows need to use the ::MoveFileEx() routine for overwriting. More investigation is needed for proper handling of very long names. --- applications/test/copyFile/Test-copyFile.C | 107 +++++++++++---------- src/OSspecific/MSwindows/MSwindows.C | 29 +++++- src/OSspecific/POSIX/POSIX.C | 8 +- 3 files changed, 86 insertions(+), 58 deletions(-) diff --git a/applications/test/copyFile/Test-copyFile.C b/applications/test/copyFile/Test-copyFile.C index 7d6de05d0a..5747287606 100644 --- a/applications/test/copyFile/Test-copyFile.C +++ b/applications/test/copyFile/Test-copyFile.C @@ -37,43 +37,69 @@ using namespace Foam; #define WIN32_LEAN_AND_MEAN #include -// Prefix '\\?\' for extended-length path -inline std::string longName(const std::string& file) +unsigned maxPath = MAX_PATH; + +// Prefix "\\?\" for extended-length path and widen +// The prefix is only valid with absolute paths +// +// In the future, this code will be relocated in MSwindows.C + +static inline std::wstring longName(const fileName& file) { - std::string longName; - longName.reserve(4 + file.length()); + const auto len = file.length(); - longName.append("\\\\?\\"); - longName.append(file); + std::wstring out; + out.reserve(4 + len); - return longName; + if (len > maxPath) + { + if (file.isAbsolute()) + { + out.append(L"\\\\?\\"); + } + else + { + Warning + << "Relative fileName exceeds " << maxPath + << " characters" << nl + << " " << file << nl << nl; + } + } + + // Character-wise copy to get widening + for (const auto c : file) + { + out += c; + } + + return out; } -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)); + constexpr const int flags + ( + MOVEFILE_COPY_ALLOWED + | MOVEFILE_REPLACE_EXISTING + | MOVEFILE_WRITE_THROUGH + ); - return ::MoveFile(srcName.c_str(), dstName.c_str()); + if (src.length() > maxPath || dst.length() > maxPath) + { + const std::wstring srcName(longName(src)); + const std::wstring dstName(longName(dst)); + + Info<< "Windows mv (wide)" << nl; + return ::MoveFileExW(srcName.c_str(), dstName.c_str(), flags); + } + + Info<< "Windows mv (ansi)" << nl; + return ::MoveFileExA(src.c_str(), dst.c_str(), flags); } #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; @@ -95,8 +121,7 @@ int main(int argc, char *argv[]) #ifdef _WIN32 argList::addBoolOption("win1", "Foam cp, Windows mv"); - argList::addBoolOption("win2", "Windows cp, Foam mv"); - argList::addBoolOption("win3", "Windows cp, Windows mv"); + argList::addOption("maxPath", "length", "Test with shorter MAX_PATH"); #endif argList::addArgument("srcFile"); @@ -104,6 +129,10 @@ int main(int argc, char *argv[]) #include "setRootCase.H" + #ifdef _WIN32 + args.readIfPresent("maxPath", maxPath); + #endif + const fileName srcFile(fileName::validate(args[1])); const fileName dstFile(fileName::validate(args[2])); const fileName tmpFile(dstFile + Foam::name(pid())); @@ -111,11 +140,13 @@ int main(int argc, char *argv[]) Info<< "src : " << srcFile << nl << "tmp : " << tmpFile << nl << "dst : " << dstFile << nl + #ifdef _WIN32 + << "test with max-path: " << maxPath << nl + #endif << nl; bool cpOk = false, mvOk = false; - if (args.found("win1")) { const auto usage = argList::optionUsage.cfind("win1"); @@ -127,28 +158,6 @@ int main(int argc, char *argv[]) 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; diff --git a/src/OSspecific/MSwindows/MSwindows.C b/src/OSspecific/MSwindows/MSwindows.C index 9ea78be680..105302d478 100644 --- a/src/OSspecific/MSwindows/MSwindows.C +++ b/src/OSspecific/MSwindows/MSwindows.C @@ -24,6 +24,9 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Description + MS-Windows versions of the functions declared in OSspecific.H + \*---------------------------------------------------------------------------*/ #include "OSspecific.H" @@ -77,6 +80,22 @@ namespace Foam static bool const abortHandlerInstalled = installAbortHandler(); + + // Move file, overwriting existing + static bool renameFile(const fileName& src, const fileName& dst) + { + constexpr const int flags + ( + MOVEFILE_COPY_ALLOWED + | MOVEFILE_REPLACE_EXISTING + | MOVEFILE_WRITE_THROUGH + ); + + // TODO: handle extra-long paths with ::MoveFileExW + + return ::MoveFileExA(src.c_str(), dst.c_str(), flags); + } + } // End namespace Foam @@ -928,10 +947,10 @@ bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) { const fileName dstName(dst/src.name()); - return 0 == std::rename(src.c_str(), dstName.c_str()); + return renameFile(src, dstName); } - return 0 == std::rename(src.c_str(), dst.c_str()); + return renameFile(src, dst); } @@ -945,10 +964,10 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) if (exists(src, false)) { - const int maxIndex = 99; + constexpr const int maxIndex = 99; char index[3]; - for (int n = 0; n <= maxIndex; n++) + for (int n = 0; n <= maxIndex; ++n) { fileName dstName(src + "." + ext); if (n) @@ -961,7 +980,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) // possible index where we have no choice if (!exists(dstName, false) || n == maxIndex) { - return (0 == std::rename(src.c_str(), dstName.c_str())); + return renameFile(src, dstName); } } } diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 4b970b4a06..27b1427510 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -1213,10 +1213,10 @@ bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) { const fileName dstName(dst/src.name()); - return (0 == ::rename(src.c_str(), dstName.c_str())); + return (0 == std::rename(src.c_str(), dstName.c_str())); } - return (0 == ::rename(src.c_str(), dst.c_str())); + return (0 == std::rename(src.c_str(), dst.c_str())); } @@ -1241,7 +1241,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) if (exists(src, false)) { - const int maxIndex = 99; + constexpr const int maxIndex = 99; char index[3]; for (int n = 0; n <= maxIndex; ++n) @@ -1257,7 +1257,7 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) // possible index where we have no choice if (!exists(dstName, false) || n == maxIndex) { - return (0 == ::rename(src.c_str(), dstName.c_str())); + return (0 == std::rename(src.c_str(), dstName.c_str())); } } } From d2db25ad81fda77f30fe8b496a8db531043c74b2 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Wed, 10 Jul 2019 13:22:19 +0100 Subject: [PATCH 13/53] CONFIG: Updated pressure FO config wrappers. See #1356 --- etc/caseDicts/postProcessing/pressure/staticPressure.cfg | 3 +-- .../postProcessing/pressure/totalPressureCompressible.cfg | 3 +-- .../postProcessing/pressure/totalPressureIncompressible.cfg | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/etc/caseDicts/postProcessing/pressure/staticPressure.cfg b/etc/caseDicts/postProcessing/pressure/staticPressure.cfg index 0651d8cc66..15df571c5b 100644 --- a/etc/caseDicts/postProcessing/pressure/staticPressure.cfg +++ b/etc/caseDicts/postProcessing/pressure/staticPressure.cfg @@ -8,8 +8,7 @@ #includeEtc "caseDicts/postProcessing/pressure/pressure.cfg" -calcTotal no; -calcCoeff no; +mode static; rho rhoInf; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/pressure/totalPressureCompressible.cfg b/etc/caseDicts/postProcessing/pressure/totalPressureCompressible.cfg index 5dcde87af1..6be21f5215 100644 --- a/etc/caseDicts/postProcessing/pressure/totalPressureCompressible.cfg +++ b/etc/caseDicts/postProcessing/pressure/totalPressureCompressible.cfg @@ -8,7 +8,6 @@ #includeEtc "caseDicts/postProcessing/pressure/pressure.cfg" -calcTotal yes; -calcCoeff no; +mode total; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/pressure/totalPressureIncompressible.cfg b/etc/caseDicts/postProcessing/pressure/totalPressureIncompressible.cfg index 3419c26757..5515aafe92 100644 --- a/etc/caseDicts/postProcessing/pressure/totalPressureIncompressible.cfg +++ b/etc/caseDicts/postProcessing/pressure/totalPressureIncompressible.cfg @@ -8,8 +8,7 @@ #includeEtc "caseDicts/postProcessing/pressure/pressure.cfg" -calcTotal yes; -calcCoeff no; +mode total; rho rhoInf; // ************************************************************************* // From 658d660333b7aaaf6aaf8cc698e8bd29908a51b8 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 12 Jul 2019 13:29:20 +0200 Subject: [PATCH 14/53] BUG: incorrect blocked face synchronisation crashes regionSplit (#1370) - now catch these and emit a warning. Still need to investigate the root cause in the caller(s) or regionSplit. --- src/meshTools/regionSplit/regionSplit.C | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C index 42f5e5cdf4..15e4368df3 100644 --- a/src/meshTools/regionSplit/regionSplit.C +++ b/src/meshTools/regionSplit/regionSplit.C @@ -534,6 +534,8 @@ Foam::autoPtr Foam::regionSplit::reduceRegions // Buffer for swapping boundary information labelList nbrRegion(mesh().nBoundaryFaces()); + bool emitWarning = true; + do { if (debug) @@ -599,9 +601,22 @@ Foam::autoPtr Foam::regionSplit::reduceRegions const label sent = localToGlobal[orig]; const label recv = patchNbrRegion[patchFacei]; - // Record the minimum value seen - if (recv < sent) + if (recv == UNASSIGNED) { + if (emitWarning) + { + Pout<<"Warning in regionSplit:" + " received unassigned on " + << pp.name() << " at patchFace " + << patchFacei + << ". Check synchronisation in caller" + << nl; + } + } + else if (recv < sent) + { + // Record the minimum value seen + auto fnd = updateLookup.find(sent); if (!fnd.found()) { @@ -646,6 +661,7 @@ Foam::autoPtr Foam::regionSplit::reduceRegions << " local regions" << endl; } + emitWarning = false; // Continue until there are no further changes } while (returnReduce(!updateLookup.empty(), orOp())); From bb35d784a295e2bc96050af5ac51116cc8865c71 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 12 Jul 2019 16:38:04 +0200 Subject: [PATCH 15/53] BUG: distanceSurface has gaps in mesh (#1374) - need to be more generous when prefiltering the cell selection --- src/sampling/surface/distanceSurface/distanceSurface.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sampling/surface/distanceSurface/distanceSurface.C b/src/sampling/surface/distanceSurface/distanceSurface.C index 2f1c9a511d..04e1236a23 100644 --- a/src/sampling/surface/distanceSurface/distanceSurface.C +++ b/src/sampling/surface/distanceSurface/distanceSurface.C @@ -209,6 +209,9 @@ void Foam::distanceSurface::createGeometry() cellBb.clear(); cellBb.add(fvm.points(), fvm.cellPoints(i)); + // Expand slightly to catch corners + cellBb.inflate(0.1); + if (!cellBb.contains(nearest[i].hitPoint())) { ignoreCells.set(i); From c07ab245561a704fd41b13c474df11ec3ee7b755 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 22 Jul 2019 15:14:46 -0700 Subject: [PATCH 16/53] BUG: EP:1070. Adding check for coupled patches in faceReflecting --- .../solarLoad/faceReflecting/faceReflecting.C | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C index eb2b158dd3..418717da88 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -413,23 +413,28 @@ void Foam::faceReflecting::calculate() // Fill patchr forAll(patchr, patchi) { - for (label bandI = 0; bandI < nBands; bandI++) - { - patchr[patchi][bandI] = - boundaryRadiation.specReflectivity - ( - patchi, - bandI, - new vectorField(patches[patchi].size(), sunDir) - ); + const polyPatch& pp = patches[patchi]; - patcha[patchi][bandI] = - boundaryRadiation.absorptivity - ( - patchi, - bandI, - new vectorField(patches[patchi].size(), sunDir) - ); + if (!pp.coupled() && !isA(pp)) + { + for (label bandI = 0; bandI < nBands; bandI++) + { + patchr[patchi][bandI] = + boundaryRadiation.specReflectivity + ( + patchi, + bandI, + new vectorField(patches[patchi].size(), sunDir) + ); + + patcha[patchi][bandI] = + boundaryRadiation.absorptivity + ( + patchi, + bandI, + new vectorField(patches[patchi].size(), sunDir) + ); + } } } From b0a1a3fd0b2ae6b9830db117546df76814fa3410 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Wed, 24 Jul 2019 09:37:38 +0100 Subject: [PATCH 17/53] BUG: quaternion - corrected construction from rotation tensor. Fixes #1348 --- src/OpenFOAM/primitives/quaternion/quaternionI.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/quaternion/quaternionI.H b/src/OpenFOAM/primitives/quaternion/quaternionI.H index e692707c30..3c550b8de7 100644 --- a/src/OpenFOAM/primitives/quaternion/quaternionI.H +++ b/src/OpenFOAM/primitives/quaternion/quaternionI.H @@ -259,7 +259,7 @@ inline Foam::quaternion::quaternion - rotationTensor.zz() ); - w_ = (rotationTensor.xz() - rotationTensor.xz())/s; + w_ = (rotationTensor.xz() - rotationTensor.zx())/s; v_[0] = (rotationTensor.xy() + rotationTensor.yx())/s; v_[1] = 0.25*s; v_[2] = (rotationTensor.yz() + rotationTensor.zy())/s; From 5767a7773290bdb01138670819eea1ac0f7c4768 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 24 Jul 2019 09:52:18 +0100 Subject: [PATCH 18/53] TUT: remove trailing space - use git show --ignore-space-change when examining --- .../LES/channel395DFSEM/system/controlDict | 48 +++---- .../simpleFoam/bump2D/system/blockMeshDict | 122 +++++++++--------- .../turbulentFlatPlate/0.kEpsilon/p | 2 +- .../turbulentFlatPlate/0.kOmegaSST/p | 2 +- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/tutorials/incompressible/pimpleFoam/LES/channel395DFSEM/system/controlDict b/tutorials/incompressible/pimpleFoam/LES/channel395DFSEM/system/controlDict index 2f213c30b5..09dc505710 100644 --- a/tutorials/incompressible/pimpleFoam/LES/channel395DFSEM/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/LES/channel395DFSEM/system/controlDict @@ -65,19 +65,19 @@ functions libs ("libfieldFunctionObjects.so"); writeControl writeTime; } - lambVector1 - { - type lambVector; - libs ("libfieldFunctionObjects.so"); - writeControl writeTime; - field U; - } - div1 - { - type div; - libs ("libfieldFunctionObjects.so"); - writeControl writeTime; - field lambVector; + lambVector1 + { + type lambVector; + libs ("libfieldFunctionObjects.so"); + writeControl writeTime; + field U; + } + div1 + { + type div; + libs ("libfieldFunctionObjects.so"); + writeControl writeTime; + field lambVector; } fieldAverage1 { @@ -102,18 +102,18 @@ functions base time; } - lambVector - { - mean on; - prime2Mean off; - base time; - } + lambVector + { + mean on; + prime2Mean off; + base time; + } - div(lambVector) - { - mean on; - prime2Mean off; - base time; + div(lambVector) + { + mean on; + prime2Mean off; + base time; } ); } diff --git a/tutorials/incompressible/simpleFoam/bump2D/system/blockMeshDict b/tutorials/incompressible/simpleFoam/bump2D/system/blockMeshDict index d50ac76078..8fc430b236 100644 --- a/tutorials/incompressible/simpleFoam/bump2D/system/blockMeshDict +++ b/tutorials/incompressible/simpleFoam/bump2D/system/blockMeshDict @@ -1,23 +1,23 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +/*--------------------------------*- 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 dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -scale 1; +scale 1; -vertices -( +vertices +( ( -25.0 0 1 ) // 0 ( 0 0 1 ) // 1 ( 0.3 0 1 ) // 2 @@ -45,10 +45,10 @@ vertices ( 0.3 5 -1 ) // 21 ( 0 5 -1 ) // 22 ( -25.0 5 -1 ) // 23 -); +); -blocks -( +blocks +( // Medium level for tutorial hex ( 0 1 13 12 11 10 22 23) (30 1 81) simpleGrading (0.002 1 20000) hex ( 1 2 14 13 10 9 21 22) (25 1 81) simpleGrading (2 1 20000) @@ -62,7 +62,7 @@ blocks //hex ( 2 3 15 14 9 8 20 21) (480 1 648) simpleGrading (1 1 20000) //hex ( 3 4 16 15 8 7 19 20) (200 1 648) simpleGrading (0.5 1 20000) //hex ( 4 5 17 16 7 6 18 19) (240 1 648) simpleGrading (500 1 20000) -); +); edges #codeStream { @@ -101,37 +101,37 @@ edges #codeStream }; -boundary -( - inlet - { - type patch; - faces - ( - (0 11 23 12) - ); - } +boundary +( + inlet + { + type patch; + faces + ( + (0 11 23 12) + ); + } - outlet - { - type patch; - faces - ( + outlet + { + type patch; + faces + ( (17 18 6 5) - ); - } + ); + } - top - { - type symmetryPlane; - faces - ( - (11 10 22 23) + top + { + type symmetryPlane; + faces + ( + (11 10 22 23) (10 9 21 22) ( 9 8 20 21) ( 8 7 19 20) ( 7 6 18 19) - ); + ); } symUp @@ -143,15 +143,15 @@ boundary ); } - bump - { - type wall; - faces - ( - ( 1 13 14 2) + bump + { + type wall; + faces + ( + ( 1 13 14 2) ( 2 14 15 3) ( 3 15 16 4) - ); + ); } symDown @@ -161,7 +161,7 @@ boundary ( ( 4 16 17 5) ); - } + } frontAndBack { @@ -180,12 +180,12 @@ boundary ( 3 8 7 4) ( 4 7 6 5) ); - } + } -); - -mergePatchPairs -( -); - -// ************************************************************************* // +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kEpsilon/p b/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kEpsilon/p index 6e98f45d8b..21d3f0ab96 100644 --- a/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kEpsilon/p +++ b/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kEpsilon/p @@ -46,7 +46,7 @@ boundaryField { type zeroGradient; } - + bottomWall { type zeroGradient; diff --git a/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kOmegaSST/p b/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kOmegaSST/p index 6e98f45d8b..21d3f0ab96 100644 --- a/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kOmegaSST/p +++ b/tutorials/incompressible/simpleFoam/turbulentFlatPlate/0.kOmegaSST/p @@ -46,7 +46,7 @@ boundaryField { type zeroGradient; } - + bottomWall { type zeroGradient; From b2f6e60a11b51601df896db9e414af37d5c123a2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 24 Jul 2019 09:52:18 +0100 Subject: [PATCH 19/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index cf3497f429..dedb008f68 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=190708 +patch=190724 From 8dd3c7f2bc878b83494588278b96a538bd3c6467 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 29 Jul 2019 10:06:26 +0200 Subject: [PATCH 20/53] CONFIG: add postProcessing/fields/lambVector template (fixes #1386) --- .../postProcessing/fields/lambVector | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 etc/caseDicts/postProcessing/fields/lambVector diff --git a/etc/caseDicts/postProcessing/fields/lambVector b/etc/caseDicts/postProcessing/fields/lambVector new file mode 100644 index 0000000000..f8692fd715 --- /dev/null +++ b/etc/caseDicts/postProcessing/fields/lambVector @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Version: v1906 + \\ / A nd | Web: www.OpenFOAM.com + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Calculates and writes the second largest eigenvalue of the sum of the + square of the symmetrical and anti-symmetrical parts of the velocity + gradient tensor. + +\*---------------------------------------------------------------------------*/ + +type lambVector; +libs ("libfieldFunctionObjects.so"); + +field U; + +executeControl writeTime; +writeControl writeTime; + +// ************************************************************************* // From 962e6f6318787ab28025315c035709095e4fbbd5 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 30 Jul 2019 08:49:15 -0700 Subject: [PATCH 21/53] ENH: Small editing to fvSchemes and alphatWallBoilingWallFunction --- ...allBoilingWallFunctionFvPatchScalarField.C | 38 ++++++++++------ .../solidQuenching2D/system/water/fvSchemes | 45 +++---------------- 2 files changed, 31 insertions(+), 52 deletions(-) diff --git a/src/phaseSystemModels/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/src/phaseSystemModels/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index bd4722a01b..bb8858fb01 100644 --- a/src/phaseSystemModels/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/src/phaseSystemModels/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -1045,7 +1045,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() mDotL_[i] = dmdt_[i]*L[i]; // No quenching flux - //qq_[i] = 0.0; + qq_[i] = 0.0; this->operator[](i) = ( @@ -1104,6 +1104,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() A1[i] = 1.0; qq_[i] = 0.0; mDotL_[i] = 0.0; + dmdt_[i] = 0.0; // Turbulente thermal diffusivity for single phase. this->operator[](i) = @@ -1141,12 +1142,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() Info<< " dmdt: " << gMin((dmdt_)) << " - " << gMax((dmdt_)) << endl; - Info<< " alphatlEff: " << gMin(liquidw*(*this + alphaw)) + Info<< " alphatlEff: " << gMin(liquidw*(*this + alphaw)) << " - " << gMax(liquidw*(*this + alphaw)) << endl; scalar Qeff = gSum(qEff*patch().magSf()); - Info<< " Effective heat transfer rate to liquid:" << Qeff - << endl; + Info<< " Effective heat transfer rate to liquid: " << Qeff + << endl << nl; if (debug & 2) { @@ -1186,11 +1187,13 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() } } - Info<< "Sub Cool faces : " << nSubCool << endl; - Info<< "Transient faces : " << nTransient << endl; - Info<< "Film faces : " << nFilm << endl; - Info<< "Non Boiling faces : " << nNonBoiling << endl; - Info<< "Total faces : " << this->size() << endl; + Info<< "Faces regime : " << nl << endl; + + Info<< " sub Cool faces : " << nSubCool << endl; + Info<< " transient faces : " << nTransient << endl; + Info<< " film faces : " << nFilm << endl; + Info<< " non-Boiling faces : " << nNonBoiling << endl; + Info<< " total faces : " << this->size() << endl << nl; const scalarField qc ( @@ -1199,7 +1202,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() ); scalar Qc = gSum(qc*patch().magSf()); - Info<< " Convective heat transfer:" << Qc << endl; + Info<< " Convective heat transfer: " << Qc << endl; const scalarField qFilm ( @@ -1219,14 +1222,21 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() Info<< " Transient boiling heat transfer:" << Qtbtot << endl; - Info<< " tDNB: " << gMin(tDNB) << " - " << gMax(tDNB) + Info<< " TDNB: " << gMin(tDNB) << " - " << gMax(tDNB) << endl; - scalar QsubCool = gSum + const scalarField qSubCool ( - fLiquid*nSubCools*(qq_ + qe())*patch().magSf() + fLiquid*nSubCools* + ( + A1*alphatConv_*hew.snGrad() + + qe() + qq() + ) ); - Info<< " Sub Cool boiling heat transfer:" << QsubCool + + scalar QsubCool = gSum(qSubCool*patch().magSf()); + + Info<< " Sub Cool boiling heat transfer: " << QsubCool << endl; Info<< " N: " << gMin(nSubCools*N) << " - " diff --git a/tutorials/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D/system/water/fvSchemes b/tutorials/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D/system/water/fvSchemes index 18e8717320..908a2f4570 100644 --- a/tutorials/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D/system/water/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D/system/water/fvSchemes @@ -22,58 +22,27 @@ ddtSchemes gradSchemes { default Gauss linear; - /* - grad((1-alpha.gas)) leastSquares;//Gauss linear; - grad(alpha.gas) leastSquares;//Gauss linear; - grad(U.gas) leastSquares;//Gauss linear; - grad(U.liquid) leastSquares;// Gauss linear; - - grad(h.gas) leastSquares; - grad(h.liquid) leastSquares; - - grad(alpha.liquid) leastSquares; - grad(alpha.gas) leastSquares; - - grad(rho) leastSquares; - - grad(p_rgh) leastSquares; - - grad(epsilon.liquid) leastSquares; - grad(k.liquid) leastSquares; - */ - } divSchemes { - default none;//Gauss upwind; + default none; "div\(phi,alpha.*\)" Gauss vanLeer; "div\(phir,alpha.*\)" Gauss vanLeer; - "div\(alphaRhoPhi.*,U.*\)" Gauss upwind;//limitedLinearV 1; - "div\(phi.*,U.*\)" Gauss upwind;//limitedLinearV 1; + "div\(alphaRhoPhi.*,U.*\)" Gauss upwind; + "div\(phi.*,U.*\)" Gauss upwind; - "div\(alphaRhoPhi.*,Yi\)" Gauss upwind;//limitedLinear 1; - "div\(alphaRhoPhi.*,(h|e|f).*\)" Gauss upwind;//limitedLinear 1; - "div\(alphaRhoPhi.*,K.*\)" Gauss upwind;//limitedLinear 1; - "div\(alphaPhi.*,p\)" Gauss upwind;//limitedLinear 1; + "div\(alphaRhoPhi.*,Yi\)" Gauss upwind; + "div\(alphaRhoPhi.*,(h|e|f).*\)" Gauss upwind; + "div\(alphaRhoPhi.*,K.*\)" Gauss upwind; + "div\(alphaPhi.*,p\)" Gauss upwind; "div\(alphaRhoPhi.*,(k|epsilon).*\)" Gauss upwind; "div\(phim,(k|epsilon)m\)" Gauss upwind; "div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear; - -/* - div(phi,U) Gauss upwind; - div(phi,K) Gauss linear; - div(phi,h) Gauss upwind; - div(phi,k) Gauss upwind; - div(phi,epsilon) Gauss upwind; - div(phi,R) Gauss upwind; - div(R) Gauss linear; - div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; -*/ } laplacianSchemes From 005abee36813e7b6270bc21d6ee946377990df99 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 31 Jul 2019 12:02:13 +0200 Subject: [PATCH 22/53] STYLE: clarify comments in etc/colourTables --- etc/colourTables | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/colourTables b/etc/colourTables index f39d34d5e6..0cd938e203 100644 --- a/etc/colourTables +++ b/etc/colourTables @@ -7,9 +7,9 @@ \*---------------------------------------------------------------------------*/ // An OpenFOAM dictionary of colourTables. -// The names should match those in the colourTables class. +// The predefined enumerations in the colourTables class *must* also appear +// here, but the file can also contain additional custom colour tables too. -6 ( coolToWarm @@ -91,6 +91,8 @@ xray ); } +// Additional tables (without code enumeration) + ) // ************************************************************************* // From 65be1b0e29760da01a1514e3d9098470a59b16f6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 6 Aug 2019 10:30:07 +0200 Subject: [PATCH 23/53] BUG: incorrect binary read of injectedParticle (fixes #1393) - the read offset missed the tag_ member entirely and thus the entire particle information would be corrupt (incorrectly interpreted) as well as potential violation of adjacent (trailing) memory locations. --- src/lagrangian/basic/injectedParticle/injectedParticleIO.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C index 4fa325b9e4..eb3185ab39 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C +++ b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C @@ -76,7 +76,7 @@ Foam::injectedParticle::injectedParticle } else { - is.read(reinterpret_cast(&soi_), sizeofFields); + is.read(reinterpret_cast(&tag_), sizeofFields); } } From f2fe35405c7c48bbb7278689866f3ef9e1285d8b Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 6 Aug 2019 16:02:38 +0200 Subject: [PATCH 24/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index dedb008f68..f5ea670a39 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=190724 +patch=190806 From 38f81f1c4dbeb75ad5ec1b89f3d225a63579d3bd Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Wed, 7 Aug 2019 13:03:48 +0100 Subject: [PATCH 25/53] DOC: Added missing endverbatim and minor tidying --- .../solidAbsorption/solidAbsorption.H | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.H b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.H index e89426e493..66de292c7b 100644 --- a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.H +++ b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.H @@ -26,18 +26,19 @@ Class Description - Radiation absorptivity-emissivity model to be used on walls on - inter-regions patches when the solid opaque radiation model is used + Radiation absorptivity-emissivity model to be used on walls on + inter-region patches when the solid opaque radiation model is used in the solid and the wall emissivity and absorptivity are taken from the solid radiation properties Usage + Example usage \verbatim - wallAbsorptionEmissionModel { type solidAbsorption; }; + \endverbatim SourceFiles From 1c1b1874eadf1acdbe603dd916f9ccd6e3348a96 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 7 Aug 2019 18:36:08 +0200 Subject: [PATCH 26/53] CONFIG: accept 'system' for foamConfigurePaths -paraview --- bin/tools/foamConfigurePaths | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index 12c1297e04..8c997f89ea 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -66,7 +66,7 @@ Components -scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/scotch_6.0.4) Graphics - -paraview VER specify 'ParaView_VERSION' (eg, 5.4.1) + -paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system) -paraview-qt VER specify 'ParaView_QT' (eg, qt-system) -paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1) -vtk VER specify 'vtk_version' (eg, VTK-7.1.0) @@ -580,11 +580,11 @@ do -paraview | -paraviewVersion | --paraviewVersion) # Replace ParaView_VERSION=... - expected="[5-9][.0-9]*" + expected="[5-9][.0-9]*" # but also accept system optionValue=$(getOptionValue "$@") _matches "$optionValue" "$expected" || \ + [ "$optionValue" != "${optionValue%system}" ] || \ die "'$1' has bad value: '$optionValue'" - replace etc/config.sh/paraview ParaView_VERSION "$optionValue" replace etc/config.csh/paraview ParaView_VERSION "$optionValue" adjusted=true From 212174064cce8883e1bb61c8f813998f3f3d73df Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 9 Aug 2019 14:22:30 +0200 Subject: [PATCH 27/53] CONFIG: robuster paraview detection --- wmake/scripts/paraviewFunctions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wmake/scripts/paraviewFunctions b/wmake/scripts/paraviewFunctions index b528f22cf7..4e7cceeb24 100644 --- a/wmake/scripts/paraviewFunctions +++ b/wmake/scripts/paraviewFunctions @@ -121,17 +121,17 @@ have_pvplugin_support() # Extract the paraview major+minor version from the directory name # From /path/paraview-5.6 -> 5.6 - pv_api=$(echo "${targetDir##*/}" | \ - sed -n -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p') + pv_api=$(echo "$targetDir" | \ + sed -ne 's@^.*/@@;s/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p') [ -n "$targetDir" ] || { - echo "$warn (could determine target)" + echo "$warn (could not determine target)" echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-???}" return 1 } [ -n "$pv_api" ] || { - echo "$warn (could determine major.minor version)" + echo "$warn (could not determine major.minor version)" return 1 } From 9510cdd1be827899cb72c80b70b8e590e7e25f53 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 13 Aug 2019 10:25:02 +0200 Subject: [PATCH 28/53] CONFIG: improve build against paraview on headless nodes - the use of 'paraview --version' can be fail if the build host doesn't have the necessary graphics. For this case, try to obtain the ParaView API number from the associated include directory. --- etc/config.csh/paraview | 12 +++-- etc/config.sh/paraview | 32 +++--------- etc/config.sh/paraview-system | 96 +++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 29 deletions(-) create mode 100644 etc/config.sh/paraview-system diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index e2458e842e..759ed518ec 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -214,9 +214,13 @@ default: endsw endif -unset cleaned archDir -unset cmake cmake_version -unset pv_api pvLibDir pvPython qtDir qtLibDir -unsetenv ParaView_VERSION ParaView_QT + +#------------------------------------------------------------------------------ + +unsetenv ParaView_VERSION ParaView_QT + +unset archDir +unset cmake cmake_version +unset pv_api pvLibDir pvPython qtDir qtLibDir #------------------------------------------------------------------------------ diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index 8a632aec09..76c825cfee 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -107,27 +107,7 @@ case "$ParaView_VERSION" in ;; (system) - # Obtain major.minor from `paraview --version` - pv_api="$(paraview --version 2>/dev/null | \ - sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')" - - if [ -n "$pv_api" ] - then - export PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-$pv_api" - else - unset ParaView_DIR PV_PLUGIN_PATH - fi - - if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] - then - if [ -n "$PV_PLUGIN_PATH" ] - then - echo "Using paraview (system)" 1>&2 - echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2 - else - echo "system paraview (not found)" 1>&2 - fi - fi + eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} -config paraview-system)" ;; (*) @@ -217,14 +197,16 @@ case "$ParaView_VERSION" in ;; esac -unset -f _foamParaviewEval 2> /dev/null -unset cleaned archDir -unset cmake cmake_version -unset pv_api pvLibDir pvPython qtDir qtLibDir + +#------------------------------------------------------------------------------ if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing then unset ParaView_VERSION ParaView_QT fi +unset archDir +unset cmake cmake_version +unset pv_api pvLibDir pvPython qtDir qtLibDir + #------------------------------------------------------------------------------ diff --git a/etc/config.sh/paraview-system b/etc/config.sh/paraview-system new file mode 100644 index 0000000000..59b6bc5dd7 --- /dev/null +++ b/etc/config.sh/paraview-system @@ -0,0 +1,96 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / 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, licensed under GNU General Public License +# . +# +# File +# etc/config.sh/paraview-system +# - sourced by OpenFOAM-*/etc/bashrc or via foamPV alias +# +# Description +# Setup using PARAVIEW system installation +# +# Note +# When _foamAddLib is unset (eg, called from makeParaView or from foamPV): +# - the ParaView_VERSION variable is retained. +#------------------------------------------------------------------------------ + +# Compiler-specific location for ThirdParty installations +archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER" + +# Clean PATH and LD_LIBRARY_PATH +eval \ + "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \ + $ParaView_DIR $archDir/ParaView-)" + +eval \ + "$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \ + $ParaView_DIR $archDir/ParaView-)" + +#------------------------------------------------------------------------------ + +ParaView_DIR="$(command -v paraview 2>/dev/null)" + +# Do have paraview? +# Obtain major.minor from `paraview --version` +if [ -n "$ParaView_DIR" ] +then + ParaView_DIR="${ParaView_DIR%/*}" # Eg, /usr/bin/paraview -> /usr/bin + ParaView_DIR="${ParaView_DIR%/*}" # Eg, /usr/bin -> /usr + + # Obtain major.minor from `paraview --version` + pv_api="$(paraview --version 2>/dev/null | \ + sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')" +else + unset pv_api +fi + +# The `paraview --version` can fail if the build host doesn't have graphics. +# Revert to guessing from the directory name if needed. +if [ -z "$pv_api" ] && [ -d "$ParaView_DIR" ] +then + pv_api="$(find $ParaView_DIR/include -maxdepth 1 -name 'paraview-*' | \ + sed -ne 's@^*/@@;s/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')" +fi + +case "$pv_api" in +([0-9]*.[0-9]*) + export ParaView_DIR + export PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-$pv_api" + ;; +(*) + unset ParaView_DIR PV_PLUGIN_PATH + ;; +esac + +if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] +then + if [ -n "$PV_PLUGIN_PATH" ] + then + echo "Using paraview (system)" 1>&2 + echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2 + else + echo "system paraview (not found)" 1>&2 + fi +fi + + +#------------------------------------------------------------------------------ + +if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing +then + unset ParaView_VERSION +else + ParaView_VERSION=system +fi + +unset archDir +unset pv_api + +#------------------------------------------------------------------------------ From e2269663aa007ae70bb7668e3a5fe0f6e3dec1ce Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Aug 2019 16:09:52 +0200 Subject: [PATCH 29/53] BUG: edge sync fails with cyclic baffles (fixes #1397) - synchronization, reduction only makes sense on processor-coupled patches. Since cyclic baffles are within a single processor domain, they are not reduced. So need to skip the sanity test for these. --- .../meshes/polyMesh/globalMeshData/globalMeshData.C | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 2976c35530..962c4d6363 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1185,6 +1185,12 @@ void Foam::globalMeshData::calcGlobalEdgeOrientation() const forAll(coupledPatch().edges(), edgeI) { + if (masterEdgeVerts[edgeI] == labelPair(labelMax, labelMax)) + { + // Skip single edge on cyclic baffle + continue; + } + const edge& e = coupledPatch().edges()[edgeI]; const labelPair masterE ( @@ -1192,7 +1198,7 @@ void Foam::globalMeshData::calcGlobalEdgeOrientation() const masterPoint[e[1]] ); - label stat = labelPair::compare + const int stat = labelPair::compare ( masterE, masterEdgeVerts[edgeI] From dec8216835194953b0098a1d31fd0eefe0765918 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 13 Aug 2019 16:24:03 +0200 Subject: [PATCH 30/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index f5ea670a39..72c7667349 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=190806 +patch=190813 From 31bfd40001125d3f19853c60fd4feb43b08e2e47 Mon Sep 17 00:00:00 2001 From: mattijs <> Date: Wed, 14 Aug 2019 12:05:52 +0100 Subject: [PATCH 31/53] ENH: globalMeshData - added else branch so that in the case of a cyclic baffle edge it sets the globalEdgeOrientation See #1367 --- .../polyMesh/globalMeshData/globalMeshData.C | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 962c4d6363..aad2b2884c 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1185,35 +1185,37 @@ void Foam::globalMeshData::calcGlobalEdgeOrientation() const forAll(coupledPatch().edges(), edgeI) { - if (masterEdgeVerts[edgeI] == labelPair(labelMax, labelMax)) + // Test that edge is not single edge on cyclic baffle + if (masterEdgeVerts[edgeI] != labelPair(labelMax, labelMax)) { - // Skip single edge on cyclic baffle - continue; - } + const edge& e = coupledPatch().edges()[edgeI]; + const labelPair masterE + ( + masterPoint[e[0]], + masterPoint[e[1]] + ); - const edge& e = coupledPatch().edges()[edgeI]; - const labelPair masterE - ( - masterPoint[e[0]], - masterPoint[e[1]] - ); - - const int stat = labelPair::compare - ( - masterE, - masterEdgeVerts[edgeI] - ); - if (stat == 0) - { - FatalErrorInFunction - << "problem : my edge:" << e - << " in master points:" << masterE - << " v.s. masterEdgeVerts:" << masterEdgeVerts[edgeI] - << exit(FatalError); + const int stat = labelPair::compare + ( + masterE, + masterEdgeVerts[edgeI] + ); + if (stat == 0) + { + FatalErrorInFunction + << "problem : my edge:" << e + << " in master points:" << masterE + << " v.s. masterEdgeVerts:" << masterEdgeVerts[edgeI] + << exit(FatalError); + } + else + { + globalEdgeOrientation.set(edgeI, (stat == 1)); + } } else { - globalEdgeOrientation.set(edgeI, (stat == 1)); + globalEdgeOrientation.set(edgeI, true); } } } From 8fe96e5dee9a4a700cb5715dc30c4cd7f0b8db73 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 19 Aug 2019 13:38:36 -0700 Subject: [PATCH 32/53] ENH: Changing tolerance overlap. Taking out filter by small overlap --- .../cellVolumeWeight/cellVolumeWeightCellCellStencil.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 4f02c9d466..60464e71eb 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -49,7 +49,7 @@ namespace cellCellStencils } Foam::scalar -Foam::cellCellStencils::cellVolumeWeight::defaultOverlapTolerance_ = 1e-9; +Foam::cellCellStencils::cellVolumeWeight::defaultOverlapTolerance_ = 1e-6; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -953,7 +953,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() // Interpolate. Check if enough overlap scalar v = mesh_.V()[cellI]; scalar overlapVol = sum(allWeights[cellI]); - if (overlapVol > (1.0-overlapTolerance_)*v) + if (overlapVol > overlapTolerance_*v) { allCellTypes[cellI] = INTERPOLATED; } @@ -971,7 +971,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() } } - +/* // Knock out cell with insufficient interpolation weights forAll(allCellTypes, cellI) { @@ -989,7 +989,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() } } } - +*/ if (debug) { tmp tfld From 785241178f665f0442eaf3c48893569464d6bf36 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 21 Aug 2019 11:34:18 -0700 Subject: [PATCH 33/53] BUG: Correct div(u*p) for Teqn in compressibleInterFoam .Gitlab 1400. --- applications/solvers/multiphase/compressibleInterFoam/TEqn.H | 2 +- .../compressibleInterDyMFoam/compressibleInterDyMFoam.C | 5 +++-- .../multiphase/compressibleInterFoam/compressibleInterFoam.C | 4 ++-- .../laminar/sloshingTank2D/system/fvSchemes | 1 + .../laminar/sphereDrop/system/fvSchemes | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H index 1561ae35cc..29ba87088f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H @@ -4,7 +4,7 @@ fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - fvm::Sp(contErr, T) - fvm::laplacian(turbulence.alphaEff(), T) + ( - (divU*p)() - contErr/rho*p + divUp - contErr/rho*p + (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))() - contErr*K ) *( diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index de115130a9..fd806d9747 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -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) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -88,10 +88,11 @@ int main(int argc, char *argv[]) { #include "readDyMControls.H" - // Store divU from the previous mesh so that it can be mapped + // Store divU and divUp from the previous mesh so that it can be mapped // and used in correctPhi to ensure the corrected phi has the // same divergence volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U))); + volScalarField divUp("divUp", fvc::div(fvc::absolute(phi, U), p)); if (LTS) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 3c35366957..18c005032f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) OpenCFD Ltd. 2017 + \\ / A nd | Copyright (C) OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) turbulence.correctPhasePhi(); #include "UEqn.H" - volScalarField divU(fvc::div(fvc::absolute(phi, U))); + volScalarField divUp("divUp", fvc::div(fvc::absolute(phi, U), p)); #include "TEqn.H" // --- Pressure corrector loop diff --git a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/system/fvSchemes b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/system/fvSchemes index 663e6611e3..61c265291c 100644 --- a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/system/fvSchemes +++ b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sloshingTank2D/system/fvSchemes @@ -34,6 +34,7 @@ divSchemes div(rhoPhi,T) Gauss linear; div(rhoPhi,K) Gauss linear; div((phi+meshPhi),p) Gauss linear; + div(U,p) Gauss linear; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; diff --git a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/fvSchemes b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/fvSchemes index 30c93fd93b..8fb0f7df95 100644 --- a/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/fvSchemes +++ b/tutorials/multiphase/compressibleInterDyMFoam/laminar/sphereDrop/system/fvSchemes @@ -39,6 +39,7 @@ divSchemes div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; div((phi+meshPhi),p) Gauss linear; + div(phi,p) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear; } From 7443011217a470da512101bf26753da35d835fc5 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 21 Aug 2019 11:47:10 -0700 Subject: [PATCH 34/53] BUG: Fixing solid specie index in omega function --- .../pyrolysisChemistryModel/pyrolysisChemistryModel.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C index 3b892483e5..b284e01682 100644 --- a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2017 OpenFOAM Foundation @@ -264,7 +264,7 @@ Foam::pyrolysisChemistryModel::omega for (label s=0; s Date: Wed, 28 Aug 2019 17:19:11 +0200 Subject: [PATCH 35/53] BUG: missing foamExec causes foamJob failure (#1309, #1411) - foamExec was removed as part of commit 6c68c34e1ac97e2d but overlooked the fact that it is partly still needed by foamJob. When running in parallel, it is used to source the etc/bashrc env. Reinstated a stripped down form, which has been relocated to bin/tools directory (it should not be directly called by the user). The previous version switching functionality has nonetheless be dropped since it only worked only when a rigid naming convention for OpenFOAM installations was followed. ENH: add foamJob log=, -log-app, -no-log options, improved coding quality --- bin/foamJob | 316 ++++++++++++++++++++++++--------------------- bin/tools/foamExec | 120 +++++++++++++++++ 2 files changed, 290 insertions(+), 146 deletions(-) create mode 100755 bin/tools/foamExec diff --git a/bin/foamJob b/bin/foamJob index 7b8143c2a8..2b5f4f67b2 100755 --- a/bin/foamJob +++ b/bin/foamJob @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # | Copyright (C) 2011-2015 OpenFOAM Foundation @@ -32,6 +32,9 @@ # Redirects the output to 'log' in the case directory. # #------------------------------------------------------------------------------ +# If dispatching via foamExec +foamExec="$WM_PROJECT_DIR/bin/tools/foamExec" + usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done @@ -40,80 +43,30 @@ usage() { Usage: ${0##*/} [OPTION] ... options: -case specify alternative case directory, default is the cwd - -parallel parallel run of processors - -screen also sends output to screen - -append append to log file instead of overwriting it + -parallel run in parallel (with mpirun) + -screen also send output to screen + -append append to existing log file instead of overwriting it + -log=FILE specify the log file + -log-app Use log.{appName} for the log file + -no-check run without fewer checks (eg, processor dirs etc) + -no-log run without log file -wait wait for execution to complete (when not using -screen) - -version=VER specify an alternative OpenFOAM version -help print the usage -* run an OpenFOAM job in background. - Redirects the output to 'log' in the case directory +Run an OpenFOAM job in background, redirecting output to a 'log' file +in the case directory USAGE exit 1 } -# Echo strings that have single quotes -echoArgs() { - addSpace="" - - for stringItem in "$@" - do - echo -n "${addSpace}" - - if [ "${stringItem##* }" = "$stringItem" ] - then - echo -n "$stringItem" - addSpace=" " - else - echo -n "'$stringItem'" - addSpace=" " - fi - done - - unset stringItem addSpace -} - - -# Replacement for possibly buggy 'which' -findExec() { - case "$1" in - */*) - if [ -x "$1" ] - then - echo "$1" - return 0 - fi - ;; - esac - - oldIFS=$IFS - IFS=':' - for d in $PATH - do - # echo "testing: $d/$1" 1>&2 - if [ -x "$d/$1" -a ! -d "$d/$1" ] - then - # echo "Found exec: $d/$1" 1>&2 - IFS=$oldIFS - echo "$d/$1" - return 0 - fi - done - IFS=$oldIFS - echo "" - return 1 -} - - - -# Main script -#~~~~~~~~~~~~ -unset parallelOpt screenOpt waitOpt -unset projectVersion - +#------------------------------------------------------------------------------ # Parse options + +logFile="log" +optCheck=true +unset optParallel optScreen optWait logMode + while [ "$#" -gt 0 ] do case "$1" in @@ -122,27 +75,41 @@ do ;; -case) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" + cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" shift ;; -p | -parallel) - parallelOpt=true + optParallel=true ;; -s | -screen) - screenOpt=true + optScreen=true ;; -a | -append) - appendOpt=true + logMode=append ;; -w | -wait) - waitOpt=true + optWait=true + ;; + -no-check*) + unset optCheck + ;; + -no-log) + logMode=none + logFile=log # Consistency if -append toggles it back on + ;; + -log=*) + logFile="${1##*=}" + [ -n "$logFile" ] || logFile="log" + ;; + -log-app) + logFile="{LOG_APPNAME}" # Tag for log.appName output ;; -version=*) - projectVersion="${1#*=}" # for foamExec + echo "Ignoring version option" 1>&2 ;; -v | -version) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - projectVersion="$2" # for foamExec + echo "Ignoring version option" 1>&2 shift ;; --) @@ -166,65 +133,74 @@ done # The requested application appName="$1" -# Use foamExec for a specified version -# Also need foamExec for remote (parallel) runs -if [ -n "$projectVersion" -o "$parallelOpt" = true ] +# Does application even exist? +APPLICATION="$(command -v "$appName")" || \ + usage "Application '$appName' not found" + +if [ "$logFile" = "{LOG_APPNAME}" ] then - # When possible, determine if application even exists - if [ -z "$projectVersion" ] - then - findExec "$appName" >/dev/null || usage "Application '$appName' not found" - fi + logFile="log.${appName##*/}" +fi + +# Need foamExec for remote (parallel) runs +if [ "$optParallel" = true ] +then # Use foamExec for dispatching - APPLICATION=$(findExec foamExec) || usage "'foamExec' not found" - - [ -n "$projectVersion" ] && APPLICATION="$APPLICATION -version $projectVersion" + [ -x "$foamExec" ] || usage "File not found: $foamExec" + APPLICATION="$foamExec" else - APPLICATION=$(findExec "$appName") || usage "Application '$appName' not found" - echo "Application : $appName" + # Drop first argument in favour of fully qualified APPLICATION shift fi -if [ "$parallelOpt" = true ] -then - # parallel - # ~~~~~~~~ +# Stringify args, adding single quotes for args with spaces +echoArgs() +{ + unset stringifiedArgs + for stringItem in "$@" + do + case "$stringItem" in (*' '*) stringItem="'$stringItem'" ;; esac + stringifiedArgs="${stringifiedArgs}${stringifiedArgs:+ }${stringItem}" + done + echo "$stringifiedArgs" +} + + +if [ "$optParallel" = true ] +then # - # Check if the case decomposed + # Parallel # - if [ -r "processor0" -o -r "processors" ] + dict="system/decomposeParDict" + + [ -r "$dict" ] || { + echo "No $dict found, which is required for parallel running." + exit 1 + } + + nProcs="$(foamDictionary -entry numberOfSubdomains -value $dict 2>/dev/null)" + + # Check if case is decomposed + if [ "$optCheck" = true ] then - nprocs="$(foamDictionary -entry numberOfSubdomains -value system/decomposeParDict 2>/dev/null)" - else - echo "Case is not currently decomposed" - if [ -r system/decomposeParDict ] - then - echo "system/decomposeParDict exists" - echo "Try decomposing with \"foamJob decomposePar\"" + [ -r "processor0" ] || [ -r "processors" ] || { + echo "Case is not currently decomposed" + echo "Try decomposing first with \"foamJob decomposePar\"" exit 1 - else - echo "Cannot find system/decomposeParDict file required to decompose the case for parallel running." - echo "Please consult the User Guide for details of parallel running" - exit 1 - fi + } fi - # - # Find mpirun - # - mpirun=$(findExec mpirun) || usage "'mpirun' not found" - mpiopts="-np $nprocs" + # Locate mpirun + mpirun=$(command -v mpirun) || usage "'mpirun' not found" + mpiopts="-n $nProcs" - # # Check if the machine ready to run parallel - # - echo "Parallel processing using $WM_MPLIB with $nprocs processors" case "$WM_MPLIB" in - *OPENMPI) + *OPENMPI*) # Add hostfile info for hostfile in \ hostfile \ @@ -233,7 +209,7 @@ then system/machines \ ; do - if [ -r $hostfile ] + if [ -r "$hostfile" ] then mpiopts="$mpiopts -hostfile $hostfile" break @@ -242,59 +218,107 @@ then # Send FOAM_SETTINGS to parallel processes, so that the proper # definitions are sent as well. - mpiopts="$mpiopts -x FOAM_SETTINGS" + if [ -n "$FOAM_SETTINGS" ] + then + mpiopts="$mpiopts -x FOAM_SETTINGS" + fi ;; esac # # Run (in parallel) # - if [ "$screenOpt" = true ] + echo "Application : $appName ($nProcs processes)" + if [ "$logMode" != "none" ] then - [ "$appendOpt" = true ] && teeOpts=" -a" - echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel | tee $teeOpts log" - $mpirun $mpiopts $APPLICATION "$@" -parallel | tee $teeOpts log + echo "Output : $logFile" + fi + echo "Executing : $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel" + if [ "$optScreen" = true ] + then + case "$logMode" in + none) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel + ;; + append) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel | tee -a "$logFile" + ;; + *) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel | tee "$logFile" + ;; + esac else - if [ "$appendOpt" = true ] - then - echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel >> log 2>&1" - $mpirun $mpiopts $APPLICATION "$@" -parallel >> log 2>&1 & - else - echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel > log 2>&1" - $mpirun $mpiopts $APPLICATION "$@" -parallel > log 2>&1 & - fi + case "$logMode" in + none) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel > /dev/null 2>&1 & + ;; + append) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel >> "$logFile" 2>&1 & + ;; + *) + "$mpirun" $mpiopts "$APPLICATION" "$@" -parallel > "$logFile" 2>&1 & + ;; + esac pid=$! - if [ "$waitOpt" = true ] + if [ "$optWait" = true ] then - wait $pid + echo "Waiting for process $pid to finish" + wait "$pid" + echo "Process $pid finished" + else + echo "Process id : $pid" fi fi else # - # Run (on single processor) + # Serial # - if [ "$screenOpt" = true ] + echo "Application : $appName ($nProcs processes)" + if [ "$logMode" != "none" ] then - [ "$appendOpt" = true ] && teeOpts=" -a" - echo "Executing: $APPLICATION $(echoArgs "$@") | tee $teeOpts log &" - $APPLICATION "$@" | tee $teeOpts log & - wait $! - else - if [ "$appendOpt" = true ] - then - echo "Executing: $APPLICATION $(echoArgs "$@") >> log 2>&1 &" - $APPLICATION "$@" >> log 2>&1 & - else - echo "Executing: $APPLICATION $(echoArgs "$@") > log 2>&1 &" - $APPLICATION "$@" > log 2>&1 & - fi + echo "Output : $logFile" + fi + echo "Executing : $APPLICATION $(echoArgs "$@")" + if [ "$optScreen" = true ] + then + case "$logMode" in + none) + "$APPLICATION" "$@" & + ;; + append) + "$APPLICATION" "$@" | tee -a "$logFile" & + ;; + *) + "$APPLICATION" "$@" | tee "$logFile" & + ;; + esac pid=$! - if [ "$waitOpt" = true ] + echo "Process id : $pid" + wait "$pid" + else + case "$logMode" in + none) + "$APPLICATION" "$@" > /dev/null 2>&1 & + ;; + append) + "$APPLICATION" "$@" >> "$logFile" 2>&1 & + ;; + *) + "$APPLICATION" "$@" > "$logFile" 2>&1 & + ;; + esac + + pid=$! + if [ "$optWait" = true ] then - wait $pid + echo "Waiting for process $pid to finish" + wait "$pid" + echo "Process $pid finished" + else + echo "Process id : $pid" fi fi fi diff --git a/bin/tools/foamExec b/bin/tools/foamExec new file mode 100755 index 0000000000..80c266a9cb --- /dev/null +++ b/bin/tools/foamExec @@ -0,0 +1,120 @@ +#!/bin/bash +#------------------------------------------------------------------------------ +# ========= | +# \\ / 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 . +# +# Script +# foamExec ... +# +# Description +# Runs an application (with arguments) after first sourcing the OpenFOAM +# etc/bashrc file from the project directory +# +# This script must exist in $WM_PROJECT_DIR/bin/tools +# +# Can useful for parallel runs. For example, +# +# mpirun -n \ +# projectDir/bin/tools/foamExec ... -parallel +# +#------------------------------------------------------------------------------ +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< ... + +options: + -help Print the usage + +Runs an application (with arguments) after first sourcing the OpenFOAM +etc/bashrc file from the project directory + +USAGE + exit 1 +} + +# Report error and exit +die() +{ + exec 1>&2 + echo + echo "Error encountered:" + while [ "$#" -ge 1 ]; do echo " $1"; shift; done + echo + echo "See '$0 -help' for usage" + echo + exit 1 +} + +#------------------------------------------------------------------------------- +toolsDir="${0%/*}" # The bin/tools dir +projectDir="${toolsDir%/bin/tools}" # Project dir + +# Parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help*) + usage + ;; + --) + shift + break + ;; + -*) + die "unknown option: '$1'" + ;; + *) + break + ;; + esac + shift +done + +#------------------------------------------------------------------------------- + +[ "$#" -ge 1 ] || die "No application specified" + +[ -d "$projectDir" ] || { + echo "Error: no project dir: $projectDir" 1>&2 + exit 2 +} + +[ -f "$projectDir/etc/bashrc" ] || { + echo "Error: file not found: $projectDir/etc/bashrc" 1>&2 + exit 2 +} + + +# Source bashrc within a function to preserve command-line arguments +# - this will not have aliases, but working non-interactively anyhow +sourceBashrc() +{ + . "$projectDir/etc/bashrc" $FOAM_SETTINGS +} + +sourceBashrc +exec "$@" + +#------------------------------------------------------------------------------ From 76c156a667440e5151a8bd0f1c95be45bb5980e7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 28 Aug 2019 17:23:46 +0200 Subject: [PATCH 36/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index 72c7667349..c3eaa96840 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=190813 +patch=190828 From a3f3ec81f81dc7d1b682c623f0344721648a9c8d Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Sep 2019 14:25:15 +0100 Subject: [PATCH 37/53] BUG: randomDecomp: added non-mesh decomposition. Fixes #1428. --- .../randomDecomp/randomDecomp.C | 19 +++++++++++++++++++ .../randomDecomp/randomDecomp.H | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.C b/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.C index e1b583cdd8..858baebd7a 100644 --- a/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.C +++ b/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.C @@ -86,6 +86,25 @@ Foam::randomDecomp::randomDecomp // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::labelList Foam::randomDecomp::decompose +( + const pointField& points, + const scalarField& pointWeights +) const +{ + return randomMap(points.size()); +} + + +Foam::labelList Foam::randomDecomp::decompose +( + const pointField& points +) const +{ + return randomMap(points.size()); +} + + Foam::labelList Foam::randomDecomp::decompose ( const polyMesh& mesh, diff --git a/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.H b/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.H index 5eea76c9f0..062cb2363a 100644 --- a/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.H +++ b/src/parallel/decompose/decompositionMethods/randomDecomp/randomDecomp.H @@ -91,6 +91,18 @@ public: return true; } + // No topology (implemented by geometric decomposers) + + //- Return for every coordinate the wanted processor number. + virtual labelList decompose + ( + const pointField& points, + const scalarField& pointWeights + ) const; + + //- Decompose with uniform weights on the points + virtual labelList decompose(const pointField& points) const; + //- Return for every coordinate the wanted processor number. virtual labelList decompose ( From 4265fc24594115a182fe60cb0b56397561589021 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 12 Sep 2019 13:42:38 +0100 Subject: [PATCH 38/53] BUG: overset: use correct normalisation. Fixes #1437. --- .../dynamicOversetFvMesh.C | 10 +++--- .../dynamicOversetFvMeshTemplates.C | 33 ++++++++++--------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C index a5491a723f..bf77f6b11a 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -330,7 +330,6 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const << " lower:" << addr.lowerAddr().size() << " upper:" << addr.upperAddr().size() << endl; - lduInterfacePtrsList iFaces = this->interfaces(); // Using lduAddressing::patch forAll(patchAddr, patchI) { @@ -340,17 +339,16 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const } // Using interfaces - Pout<< "iFaces:" << iFaces.size() << endl; + const lduInterfacePtrsList& iFaces = allInterfaces_; + Pout<< "Adapted interFaces:" << iFaces.size() << endl; forAll(iFaces, patchI) { if (iFaces.set(patchI)) { - Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type() - << endl; + Pout<< " " << patchI << "\tinterface:" + << iFaces[patchI].type() << endl; } } - - Pout<< "end of printing." << endl; } return true; diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C index 2d54a3cbb6..0edf51be28 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2014-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,14 +149,14 @@ Foam::tmp Foam::dynamicOversetFvMesh::normalisation const fvMatrix& m ) const { - // Determine normalisation. This is normally the original diagonal. - // This needs to be stabilised for hole cells + // Determine normalisation. This is normally the original diagonal plus + // remote contributions. This needs to be stabilised for hole cells // which can have a zero diagonal. Assume that if any component has // a non-zero diagonal the cell does not need stabilisation. tmp tnorm(tmp::New(m.diag())); scalarField& norm = tnorm.ref(); - // Add boundary coeffs to duplicate behaviour of fvMatrix::addBoundaryDiag + // Add remote coeffs to duplicate behaviour of fvMatrix::addBoundaryDiag const FieldField& internalCoeffs = m.internalCoeffs(); for (direction cmpt=0; cmpt::nComponents; cmpt++) { @@ -174,10 +174,14 @@ Foam::tmp Foam::dynamicOversetFvMesh::normalisation // Count number of problematic cells label nZeroDiag = 0; - for (const scalar n : norm) + forAll(norm, celli) { + const scalar& n = norm[celli]; if (magSqr(n) < sqr(SMALL)) { + //Pout<< "For field " << m.psi().name() + // << " have diagonal " << n << " for cell " << celli + // << " at:" << cellCentres()[celli] << endl; nZeroDiag++; } } @@ -302,22 +306,19 @@ Foam::tmp Foam::dynamicOversetFvMesh::normalisation forAll(norm, celli) { scalar& n = norm[celli]; - if (mag(n) < SMALL) + if (magSqr(n) < sqr(SMALL)) { + //Pout<< "For field " << m.psi().name() + // << " for cell " << celli + // << " at:" << cellCentres()[celli] + // << " have norm " << n + // << " have extrapolated norm " << extrapolatedNorm[celli] + // << endl; + // Override the norm n = extrapolatedNorm[celli]; } - else - { - // Use original diagonal - n = m.diag()[celli]; - } } } - else - { - // Use original diagonal - norm = m.diag(); - } return tnorm; } From e1fb615f87e3633a830de5153b91258d2001a1ec Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 18 Sep 2019 09:22:35 -0700 Subject: [PATCH 39/53] BUG: Fixing psib to use products mixture. Fix Gitlab issue #1423 --- .../reactionThermo/psiuReactionThermo/heheuPsiThermo.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C index 11b6bae093..3de79763cc 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -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-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -611,7 +611,7 @@ Foam::heheuPsiThermo::psib() const forAll(psibCells, celli) { psibCells[celli] = - this->cellReactants(celli).psi(pCells[celli], TbCells[celli]); + this->cellProducts(celli).psi(pCells[celli], TbCells[celli]); } volScalarField::Boundary& psibBf = psib.boundaryFieldRef(); From a1fa05f1ed5d8e67aeb51181d5532e091c3c8f2a Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 18 Sep 2019 13:03:04 -0700 Subject: [PATCH 40/53] BUG: Fixing psib at the boundary Fix gitlab #1423 --- .../reactionThermo/psiuReactionThermo/heheuPsiThermo.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C index 3de79763cc..db1aebf62c 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -626,7 +626,7 @@ Foam::heheuPsiThermo::psib() const forAll(ppsib, facei) { ppsib[facei] = - this->patchFaceReactants + this->patchFaceProducts (patchi, facei).psi(pp[facei], pTb[facei]); } } From 92f288ca361ee3d9b873d944f1c6848e2309d1b5 Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 27 Sep 2019 14:24:05 -0700 Subject: [PATCH 41/53] BUG: Correcting issue 1441. Reading cAlphas entry for multiphase --- .../phaseSystem/multiphaseSystem/multiphaseSystem.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C index f4a1414df3..48b980e003 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C @@ -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-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,7 +59,7 @@ Foam::multiphaseSystem::multiphaseSystem ) : phaseSystem(mesh), - cAlphas_(mesh.solverDict("alpha").lookup("cAlphas")), + cAlphas_(), ddtAlphaMax_(0.0), limitedPhiAlphas_(phaseModels_.size()), Su_(phaseModels_.size()), @@ -73,6 +73,8 @@ Foam::multiphaseSystem::multiphaseSystem phases_.set(phasei++, &pm); } + mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_); + // Initiate Su and Sp forAllConstIters(phaseModels_, iter) { From 58f6258d7a006ab07489ce8ccec644c9c339714b Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 27 Sep 2019 15:16:00 -0700 Subject: [PATCH 42/53] BUG: Correcting delta in fa consistent with fv. Solve issue 1431 Gitlab. delta() calculation on the patch is consistent with not applying non-orthogonality on the patch. --- src/finiteArea/faMesh/faPatches/faPatch/faPatch.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C index b0f1692721..199c2bfc5c 100644 --- a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C +++ b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C @@ -20,7 +20,7 @@ License 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 +// You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ @@ -424,7 +424,8 @@ Foam::tmp Foam::faPatch::edgeFaceCentres() const Foam::tmp Foam::faPatch::delta() const { - return edgeCentres() - edgeFaceCentres(); + return edgeNormals()*(edgeNormals() & (edgeCentres() - edgeFaceCentres())); + //return edgeCentres() - edgeFaceCentres(); } From b0cc93ecc8a7d515bdec54fbc0d47452df1d2fbc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 25 Sep 2019 17:36:10 +0200 Subject: [PATCH 43/53] BACKPORT: openfoam shell wrapper (interactive or 'one-shot' use) --- bin/tools/openfoam | 191 ++++++++++++++++++++++++++++++++++++++++ bin/tools/source-bashrc | 93 +++++++++++++++++++ etc/config.sh/aliases | 17 ++-- 3 files changed, 293 insertions(+), 8 deletions(-) create mode 100755 bin/tools/openfoam create mode 100644 bin/tools/source-bashrc diff --git a/bin/tools/openfoam b/bin/tools/openfoam new file mode 100755 index 0000000000..27997ce3dc --- /dev/null +++ b/bin/tools/openfoam @@ -0,0 +1,191 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / 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, licensed under GNU General Public License +# . +# +# Script +# openfoam [args] +# +# Description +# Open an interactive bash session with an OpenFOAM environment, +# or run an OpenFOAM application (with arguments) after first sourcing +# the OpenFOAM etc/bashrc file from the project directory. +# +# This script normally exists in $WM_PROJECT_DIR/bin/tools but can also +# be modified to use a hard-coded PROJECT_DIR entry and placed elsewhere +# in the filesystem (eg, /usr/bin). +# +#------------------------------------------------------------------------------ +# Hard-coded value (eg, with autoconfig) +projectDir="@PROJECT_DIR@" + +if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ] +then + # Auto-detect from location + toolsDir="${0%/*}" # The bin/tools dir + projectDir="${toolsDir%/bin/tools}" # Project dir + + case "$projectDir" in + (/bin | /usr/bin | /usr/local/bin) + # This shouldn't happen. + # If copied to a system dir, should also be using hard-coded values! + echo "Warning: suspicious looking project dir: $projectDir" 1>&2 + ;; + + ("$toolsDir") + # Eg, called as ./openfoam etc - need to try harder + projectDir="$(\cd $(dirname $0)/../.. && \pwd -L)" || unset projectDir + ;; + esac +fi + +#------------------------------------------------------------------------------ +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 + exit 1 + ;; + *) + break + ;; + esac + shift +done + +#------------------------------------------------------------------------------- + +# Remove current OpenFOAM environment +if [ -d "$WM_PROJECT_DIR" ] && [ -f "$WM_PROJECT_DIR/etc/config.sh/unset" ] +then + . "$WM_PROJECT_DIR/etc/config.sh/unset" +fi + +[ -d "$projectDir" ] || { + echo "Error: no project dir: $projectDir" 1>&2 + exit 2 +} + +_foamSourceBashEnv="$projectDir/etc/bashrc" + +if [ "$#" -eq 0 ] +then + # Interactive shell + _foamSourceBashEnv="$projectDir/bin/tools/source-bashrc" +fi + +[ -f "$_foamSourceBashEnv" ] || { + echo "Error: file not found: $_foamSourceBashEnv" 1>&2 + exit 2 +} + +if [ "$#" -eq 0 ] +then + # Source user ~/.bashrc and OpenFOAM etc/bashrc. + # 1) Can either use a tmp file, or 2) chain off to a dedicated file + # We use a dedicated file. + + if [ -n "$_foamSettings" ] + then + export FOAM_SETTINGS="$_foamSettings" + fi + + ## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2 + + # Interactive shell (newer bash can use --init-file instead of --rcfile) + exec bash --rcfile "$_foamSourceBashEnv" -i + +else + # Non-interactive + + # Source bashrc within a function to preserve command-line arguments + # - this will not have aliases, but working non-interactively anyhow + sourceBashrc() + { + . "$_foamSourceBashEnv" $_foamSettings + } + + sourceBashrc + exec "$@" +fi + +#------------------------------------------------------------------------------ diff --git a/bin/tools/source-bashrc b/bin/tools/source-bashrc new file mode 100644 index 0000000000..01c8fe37ee --- /dev/null +++ b/bin/tools/source-bashrc @@ -0,0 +1,93 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / 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, licensed under GNU General Public License +# . +# +# File +# bin/tools/source-bashrc +# +# Description +# Source user ~/.bashrc and OpenFOAM etc/bashrc +# +# This file is normally not sourced manually, +# but from bash with the --rcfile option. +#------------------------------------------------------------------------------ +# Hard-coded value (eg, with autoconfig) +projectDir="@PROJECT_DIR@" + +if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ] +then + # Auto-detect (as per OpenFOAM etc/bashrc) + # -- + # Assuming this file is $WM_PROJECT_DIR/bin/tools/source-bashrc, + # the next lines should work when sourced by BASH or ZSH shells. + # -- + + projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}" + [ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/../.. && \pwd -L)" || unset projectDir +fi + +#------------------------------------------------------------------------------ + +if [ -d "$projectDir" ] +then + _foamSourceBashEnv="$projectDir/etc/bashrc" +else + unset _foamSourceBashEnv +fi + + +# Source the user bashrc first. +# Simply hope that they don't unset/reset _foamSourceBashEnv !! + +if [ -f "$HOME/.bashrc" ] +then + . "$HOME/.bashrc" +fi + + +# Source the OpenFOAM etc/bashrc + +if [ -f "$_foamSourceBashEnv" ] +then + . "$_foamSourceBashEnv" $FOAM_SETTINGS + + # Avoid further inheritance + unset FOAM_SETTINGS + + # Some feedback + if [ -n "$PS1" ] && [ -d "$WM_PROJECT_DIR" ] + then + info="$(foamEtcFile -show-patch 2>/dev/null)" + + # echo "Using: OpenFOAM-$WM_PROJECT_VERSION ($FOAM_API${info:+ patch=$info}) - see www.OpenFOAM.com" 1>&2 + echo "Using: OpenFOAM-$WM_PROJECT_VERSION${info:+ (patch=$info)} - see www.OpenFOAM.com" 1>&2 + echo "Arch: $WM_OPTIONS (mpi=$FOAM_MPI)" 1>&2 + + ## echo "$WM_PROJECT_DIR" 1>&2 + ## echo 1>&2 + + # Set prompt as reminder that this is a shell session + + # Chalmers likes this one: + # PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'$(foamPwd)\n\u\$ ' + + PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'\w/\n\u\$ ' + fi +else + echo "Could not locate OpenFOAM etc/bashrc in '$projectDir'" 1>&2 +fi + +echo "OpenFOAM shell session - use exit to quit" 1>&2 +echo 1>&2 + +# Cleanup variables (done as final statement for a clean exit code) +unset _foamSourceBashEnv projectDir + +#------------------------------------------------------------------------------ diff --git a/etc/config.sh/aliases b/etc/config.sh/aliases index 9ead10e19f..00b1620250 100644 --- a/etc/config.sh/aliases +++ b/etc/config.sh/aliases @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -111,15 +111,16 @@ foamPV() unset -f foamPwd 2>/dev/null foamPwd() { - if [ -d "$WM_PROJECT_DIR" ] + if [ -n "$WM_PROJECT_DIR" ] then - echo "$PWD" | sed \ - -e "s#^${FOAM_RUN}#\$FOAM_RUN#;" \ - -e "s#^${WM_PROJECT_DIR}#\$WM_PROJECT_DIR#;" \ - -e "s#^${WM_PROJECT_USER_DIR}#\$WM_PROJECT_USER_DIR#;" \ - -e "s#^${HOME}#\$HOME#"; + echo "$PWD/" | sed \ + -e "s#^${FOAM_RUN}/#\$FOAM_RUN/#" \ + -e "s#^${WM_PROJECT_DIR}/#\$WM_PROJECT_DIR/#" \ + -e "s#^${WM_PROJECT_USER_DIR}/#\$WM_PROJECT_USER_DIR/#" \ + -e "s#^${HOME}/#~/#" \ + ; else - echo "$PWD" | sed -e "s#^${HOME}#\$HOME#;" + echo "$PWD/" | sed -e "s#^${HOME}/#~/#"; fi } From a563db323f898cc838a0a048a0a5255cb438d0b2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Oct 2019 14:01:58 +0200 Subject: [PATCH 44/53] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index c3eaa96840..ea2fb38271 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=190828 +patch=191001 From 386cafd8a765cbd11034a28ca2f5c6e38200e01b Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 3 Oct 2019 10:51:29 +0100 Subject: [PATCH 45/53] ENH: patchSet: merge collocated points. Fixes #1453. --- .../sampledSet/patchEdge/patchEdgeSet.C | 54 +++++++++++++++++-- .../sampledSet/patchEdge/patchEdgeSet.H | 2 + 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/sampling/sampledSet/patchEdge/patchEdgeSet.C b/src/sampling/sampledSet/patchEdge/patchEdgeSet.C index df3e3fc8b3..69756b4769 100644 --- a/src/sampling/sampledSet/patchEdge/patchEdgeSet.C +++ b/src/sampling/sampledSet/patchEdge/patchEdgeSet.C @@ -28,6 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "searchableSurface.H" #include "Time.H" +#include "mergePoints.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -126,15 +127,58 @@ void Foam::patchEdgeSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); - setSamples + + labelList pointMap; + const label nMerged = mergePoints ( samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + SMALL, //const scalar mergeTol, + false, //const bool verbose, + pointMap, + origin_ ); + if (nMerged == 0) + { + setSamples + ( + samplingPts, + samplingCells, + samplingFaces, + samplingSegments, + samplingCurveDist + ); + } + else + { + // Compress out duplicates + + List newSamplingPts(nMerged); + List