From d8865404c3362691ed8d33e57b82ff96c3b11ee3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 29 Apr 2013 15:20:49 +0100 Subject: [PATCH 01/13] ENH: writeCellCentres: dump volume --- .../writeCellCentres/writeCellCentres.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C index ce40f502e1..6e4f009be2 100644 --- a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C +++ b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C @@ -97,6 +97,23 @@ int main(int argc, char *argv[]) cci.write(); } + + volScalarField V + ( + IOobject + ( + "V", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + + ); + mesh.V().setInstance(runTime.timeName()); + mesh.V().write(); } Info<< "\nEnd\n" << endl; From 487103fa60bc76b127ac2e9da72425994c074121 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 29 Apr 2013 15:21:20 +0100 Subject: [PATCH 02/13] ENH: checkMesh: volume ratio too tight --- .../utilities/mesh/manipulation/checkMesh/checkGeometry.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index cf503b0574..5e142f9d85 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -852,7 +852,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) if (allGeometry) { faceSet faces(mesh, "lowVolRatioFaces", mesh.nFaces()/100); - if (mesh.checkVolRatio(true, 0.05, &faces)) + if (mesh.checkVolRatio(true, 0.01, &faces)) { noFailedChecks++; From d9afcb75d383d359dca3a8d8908b5bf6031b6d29 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 29 Apr 2013 15:21:56 +0100 Subject: [PATCH 03/13] ENH: snappyHexMesh: update with code --- .../mesh/generation/snappyHexMesh/snappyHexMeshDict | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index f2a52c2e5b..4e5b20e4ab 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -222,6 +222,11 @@ castellatedMeshControls // are only on the boundary of corresponding cellZones or also allow // free-standing zone faces. Not used if there are no faceZones. allowFreeStandingZoneFaces true; + + + // Optional: whether all baffles get eroded away. WIP. Used for + // surface simplification. + //allowFreeStandingBaffles false; } // Settings for the snapping. From f47ee78c0b923183347e78b5879add04445f79c6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 29 Apr 2013 15:37:51 +0100 Subject: [PATCH 04/13] BUG: SRFModel: axis read from subdictionary upon re-reading --- .../cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C index 4894fae3c4..7db661b48e 100644 --- a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,7 +81,7 @@ bool Foam::SRF::SRFModel::read() if (regIOobject::read()) { // Re-read axis - SRFModelCoeffs_.lookup("axis") >> axis_; + lookup("axis") >> axis_; axis_ /= mag(axis_); // Re-read sub-model coeffs From 669317192126f9976868f6533e1b4d227a6dd799 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 30 Apr 2013 10:13:35 +0100 Subject: [PATCH 05/13] BUG: TableBase: repeat not handled --- src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C index 054d87575e..c2e768cceb 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C @@ -363,7 +363,7 @@ Type Foam::TableBase::value(const scalar x) const } // Use interpolator - interpolator().valueWeights(x, currentIndices_, currentWeights_); + interpolator().valueWeights(xDash, currentIndices_, currentWeights_); Type t = currentWeights_[0]*table_[currentIndices_[0]].second(); for (label i = 1; i < currentIndices_.size(); i++) From 42811b16a1317df97a19efc3e6af1bd3aa940207 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 30 Apr 2013 10:13:48 +0100 Subject: [PATCH 06/13] COMP: targetVolumeToCell: unused variable --- .../sets/cellSources/targetVolumeToCell/targetVolumeToCell.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C index dde6c52c4e..2f29a30216 100644 --- a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C @@ -133,7 +133,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const scalar maxComp = -GREAT; label maxCells = 0; - scalar maxVol = 0; + //scalar maxVol = 0; scalar minComp = GREAT; { const boundBox& bb = mesh_.bounds(); @@ -158,7 +158,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const PackedBoolList maxSelected(mesh_.nCells()); maxCells = selectCells(maxComp, maskSet, maxSelected); - maxVol = volumeOfSet(maxSelected); + //maxVol = volumeOfSet(maxSelected); // Check that maxPoint indeed selects all cells if (maxCells != nTotCells) From 2bbfd25991780c0831922e34fa36db3d7e51000b Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 30 Apr 2013 10:14:18 +0100 Subject: [PATCH 07/13] COMP: triangle: unused variable --- src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index 2c945fae54..1f4465637f 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -715,7 +715,7 @@ inline Foam::pointHit Foam::triangle::nearestPoint point nearestEdgePoint; point nearestLinePoint; - label minEdgeIndex = 0; + //label minEdgeIndex = 0; scalar minDist = ln.nearestDist ( linePointRef(a_, b_), @@ -737,7 +737,7 @@ inline Foam::pointHit Foam::triangle::nearestPoint minDist = dist; nearestEdgePoint = triEdgePoint; nearestLinePoint = linePoint; - minEdgeIndex = 1; + //minEdgeIndex = 1; } } @@ -755,7 +755,7 @@ inline Foam::pointHit Foam::triangle::nearestPoint minDist = dist; nearestEdgePoint = triEdgePoint; nearestLinePoint = linePoint; - minEdgeIndex = 2; + //minEdgeIndex = 2; } } From b12af57d7eb9be3c9bbfe61f3b47976d479d07a3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 30 Apr 2013 11:56:02 +0100 Subject: [PATCH 08/13] ENH: inverseVolume: not register temporary field V --- .../inverseVolume/inverseVolumeDiffusivity.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C index 3e0b5442d7..b768e5726e 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseVolume/inverseVolumeDiffusivity.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 @@ -75,7 +75,10 @@ void Foam::inverseVolumeDiffusivity::correct() ( "V", mesh().time().timeName(), - mesh() + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false ), mesh(), dimless, From 6754eac57af3088a9f0273f79b514f881afd9f0f Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 30 Apr 2013 15:20:30 +0100 Subject: [PATCH 09/13] ENH: beamEndLoad: enhanced comment --- .../beamEndLoad/system/fvSolution | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/stressAnalysis/solidEquilibriumDisplacementFoam/beamEndLoad/system/fvSolution b/tutorials/stressAnalysis/solidEquilibriumDisplacementFoam/beamEndLoad/system/fvSolution index 8dabfdac0a..26948af5b6 100644 --- a/tutorials/stressAnalysis/solidEquilibriumDisplacementFoam/beamEndLoad/system/fvSolution +++ b/tutorials/stressAnalysis/solidEquilibriumDisplacementFoam/beamEndLoad/system/fvSolution @@ -34,7 +34,7 @@ stressAnalysis { nCorrectors 1; D 1e-10; - accelerationFactor 2; + accelerationFactor 2; // lower for other Poisson ratio (e.g. 0.1 for 0.3) } From 4cd72f560a8c9f815ca5bf377c9da564f30d6da0 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 30 Apr 2013 21:14:47 +0100 Subject: [PATCH 10/13] fixedFluxPressureFvPatchScalarField: corrected BC group in docs --- .../fixedFluxPressure/fixedFluxPressureFvPatchScalarField.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.H index 8476e63dff..e18ef462ea 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.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 @@ -25,7 +25,7 @@ Class Foam::fixedFluxPressureFvPatchScalarField Group - grpOutletBoundaryConditions + grpInletBoundaryConditions grpWallBoundaryConditions Description This boundary condition adjusts the pressure gradient such that the flux From dede1f913702030cdd9dfae95a31432f9ac38351 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 1 May 2013 09:25:46 +0100 Subject: [PATCH 11/13] ENH: turbulentHeatFluxTemperature: resume with gradient --- ...turbulentHeatFluxTemperatureFvPatchScalarField.C | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 5ee38ffba1..0b8ef68cf0 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -114,8 +114,17 @@ turbulentHeatFluxTemperatureFvPatchScalarField q_("q", dict, p.size()), QrName_(dict.lookupOrDefault("Qr", "none")) { - fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; + if (dict.found("value") && dict.found("gradient")) + { + fvPatchField::operator=(Field("value", dict, p.size())); + gradient() = Field("gradient", dict, p.size()); + } + else + { + // Still reading so cannot yet evaluate. Make up a value. + fvPatchField::operator=(patchInternalField()); + gradient() = 0.0; + } } From 803b87e0c1e5a9f73dc60733bdc3aace0b03a68d Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Wed, 1 May 2013 15:27:02 +0100 Subject: [PATCH 12/13] ENH: Adding feature edge to the target walk for AMI Adding mininum area tolerance in processSourceFace function to calculate weight Modifying calculation of face normals in function interArea --- .../AMIMethod/AMIMethod/AMIMethod.C | 14 +++++++++++++- .../faceAreaWeightAMI/faceAreaWeightAMI.C | 11 ++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C index 03f6355870..920c782286 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C @@ -26,6 +26,7 @@ License #include "AMIMethod.H" #include "meshTools.H" #include "mapDistribute.H" +#include "unitConversion.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -262,6 +263,7 @@ void Foam::AMIMethod::appendNbrFaces ) const { const labelList& nbrFaces = patch.faceFaces()[faceI]; + const pointField& tgtPoints = patch.points(); // filter out faces already visited from src face neighbours forAll(nbrFaces, i) @@ -291,7 +293,17 @@ void Foam::AMIMethod::appendNbrFaces if (valid) { - faceIDs.append(nbrFaceI); + const face& myn = patch[faceI]; + const face& nbrn = patch[nbrFaceI]; + const vector& nbrNormal = nbrn.normal(tgtPoints); + const vector& mynNormal = myn.normal(tgtPoints); + + scalar cosI = nbrNormal & mynNormal; + + if (cosI > Foam::cos(degToRad(89.0))) + { + faceIDs.append(nbrFaceI); + } } } } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index 6aea34e945..820d3f22fc 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -68,7 +68,7 @@ bool Foam::faceAreaWeightAMI::processSourceFace scalar area = interArea(srcFaceI, tgtFaceI); // store when intersection area > 0 - if (area > 0) + if (area/this->srcMagSf_[srcFaceI] > faceAreaIntersect::tolerance()) { srcAddr[srcFaceI].append(tgtFaceI); srcWght[srcFaceI].append(area); @@ -228,10 +228,10 @@ Foam::scalar Foam::faceAreaWeightAMI::interArea // quick reject if either face has zero area // Note: do not used stored face areas for target patch + const scalar tgtMag = tgt.mag(tgtPoints); if ( - (this->srcMagSf_[srcFaceI] < ROOTVSMALL) - || (tgt.mag(tgtPoints) < ROOTVSMALL) + (this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL) ) { return 0.0; @@ -242,13 +242,14 @@ Foam::scalar Foam::faceAreaWeightAMI::interArea // crude resultant norm vector n(-src.normal(srcPoints)); + n /= mag(n); if (this->reverseTarget_) { - n -= tgt.normal(tgtPoints); + n -= tgt.normal(tgtPoints)/tgtMag; } else { - n += tgt.normal(tgtPoints); + n += tgt.normal(tgtPoints)/tgtMag; } n *= 0.5; From aa5477679030970acd1c295ce49e8eac62c84278 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Wed, 1 May 2013 15:28:29 +0100 Subject: [PATCH 13/13] BUG: Deleting reading of the key entry "value". It is done by fvPatchField. --- .../energyRegionCoupledFvPatchScalarField.C | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C index d09ec8ee55..56a476f97d 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -271,11 +271,6 @@ energyRegionCoupledFvPatchScalarField << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); } - - if (dict.found("value")) - { - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); - } }