From 76afade78890039567a4e04dbb4438bf78489bec Mon Sep 17 00:00:00 2001 From: graham Date: Tue, 18 May 2010 10:30:49 +0100 Subject: [PATCH 1/3] ENH: Correcting pbNumber, shouldn't be divided by number of parcels. Adding pbFixed so nParticles is specified directly by the user, making massTotal not determine anything in this case. Removing unused private data member. --- .../KinematicParcel/KinematicParcel.C | 2 +- .../InjectionModel/InjectionModel.C | 22 +++++++++++++++++-- .../InjectionModel/InjectionModel.H | 7 +++++- .../ManualInjection/ManualInjection.H | 3 --- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 4d89dedde1..31c274ea38 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -346,7 +346,7 @@ bool Foam::KinematicParcel::hitPatch { ParcelType& p = static_cast(*this); - // Invoke poost-processing mdoel + // Invoke post-processing model td.cloud().postProcessing().postPatch(p, patchI); // Invoke surface film model diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 84d959976d..a232a5f060 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -212,7 +212,12 @@ Foam::scalar Foam::InjectionModel::setNumberOfParticles } case pbNumber: { - nP = massTotal_/(rho*volumeTotal_*parcels); + nP = massTotal_/(rho*volumeTotal_); + break; + } + case pbFixed: + { + nP = nParticlesFixed_; break; } default: @@ -285,6 +290,7 @@ Foam::InjectionModel::InjectionModel(CloudType& owner) nInjections_(0), parcelsAddedTotal_(0), parcelBasis_(pbNumber), + nParticlesFixed_(0.0), time0_(0.0), timeStep0_(0.0) { @@ -310,6 +316,7 @@ Foam::InjectionModel::InjectionModel nInjections_(0), parcelsAddedTotal_(0), parcelBasis_(pbNumber), + nParticlesFixed_(0.0), time0_(owner.db().time().value()), timeStep0_(0.0) { @@ -320,6 +327,7 @@ Foam::InjectionModel::InjectionModel << endl; const word parcelBasisType = coeffDict_.lookup("parcelBasisType"); + if (parcelBasisType == "mass") { parcelBasis_ = pbMass; @@ -328,6 +336,16 @@ Foam::InjectionModel::InjectionModel { parcelBasis_ = pbNumber; } + else if (parcelBasisType == "fixed") + { + parcelBasis_ = pbFixed; + + Info<< " Choosing nParticles to be a fixed value, massTotal " + << "variable now does not determine anything." + << endl; + + nParticlesFixed_ = readScalar(coeffDict_.lookup("nParticles")); + } else { FatalErrorIn @@ -338,7 +356,7 @@ Foam::InjectionModel::InjectionModel "CloudType&, " "const word&" ")" - )<< "parcelBasisType must be either 'number' or 'mass'" << nl + )<< "parcelBasisType must be either 'number', 'mass' or 'fixed'" << nl << exit(FatalError); } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index d7309f5a0a..c6fb6e424b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H @@ -73,7 +73,8 @@ public: enum parcelBasis { pbNumber, - pbMass + pbMass, + pbFixed }; @@ -137,6 +138,10 @@ protected: //- Parcel basis enumeration parcelBasis parcelBasis_; + //- nParticles to assign to parcels when the 'fixed' basis + // is selected + scalar nParticlesFixed_; + //- Continuous phase time at start of injection time step [s] scalar time0_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H index 7d8305088f..0202c9eb60 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H @@ -76,9 +76,6 @@ class ManualInjection //- Parcel size PDF model const autoPtr parcelPDF_; - //- Number of particles represented by each parcel - scalar nParticlesPerParcel_; - protected: From 2e418fec9e7e6dbbed162fcb3d862fec98f4dd17 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 18 May 2010 12:10:10 +0100 Subject: [PATCH 2/3] ENH: fixedShearStress for incompressible flows --- .../incompressible/RAS/Make/files | 1 + .../fixedShearStressFvPatchVectorField.C | 164 ++++++++++++++++++ .../fixedShearStressFvPatchVectorField.H | 147 ++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C create mode 100644 src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index 7ddd1d4e3b..f6107822df 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -43,6 +43,7 @@ $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C new file mode 100644 index 0000000000..0397d52fae --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "fixedShearStressFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "RASModel.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + tau0_(vector::zero) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + tau0_(dict.lookupOrDefault("tau", vector::zero)) +{ + fvPatchField::operator=(patchInternalField()); +} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + tau0_(ptf.tau0_) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf +) +: + fixedValueFvPatchVectorField(ptf), + tau0_(ptf.tau0_) +{} + + +fixedShearStressFvPatchVectorField:: +fixedShearStressFvPatchVectorField +( + const fixedShearStressFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(ptf, iF), + tau0_(ptf.tau0_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fixedShearStressFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("RASProperties"); + + const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + + const vectorField Ui = Uw.patchInternalField(); + + vector tauHat = tau0_/mag(tau0_); + + const scalarField& ry = patch().deltaCoeffs(); + + scalarField nuEffw = rasModel.nuEff()().boundaryField()[patchI]; + + vectorField UwUpdated = + tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui)); + + operator==(UwUpdated); + + if (debug) + { + vectorField nHat = this->patch().nf(); + volSymmTensorField Reff = rasModel.devReff(); + Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl; + } + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void fixedShearStressFvPatchVectorField::write(Ostream& os) const +{ + fixedValueFvPatchVectorField::write(os); + os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + fixedShearStressFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H new file mode 100644 index 0000000000..25e65f4bbf --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::fixedShearStressFvPatchVectorField + +Description + Set a constant shear stress as tau0 = -nuEff dU/dn. + +SourceFiles + fixedShearStressFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedShearStressFvPatchVectorField_H +#define fixedShearStressFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +/*---------------------------------------------------------------------------*\ + Class fixedShearStressFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class fixedShearStressFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Constant shear stress + vector tau0_; + + +public: + + //- Runtime type information + TypeName("fixedShearStress"); + + + // Constructors + + //- Construct from patch and internal field + fixedShearStressFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedShearStressFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new fixedShearStressFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedShearStressFvPatchVectorField + ( + const fixedShearStressFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fixedShearStressFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 5d3e38e34e62fd44cd2270149de368f8dea975dc Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 18 May 2010 13:30:32 +0100 Subject: [PATCH 3/3] ENH: extrudeToRegionMesh : allow extrusion on cyclics. Still not good enough - only handles single extrusion vector per cyclic point. --- .../extrudeToRegionMesh/createShellMesh.C | 2 - .../extrudeToRegionMesh/extrudeToRegionMesh.C | 368 ++++++++++++++---- 2 files changed, 286 insertions(+), 84 deletions(-) diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C index 944ff9cb48..ffea670952 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C @@ -158,7 +158,6 @@ void Foam::createShellMesh::calcPointRegions } - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::createShellMesh::createShellMesh @@ -184,7 +183,6 @@ Foam::createShellMesh::createShellMesh // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::createShellMesh::setRefinement ( const pointField& thickness, diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index 6a3b7dd7ea..4cf3c67ff9 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -130,6 +130,7 @@ Usage #include "volFields.H" #include "surfaceFields.H" #include "cyclicPolyPatch.H" +#include "syncTools.H" using namespace Foam; @@ -595,6 +596,237 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) } +//XXXXXXXXX +label findUncoveredPatchFace +( + const fvMesh& mesh, + const UIndirectList