From 93207cbe9d684b9ad0c06750bd7cb91e7e5eb754 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 20 Sep 2012 10:25:54 +0100 Subject: [PATCH 01/48] singleStepCombustion.C: Updated for SP compilation --- .../singleStepCombustion/singleStepCombustion.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C index e3754f0a58..8234e573c5 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.C +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C @@ -119,7 +119,7 @@ singleStepCombustion::R { const label fNorm = singleMixturePtr_->specieProd()[specieI]; const volScalarField fres(singleMixturePtr_->fres(specieI)); - wSpecie /= max(fNorm*(Y - fres), 1e-2); + wSpecie /= max(fNorm*(Y - fres), scalar(1e-2)); return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y); } From 30a7437682e3cca84add299bbdeadd3f04769ae9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:49:27 +0100 Subject: [PATCH 02/48] STYLE: Table.H: comment out of date --- src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H index 63d7b293e3..e89234cfa9 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H @@ -27,13 +27,13 @@ Class Description Templated table container data entry. Items are stored in a list of Tuple2's. First column is always stored as scalar entries. Data is read - in the form, e.g. for an entry \ that is (scalar, vector): + in Tuple2 form, e.g. for an entry \ that is (scalar, vector): \verbatim - table [0 1 0 0 0] //dimension set optional + table ( - 0.0 (1 2 3) - 1.0 (4 5 6) + (0.0 (1 2 3)) + (1.0 (4 5 6)) ); \endverbatim From 001a2ae3ddb05adeb2d6d690b007e8bc384e4cbc Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:51:33 +0100 Subject: [PATCH 03/48] ENH: createPatchDict: use same transform --- .../utilities/mesh/manipulation/createPatch/createPatchDict | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatchDict b/applications/utilities/mesh/manipulation/createPatch/createPatchDict index f731f78df9..62e6cf619c 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatchDict +++ b/applications/utilities/mesh/manipulation/createPatch/createPatchDict @@ -92,8 +92,10 @@ patches // Optional: explicitly set transformation tensor. // Used when matching and synchronising points. transform rotational; - rotationAxis ( 0 0 1 ); - rotationCentre ( 0.3 0 0 ); + rotationAxis (1 0 0); + rotationCentre (0 0 0); + // transform translational; + // separationVector (1 0 0); } // How to construct: either from 'patches' or 'set' From d50f2d034c6ea8298954003a1d8e6d9baeee410c Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:52:43 +0100 Subject: [PATCH 04/48] STYLE: patchEdgeFaceRegion: extraneous debug printing --- .../faceSources/regionToFace/patchEdgeFaceRegionI.H | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H b/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H index 60a6d13eb3..eea60716a7 100644 --- a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H +++ b/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H @@ -45,9 +45,6 @@ inline bool Foam::patchEdgeFaceRegion::update if (w2.region_ == -2 || region_ == -2) { - -Pout<< "update : " << *this << " w2:" << w2 << " return FALSE" << endl; - // Blocked edge/face return false; } @@ -55,27 +52,18 @@ Pout<< "update : " << *this << " w2:" << w2 << " return FALSE" << endl; if (!valid(td)) { // current not yet set so use any value - label oldRegion = region_; operator=(w2); -Pout<< "update : " << *this << " was:" << oldRegion - << " w2:" << w2 << " return TRUE" << endl; return true; } else { if (w2.region_ < region_) { - label oldRegion = region_; operator=(w2); -Pout<< "update : " << *this << " was:" << oldRegion - << " w2:" << w2 << " return TRUE" << endl; - return true; return true; } else { -Pout<< "update : " << *this - << " w2:" << w2 << " return FALSE" << endl; return false; } } From b7a8e8b5acc63e60d7f1ea465fab4e727fdaab61 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:53:52 +0100 Subject: [PATCH 05/48] ENH: dynamicFvMesh: added region support --- .../include/createNamedDynamicFvMesh.H | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/dynamicFvMesh/include/createNamedDynamicFvMesh.H diff --git a/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H b/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H new file mode 100644 index 0000000000..8ffc1490f5 --- /dev/null +++ b/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H @@ -0,0 +1,32 @@ + Foam::word regionName; + + if (args.optionReadIfPresent("region", regionName)) + { + Foam::Info + << "Create mesh " << regionName << " for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + } + else + { + regionName = Foam::fvMesh::defaultRegion; + Foam::Info + << "Create mesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + } + + + autoPtr meshPtr + ( + dynamicFvMesh::New + ( + IOobject + ( + regionName, + runTime.timeName(), + runTime, + IOobject::MUST_READ + ) + ) + ); + + dynamicFvMesh& mesh = meshPtr(); From 046dcbd46fd1a1025f86b80768a937dcf2ddee85 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:54:25 +0100 Subject: [PATCH 06/48] STYLE: CompatibilityConstant: indenting --- .../DataEntry/CompatibilityConstant/CompatibilityConstant.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C index 78c6a4d7c5..953328f031 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/CompatibilityConstant/CompatibilityConstant.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,8 @@ License template Foam::CompatibilityConstant::CompatibilityConstant ( - const word& entryName, const dictionary& dict + const word& entryName, + const dictionary& dict ) : DataEntry(entryName), @@ -69,6 +70,7 @@ Foam::CompatibilityConstant::CompatibilityConstant dimensions_(cnst.dimensions_) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template From ab0e9614b69a9466bd773956f9c3502d50233eb4 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:58:07 +0100 Subject: [PATCH 07/48] ENH: moveDynamicMesh: add -region option --- .../mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index 00c97614de..052cd91210 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -107,6 +107,7 @@ void writeWeights(const polyMesh& mesh) int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::addBoolOption ( "checkAMI", @@ -115,7 +116,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" -# include "createDynamicFvMesh.H" +# include "createNamedDynamicFvMesh.H" const bool checkAMI = args.optionFound("checkAMI"); From 4a3948383b3db92b3ae86c5b53cd99d1075d52a5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 12:59:32 +0100 Subject: [PATCH 08/48] ENH: topoSetDict: add zoneToPoint --- .../mesh/manipulation/topoSet/topoSetDict | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 7a2049c686..31fa348e97 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -359,6 +359,20 @@ FoamFile // cellSet c0; // name of cellSet of slave side // } // +// +// pointZoneSet +// ~~~~~~~~~~~~ +// (mirrors operations on a pointSet into a pointZone) +// +// // Select based on pointSet +// source setToPointZone; +// sourceInfo +// { +// set p0; // name of pointSet +// } +// +// +// actions ( From 4bc26d46bdf66ad0e470815e5e5e87f1f049c4d0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 13:00:16 +0100 Subject: [PATCH 09/48] ENH: snappyHexMeshDict: improved comment --- .../utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 05dcb07286..8d7927c42b 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -239,7 +239,8 @@ snapControls // Leave out altogether to disable. nFeatureSnapIter 10; - //- Detect (geometric) features by sampling the surface (default=false) + //- Detect (geometric only) features by sampling the surface + // (default=false). implicitFeatureSnap false; //- Use castellatedMeshControls::features (default = true) From 33c72cc4c4ed2caf7e3de78ee24bb1668ef2e739 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 13:01:28 +0100 Subject: [PATCH 10/48] ENH: etc/controlDict: added dimensionSet symbols --- etc/controlDict | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/etc/controlDict b/etc/controlDict index 04ec43aca0..2199d7ec7a 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -964,4 +964,34 @@ DimensionedConstants } +DimensionSets +{ + unitSet SI; // USCS + + SICoeffs + { + // Basic units + kg kg [ 1 0 0 0 0 0 0 ] 1.0; + m m [ 0 1 0 0 0 0 0 ] 1.0; + s s [ 0 0 1 0 0 0 0 ] 1.0; + K K [ 0 0 0 1 0 0 0 ] 1.0; + mol mol [ 0 0 0 0 1 0 0 ] 1.0; + A A [ 0 0 0 0 0 1 0 ] 1.0; + Cd Cd [ 0 0 0 0 0 0 1 ] 1.0; + + // Derived units + Pa Pa [ kg^1 m^-2 ] 1.0; + + // Scaled units + mm mm [ kg^1 m^-2 ] 1e-3; + + + // Set of units used for printing. Can be any basic or derived + // but not scaled (only supported for dimensionedScalar, etc) + printUnits (kg m s K mol A Cd); + } +} + + + // ************************************************************************* // From dfa74d978cc4d41e71a03554951c634bbe41345f Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 20 Sep 2012 14:21:40 +0100 Subject: [PATCH 11/48] ENH: flowRateInletVelocity: different keywords for volumetric and mass --- applications/test/dataEntry/Make/files | 3 + applications/test/dataEntry/Make/options | 1 + applications/test/dataEntry/Test-DataEntry.C | 60 ++++- .../flowRateInletVelocityFvPatchVectorField.C | 144 ++++++++---- .../flowRateInletVelocityFvPatchVectorField.H | 35 ++- .../displacementSBRStressFvMotionSolver.C | 34 ++- .../displacementSBRStressFvMotionSolver.H | 3 +- .../autoHexMeshDriver/autoLayerDriverShrink.C | 206 +++++++++--------- .../fireFoam/les/oppositeBurningPanels/0/U | 2 +- .../rhoPimpleFoam/ras/angledDuct/0/U | 2 +- .../rhoPimplecFoam/angledDuct/0/U | 4 +- .../angledDuct/system/controlDict | 2 +- .../rhoPorousMRFLTSPimpleFoam/angledDuct/0/U | 2 +- .../angledDuctImplicit/0/U | 2 +- .../rhoSimplecFoam/squareBend/0/U | 4 +- .../squareBend/system/controlDict | 2 +- .../constant/polyMesh/blockMeshDict | 10 +- .../constant/polyMesh/boundary | 15 +- .../iglooWithFridges/system/snappyHexMeshDict | 88 ++++---- .../mixerVessel2D/constant/polyMesh/boundary | 2 + .../cavity/constant/polyMesh/blockMeshDict | 2 + .../pimpleDyMFoam/propeller/system/fvSchemes | 4 +- .../motorBike/system/decomposeParDict | 2 +- .../porousSimpleFoam/angledDuctImplicit/0/U | 3 +- .../angledDuctImplicit/system/controlDict | 2 +- .../oscillatingBox/system/controlDict | 3 +- .../turbineSiting/system/controlDict | 2 + .../verticalChannel/0.org/U | 4 +- .../LTSReactingParcelFoam/verticalChannel/0/U | 4 +- .../verticalChannel/0.org/U | 4 +- .../verticalChannel/0/U | 4 +- .../constant/triSurface/domain.stl | 2 +- .../SnakeRiverCanyon/constant/dynamicMeshDict | 1 + .../constant/polyMesh/blockMeshDict | 3 +- .../constant/polyMesh/boundary | 26 +-- .../SnakeRiverCanyon/system/controlDict | 8 +- .../snappyHexMesh/flange/system/controlDict | 2 +- .../flange/system/snappyHexMeshDict | 24 +- .../ras/sloshingTank2D/system/controlDict | 3 - .../ras/sloshingTank2D3DoF/system/controlDict | 3 - .../multiphase/interFoam/ras/waterChannel/0/U | 3 +- wmake/rules/linux64Gcc/c | 2 +- wmake/rules/linux64Gcc/c++ | 2 +- 43 files changed, 446 insertions(+), 288 deletions(-) diff --git a/applications/test/dataEntry/Make/files b/applications/test/dataEntry/Make/files index c514002f99..a88ccad3bc 100644 --- a/applications/test/dataEntry/Make/files +++ b/applications/test/dataEntry/Make/files @@ -1,3 +1,6 @@ Test-DataEntry.C +interpolationWeights.C +splineInterpolationWeights.C +linearInterpolationWeights.C EXE = $(FOAM_USER_APPBIN)/Test-DataEntry diff --git a/applications/test/dataEntry/Make/options b/applications/test/dataEntry/Make/options index a071d9557c..72cae9f645 100644 --- a/applications/test/dataEntry/Make/options +++ b/applications/test/dataEntry/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -DFULLDEBUG -g -O0 \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ diff --git a/applications/test/dataEntry/Test-DataEntry.C b/applications/test/dataEntry/Test-DataEntry.C index 92761b1d01..a47a29be24 100644 --- a/applications/test/dataEntry/Test-DataEntry.C +++ b/applications/test/dataEntry/Test-DataEntry.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,8 @@ Description #include "fvCFD.H" #include "DataEntry.H" #include "IOdictionary.H" +#include "linearInterpolationWeights.H" +#include "splineInterpolationWeights.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,6 +43,62 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" +{ + scalarField samples(4); + samples[0] = 0; + samples[1] = 1; + samples[2] = 2; + samples[3] = 3; + scalarField values(4); + values = 1.0; + //values[0] = 0.0; + //values[1] = 1.0; + + //linearInterpolationWeights interpolator + splineInterpolationWeights interpolator + ( + samples, + interpolationWeights::WARN + ); + labelList indices; + scalarField weights; + + interpolator.integrationWeights(1.1, 1.2, indices, weights); + Pout<< "indices:" << indices << endl; + Pout<< "weights:" << weights << endl; + + scalar baseSum = interpolator.weightedSum + ( + weights, + UIndirectList(values, indices) + ); + Pout<< "baseSum=" << baseSum << nl << nl << endl; + + +// interpolator.integrationWeights(-0.01, 0, indices, weights); +// scalar partialSum = interpolator.weightedSum +// ( +// weights, +// UIndirectList(values, indices) +// ); +// Pout<< "partialSum=" << partialSum << nl << nl << endl; +// +// +// interpolator.integrationWeights(-0.01, 1, indices, weights); +// //Pout<< "samples:" << samples << endl; +// //Pout<< "indices:" << indices << endl; +// //Pout<< "weights:" << weights << endl; +// scalar sum = interpolator.weightedSum +// ( +// weights, +// UIndirectList(values, indices) +// ); +// Pout<< "integrand=" << sum << nl << nl << endl; + + + return 1; +} + IOdictionary dataEntryProperties ( IOobject diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index bbd50fa4de..9b72859c9d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -40,8 +40,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField(p, iF), flowRate_(), - phiName_("phi"), - rhoName_("rho") + volumetric_(false), + rhoName_("rho"), + rhoInlet_(0.0) {} @@ -56,8 +57,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf, p, iF, mapper), flowRate_(ptf.flowRate_().clone().ptr()), - phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + volumetric_(ptf.volumetric_), + rhoName_(ptf.rhoName_), + rhoInlet_(ptf.rhoInlet_) {} @@ -69,11 +71,52 @@ flowRateInletVelocityFvPatchVectorField const dictionary& dict ) : - fixedValueFvPatchField(p, iF, dict), - flowRate_(DataEntry::New("flowRate", dict)), - phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")) -{} + fixedValueFvPatchField(p, iF), + rhoInlet_(0.0) +{ + if (dict.found("volumetricFlowRate")) + { + volumetric_ = true; + flowRate_ = DataEntry::New("volumetricFlowRate", dict); + rhoName_ = "rho"; + } + else if (dict.found("massFlowRate")) + { + volumetric_ = false; + flowRate_ = DataEntry::New("massFlowRate", dict); + rhoName_ = word(dict.lookupOrDefault("rho", "rho")); + } + else + { + FatalIOErrorIn + ( + "flowRateInletVelocityFvPatchVectorField::" + "flowRateInletVelocityFvPatchVectorField" + "(const fvPatch&, const DimensionedField&," + " const dictionary&)", + dict + ) << "Please supply either 'volumetricFlowRate' or" + << " 'massFlowRate' and 'rho'" << exit(FatalIOError); + } + + // Value field require if mass based + if (dict.found("value")) + { + fvPatchField::operator= + ( + vectorField("value", dict, p.size()) + ); + } + else if (volumetric_) + { + evaluate(Pstream::blocking); + } + else + { + rhoInlet_ = readScalar(dict.lookup("rhoInlet")); + updateCoeffs(rhoInlet_); + } +} Foam::flowRateInletVelocityFvPatchVectorField:: @@ -84,8 +127,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf), flowRate_(ptf.flowRate_().clone().ptr()), - phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + volumetric_(ptf.volumetric_), + rhoName_(ptf.rhoName_), + rhoInlet_(ptf.rhoInlet_) {} @@ -98,13 +142,44 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField(ptf, iF), flowRate_(ptf.flowRate_().clone().ptr()), - phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + volumetric_(ptf.volumetric_), + rhoName_(ptf.rhoName_), + rhoInlet_(ptf.rhoInlet_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs +( + const scalar uniformRho +) +{ + if (updated()) + { + return; + } + + const scalar t = db().time().timeOutputValue(); + + // a simpler way of doing this would be nice + const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf()); + + tmp n = patch().nf(); + + if (volumetric_ || rhoName_ == "none") + { + // volumetric flow-rate + operator==(n*avgU); + } + else + { + // mass flow-rate + operator==(n*avgU/uniformRho); + } +} + + void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) @@ -119,40 +194,18 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs() tmp n = patch().nf(); - const surfaceScalarField& phi = - db().lookupObject(phiName_); - - if (phi.dimensions() == dimVelocity*dimArea) + if (volumetric_ || rhoName_ == "none") { - // volumetric flow-rate + // volumetric flow-rate or density not given operator==(n*avgU); } - else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) - { - if (rhoName_ == "none") - { - // volumetric flow-rate if density not given - operator==(n*avgU); - } - else - { - // mass flow-rate - const fvPatchField& rhop = - patch().lookupPatchField(rhoName_); - - operator==(n*avgU/rhop); - } - } else { - FatalErrorIn - ( - "flowRateInletVelocityFvPatchVectorField::updateCoeffs()" - ) << "dimensions of " << phiName_ << " are incorrect" << nl - << " on patch " << this->patch().name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << nl << exit(FatalError); + // mass flow-rate + const fvPatchField& rhop = + patch().lookupPatchField(rhoName_); + + operator==(n*avgU/rhop); } fixedValueFvPatchField::updateCoeffs(); @@ -163,8 +216,11 @@ void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchField::write(os); flowRate_->writeData(os); - writeEntryIfDifferent(os, "phi", "phi", phiName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); + if (!volumetric_) + { + writeEntryIfDifferent(os, "rho", "rho", rhoName_); + os.writeKeyword("rhoInlet") << rhoInlet_ << token::END_STATEMENT << nl; + } writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index a4b48c7629..192e14b7d1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -28,21 +28,25 @@ Description Describes a volumetric/mass flow normal vector boundary condition by its magnitude as an integral over its area. - The basis of the patch (volumetric or mass) is determined by the - dimensions of the flux, phi. - - If the flux is mass-based - - the current density is used to correct the velocity - - volumetric flow rate can be applied by setting the 'rho' entry to 'none' + Either specify 'volumetricFlowRate' or 'massFlowRate' (requires additional + 'rho' entry). Example of the boundary condition specification: \verbatim inlet { - type flowRateInletVelocity; - flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s] - rho rho; // none | rho [m3/s or kg/s] - value uniform (0 0 0); // placeholder + type flowRateInletVelocity; + volumetricFlowRate 0.2; // Volumetric [m3/s] + } + \endverbatim + + \verbatim + inlet + { + type flowRateInletVelocity; + volumetricFlowRate 0.2; // mass flow rate [kg/s] + rho rho; // rho [m3/s or kg/s] + value uniform (0 0 0); // placeholder } \endverbatim @@ -79,12 +83,15 @@ class flowRateInletVelocityFvPatchVectorField //- Inlet integral flow rate autoPtr > flowRate_; - //- Name of the flux transporting the field - word phiName_; + //- Is volumetric? + bool volumetric_; //- Name of the density field used to normalize the mass flux word rhoName_; + //- Rho initialisation value (for start; if value not supplied) + scalar rhoInlet_; + public: @@ -157,6 +164,10 @@ public: // Member functions + //- Update the coefficients associated with the patch field given + // uniform density field + void updateCoeffs(const scalar uniformRho); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C index 04edda45ee..2b5e23e9a9 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C @@ -81,8 +81,14 @@ Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver diffusivityPtr_ ( motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity")) - ) -{} + ), + solveOnPoints0_(coeffDict().lookupOrDefault("solveOnPoints0", false)) +{ + if (solveOnPoints0_) + { + Info<< type() << " : solving on points0" << endl; + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -123,11 +129,18 @@ void Foam::displacementSBRStressFvMotionSolver::solve() diffusivityPtr_->correct(); pointDisplacement_.boundaryField().updateCoeffs(); + pointField oldPoints; + if (solveOnPoints0_) + { + oldPoints = fvMesh_.points(); + movePoints(points0()); + } + surfaceScalarField Df(diffusivityPtr_->operator()()); volTensorField gradCd(fvc::grad(cellDisplacement_)); - Foam::solve + tmp > laplacianDf ( fvm::laplacian ( @@ -135,7 +148,16 @@ void Foam::displacementSBRStressFvMotionSolver::solve() cellDisplacement_, "laplacian(diffusivity,cellDisplacement)" ) + ); +// if (solveOnPoints0_) +// { +// movePoints(oldPoints); +// } + + Foam::solve + ( + laplacianDf + fvc::div ( Df @@ -173,6 +195,12 @@ void Foam::displacementSBRStressFvMotionSolver::solve() ) */ ); + + if (solveOnPoints0_) + { + movePoints(points0()); + } + } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H index db98e1a7cc..4d68cfc421 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H @@ -53,7 +53,6 @@ class motionDiffusivity; class displacementSBRStressFvMotionSolver : -// public displacementFvMotionSolver public displacementMotionSolver, public fvMotionSolverCore { @@ -65,6 +64,8 @@ class displacementSBRStressFvMotionSolver //- Diffusivity used to control the motion autoPtr diffusivityPtr_; + //- Solve on base mesh + Switch solveOnPoints0_; // Private Member Functions diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C index 58725470e1..db246ba1f2 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C @@ -99,76 +99,6 @@ void Foam::autoLayerDriver::sumWeights // Smooth field on moving patch -//void Foam::autoLayerDriver::smoothField -//( -// const motionSmoother& meshMover, -// const PackedBoolList& isMasterEdge, -// const labelList& meshEdges, -// const scalarField& fieldMin, -// const label nSmoothDisp, -// scalarField& field -//) const -//{ -// const indirectPrimitivePatch& pp = meshMover.patch(); -// const edgeList& edges = pp.edges(); -// const labelList& meshPoints = pp.meshPoints(); -// -// scalarField invSumWeight(pp.nPoints()); -// sumWeights -// ( -// isMasterEdge, -// meshEdges, -// meshPoints, -// edges, -// invSumWeight -// ); -// -// // Get smoothly varying patch field. -// Info<< "shrinkMeshDistance : Smoothing field ..." << endl; -// -// for (label iter = 0; iter < nSmoothDisp; iter++) -// { -// scalarField average(pp.nPoints()); -// averageNeighbours -// ( -// meshMover.mesh(), -// isMasterEdge, -// meshEdges, -// meshPoints, -// pp.edges(), -// invSumWeight, -// field, -// average -// ); -// -// // Transfer to field -// forAll(field, pointI) -// { -// //full smoothing neighbours + point value -// average[pointI] = 0.5*(field[pointI]+average[pointI]); -// -// // perform monotonic smoothing -// if -// ( -// average[pointI] < field[pointI] -// && average[pointI] >= fieldMin[pointI] -// ) -// { -// field[pointI] = average[pointI]; -// } -// } -// -// // Do residual calculation every so often. -// if ((iter % 10) == 0) -// { -// Info<< " Iteration " << iter << " residual " -// << gSum(mag(field-average)) -// /returnReduce(average.size(), sumOp