diff --git a/.gitmodules b/.gitmodules index ee2b053a21..592cb24277 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "cfmesh"] path = modules/cfmesh url = https://develop.openfoam.com/Community/integration-cfmesh.git +[submodule "avalanche"] + path = modules/avalanche + url = https://develop.openfoam.com/Community/avalanche.git diff --git a/BuildIssues.txt b/BuildIssues.txt index fbb6b6dcb5..a05b5301c3 100644 --- a/BuildIssues.txt +++ b/BuildIssues.txt @@ -1,4 +1,4 @@ -OpenFOAM-1706 +OpenFOAM-1712 ================== Known Build Issues ================== @@ -75,6 +75,33 @@ If your system compiler is too old to build the minimum required gcc or clang/llvm, it is just simply too old. +--------------------------------- +ThirdParty clang without gmp/mpfr +--------------------------------- + +If using ThirdParty clang without gmp/mpfr, the ThirdParty makeCGAL +script will need to be run manually and specify that there is no +gmp/mpfr. Eg, + + cd $WM_THIRD_PARTY_DIR + ./makeCGAL gmp-none mpfr-none + +Subequent compilation with Allwmake will now run largely without any +problems, except that the components linking against CGAL +(foamyMesh and surfaceBooleanFeatures) will also try to link against +a nonexistent mpfr library. As a workaround, the link-dependency can +be removed in wmake/rules/General/CGAL : + + CGAL_LIBS = \ + -L$(BOOST_ARCH_PATH)/lib \ + -L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ + -L$(CGAL_ARCH_PATH)/lib \ + -L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ + -lCGAL + +This is a temporary inconvenience until a more robust solution is found. + + ------------------------- Building with spack ------------------------- diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H index 27f568bce7..41c1cd5635 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/createFields.H @@ -61,18 +61,6 @@ dimensionedScalar rhoMin ) ); -Info<< "Creating turbulence model\n" << endl; -autoPtr turbulence -( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) -); - mesh.setFluxRequired(p.name()); Info<< "Creating field dpdt\n" << endl; @@ -115,3 +103,15 @@ volScalarField K("K", 0.5*magSqr(U)); // Mask field for zeroing out contributions on hole cells #include "createCellMask.H" + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); diff --git a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H index ba9cbf752c..ec31872e6d 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/overRhoPimpleDyMFoam/pEqn.H @@ -8,7 +8,7 @@ surfaceScalarField faceMask(localMin(mesh).interpolate(cellMask)); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); -HbyA = constrainHbyA(rAU*UEqn.H(), U, p); +HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p); if (pimple.nCorrPISO() <= 1) { diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H index 9baea7b716..e6acdd5b04 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/pEqn.H @@ -20,7 +20,7 @@ surfaceScalarField faceMask(localMin(mesh).interpolate(cellMask)); surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU)); volVectorField HbyA("HbyA", U); -HbyA = constrainHbyA(rAU*UEqn.H(), U, p); +HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p); //mesh.interpolate(HbyA); if (massFluxInterpolation) diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H new file mode 100644 index 0000000000..81309cd091 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaSuSp.H @@ -0,0 +1,43 @@ +volScalarField::Internal Sp +( + IOobject + ( + "Sp", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("Sp", dgdt.dimensions(), 0) +); + +volScalarField::Internal Su +( + IOobject + ( + "Su", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("Su", dgdt.dimensions(), 0) +); + +forAll(dgdt, celli) +{ + if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0) + { + Sp[celli] -= dgdt[celli]*alpha1[celli]; + Su[celli] += dgdt[celli]*alpha1[celli]; + } + else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0) + { + Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]); + } +} + +volScalarField::Internal divU +( + mesh.moving() + ? fvc::div(phiCN() + mesh.phi()) + : fvc::div(phiCN()) +); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H index b1eace14f2..dd6c345b85 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -56,29 +56,13 @@ } else { - #include "rhofs.H" - - p_rghEqnComp1 = - pos(alpha1) - *( - ( - fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f) - - (fvOptions(alpha1, mixture.thermo1().rho())&rho1) - )/rho1 - - fvc::ddt(alpha1) - fvc::div(alphaPhi1) - + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)) - ); + p_rghEqnComp1 = + fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh)) + + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1); p_rghEqnComp2 = - pos(alpha2) - *( - ( - fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f) - - (fvOptions(alpha2, mixture.thermo2().rho())&rho2) - )/rho2 - - fvc::ddt(alpha2) - fvc::div(alphaPhi2) - + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)) - ); + fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh)) + + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2); } // Cache p_rgh prior to solve for density update @@ -94,7 +78,11 @@ solve ( - p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp, + ( + (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1() + + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2() + ) + + p_rghEqnIncomp, mesh.solver(p_rgh.select(pimple.finalInnerIter())) ); @@ -105,8 +93,8 @@ dgdt = ( - alpha1*(p_rghEqnComp2 & p_rgh) - - alpha2*(p_rghEqnComp1 & p_rgh) + pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2 + - pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1 ); phi = phiHbyA + p_rghEqnIncomp.flux(); @@ -131,8 +119,11 @@ rho = alpha1*rho1 + alpha2*rho2; // Correct p_rgh for consistency with p and the updated densities + p = max(p_rgh + rho*gh, pMin); p_rgh = p - rho*gh; p_rgh.correctBoundaryConditions(); + + K = 0.5*magSqr(U); } diff --git a/applications/test/openmp/Make/options b/applications/test/openmp/Make/options index 54eed51fb9..9c1cb59980 100644 --- a/applications/test/openmp/Make/options +++ b/applications/test/openmp/Make/options @@ -1,4 +1,4 @@ -EXE_INC = ${COMP_OPENMP} +EXE_INC = ${COMP_OPENMP} /* -UUSE_OMP */ /* Mostly do not need to explicitly link openmp libraries */ /* EXE_LIBS = ${LINK_OPENMP} */ diff --git a/applications/test/openmp/Test-openmp.C b/applications/test/openmp/Test-openmp.C index acb68e9ed8..1ac9762c76 100644 --- a/applications/test/openmp/Test-openmp.C +++ b/applications/test/openmp/Test-openmp.C @@ -30,7 +30,7 @@ Description #include #include -#ifdef USE_OMP +#if _OPENMP #include #endif @@ -39,11 +39,19 @@ Description int main(int argc, char *argv[]) { +#if USE_OMP + std::cout << "USE_OMP defined (" << USE_OMP << ")\n"; +#else + std::cout << "USE_OMP undefined\n"; +#endif + +#if _OPENMP + std::cout << "_OPENMP = " << _OPENMP << "\n\n"; + + // Fork threads with their own copies of variables int nThreads, threadId; -// Fork threads with their own copies of variables -#ifdef USE_OMP -#pragma omp parallel private(nThreads, threadId) + #pragma omp parallel private(nThreads, threadId) { threadId = omp_get_thread_num(); nThreads = omp_get_num_threads(); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 21796ed9d6..7193d08ed6 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1094,7 +1094,9 @@ int main(int argc, char *argv[]) // Update proc maps if (cellProcAddressing.headerOk()) { - if (cellProcAddressing.size() == mesh.nCells()) + bool localOk = (cellProcAddressing.size() == mesh.nCells()); + + if (returnReduce(localOk, andOp())) { Info<< "Renumbering processor cell decomposition map " << cellProcAddressing.name() << endl; @@ -1118,7 +1120,9 @@ int main(int argc, char *argv[]) if (faceProcAddressing.headerOk()) { - if (faceProcAddressing.size() == mesh.nFaces()) + bool localOk = (faceProcAddressing.size() == mesh.nFaces()); + + if (returnReduce(localOk, andOp())) { Info<< "Renumbering processor face decomposition map " << faceProcAddressing.name() << endl; @@ -1158,7 +1162,9 @@ int main(int argc, char *argv[]) if (pointProcAddressing.headerOk()) { - if (pointProcAddressing.size() == mesh.nPoints()) + bool localOk = (pointProcAddressing.size() == mesh.nPoints()); + + if (returnReduce(localOk, andOp())) { Info<< "Renumbering processor point decomposition map " << pointProcAddressing.name() << endl; @@ -1182,7 +1188,16 @@ int main(int argc, char *argv[]) if (boundaryProcAddressing.headerOk()) { - if (boundaryProcAddressing.size() != mesh.boundaryMesh().size()) + bool localOk = + ( + boundaryProcAddressing.size() + == mesh.boundaryMesh().size() + ); + if (returnReduce(localOk, andOp())) + { + // No renumbering needed + } + else { Info<< "Not writing inconsistent processor patch decomposition" << " map " << boundaryProcAddressing.filePath() << endl; diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 0cc795761c..743ec98a78 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -125,12 +125,6 @@ Foam::domainDecomposition::domainDecomposition } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::domainDecomposition::~domainDecomposition() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index 21b34f22ac..03776381a4 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -160,7 +160,7 @@ public: // Constructors //- Construct from IOobjects (for mesh and optional non-standard - // decomposeParDict location) + //- decomposeParDict location) domainDecomposition ( const IOobject& io, @@ -169,7 +169,7 @@ public: //- Destructor - ~domainDecomposition(); + ~domainDecomposition() = default; // Member Functions @@ -204,7 +204,6 @@ public: } // End namespace Foam - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository diff --git a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C index 7e391f7d14..68affb4e4e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C @@ -34,11 +34,11 @@ License #include "OSspecific.H" #include "Map.H" #include "globalMeshData.H" - +#include "decompositionModel.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void faMeshDecomposition::distributeFaces() +void Foam::faMeshDecomposition::distributeFaces() { Info<< "\nCalculating distribution of faces" << endl; @@ -71,7 +71,7 @@ void faMeshDecomposition::distributeFaces() // located at the end of the faceProcAddressing, cutting it at // i = owner.size() will correctly decompose faMesh faces. // Vanja Skuric, 2016-04-21 - if (decompositionDict_.found("globalFaceZones")) + if (hasGlobalFaceZones_) { labelList faceProcAddressing ( @@ -153,25 +153,30 @@ void faMeshDecomposition::distributeFaces() << " s" << endl; } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components -faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh) +Foam::faMeshDecomposition::faMeshDecomposition +( + const fvMesh& mesh, + const fileName& decompDictFile +) : faMesh(mesh), - decompositionDict_ + decompDictFile_(decompDictFile), + nProcs_ ( - IOobject + decompositionMethod::nDomains ( - "decomposeParDict", - time().system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE + decompositionModel::New + ( + mesh, + decompDictFile + ) ) ), - nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), + hasGlobalFaceZones_(false), faceToProc_(nFaces()), procFaceLabels_(nProcs_), procMeshEdgesMap_(nProcs_), @@ -190,22 +195,20 @@ faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh) globallySharedPoints_(0), cyclicParallel_(false) { - if (decompositionDict_.found("distributed")) - { - distributed_ = Switch(decompositionDict_.lookup("distributed")); - } + const decompositionModel& model = decompositionModel::New + ( + mesh, + decompDictFile + ); + + model.readIfPresent("distributed", distributed_); + hasGlobalFaceZones_ = model.found("globalFaceZones"); } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -faMeshDecomposition::~faMeshDecomposition() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void faMeshDecomposition::decomposeMesh() +void Foam::faMeshDecomposition::decomposeMesh() { // Decide which cell goes to which processor distributeFaces(); @@ -273,7 +276,7 @@ void faMeshDecomposition::decomposeMesh() ) ); - HashTable > fvFaceProcAddressingHash; + Map