From 54b212e769369ad1a0748a6c6936d6fafbadf004 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 11 Jun 2013 15:42:29 +0100 Subject: [PATCH 01/11] ENH: triSurface: improved error message --- src/triSurface/triSurface/triSurface.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index e0e6c265ff..258958ca69 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -494,6 +494,7 @@ void Foam::triSurface::write ( "triSurface::write(const fileName&, const word&, const bool)" ) << "unknown file extension " << ext + << " for file " << name << ". Supported extensions are '.ftr', '.stl', '.stlb', " << "'.gts', '.obj', '.vtk'" << ", '.off', '.dx', '.smesh', '.ac' and '.tri'" From f2daad4806e435b23d2bf93356b4cccf93a870f9 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 11 Jun 2013 20:10:42 +0100 Subject: [PATCH 02/11] Field: Removed unnecessary typedef which causes gcc-4.8 and latest clang to spew-out hundreds of warning messages --- src/OpenFOAM/fields/Fields/Field/Field.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 7460dba215..334eba8e41 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -677,7 +677,6 @@ template template void Foam::Field::operator=(const VectorSpace& vs) { - typedef VectorSpace VSType; TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs) } From 58aa5560aa564f557b0422fb46604b6553b2dbe3 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 08:25:47 +0100 Subject: [PATCH 03/11] wallFunctions: corrected fvPatchField to fvPatchScalarField for the return reference --- .../epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C | 2 +- .../omegaWallFunction/omegaWallFunctionFvPatchScalarField.C | 2 +- .../epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C | 2 +- .../omegaWallFunction/omegaWallFunctionFvPatchScalarField.C | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 3f1ab4a2c2..90915d25eb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -141,7 +141,7 @@ void epsilonWallFunctionFvPatchScalarField::createAveragingWeights() forAll(epsilonPatches, i) { label patchI = epsilonPatches[i]; - const fvPatchField& wf = weights.boundaryField()[patchI]; + const fvPatchScalarField& wf = weights.boundaryField()[patchI]; cornerWeights_[patchI] = 1.0/wf.patchInternalField(); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 2f4e11dc20..d0d9865c5c 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -143,7 +143,7 @@ void omegaWallFunctionFvPatchScalarField::createAveragingWeights() forAll(omegaPatches, i) { label patchI = omegaPatches[i]; - const fvPatchField& wf = weights.boundaryField()[patchI]; + const fvPatchScalarField& wf = weights.boundaryField()[patchI]; cornerWeights_[patchI] = 1.0/wf.patchInternalField(); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index dc08123d26..da2913f304 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -141,7 +141,7 @@ void epsilonWallFunctionFvPatchScalarField::createAveragingWeights() forAll(epsilonPatches, i) { label patchI = epsilonPatches[i]; - const fvPatchField& wf = weights.boundaryField()[patchI]; + const fvPatchScalarField& wf = weights.boundaryField()[patchI]; cornerWeights_[patchI] = 1.0/wf.patchInternalField(); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 69f8ffd170..9aec38bc38 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -143,7 +143,7 @@ void omegaWallFunctionFvPatchScalarField::createAveragingWeights() forAll(omegaPatches, i) { label patchI = omegaPatches[i]; - const fvPatchField& wf = weights.boundaryField()[patchI]; + const fvPatchScalarField& wf = weights.boundaryField()[patchI]; cornerWeights_[patchI] = 1.0/wf.patchInternalField(); } From 77d8b45dedfce3e4c882f7242fa118a7204bce1c Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 12 Jun 2013 09:38:13 +0100 Subject: [PATCH 04/11] BUG: chemFoam - reverted change to pressure indexing --- .../solvers/combustion/chemFoam/readInitialConditions.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/combustion/chemFoam/readInitialConditions.H b/applications/solvers/combustion/chemFoam/readInitialConditions.H index b25fd944c5..8e340a7e16 100644 --- a/applications/solvers/combustion/chemFoam/readInitialConditions.H +++ b/applications/solvers/combustion/chemFoam/readInitialConditions.H @@ -87,7 +87,7 @@ forAll(Y, i) { Y[i] = Y0[i]; - h0 += Y0[i]*specieData[i].Hs(p[i], T0); + h0 += Y0[i]*specieData[i].Hs(p[0], T0); } thermo.he() = dimensionedScalar("h", dimEnergy/dimMass, h0); From dee88bceddb8c23f28b122d9326e0dbe1d8052ea Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 12 Jun 2013 10:33:36 +0100 Subject: [PATCH 05/11] BUG: displacementLayeredMotionSolver: too early evaluation of boundary conditions --- .../displacementInterpolationMotionSolver.H | 5 +- .../displacementLayeredMotionMotionSolver.C | 104 +++++++++--------- .../displacementLayeredMotionMotionSolver.H | 10 +- 3 files changed, 57 insertions(+), 62 deletions(-) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H index ec49b1e223..b5da0b5b3b 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,9 +36,6 @@ Description Tables are in the \a constant/tables directory. -Note - could be a motionSolver - does not use any fvMesh structure. - SourceFiles displacementInterpolationMotionSolver.C diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index f491ee586d..ace954062b 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -253,6 +253,16 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate // Only on boundary faces - follow boundary conditions fld = vectorField(pointDisplacement_, meshPoints); } + else if (type == "uniformFollow") + { + // Reads name of name of patch. Then get average point dislacement on + // patch. That becomes the value of fld. + const word patchName(dict.lookup("patch")); + label patchID = mesh().boundaryMesh().findPatchID(patchName); + pointField pdf = + pointDisplacement_.boundaryField()[patchID].patchInternalField(); + fld = gAverage(pdf); + } else { FatalIOErrorIn @@ -399,22 +409,6 @@ Info<< "For cellZone:" << cellZoneI // Implement real bc. patchDisp[patchI].correctBoundaryConditions(); - -//Info<< "Writing displacement for faceZone " << fz.name() -// << " to " << patchDisp[patchI].name() << endl; -//patchDisp[patchI].write(); - -// // Copy into pointDisplacement for other fields to use -// forAll(isZonePoint, pointI) -// { -// if (isZonePoint[pointI]) -// { -// pointDisplacement_[pointI] = patchDisp[patchI][pointI]; -// } -// } -// pointDisplacement_.correctBoundaryConditions(); - - patchI++; } @@ -423,37 +417,40 @@ Info<< "For cellZone:" << cellZoneI // ~~~~~ // solving the interior is just interpolating -// // Get normalised distance -// pointScalarField distance -// ( -// IOobject -// ( -// "distance", -// mesh().time().timeName(), -// mesh(), -// IOobject::NO_READ, -// IOobject::NO_WRITE, -// false -// ), -// pointMesh::New(mesh()), -// dimensionedScalar("distance", dimLength, 0.0) -// ); -// forAll(distance, pointI) -// { -// if (isZonePoint[pointI]) -// { -// scalar d1 = patchDist[0][pointI]; -// scalar d2 = patchDist[1][pointI]; -// if (d1+d2 > SMALL) -// { -// scalar s = d1/(d1+d2); -// distance[pointI] = s; -// } -// } -// } -// Info<< "Writing distance pointScalarField to " << mesh().time().timeName() -// << endl; -// distance.write(); + if (debug) + { + // Get normalised distance + pointScalarField distance + ( + IOobject + ( + "distance", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + pointMesh::New(mesh()), + dimensionedScalar("distance", dimLength, 0.0) + ); + forAll(distance, pointI) + { + if (isZonePoint[pointI]) + { + scalar d1 = patchDist[0][pointI]; + scalar d2 = patchDist[1][pointI]; + if (d1+d2 > SMALL) + { + scalar s = d1/(d1+d2); + distance[pointI] = s; + } + } + } + Info<< "Writing distance pointScalarField to " + << mesh().time().timeName() << endl; + distance.write(); + } // Average forAll(pointDisplacement_, pointI) @@ -470,7 +467,6 @@ Info<< "For cellZone:" << cellZoneI + s*patchDisp[1][pointI]; } } - pointDisplacement_.correctBoundaryConditions(); } @@ -484,9 +480,7 @@ displacementLayeredMotionMotionSolver ) : displacementMotionSolver(mesh, dict, typeName) -{ - pointDisplacement_.correctBoundaryConditions(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -518,6 +512,9 @@ void Foam::displacementLayeredMotionMotionSolver::solve() // the motionSolver accordingly movePoints(mesh().points()); + // Apply boundary conditions + pointDisplacement_.boundaryField().updateCoeffs(); + // Apply all regions (=cellZones) const dictionary& regionDicts = coeffDict().subDict("regions"); @@ -544,6 +541,9 @@ void Foam::displacementLayeredMotionMotionSolver::solve() cellZoneSolve(zoneI, regionDict); } + + // Update pointDisplacement for solved values + pointDisplacement_.correctBoundaryConditions(); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H index 0f29c4f88f..1aa7884f52 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,11 +28,6 @@ Description Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the structure of the mesh blocks and boundary conditions on these blocks. - Note: should not be an fvMotionSolver but just a motionSolver. Only here - so we can reuse displacementFvMotionSolver functionality (e.g. surface - following boundary conditions) - - The displacementLayeredMotionCoeffs subdict of dynamicMeshDict specifies per region (=cellZone) the boundary conditions on two opposing patches (=faceZones). It then interpolates the boundary values using topological @@ -44,6 +39,9 @@ Description Use this for faceZones on boundary faces (so it uses the proper boundary conditions on the pointDisplacement). + uniformFollow: like 'follow' but takes the average value of + a specified 'patch' (which is not necessarily colocated) + fixedValue: fixed value. timeVaryingUniformFixedValue: table-driven fixed value. From e9932a0be73ac2ecf8cf1cb73113f0d5112215eb Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 12:51:56 +0100 Subject: [PATCH 06/11] probes: write probe data in user-time rather than s --- src/sampling/probes/patchProbesTemplates.C | 8 ++++++-- src/sampling/probes/probesTemplates.C | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/sampling/probes/patchProbesTemplates.C b/src/sampling/probes/patchProbesTemplates.C index 8f37e2f07c..7e8ddd74b4 100644 --- a/src/sampling/probes/patchProbesTemplates.C +++ b/src/sampling/probes/patchProbesTemplates.C @@ -43,7 +43,9 @@ void Foam::patchProbes::sampleAndWrite unsigned int w = IOstream::defaultPrecision() + 7; OFstream& probeStream = *probeFilePtrs_[vField.name()]; - probeStream << setw(w) << vField.time().value(); + probeStream + << setw(w) + << vField.time().timeToUserTime(vField.time().value()); forAll(values, probeI) { @@ -67,7 +69,9 @@ void Foam::patchProbes::sampleAndWrite unsigned int w = IOstream::defaultPrecision() + 7; OFstream& probeStream = *probeFilePtrs_[sField.name()]; - probeStream << setw(w) << sField.time().value(); + probeStream + << setw(w) + << sField.time().timeToUserTime(sField.time().value()); forAll(values, probeI) { diff --git a/src/sampling/probes/probesTemplates.C b/src/sampling/probes/probesTemplates.C index 3a34c1c264..b64bbb577f 100644 --- a/src/sampling/probes/probesTemplates.C +++ b/src/sampling/probes/probesTemplates.C @@ -76,7 +76,7 @@ void Foam::probes::sampleAndWrite unsigned int w = IOstream::defaultPrecision() + 7; OFstream& os = *probeFilePtrs_[vField.name()]; - os << setw(w) << vField.time().value(); + os << setw(w) << vField.time().timeToUserTime(vField.time().value()); forAll(values, probeI) { @@ -90,17 +90,17 @@ void Foam::probes::sampleAndWrite template void Foam::probes::sampleAndWrite ( - const GeometricField& vField + const GeometricField& sField ) { - Field values(sample(vField)); + Field values(sample(sField)); if (Pstream::master()) { unsigned int w = IOstream::defaultPrecision() + 7; - OFstream& os = *probeFilePtrs_[vField.name()]; + OFstream& os = *probeFilePtrs_[sField.name()]; - os << setw(w) << vField.time().value(); + os << setw(w) << sField.time().timeToUserTime(sField.time().value()); forAll(values, probeI) { @@ -259,7 +259,7 @@ template Foam::tmp > Foam::probes::sample ( - const GeometricField& vField + const GeometricField& sField ) const { const Type unsetVal(-VGREAT*pTraits::one); @@ -275,7 +275,7 @@ Foam::probes::sample { if (faceList_[probeI] >= 0) { - values[probeI] = vField[faceList_[probeI]]; + values[probeI] = sField[faceList_[probeI]]; } } From 43ac6073864eac444310a2e52a31d35c4ed1b2c8 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 12:53:47 +0100 Subject: [PATCH 07/11] GAMGSolverInterpolate: Correct interpolate for conservation such that the sum of the values in the fines cells is equal to the value in the coarse cell --- .../lduMatrix/solvers/GAMG/GAMGSolver.H | 3 ++- .../solvers/GAMG/GAMGSolverInterpolate.C | 27 ++++++++++++++++++- .../lduMatrix/solvers/GAMG/GAMGSolverSolve.C | 8 +++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H index ed49d00827..7f462840f5 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H @@ -230,7 +230,8 @@ class GAMGSolver const lduMatrix& m, const FieldField& interfaceBouCoeffs, const lduInterfaceFieldPtrsList& interfaces, - const scalarField& source, + const labelList& restrictAddressing, + const scalarField& psiC, const direction cmpt ) const; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C index a24612645b..6c18b43d0a 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverInterpolate.C @@ -34,7 +34,8 @@ void Foam::GAMGSolver::interpolate const lduMatrix& m, const FieldField& interfaceBouCoeffs, const lduInterfaceFieldPtrsList& interfaces, - const scalarField& source, + const labelList& restrictAddressing, + const scalarField& psiC, const direction cmpt ) const { @@ -80,6 +81,30 @@ void Foam::GAMGSolver::interpolate { psiPtr[celli] = -ApsiPtr[celli]/(diagPtr[celli]); } + + register const label nCCells = psiC.size(); + scalarField corrC(nCCells, 0); + scalarField diagC(nCCells, 0); + + for (register label celli=0; celli(ACf.operator const scalarField&()); - if (interpolateCorrection_) + if (interpolateCorrection_ && leveli < coarsestLevel - 2) { interpolate ( @@ -322,7 +322,8 @@ void Foam::GAMGSolver::Vcycle matrixLevels_[leveli], interfaceLevelsBouCoeffs_[leveli], interfaceLevels_[leveli], - coarseSources[leveli], + agglomeration_.restrictAddressing(leveli + 1), + coarseCorrFields[leveli + 1], cmpt ); } @@ -382,7 +383,8 @@ void Foam::GAMGSolver::Vcycle matrix_, interfaceBouCoeffs_, interfaces_, - finestResidual, + agglomeration_.restrictAddressing(0), + coarseCorrFields[0], cmpt ); } From 6b054eab14026feac01dbee74497411f0596bf6c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 12:55:37 +0100 Subject: [PATCH 08/11] MGridGenGAMGAgglomerate: Use sum magSf rather than mag(sum Sf) for face-weighting This is more consistent with the faceArea agglomeration and generates more reliable agglomerations. --- .../MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C | 5 ----- .../MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C index e3663315aa..4d32bfa89f 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C @@ -30,11 +30,6 @@ Description #include "fvMesh.H" #include "syncTools.H" -//extern "C" -//{ -//# include "mgridgen.h" -//} - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::MGridGenGAMGAgglomeration:: diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C index 59c45bc11b..cc259c5038 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C @@ -59,7 +59,11 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration // Start geometric agglomeration from the cell volumes and areas of the mesh scalarField* VPtr = const_cast(&fvMesh_.cellVolumes()); - SubField Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces()); + + vectorField magFaceAreas(vector::one*mag(fvMesh_.faceAreas())); + SubField Sf(magFaceAreas, fvMesh_.nInternalFaces()); + //SubField Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces()); + vectorField* SfPtr = const_cast ( &Sf.operator const vectorField&() From 818f6a549fefcbc70ce512143b43ea249668504c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 12:57:50 +0100 Subject: [PATCH 09/11] pairGAMGAgglomeration: Support reverse cell-scanning without reversing the order of the generated agglomeration Gives better cache coherency --- .../pairGAMGAgglomerate.C | 355 +++++++++--------- .../pairGAMGAgglomeration.C | 5 +- .../pairGAMGAgglomeration.H | 4 +- 3 files changed, 190 insertions(+), 174 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C index b0f5e757da..508c0c3f94 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C @@ -26,177 +26,7 @@ License #include "pairGAMGAgglomeration.H" #include "lduAddressing.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -Foam::tmp Foam::pairGAMGAgglomeration::agglomerate -( - label& nCoarseCells, - const lduAddressing& fineMatrixAddressing, - const scalarField& faceWeights -) -{ - const label nFineCells = fineMatrixAddressing.size(); - - const labelUList& upperAddr = fineMatrixAddressing.upperAddr(); - const labelUList& lowerAddr = fineMatrixAddressing.lowerAddr(); - - // For each cell calculate faces - labelList cellFaces(upperAddr.size() + lowerAddr.size()); - labelList cellFaceOffsets(nFineCells + 1); - - // memory management - { - labelList nNbrs(nFineCells, 0); - - forAll(upperAddr, facei) - { - nNbrs[upperAddr[facei]]++; - } - - forAll(lowerAddr, facei) - { - nNbrs[lowerAddr[facei]]++; - } - - cellFaceOffsets[0] = 0; - forAll(nNbrs, celli) - { - cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli]; - } - - // reset the whole list to use as counter - nNbrs = 0; - - forAll(upperAddr, facei) - { - cellFaces - [ - cellFaceOffsets[upperAddr[facei]] + nNbrs[upperAddr[facei]] - ] = facei; - - nNbrs[upperAddr[facei]]++; - } - - forAll(lowerAddr, facei) - { - cellFaces - [ - cellFaceOffsets[lowerAddr[facei]] + nNbrs[lowerAddr[facei]] - ] = facei; - - nNbrs[lowerAddr[facei]]++; - } - } - - - // go through the faces and create clusters - - tmp tcoarseCellMap(new labelField(nFineCells, -1)); - labelField& coarseCellMap = tcoarseCellMap(); - - nCoarseCells = 0; - - for (label celli=0; celli maxFaceWeight - ) - { - // Match found. Pick up all the necessary data - matchFaceNo = facei; - maxFaceWeight = faceWeights[facei]; - } - } - - if (matchFaceNo >= 0) - { - // Make a new group - coarseCellMap[upperAddr[matchFaceNo]] = nCoarseCells; - coarseCellMap[lowerAddr[matchFaceNo]] = nCoarseCells; - nCoarseCells++; - } - else - { - // No match. Find the best neighbouring cluster and - // put the cell there - label clusterMatchFaceNo = -1; - scalar clusterMaxFaceCoeff = -GREAT; - - for - ( - label faceOs=cellFaceOffsets[celli]; - faceOs clusterMaxFaceCoeff) - { - clusterMatchFaceNo = facei; - clusterMaxFaceCoeff = faceWeights[facei]; - } - } - - if (clusterMatchFaceNo >= 0) - { - // Add the cell to the best cluster - coarseCellMap[celli] = max - ( - coarseCellMap[upperAddr[clusterMatchFaceNo]], - coarseCellMap[lowerAddr[clusterMatchFaceNo]] - ); - } - } - } - } - - - // Check that all cells are part of clusters, - // if not create single-cell "clusters" for each - for (label celli=0; celli Foam::pairGAMGAgglomeration::agglomerate +( + label& nCoarseCells, + const lduAddressing& fineMatrixAddressing, + const scalarField& faceWeights +) +{ + const label nFineCells = fineMatrixAddressing.size(); + + const labelUList& upperAddr = fineMatrixAddressing.upperAddr(); + const labelUList& lowerAddr = fineMatrixAddressing.lowerAddr(); + + // For each cell calculate faces + labelList cellFaces(upperAddr.size() + lowerAddr.size()); + labelList cellFaceOffsets(nFineCells + 1); + + // memory management + { + labelList nNbrs(nFineCells, 0); + + forAll(upperAddr, facei) + { + nNbrs[upperAddr[facei]]++; + } + + forAll(lowerAddr, facei) + { + nNbrs[lowerAddr[facei]]++; + } + + cellFaceOffsets[0] = 0; + forAll(nNbrs, celli) + { + cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli]; + } + + // reset the whole list to use as counter + nNbrs = 0; + + forAll(upperAddr, facei) + { + cellFaces + [ + cellFaceOffsets[upperAddr[facei]] + nNbrs[upperAddr[facei]] + ] = facei; + + nNbrs[upperAddr[facei]]++; + } + + forAll(lowerAddr, facei) + { + cellFaces + [ + cellFaceOffsets[lowerAddr[facei]] + nNbrs[lowerAddr[facei]] + ] = facei; + + nNbrs[lowerAddr[facei]]++; + } + } + + + // go through the faces and create clusters + + tmp tcoarseCellMap(new labelField(nFineCells, -1)); + labelField& coarseCellMap = tcoarseCellMap(); + + nCoarseCells = 0; + label celli; + + for (label cellfi=0; cellfi maxFaceWeight + ) + { + // Match found. Pick up all the necessary data + matchFaceNo = facei; + maxFaceWeight = faceWeights[facei]; + } + } + + if (matchFaceNo >= 0) + { + // Make a new group + coarseCellMap[upperAddr[matchFaceNo]] = nCoarseCells; + coarseCellMap[lowerAddr[matchFaceNo]] = nCoarseCells; + nCoarseCells++; + } + else + { + // No match. Find the best neighbouring cluster and + // put the cell there + label clusterMatchFaceNo = -1; + scalar clusterMaxFaceCoeff = -GREAT; + + for + ( + label faceOs=cellFaceOffsets[celli]; + faceOs clusterMaxFaceCoeff) + { + clusterMatchFaceNo = facei; + clusterMaxFaceCoeff = faceWeights[facei]; + } + } + + if (clusterMatchFaceNo >= 0) + { + // Add the cell to the best cluster + coarseCellMap[celli] = max + ( + coarseCellMap[upperAddr[clusterMatchFaceNo]], + coarseCellMap[lowerAddr[clusterMatchFaceNo]] + ); + } + } + } + } + + // Check that all cells are part of clusters, + // if not create single-cell "clusters" for each + for (label cellfi=0; cellfi Date: Wed, 12 Jun 2013 12:58:39 +0100 Subject: [PATCH 10/11] twoPhaseEulerFoam/bed tutorial: update for new location of alpha solver settings --- .../multiphase/twoPhaseEulerFoam/bed/system/fvSolution | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution b/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution index 5800e2a4b4..3a47e5857c 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/system/fvSolution @@ -53,6 +53,12 @@ solvers relTol 0; } + alpha1 + { + nAlphaCorr 2; + nAlphaSubCycles 3; + } + alpha { solver PCG; @@ -72,12 +78,9 @@ PIMPLE { nCorrectors 2; nNonOrthogonalCorrectors 0; - nAlphaCorr 2; - nAlphaSubCycles 3; correctAlpha yes; pRefCell 0; pRefValue 0; } - // ************************************************************************* // From a38ff1757c99160469c66158b6d7c441dfc61a60 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 12 Jun 2013 13:07:58 +0100 Subject: [PATCH 11/11] displacementLayeredMotionMotionSolver: correct constructor for clang --- .../layeredSolver/displacementLayeredMotionMotionSolver.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index ace954062b..3ea1d3ed39 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -259,8 +259,10 @@ Foam::displacementLayeredMotionMotionSolver::faceZoneEvaluate // patch. That becomes the value of fld. const word patchName(dict.lookup("patch")); label patchID = mesh().boundaryMesh().findPatchID(patchName); - pointField pdf = - pointDisplacement_.boundaryField()[patchID].patchInternalField(); + pointField pdf + ( + pointDisplacement_.boundaryField()[patchID].patchInternalField() + ); fld = gAverage(pdf); } else